import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; /// Android background-survival controls that ReVolt can actually verify. abstract final class PowerSettings { PowerSettings._(); static const MethodChannel _channel = MethodChannel( 'com.revoltvpn.app/power', ); static Future isBatteryOptimisationDisabled() async { if (kIsWeb) return true; try { return await _channel.invokeMethod( 'isIgnoringBatteryOptimizations', ) ?? false; } catch (_) { return false; } } static Future requestDisableBatteryOptimisation() async { if (kIsWeb) return true; try { return await _channel.invokeMethod( 'requestIgnoreBatteryOptimizations', ) ?? false; } catch (_) { return false; } } }