Add gradient backgrounds in passcode entry screen

This commit is contained in:
Ilya Laktyushin
2021-07-07 02:31:12 +03:00
parent ad98e74477
commit 4fcb54c687
11 changed files with 200 additions and 87 deletions

View File

@@ -58,7 +58,10 @@ public final class PasscodeEntryController: ViewController {
private var inBackground: Bool = false
private var inBackgroundDisposable: Disposable?
public init(applicationBindings: TelegramApplicationBindings, accountManager: AccountManager, appLockContext: AppLockContext, presentationData: PresentationData, presentationDataSignal: Signal<PresentationData, NoError>, challengeData: PostboxAccessChallengeData, biometrics: PasscodeEntryControllerBiometricsMode, arguments: PasscodeEntryControllerPresentationArguments) {
private let statusBarHost: StatusBarHost?
private var previousStatusBarStyle: UIStatusBarStyle?
public init(applicationBindings: TelegramApplicationBindings, accountManager: AccountManager, appLockContext: AppLockContext, presentationData: PresentationData, presentationDataSignal: Signal<PresentationData, NoError>, statusBarHost: StatusBarHost?, challengeData: PostboxAccessChallengeData, biometrics: PasscodeEntryControllerBiometricsMode, arguments: PasscodeEntryControllerPresentationArguments) {
self.applicationBindings = applicationBindings
self.accountManager = accountManager
self.appLockContext = appLockContext
@@ -68,10 +71,12 @@ public final class PasscodeEntryController: ViewController {
self.biometrics = biometrics
self.arguments = arguments
self.statusBarHost = statusBarHost
self.previousStatusBarStyle = statusBarHost?.statusBarStyle
super.init(navigationBarPresentationData: nil)
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
self.statusBar.statusBarStyle = .White
statusBarHost?.setStatusBarStyle(.lightContent, animated: true)
self.presentationDataDisposable = (presentationDataSignal
|> deliverOnMainQueue).start(next: { [weak self] presentationData in
@@ -128,7 +133,7 @@ public final class PasscodeEntryController: ViewController {
} else {
biometricsType = nil
}
self.displayNode = PasscodeEntryControllerNode(accountManager: self.accountManager, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, passcodeType: passcodeType, biometricsType: biometricsType, arguments: self.arguments, statusBar: self.statusBar, modalPresentation: self.arguments.modalPresentation)
self.displayNode = PasscodeEntryControllerNode(accountManager: self.accountManager, presentationData: self.presentationData, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, passcodeType: passcodeType, biometricsType: biometricsType, arguments: self.arguments, modalPresentation: self.arguments.modalPresentation)
self.displayNodeDidLoad()
let _ = (self.appLockContext.invalidAttempts
@@ -271,6 +276,9 @@ public final class PasscodeEntryController: ViewController {
}
public override func dismiss(completion: (() -> Void)? = nil) {
if let statusBarHost = self.statusBarHost, let previousStatusBarStyle = self.previousStatusBarStyle {
statusBarHost.setStatusBarStyle(previousStatusBarStyle, animated: true)
}
self.view.endEditing(true)
self.controllerNode.animateOut { [weak self] in
guard let strongSelf = self else {