-
Notifications
You must be signed in to change notification settings - Fork 2
fix(android): deprecate preventScreenshots and make dialog more reliable #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, tested and seems to be working fine.
I needed to change the dependencies on capacitor framework to ^7.0.0, because it was installing next= 8.0.0-alpha.3 which uses kotlin 2.2.20, but because other modules had 1.9.X it had an error (I had package-lock.json and node_modules cleared to simulate a fresh clone, otherwise you may not get this issue if you had 8.0.0-alpha.2 or older:
lass 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The actual metadata version is 2.2.0, but the compiler version 1.9.0 can read versions up to 2.0.0.
Don't know if this needs to be addressed in this PR, but leaving the remark.
| * @deprecated This option is no longer necessary. FLAG_SECURE is now always applied when the privacy screen is enabled, | ||
| * which prevents screenshots and protects content in the app switcher. This option will be removed in a future version. | ||
| * | ||
| * If you need to control screenshot prevention separately, you can enable/disable the plugin as needed per screen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this option is now a dud, should we remove this option in v2 of the plugin (next branch). Or what would be the future version this option gets removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think it makes sense to remove it in v2. I will cherry pick the changes and update to remove this option in the next branch.
I updated this PR to adjust the dependency versions since it should definitely be included in this release & It wasn't a big deal to make the changes here. |
Deprecates the
preventScreenshotsAndroid config option asFLAG_SECUREis now automatically applied when the privacy screen is enabled. We have to do this since adding and removing the flag dynamically results in a race condition.This Pr also improves reliability of the privacy screen dialog handling across different navigation modes (gesture navigation, home button, recent apps). The dialog is used in cases where
FLAG_SECUREdoesn't fully protect content. This happens when using gesture navigation (onPausedoesn't reliably trigger), or on newer Android devices where the recent apps menu does not use a snapshot and instead uses a live view fragment which will persist until the OS decides to cache it.