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
Fixed the wrong window being shown by lock screen presenter #1503
Fixed the wrong window being shown by lock screen presenter #1503
Conversation
Fixed black screen when lock screen is presented in background
__weak typeof(self) weakself = self; | ||
dispatch_async(dispatch_get_main_queue(), ^{ | ||
if (!([UIApplication sharedApplication].applicationState == UIApplicationStateActive)) { | ||
// Don't present lock screen when app is backgrounded because the screenshot will be a black screen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What code causes this to work correctly when the app comes into the foreground?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was removed
|
||
- (void)sdl_checkLockScreenStatus { | ||
// Present the VC depending on the lock screen status | ||
if (self.config.displayMode == SDLLockScreenConfigurationDisplayModeAlways) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation is 6 spaces. Do you have Xcode Preferences -> Text Editing -> Indentation, "Prefer Indent Using: Spaces" and "Tab Width / Indent Width" set to 4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
NSArray<UIWindow *> *windows = appWindowScene.windows; | ||
UIWindow *appWindow = nil; | ||
for (UIWindow *window in windows) { | ||
if (window != self.lockWindow) { | ||
if (window.isKeyWindow) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will work for apps using iOS 13 scene API. keyWindow
is deprecated, though this API appears not to be. In any case, I wouldn't trust it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was removed
@@ -98,10 +99,11 @@ - (void)sdl_presentIOS13 { | |||
} | |||
} | |||
|
|||
// Find the currently visible app window |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Apparently in Xcode a tab = 4 spaces and in GitHub 6
@@ -169,7 +174,7 @@ - (void)sdl_dismissIOS12 { | |||
UIWindow *appWindow = nil; | |||
for (UIWindow *window in windows) { | |||
SDLLogV(@"Checking window: %@", window); | |||
if (window != self.lockWindow) { | |||
if ([window.rootViewController isKindOfClass:[self.coveredRootViewController class]]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you directly check equality between window.rootViewController
and coveredRootViewController
? Imagine if the same class (or in the case of using isKindOfClass
a subclass) is used in multiple windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was removed
@@ -204,7 +209,7 @@ - (void)sdl_dismissIOS13 { | |||
UIWindow *appWindow = nil; | |||
for (UIWindow *window in windows) { | |||
SDLLogV(@"Checking window: %@", window); | |||
if (window != self.lockWindow) { | |||
if ([window.rootViewController isKindOfClass:[self.coveredRootViewController class]]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was removed
Closing in favor of #1509 as pretty much all the code was changed. |
Fixes #1501
This PR is ready for review.
Risk
This PR makes no API changes.
Testing Plan
Unit Tests
Unit tests were run.
Core Tests
Smoke tests perform with SYNC 3.
Core version / branch / commit hash / module tested against: SYNC 3 v3.0
HMI name / version / branch / commit hash / module tested against: SYNC 3 v3.0
Summary
Fixed the lock screen presenter selecting the wrong
UIWindow
when the app has multipleUIWindow
s. This bug created the following issues:UIWindow
was made visible when dismissing the lock screen window.Changelog
Bug Fixes
UIWindow
when the app has multipleUIWindow
s.Tasks Remaining:
CLA