Skip to content
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

feat: Separate Control for Privacy Screen and Screenshot Protection #112

Open
jimcase opened this issue Dec 27, 2024 · 2 comments
Open

feat: Separate Control for Privacy Screen and Screenshot Protection #112

jimcase opened this issue Dec 27, 2024 · 2 comments

Comments

@jimcase
Copy link

jimcase commented Dec 27, 2024

Summary

Currently, the @capacitor-community/privacy-screen plugin handles both privacy screen protection and screenshot prevention as a single feature set. While useful, this coupling can limit flexibility for applications that need discrete control over these two functionalities. This feature request aims to propose the separation of privacy screen and screenshot protection into two independently controllable features.

Current Behavior

The plugin activates both privacy screen protection and screenshot blocking simultaneously, without allowing separate control over these features.

Desired Behavior

Introduce separate methods for enabling/disabling the privacy screen and for enabling/disabling screenshot protection. This would allow developers to tailor the behavior of their applications more precisely, depending on the context and user settings.

Proposed Changes

Separate API Methods:

enablePrivacyScreen(): Enables the privacy screen without affecting screenshot capabilities.
disablePrivacyScreen(): Disables the privacy screen independently.
enableScreenshotProtection(): Enables screenshot protection without activating the privacy screen.
disableScreenshotProtection(): Disables screenshot protection independently.

@robingenz
Copy link
Member

This would only be possible on iOS, not Android.

@jimcase
Copy link
Author

jimcase commented Dec 31, 2024

Hey @robingenz,

I have created a PR-113 to add support in Android for separate privacy screen and screenshot functionality.
The main idea is to add an extra View for the privacy screen, to detect when the View loses focus or the app stops.
And use WindowManager.LayoutParams.FLAG_SECURE only to manage screenshots dynamically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants