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

feat(ios): support custom image as privacy screen #66

Closed UlricW closed 1 year ago

UlricW commented 1 year ago

Pull Request: Allow to use iOS Background Image for capacitor-privacy-screen Plugin

Description

This pull request introduces a feature enhancement to the capacitor-privacy-screen plugin for iOS. The current behavior on iOS displays a grey background screen when the privacy screen is enabled. This pull request enhances the user experience by allowing the use of a custom background image instead of the default grey background. The background of the image (if the image doesn't take all the device screen) will be the system background (dependant of the dark theme is activated or not)

Changes Made

Usage Example


// Configure the plugin with custom background image
plugins: {
    PrivacyScreen: {
      enable: true,
      useImageBackground: true,
      imageName: "Splashscreen"
    },
  }

Close #27

robingenz commented 1 year ago

Thank you for your contribution. I will take a look as soon as possible.

robingenz commented 1 year ago

@UlricW Please merge the current main branch into your PR. I have created a separate implementation class because the plugin is getting more complex.

UlricW commented 1 year ago

robingenz it's done

robingenz commented 1 year ago

@UlricW Please make sure that the pipeline checks are successful.

UlricW commented 1 year ago

It's fixed, sorry for that :)

robingenz commented 1 year ago

@UlricW Thank you, looks great! I just had to release a hotfix. Please merge this again into your branch and then we are done. 🙌

UlricW commented 1 year ago

The merge is done ! :)

robingenz commented 1 year ago

@UlricW Thank you for your contribution!

subhashjha35 commented 11 months ago

Hi @robingenz Recently I stumbled upon this library as Privacy Screen was not functioning for android through AppStateChange. I wonder if we can have the same custom image support for android too to avoid having grey screen for content protection?

robingenz commented 11 months ago

@subhashjha35 On Android, this plugin sets the FLAG_SECURE flag to treat the content of the window as secure, preventing it from appearing in screenshots or from being viewed on non-secure displays. As far as I know, there is no way to set a custom image. But feel free to create a PR if you find an option.