Skip to content

Commit 018fd7e

Browse files
tejasdncooke3
andauthored
Fix sign in alert shown inconsistently when triggered in viewDidAppear (#10288)
* Simple fix for #8096 * Update FirebaseAppDistribution/CHANGELOG.md Co-authored-by: Nick Cooke <[email protected]> Co-authored-by: Nick Cooke <[email protected]>
1 parent dc34af6 commit 018fd7e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

FirebaseAppDistribution/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 10.1.0
2+
- [fixed] Fixed inconsistent sign in prompts in single scene apps (#8096).
3+
14
# 9.0.0
25
- [fixed] Marked `releaseNotes` as `nullable` as they don't always exist (#8602).
36
- [fixed] **Breaking change:** Fixed an ObjC-to-Swift API conversion error where`checkForUpdate()`

FirebaseAppDistribution/Sources/FIRAppDistributionUIService.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,15 @@ - (void)initializeUIState {
213213

214214
if (foregroundedScene) {
215215
self.window = [[UIWindow alloc] initWithWindowScene:foregroundedScene];
216+
} else if ([UIApplication sharedApplication].connectedScenes.count == 1) {
217+
// There are situations where a scene isn't considered foreground in viewDidAppear
218+
// and this fixes the issue in single scene apps.
219+
// https://github.com/firebase/firebase-ios-sdk/issues/8096
220+
UIWindowScene *scene =
221+
(UIWindowScene *)[UIApplication sharedApplication].connectedScenes.anyObject;
222+
self.window = [[UIWindow alloc] initWithWindowScene:scene];
216223
} else {
224+
// TODO: Consider using UISceneDidActivateNotification.
217225
FIRFADInfoLog(@"No foreground scene found.");
218226
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
219227
}

0 commit comments

Comments
 (0)