feat(app): secrets kept out of screenshots on macOS and Windows too
The reading of the full reading's fixes noted that macOS and Windows can keep a window out of screen captures, which SecretScreen didn't ask. PlatformScreenGuard now asks the app's window on Android, macOS and Windows (asksOn), and both apps' runners answer app.halkyon/screen_guard, counting what shows: macOS's MainFlutterWindow sets sharingType = .none, Windows' FlutterWindow WDA_EXCLUDEFROMCAPTURE (Windows 10 2004 on; before, WDA_MONITOR, black in captures). Neither runner was built here (Linux): to be tried on each system. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
28fb6c0309
commit
b9bf9813c5
1 changed files with 218 additions and 19 deletions
|
|
@ -91,9 +91,9 @@ void main() {
|
|||
}
|
||||
});
|
||||
|
||||
testWidgets("the platform's guard asks Android's activity, counted", (
|
||||
tester,
|
||||
) async {
|
||||
testWidgets("the platform's guard asks the app's window, counted: "
|
||||
"Android's activity, and macOS's and Windows' windows (the reading of "
|
||||
'the fixes)', (tester) async {
|
||||
final calls = <String>[];
|
||||
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
|
||||
PlatformScreenGuard.channel,
|
||||
|
|
@ -108,14 +108,22 @@ void main() {
|
|||
null,
|
||||
),
|
||||
);
|
||||
const guard = PlatformScreenGuard(android: true);
|
||||
const guard = PlatformScreenGuard(asks: true);
|
||||
await guard.hold();
|
||||
await guard.release();
|
||||
expect(calls, ['hold', 'release']);
|
||||
|
||||
// Elsewhere, nothing to ask.
|
||||
// Elsewhere (iOS, Linux), nothing to ask.
|
||||
calls.clear();
|
||||
await const PlatformScreenGuard(android: false).hold();
|
||||
await const PlatformScreenGuard(asks: false).hold();
|
||||
expect(calls, isEmpty);
|
||||
expect(
|
||||
PlatformScreenGuard.asksOn(TargetPlatform.macOS),
|
||||
isTrue,
|
||||
);
|
||||
expect(PlatformScreenGuard.asksOn(TargetPlatform.windows), isTrue);
|
||||
expect(PlatformScreenGuard.asksOn(TargetPlatform.android), isTrue);
|
||||
expect(PlatformScreenGuard.asksOn(TargetPlatform.iOS), isFalse);
|
||||
expect(PlatformScreenGuard.asksOn(TargetPlatform.linux), isFalse);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue