capacitor-community / privacy-screen

⚡️ Capacitor plugin that protects your app from displaying a screenshot in Recents screen/App Switcher.
MIT License
87 stars 23 forks source link

bug: does not work with `@capacitor/share` #76

Closed shanselm-ergon closed 8 months ago

shanselm-ergon commented 1 year ago

Plugin version: >= 4.1.0

Platform(s): iOS

Current behavior: Privacy screen blocks interaction with the app after it got shown. We also observed that the screen went black while leaving the app, this happened not all the time. In our case we try to share some content and if we return to the app it looks frozen to the user. App switching is still possible, the web itself is also fine, but interaction is blocked (like a glass pane will prevent interaction).

Expected behavior: Privacy screen should not impact normal app flow.

Steps to reproduce: We created a simple capacitor 5 app to demonstrate the problem. https://github.com/qHerren-Ergon/privacy-screen-demo-app Setup:

  1. checkout
  2. npm install
  3. npm run build
  4. npx cap sync ios
  5. npx cap open ios
  6. Adjust signing team and app identifier to run the app

Reproduction:

  1. start the app, two buttons are shown and lots of text, scrolling is possible
  2. click Enable Privacy!
  3. verify in the app switcher, that the cover is shown and the app is still responding
  4. click Share!
  5. the system share dialog is shown, you can share to an app or just close it and return to the app
  6. (!) the app does not respond to input anymore, try to scroll or click to a button

Our analysis: It looks like the privacy element added to the view hierarchy is not removed correctly when returning to the app (and its size is very small). This behaviour was introduced with 4.1.0 with the screenshot prevention feature. Our workaround was to use the 4.0.0 version of the plugin.

Related code: see reproduction

Other information: If the reproduction steps are not enough, we could also create a video to show the behaviour.

Capacitor doctor:

> npx cap doctor
💊   Capacitor Doctor  💊 

Latest Dependencies:

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

Installed Dependencies:

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

[success] iOS looking great! 👌
[success] Android looking great! 👌
robingenz commented 1 year ago

Please try the latest version of the plugin.

shanselm-ergon commented 1 year ago

Cool, thank you very much for the fast reply. The issue with "the config not respected" is solved. The more important issue with the app not responsive anymore still exists, even with the new version.

robingenz commented 1 year ago

Your reproduction example still uses version 4.2.0 which is not the latest version.

robingenz commented 1 year ago

Please also update the issue description if some issues are already resolved.

shanselm-ergon commented 1 year ago

I updated the description and the demo app.

robingenz commented 1 year ago

I can now reproduce the issue. Unfortunately, I have no idea what the problem could be. @dtarnawsky Can you take a look at this?

dtarnawsky commented 1 year ago

Spent a few hours on this today and haven't been able to resolve it yet.

robingenz commented 1 year ago

@dtarnawsky Yes, same here. I'm thinking about reverting #59. This feature is currently causing a few issues, unfortunately. :/ What do you think? Do you have any other idea?

shanselm-ergon commented 9 months ago

Hi Is there any update available to this issue? Thank you