mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-28 11:19:21 +00:00
ios: reset loaded members on in-place chat change
This commit is contained in:
@@ -359,6 +359,7 @@ struct ChatView: View {
|
||||
revealedItems = Set()
|
||||
stopAudioPlayer()
|
||||
if let cId {
|
||||
chatModel.membersLoaded = false
|
||||
if let c = chatModel.getChat(cId) {
|
||||
chat = c
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ struct MemberSupportView: View {
|
||||
var body: some View {
|
||||
viewBody()
|
||||
.onAppear {
|
||||
if !chatModel.membersLoaded || chatModel.groupMembers.first?.wrapped.groupId != groupInfo.groupId {
|
||||
if !chatModel.membersLoaded {
|
||||
Task {
|
||||
await chatModel.loadGroupMembers(groupInfo)
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ Load the list once per open group, then keep it current from what arrives.
|
||||
- `JoinedGroupMember` and `JoinedGroupMemberConnecting` are emitted right after the "new member pending review" item, and they carry the member with zero support stats. Their handlers keep the support stats already in the list, so they do not erase the badge the item event just set. On Kotlin that item event can also be applied after them; the merge covers either order.
|
||||
- The member list loads only if `membersLoaded` is false. The mention picker already uses this flag the same way, and it is reset when leaving the group.
|
||||
- `apiListMembers` returns `null`/`nil` on error on both platforms, and the member load then keeps the current state, so a failed load does not mark members as loaded. iOS still runs the load's completion, so group info still opens.
|
||||
- iOS resets `membersLoaded` when the open chat changes without going through the chat list (notification tap, "forwarded from", member info), as Kotlin already does, because group info can be opened without reloading members.
|
||||
- iOS resets `membersLoaded` when chats are refreshed on resume, because the notification extension may have changed support chats while the app was suspended.
|
||||
- Kotlin `upsertGroupMember` also resets `membersLoaded` when it clears another group's stale members.
|
||||
- Kotlin `setGroupMembers` now writes on the main thread, where all upserts run, so an upsert can no longer land between clearing the index and rebuilding it and add a duplicate. It writes its result only if the group is still the open chat (or the channel being created), as iOS `loadGroupMembers` already does. Without this check, a slow load from a previously opened channel could finish after a chat switch and mark another group's members as loaded. The old reload on every return hid that.
|
||||
|
||||
Reference in New Issue
Block a user