mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
* replace all print statements with printV * restore backup error message * missing print statements, error fixes * Update cw_core/lib/utils/print_verbose.dart [skip ci] * Update cw_core/lib/utils/print_verbose.dart [skip ci] * CW-846: Correctly display balance (#1848) * Correctly display balance even with frozen coins * remove package= from AndroidMainfest.xml * update namespace * print -> printV --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
24 lines
785 B
Dart
24 lines
785 B
Dart
import 'package:cw_core/utils/print_verbose.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
const MethodChannel _channel = MethodChannel('com.cake_wallet/native_utils');
|
|
|
|
Future<void> requestDisableBatteryOptimization() async {
|
|
try {
|
|
await _channel.invokeMethod('disableBatteryOptimization');
|
|
} on PlatformException catch (e) {
|
|
printV("Failed to disable battery optimization: '${e.message}'.");
|
|
}
|
|
}
|
|
|
|
Future<bool> isBatteryOptimizationDisabled() async {
|
|
try {
|
|
final bool isDisabled = await _channel.invokeMethod('isBatteryOptimizationDisabled') as bool;
|
|
printV('It\'s actually disabled? $isDisabled');
|
|
return isDisabled;
|
|
} on PlatformException catch (e) {
|
|
printV("Failed to check battery optimization status: '${e.message}'.");
|
|
return false;
|
|
}
|
|
}
|