Add support for prevent screen capture

This commit is contained in:
2023-09-22 17:28:33 +08:00
parent 50ff4b3fdd
commit 286e2fbb5b
7 changed files with 102 additions and 2 deletions

31
lib/platform/display.dart Normal file
View 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;
}
}
}