#10 add group chat delete alongside leave
- Delete a group chat from GroupInfoView or via a swipe in the chat list: remove the conversation and its messages from SwiftData, clean per-chat state, and leave the room on the server first when joined. - Keep "Покинуть комнату" as leave-without-deleting and suppress deleted rooms for the session so roomState events cannot recreate them; an explicit rejoin or a fresh invitation clears the suppression. - Add verify.sh invariants and document the behaviour in ARCHITECTURE.md.
This commit is contained in:
1 parent
fc07855036
commit
4566b59ff1
5 files changed
+132
No files matched your search
@@ -11,6 +11,7 @@ struct GroupInfoView: View {
|
||||
@State private var invitees = ""
|
||||
@State private var isJoining = false
|
||||
@State private var isInviting = false
|
||||
@State private var confirmingDeletion = false
|
||||
|
||||
init(model: AppModel, conversation: Conversation) {
|
||||
self.model = model
|
||||
@@ -68,6 +69,16 @@ struct GroupInfoView: View {
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
Button(role: .destructive) {
|
||||
confirmingDeletion = true
|
||||
} label: {
|
||||
Label("Удалить чат", systemImage: "trash")
|
||||
}
|
||||
} footer: {
|
||||
Text("Чат и его история будут удалены с этого устройства.")
|
||||
}
|
||||
|
||||
Section {
|
||||
Label(
|
||||
model.encryptionEnabled(for: conversation.jid)
|
||||
@@ -85,6 +96,15 @@ struct GroupInfoView: View {
|
||||
Button("Готово") { dismiss() }
|
||||
}
|
||||
}
|
||||
.alert("Удалить групповой чат?", isPresented: $confirmingDeletion) {
|
||||
Button("Удалить", role: .destructive) {
|
||||
model.deleteGroupChat(jid: conversation.jid)
|
||||
dismiss()
|
||||
}
|
||||
Button("Отмена", role: .cancel) {}
|
||||
} message: {
|
||||
Text("Чат и его история будут удалены с этого устройства. Luma выйдет из комнаты, если вы в ней.")
|
||||
}
|
||||
}
|
||||
#if os(macOS)
|
||||
.frame(minWidth: 480, minHeight: 500)
|
||||
|
||||
Reference in new issue
Block a user