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(ios): support custom image as privacy screen #66

Merged
merged 8 commits into from
Sep 11, 2023

Conversation

UlricW
Copy link
Contributor

@UlricW UlricW commented Aug 30, 2023

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

  • Added a new configuration options in the plugin settings specifically for iOS:
    • useImageBackground. This option enables the user to specify a custom image file to be displayed as the background
    • imageName. This is the name of the image in iOS assets
  • Modified the plugin's iOS implementation to load and display the custom background image when the privacy screen is enabled and the useImageBackground is true.

Usage Example

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

Close #27

…he current opened application or when doing a screenshot.
@UlricW UlricW changed the title Use a custom image in iOS instead of a background-color [capacitor-community/privacy-screen#27] Use a custom image in iOS instead of a background-color Aug 30, 2023
@UlricW UlricW changed the title [capacitor-community/privacy-screen#27] Use a custom image in iOS instead of a background-color fixes #27 Use a custom image in iOS instead of a background-color Aug 30, 2023
@UlricW UlricW changed the title fixes #27 Use a custom image in iOS instead of a background-color Use a custom image in iOS instead of a background-color grey Aug 30, 2023
@UlricW UlricW mentioned this pull request Aug 30, 2023
@robingenz
Copy link
Member

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

@robingenz
Copy link
Member

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

uwi added 2 commits September 4, 2023 10:14
…he current opened application or when doing a screenshot.
# Conflicts:
#	ios/Plugin/PrivacyScreenPlugin.swift
@UlricW
Copy link
Contributor Author

UlricW commented Sep 4, 2023

robingenz it's done

ios/Plugin/PrivacyScreenConfig.swift Outdated Show resolved Hide resolved
ios/Plugin/PrivacyScreenConfig.swift Outdated Show resolved Hide resolved
@robingenz
Copy link
Member

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

@UlricW
Copy link
Contributor Author

UlricW commented Sep 7, 2023

It's fixed, sorry for that :)

@robingenz
Copy link
Member

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

# Conflicts:
#	ios/Plugin/PrivacyScreen.swift
@UlricW
Copy link
Contributor Author

UlricW commented Sep 11, 2023

The merge is done ! :)

@robingenz robingenz changed the title Use a custom image in iOS instead of a background-color grey feat(ios): support custom image as privacy screen Sep 11, 2023
@robingenz
Copy link
Member

@UlricW Thank you for your contribution!

@robingenz robingenz merged commit 62ceb78 into capacitor-community:main Sep 11, 2023
2 checks passed
@subhashjha35
Copy link

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
Copy link
Member

@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.

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

Successfully merging this pull request may close these issues.

feat: use splash screen
3 participants