From a26cba3de11c2c246545acbbe8cf843301927baa Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 14 May 2018 10:31:12 -0400 Subject: [PATCH 1/2] Don't show screen block until app is ready. --- Signal/src/ViewControllers/LoadingViewController.swift | 2 +- Signal/src/util/OWSScreenLockUI.m | 5 +++-- SignalMessaging/ViewControllers/ScreenLockViewController.m | 6 ++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Signal/src/ViewControllers/LoadingViewController.swift b/Signal/src/ViewControllers/LoadingViewController.swift index 52d5d1281..172d8ed49 100644 --- a/Signal/src/ViewControllers/LoadingViewController.swift +++ b/Signal/src/ViewControllers/LoadingViewController.swift @@ -50,7 +50,7 @@ public class LoadingViewController: UIViewController { var isShowingTopLabel = false var isShowingBottomLabel = false - override public func viewDidAppear(_ animated: Bool) { + override public func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) // We only show the "loading" UI if it's a slow launch. Otherwise this ViewController diff --git a/Signal/src/util/OWSScreenLockUI.m b/Signal/src/util/OWSScreenLockUI.m index 8f92c49a9..9e09b4915 100644 --- a/Signal/src/util/OWSScreenLockUI.m +++ b/Signal/src/util/OWSScreenLockUI.m @@ -130,8 +130,9 @@ NS_ASSUME_NONNULL_BEGIN [self observeNotifications]; - // Default to screen protection until we know otherwise. - [self updateScreenBlockingWindow:ScreenLockUIStateScreenProtection animated:NO]; + // Hide the screen blocking window until "app is ready" to + // avoid blocking the loading view. + [self updateScreenBlockingWindow:ScreenLockUIStateNone animated:NO]; // Initialize the screen lock state. // diff --git a/SignalMessaging/ViewControllers/ScreenLockViewController.m b/SignalMessaging/ViewControllers/ScreenLockViewController.m index cf2a961fb..cf3de5b45 100644 --- a/SignalMessaging/ViewControllers/ScreenLockViewController.m +++ b/SignalMessaging/ViewControllers/ScreenLockViewController.m @@ -76,6 +76,8 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value) self.screenBlockingImageView = imageView; self.screenBlockingButton = button; + + [self updateUIWithState:ScreenLockUIStateScreenProtection isLogoAtTop:NO animated:NO]; } // The "screen blocking" window has three possible states: @@ -89,6 +91,10 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value) { OWSAssertIsOnMainThread(); + if (!self.screenBlockingImageView) { + return; + } + BOOL shouldShowBlockWindow = uiState != ScreenLockUIStateNone; BOOL shouldHaveScreenLock = uiState == ScreenLockUIStateScreenLock; From edabe506788730b8c9d72665d46c42e153d36243 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 14 May 2018 11:51:28 -0400 Subject: [PATCH 2/2] Respond to CR. --- SignalMessaging/ViewControllers/ScreenLockViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalMessaging/ViewControllers/ScreenLockViewController.m b/SignalMessaging/ViewControllers/ScreenLockViewController.m index cf3de5b45..958ee2cc3 100644 --- a/SignalMessaging/ViewControllers/ScreenLockViewController.m +++ b/SignalMessaging/ViewControllers/ScreenLockViewController.m @@ -91,7 +91,7 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value) { OWSAssertIsOnMainThread(); - if (!self.screenBlockingImageView) { + if (!self.isViewLoaded) { return; }