From e7880b863a6b4133466c78aed9b4a7a9ffa0ee06 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Tue, 21 Jul 2020 16:14:46 +0300 Subject: [PATCH] Go to pin setter screen only if forced at login --- .../AuthenticationViewController.m | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/Riot/Modules/Authentication/AuthenticationViewController.m b/Riot/Modules/Authentication/AuthenticationViewController.m index a21b4c1b8..48d8be56c 100644 --- a/Riot/Modules/Authentication/AuthenticationViewController.m +++ b/Riot/Modules/Authentication/AuthenticationViewController.m @@ -883,21 +883,16 @@ - (void)onSuccessfulLogin:(MXCredentials*)credentials { - // if really login - if (self.authType == MXKAuthenticationTypeLogin) + // if really login and pin protection is forced + if (self.authType == MXKAuthenticationTypeLogin && [PinCodePreferences shared].forcePinProtection) { loginCredentials = credentials; - BOOL forcePinProtection = [[NSUserDefaults standardUserDefaults] boolForKey:@"forcePINProtection"]; - - if (forcePinProtection) - { - SetPinCoordinatorBridgePresenter *presenter = [[SetPinCoordinatorBridgePresenter alloc] initWithSession:nil]; - presenter.delegate = self; - [presenter presentFrom:self animated:YES]; - self.setPinCoordinatorBridgePresenter = presenter; - return; - } + SetPinCoordinatorBridgePresenter *presenter = [[SetPinCoordinatorBridgePresenter alloc] initWithSession:nil viewMode:SetPinCoordinatorViewModeSetPin]; + presenter.delegate = self; + [presenter presentFrom:self animated:YES]; + self.setPinCoordinatorBridgePresenter = presenter; + return; } [self afterSetPinFlowCompletedWithCredentials:credentials]; @@ -1407,4 +1402,16 @@ [self afterSetPinFlowCompletedWithCredentials:loginCredentials]; } +- (void)setPinCoordinatorBridgePresenterDelegateDidCancel:(SetPinCoordinatorBridgePresenter *)coordinatorBridgePresenter +{ + // enable the view again + [self setUserInteractionEnabled:YES]; + + // stop the spinner + [self.authenticationActivityIndicator stopAnimating]; + + // then, just close the enter pin screen + [coordinatorBridgePresenter dismissWithAnimated:YES completion:nil]; +} + @end