mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-06-24 12:46:49 +08:00
Add support for prevent screen capture
This commit is contained in:
31
lib/platform/display.dart
Normal file
31
lib/platform/display.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
final _log = Logger("platformDisplay");
|
||||
|
||||
class Display {
|
||||
static const platform =
|
||||
MethodChannel("lifegpc.eh_downloader_flutter/display");
|
||||
Future<bool> disableProtect() async {
|
||||
if (kIsWeb) return true;
|
||||
try {
|
||||
await platform.invokeMethod<void>("disableProtect");
|
||||
return true;
|
||||
} catch (e) {
|
||||
_log.warning("Failed to disable protect", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> enableProtect() async {
|
||||
if (kIsWeb) return true;
|
||||
try {
|
||||
await platform.invokeMethod<void>("enableProtect");
|
||||
return true;
|
||||
} catch (e) {
|
||||
_log.warning("Failed to enable protect", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user