Add the same unsaved changes alerts that Android has. (#4803)

* Add an alert to Discard or Save when there are unsaved changes on the RoomDetailsEditScreen.

* Add an alert to Discard or Save when there are unsaved changes on the UserDetailsEditScreen.

* Add an alert to Discard or Save when there are unsaved changes on the SecurityAndPrivacyScreen.

* Update strings.
This commit is contained in:
Doug
2025-12-01 13:02:50 +00:00
committed by GitHub
parent a16f6ad3e4
commit 7496f30966
22 changed files with 409 additions and 96 deletions
@@ -31,13 +31,22 @@ struct UserDetailsEditScreen: View {
.scrollDismissesKeyboard(.immediately)
.navigationTitle(L10n.screenEditProfileTitle)
.navigationBarTitleDisplayMode(.inline)
.navigationBarBackButtonHidden(context.viewState.canSave)
.toolbar { toolbar }
.alert(item: $context.alertInfo)
}
// MARK: - Private
@ToolbarContentBuilder
private var toolbar: some ToolbarContent {
ToolbarItem(placement: .cancellationAction) {
if context.viewState.canSave {
Button(L10n.actionCancel) {
context.send(viewAction: .cancel)
}
}
}
ToolbarItem(placement: .confirmationAction) {
Button(L10n.actionSave) {
context.send(viewAction: .save)