fix: add cancel button for better UI flow (MESSENGER-7861)

This commit is contained in:
Frank Rotermund
2025-11-05 08:21:49 +01:00
parent 9730c47b19
commit 7737aa0a6a
3 changed files with 21 additions and 9 deletions

View File

@@ -235,14 +235,17 @@ NSString *const kMXKWebViewViewControllerJavaScriptEnableLog =
canGoBack = (![webView.URL.absoluteString isEqualToString:@"about:blank"]);
}
if (canGoBack)
{
self.navigationItem.rightBarButtonItem = backButton;
}
else
{
// Reset the original state
self.navigationItem.rightBarButtonItems = originalRightBarButtonItems;
// bwi #7861 don't overwrite other barbutton items here
if (self.navigationItem.rightBarButtonItem == nil) {
if (canGoBack)
{
self.navigationItem.rightBarButtonItem = backButton;
}
else
{
// Reset the original state
self.navigationItem.rightBarButtonItems = originalRightBarButtonItems;
}
}
}

View File

@@ -53,10 +53,16 @@ final class ReauthFallBackViewController: AuthFallBackViewController, Themable {
}
private func setupNavigationBar() {
// bwi #7861 change logic to both have a cancel and a close button. We don't need a back button here
let doneBarButtonItem = MXKBarButtonItem(title: VectorL10n.close, style: .plain) { [weak self] in
self?.didValidate?()
}
self.navigationItem.leftBarButtonItem = doneBarButtonItem
self.navigationItem.rightBarButtonItem = doneBarButtonItem
let cancelBarButtonItem = MXKBarButtonItem(title: VectorL10n.cancel, style: .plain) { [weak self] in
self?.didCancel?()
}
self.navigationItem.leftBarButtonItem = cancelBarButtonItem
}
}

View File

@@ -149,6 +149,9 @@ final class ReauthenticationCoordinator: ReauthenticationCoordinatorType {
return
}
self.delegate?.reauthenticationCoordinatorDidCancel(self)
// bwi #7861 cancel buttons should close the view
self.presentingViewController.dismiss(animated: true)
}
reauthFallbackViewController.didValidate = { [weak self] in