diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index aa663978b..24075e3cd 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -665,6 +665,8 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni self.setPinCoordinatorBridgePresenter = [[SetPinCoordinatorBridgePresenter alloc] initWithSession:mxSessionArray.firstObject viewMode:SetPinCoordinatorViewModeUnlockByPin]; self.setPinCoordinatorBridgePresenter.delegate = self; [self.setPinCoordinatorBridgePresenter presentIn:self.window]; + } else { + [self afterAppUnlockedByPin:application]; } } @@ -4661,6 +4663,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { [coordinatorBridgePresenter dismiss]; self.setPinCoordinatorBridgePresenter = nil; + [self afterAppUnlockedByPin:[UIApplication sharedApplication]]; } - (void)setPinCoordinatorBridgePresenterDelegateDidCompleteWithReset:(SetPinCoordinatorBridgePresenter *)coordinatorBridgePresenter diff --git a/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewAction.swift b/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewAction.swift index 06e04b922..85c49c55f 100644 --- a/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewAction.swift +++ b/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewAction.swift @@ -25,5 +25,6 @@ enum EnterPinCodeViewAction { case forgotPinPressed case cancel case pinsDontMatchAlertAction - case forgotPinAlertAction + case forgotPinAlertResetAction + case forgotPinAlertCancelAction } diff --git a/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewController.swift b/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewController.swift index c87e1e760..1a38912b8 100644 --- a/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewController.swift +++ b/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewController.swift @@ -40,7 +40,6 @@ final class EnterPinCodeViewController: UIViewController { private var viewModel: EnterPinCodeViewModelType! private var theme: Theme! - private var keyboardAvoider: KeyboardAvoider? private var errorPresenter: MXKErrorPresentation! private var activityPresenter: ActivityIndicatorPresenter! @@ -61,7 +60,6 @@ final class EnterPinCodeViewController: UIViewController { // Do any additional setup after loading the view. self.setupViews() -// self.keyboardAvoider = KeyboardAvoider(scrollViewContainerView: self.view, scrollView: self.scrollView) self.activityPresenter = ActivityIndicatorPresenter() self.errorPresenter = MXKErrorAlertPresentation() @@ -78,18 +76,6 @@ final class EnterPinCodeViewController: UIViewController { self.viewModel.process(viewAction: .loadData) } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - - self.keyboardAvoider?.startAvoiding() - } - - override func viewDidDisappear(_ animated: Bool) { - super.viewDidDisappear(animated) - - self.keyboardAvoider?.stopAvoiding() - } - override var preferredStatusBarStyle: UIStatusBarStyle { return self.theme.statusBarStyle } @@ -238,10 +224,15 @@ final class EnterPinCodeViewController: UIViewController { preferredStyle: .alert) let resetAction = UIAlertAction(title: VectorL10n.pinProtectionResetAlertActionReset, style: .default) { (_) in - self.viewModel.process(viewAction: .forgotPinAlertAction) + self.viewModel.process(viewAction: .forgotPinAlertResetAction) + } + + let cancelAction = UIAlertAction(title: VectorL10n.cancel, style: .cancel) { (_) in + self.viewModel.process(viewAction: .forgotPinAlertCancelAction) } controller.addAction(resetAction) + controller.addAction(cancelAction) self.present(controller, animated: true, completion: nil) } diff --git a/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewModel.swift b/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewModel.swift index 07c4ec9e5..e7b531089 100644 --- a/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewModel.swift +++ b/Riot/Modules/SetPinCode/EnterPinCode/EnterPinCodeViewModel.swift @@ -67,8 +67,11 @@ final class EnterPinCodeViewModel: EnterPinCodeViewModelType { currentPin.removeAll() // go back to first state self.update(viewState: .choosePin) - case .forgotPinAlertAction: + case .forgotPinAlertResetAction: self.coordinatorDelegate?.enterPinCodeViewModelDidCompleteWithReset(self) + case .forgotPinAlertCancelAction: + // no-op + break } }