Skip to content

Conversation

@ramey29
Copy link

@ramey29 ramey29 commented Nov 9, 2025

Description

This will disable screenshot feature in android and ios app
android : blocks screenshot all together
ios : On iOS, you cannot stop the user from pressing the "take screenshot" buttons. The secure_application package uses the standard iOS method: it tells the OS the content is "secure," so iOS blanks/black out the app's content in the screenshot file.

Tests

Test 1: Taking the Screenshot

With your app open and visible in the simulator/device, navigate to any screen (e.g., your photo gallery).

Take screenshot on device else Go to the simulator's menu and select Device > Take Screenshot (or use the keyboard shortcut Cmd + S).

The screenshot will be saved to your Desktop (or wherever your simulator saves them) or in photos app in device.

Open the saved image file (e.g., Screenshot 2025-11-09 at 10.30.00.png).

✅ Expected Result (Success): The screenshot image will be a black or blank screen in ios and no screenshot will be taken in case of android. You may see the system status bar (the time, battery, etc.), but your app's entire UI, including your photos, will be completely hidden.

❌ Failure: If the screenshot image clearly shows your app's UI and photos, the implementation is not working.

Test 2: Checking the App Switcher (Multitasking View)

The secure_application package also protects your app's content from being visible in the app switcher.

With your app open, simulate swiping up from the bottom of the screen to enter the multitasking view (where you see all your open apps as cards).

In the simulator, you can do this by clicking and dragging up from the bottom of the screen or using the simulator's "App Switcher" button.

✅ Expected Result (Success): Your app's "card" or "snapshot" in the app switcher view will be blurred or replaced with a blank screen. All other apps (like Settings or Safari) will look normal.

❌ Failure: If you can clearly see your app's last-viewed screen in the app switcher, the protection is not active.

Performance

No "Per-Frame" Cost: The protection is not running every frame. It's not checking "is someone taking a screenshot?" 60 times per second. It only acts once when the OS-level "pause" or "inactive" event occurs.

No Impact on Scrolling/Navigation: Your app's normal performance (scrolling through photos, navigating to new pages) will be completely unaffected.

only added a lightweight listener that reacts to system events. This is a standard pattern and will not introduce performance problems to your app.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Rameshwar Bishnoi seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 91 to 105
await _init(false, via: 'mainMethod');
final Locale? locale = await getLocale(noFallback: true);
runApp(
AppLock(
builder: (args) => EnteApp(locale, savedThemeMode),
lockScreen: const LockScreen(),
enabled: await Configuration.instance.shouldShowLockScreen() ||
localSettings.isOnGuestView(),
locale: locale,
lightTheme: lightThemeData,
darkTheme: darkThemeData,
savedThemeMode: _themeMode(savedThemeMode),
SecureApplication(
child: AppLock(
builder: (args) => EnteApp(locale, savedThemeMode),
lockScreen: const LockScreen(),
enabled: await Configuration.instance.shouldShowLockScreen() ||
localSettings.isOnGuestView(),
locale: locale,
lightTheme: lightThemeData,
darkTheme: darkThemeData,
savedThemeMode: _themeMode(savedThemeMode),
),
),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Wrap app in SecureGate so screenshots actually blank out

Only wrapping the root widget in SecureApplication does not trigger any visual protection on iOS—the package relies on a SecureGate (or an explicit SecureApplicationController.secure()) inside the widget tree to insert the blurred/blank overlay when screenshots or the app switcher snapshot are generated. Because the new code never adds a gate or calls the controller, the default state remains insecure and screenshots will still capture the UI, so the feature described in the commit message will fail on iOS.

Useful? React with 👍 / 👎.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed it
builder: (args) => SecureGate(
child: EnteApp(locale, savedThemeMode),
),

@ramey29 ramey29 closed this Nov 9, 2025
@ramey29 ramey29 reopened this Nov 9, 2025
@ramey29 ramey29 closed this Nov 9, 2025
@ramey29 ramey29 reopened this Nov 9, 2025
@prateekmedia
Copy link
Member

We already have Hide content setting (defaults to false) in Security > App Lock > Hide Content. Which already blocks screenshot in android.

It would be better if you can integrate the iOS implementation of it whenever Hide Content is enabled.

@mnvr
Copy link
Member

mnvr commented Nov 10, 2025

The commits are with a local email that does not match the email associated with your GitHub account, which is why the CLA is not being marked as signed. You'll need to amend the commits (or do a new PR).

For now I'll close this PR, since this unconditionally disables the functionality, instead of trying to make it work with the Hide Content functionality that the app already provides. If you do decide to continue on these lines, (a) we'd need something that works for iOS, (b) something that respects the Hide Content setting, and (c) commits are done using an email tied to your GitHub account so that the CLA can be accepted.

@mnvr mnvr closed this Nov 10, 2025
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.

4 participants