2022-01-21 13:02:00 +00:00
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
|
|
class WakeLock {
|
|
|
|
static const _utils = const MethodChannel('com.cake_wallet/native_utils');
|
|
|
|
|
|
|
|
Future<void> enableWake() async {
|
|
|
|
try {
|
2022-01-25 06:40:09 +00:00
|
|
|
await _utils.invokeMethod<bool>('enableWakeScreen');
|
2022-01-21 13:02:00 +00:00
|
|
|
} on PlatformException catch (_) {
|
|
|
|
print('Failed enabling screen wakelock');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> disableWake() async {
|
|
|
|
try {
|
2022-01-25 06:40:09 +00:00
|
|
|
await _utils.invokeMethod<bool>('disableWakeScreen');
|
2022-01-21 13:02:00 +00:00
|
|
|
} on PlatformException catch (_) {
|
|
|
|
print('Failed enabling screen wakelock');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|