PrivacyScreenPlugin
PrivacyScreenPlugin copied to clipboard
Do not show privacy screen when app is in foreground while inactive
Hi, This change is for not showing privacy screen when the app is still in foreground but may temporarily inactive, for example, when showing the ios native touch id dialog, or when user using splitview slide, or when sliding from top to show the device status bar.
I saw there is already another pull request for this issue, https://github.com/devgeeks/PrivacyScreenPlugin/pull/26 but think that pull request may cause some side effect, so would suggest to fix the issue by changing the privacy plugin's notification handler from
UIApplicationDidBecomeActiveNotification UIApplicationWillResignActiveNotification to UIApplicationWillEnterForegroundNotification UIApplicationDidEnterBackgroundNotification
This also follows better with Apple's UI guide, as when the app is still in foreground, the app should still show the meaningful content to user.
Thanks Jonathan
Hi, Just tested the change on both ipad2 simulator and iphone 5s device, and it works as expected. I shared the iphone screen recording at
The testing project only has a statusbar plugin and privacyscreen plugin.
Note during the recorded testing I first clicked the home button to verify the privacy screen function. Then the second time I double clicked the home button, since at that time, the app still did not enter background, so the privacyscreen will not show, but once another app or home screen was selected to become active app, then the testing app will enter background, and the privacy screen would apply.
If you still get problem in your testing, could you share the prototype project or a screen recording so that I can follow it to repeat the issue?
Thanks Jonathan
This is a tough one. I have been agonising over this a bit.
On the one hand, I don't want it to go all splashscreen whenever the touch ID modal pops up... But on the other hand, I would like it to pop up as soon as the task switcher is used.
I think this PR is probably the lesser of the two evils. I will probably just go ahead and merge it this week, but I expect many issues raised because of it :/
I was just looking at how 1Password handles this and it's the same as your PR. Pretty sure I am going to pull this in. Sorry for the delay.
Hi, Found some issues while testing the privacy screen plugin on ipad pro and other devices, and a new update was added in the pull request. Line 40: always use screen size when taking privacy screen image, as the privacy screen is always shown in full screen size after double tabbing the home button Line 41: allow resize the privacy image view size to parent view, so privacy screen will not show partially after device orientation change Line 83: the new xcode 8 no longer generates UILaunchImageFile in info.plist in app bundle, instead UILaunchImages is preferred. Line 119: When iphone 5/5s/6 runs on landscrape mode, it is better to show the portrait privacy image, instead of showing a black screen by setting imageName to nil.
Thanks Jonathan
Gonna merge this tomorrow probably... but I think it might be time for you to get commit privileges on this repo ;)
@devgeeks Friendly reminder that this still isn't merged. :)
I really wanna update this, but is there any chance of a quick repro to test it?
I don't actually have any apps that use Touch ID.
Hi, I have shared an ios project to demo this issue when touch id is used. The project and the related screen shot is available at: https://mdocs.sap.com/mcm/public/v1/open?shr=4OKI1UkwNnfA3Bi7aEFya1g5NKSunTaDDx06cIei9xo
Steps to repeat the issue:
- build and run the project on ipad device (screen1), and click log in button on the screen
- input "https://www.google.com" in the first textbox field (screen2), and click ok button
- input "password" in both set password and confirm password fields, and also check "Enable unlock with fingerprint" checkbox (screen3), then click ok button
- in the next tip screen, click continue button (screen4)
- the app should show the google web page (screen5)
- kill the application and restart it
- the app will show the touch id screen with privacyscreen behind it (screen6). This is not expected.
If replacing the privacyScreenplugin.m with the updated file in the shared folder (privacyscreen.m.withfix), then repeating the step 7, the app will have the expected behavior of showing application UI screen behind the touch id screen (screen7)
Please let me know if you get any issue when using the project to repeat the issue.
Thanks Jonathan
@jonathanli2 Thanks SO much for that. I'll look at this asap.
Hi, We got another customer reports the black screen due to this issue. Just wonder whether the pull request is still under evaluation?
Thanks Jonathan
Hi @devgeeks I'm having the same problem as @jonathanli2 is there any solution for this or a workaround?