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

bug: enable() immediately shows privacy layer, app unusable #73

Closed
jkyoutsey opened this issue Sep 29, 2023 · 7 comments
Closed

bug: enable() immediately shows privacy layer, app unusable #73

jkyoutsey opened this issue Sep 29, 2023 · 7 comments

Comments

@jkyoutsey
Copy link

Plugin version:
^4.2.0

Platform(s):
iOS/Android

Current behavior:
Upon calling PrivacyScreen.enable() the privacy layer is immediately displayed making the app unusable.

Expected behavior:
The privacy layer should only be shown when the user is trying to take a screenshot, screen recording, or viewing the task switcher.

Steps to reproduce:
Sample Repo

  1. Clone and follow instructions to install and run for either iOS/Android.
  2. Run on a simulator/real device.
  3. Click the "Enable" button.
  4. See that the privacy screen is shown and cannot be dismissed.

Related code:
See this file in the repo on line 20 where PrivacyScreen.enable() is called.

Capacitor doctor:

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 5.4.1
  @capacitor/core: 5.4.1
  @capacitor/android: 5.4.1
  @capacitor/ios: 5.4.1

Installed Dependencies:

  @capacitor/cli: 5.3.0
  @capacitor/core: 5.3.0
  @capacitor/android: 5.3.0
  @capacitor/ios: 5.3.0

[success] iOS looking great! 👌
@jkyoutsey jkyoutsey changed the title bug: bug: enable() immediately shows privacy layer, app unusable Sep 29, 2023
@robingenz
Copy link
Member

Thank you for your request.
Please share a screen recording.

@mirzadugum
Copy link

mirzadugum commented Oct 3, 2023

Hello,
This only occurs on iOS17 with custom image added. If you remove splash than its working

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2023-10-03.at.10.14.07.mp4

@jkyoutsey
Copy link
Author

jkyoutsey commented Oct 3, 2023

I did this without splash and had the same results that the screen is blanked out.

Help me understand. When I call enable() is it supposed to show the privacy screen immediately? The documentation suggests that you use enable to protect against screenshots and view in the switcher if the user tries to take a screenshot/use the switcher. So, enable() = "wait until a screenshot is taken or the switcher is shown and then show privacy screen". Right? Because when I call enable() it IMMEDIATELY blanks my screen, which seems incorrect to me.

But, maybe I misunderstand. Do I need to add listeners and then only call enable() when the listeners are triggered? "enable" to me != "show". It "enables" protection.

Here is a screen recording where I show it disabled first, then enabled second, all without imageName specified in the config (no splash)

(Oh, and the docs don't really show how to specify a splash image. What size is used and how is it scaled? Do we just put it in the app's asset folder and then just give it the plain name to it? imageName: 'my-privacy-screen.png' if my-privacy-screen.png is in /assets?)

PrivacyScreen.mov

@mirzadugum
Copy link

mirzadugum commented Oct 4, 2023

On this video you posted it is working as it should. They grey screen you get it is because you didnt add splashscreen. The privacy screen is visible only when app isnt active (in recent).

If you put img name splash, than it will use splash screen of the app if you have one. I generated splash screen with capacitor-assets plugin.

@jkyoutsey
Copy link
Author

Yes, it does seem to be working for "recents"/"switcher". But it's NOT preventing screenshots. I couldn't care less about the switcher. I NEED to prevent screenshots. How do you prevent a screenshot with this plugin?

@robingenz
Copy link
Member

I will take a look at it in the next few days.

@robingenz
Copy link
Member

I close this issue as duplicate of #74.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants