-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix FXIOS-8364 [v123] Add confirmation dialog #18581
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -282,6 +282,9 @@ class TabTrayViewController: UIViewController, | |
if let url = tabTrayState.shareURL { | ||
navigationHandler?.shareTab(url: url, sourceView: self.view) | ||
} | ||
if tabTrayState.showCloseConfirmation { | ||
showCloseAllConfirmation() | ||
} | ||
} | ||
|
||
func updateTabCountImage(count: String) { | ||
|
@@ -460,6 +463,24 @@ class TabTrayViewController: UIViewController, | |
store.dispatch(TabPanelAction.closeAllTabs(windowUUID.context)) | ||
} | ||
|
||
private func showCloseAllConfirmation() { | ||
let controller = AlertController(title: nil, message: nil, preferredStyle: .actionSheet) | ||
controller.addAction(UIAlertAction(title: .AppMenu.AppMenuCloseAllTabsTitleString, | ||
style: .default, | ||
handler: { _ in self.confirmCloseAll() }), | ||
accessibilityIdentifier: AccessibilityIdentifiers.TabTray.deleteCloseAllButton) | ||
controller.addAction(UIAlertAction(title: .TabTrayCloseAllTabsPromptCancel, | ||
style: .cancel, | ||
handler: nil), | ||
accessibilityIdentifier: AccessibilityIdentifiers.TabTray.deleteCancelButton) | ||
controller.popoverPresentationController?.barButtonItem = deleteButton | ||
present(controller, animated: true, completion: nil) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, we don't have any existing Alert Controller designs for destructive actions? The UX of this to me doesn't emphasize the fact that this is to delete a bunch of data (for example, using red in the text of the confirmation) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Improving the UX is mostly out of scope for this project so I think it's fine to keep it the same for now but this is a very good point, would you mind creating a bug for it and we can tackle it through our regular triage process since it' needs UX input. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created a bug here https://mozilla-hub.atlassian.net/browse/FXIOS-8399 |
||
|
||
private func confirmCloseAll() { | ||
store.dispatch(TabPanelAction.confirmCloseAllTabs(windowUUID.context)) | ||
} | ||
|
||
@objc | ||
private func newTabButtonTapped() { | ||
let context = AddNewTabContext(urlRequest: nil, isPrivate: tabTrayState.isPrivateMode, windowUUID: windowUUID) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference between
state.normalTabsCount
andtabModel.normalTabsCount
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible tabModel.normalTabsCount might not be calculated in certain cases if it's updating the private window so just safer to keep the value the same as it's current value since the private screen cannot impact this number for the normal screen.