#10 add group chat delete alongside leave
iOS CI / Build and Test SwiftUI App (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build Unsigned iOS IPA (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build macOS ZIP (push) Canceled after 0s

- 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:
wt committed 2026-08-29 01:56:23 +07:00
1 parent fc07855036
commit 4566b59ff1
5 files changed
+132

No files matched your search

+27
View File
@@ -21,6 +21,7 @@ struct MainChatView: View {
@State private var showingNewChat = false
@State private var showingNewGroup = false
@State private var showingSettings = false
@State private var pendingGroupDeletion: Conversation?
/// SwiftData-backed chat list. The query orders by last activity;
/// `filteredConversations` applies the pinned-first ordering that matches
@@ -129,6 +130,23 @@ struct MainChatView: View {
.sheet(isPresented: $showingSettings) {
SettingsView(model: model)
}
.alert(
"Удалить групповой чат?",
isPresented: Binding(
get: { pendingGroupDeletion != nil },
set: { if !$0 { pendingGroupDeletion = nil } }
)
) {
Button("Удалить", role: .destructive) {
if let pendingGroupDeletion {
model.deleteGroupChat(jid: pendingGroupDeletion.jid)
}
pendingGroupDeletion = nil
}
Button("Отмена", role: .cancel) { pendingGroupDeletion = nil }
} message: {
Text("Чат и его история будут удалены с этого устройства. Luma выйдет из комнаты, если вы в ней.")
}
}
private var chatList: some View {
@@ -141,6 +159,15 @@ struct MainChatView: View {
)
.tag(conversation.jid)
.listRowInsets(EdgeInsets(top: 6, leading: 12, bottom: 6, trailing: 12))
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
if conversation.isGroup {
Button(role: .destructive) {
pendingGroupDeletion = conversation
} label: {
Label("Удалить", systemImage: "trash")
}
}
}
}
}
.listStyle(.plain)