ios: edit group profile (#853)

This commit is contained in:
Evgeny Poberezkin
2022-07-30 16:03:44 +04:00
committed by GitHub
parent 0c58adff08
commit de0f231c60
12 changed files with 239 additions and 56 deletions
+14
View File
@@ -621,6 +621,20 @@ func apiListMembers(_ groupId: Int64) async -> [GroupMember] {
return []
}
func filterMembersToAdd(_ ms: [GroupMember]) -> [Contact] {
let memberContactIds = ms.compactMap{ m in m.memberCurrent ? m.memberContactId : nil }
return ChatModel.shared.chats
.compactMap{ $0.chatInfo.contact }
.filter{ !memberContactIds.contains($0.apiId) }
.sorted{ $0.displayName.lowercased() < $1.displayName.lowercased() }
}
func apiUpdateGroup(_ groupId: Int64, _ groupProfile: GroupProfile) async throws -> GroupInfo {
let r = await chatSendCmd(.apiUpdateGroupProfile(groupId: groupId, groupProfile: groupProfile))
if case let .groupUpdated(toGroup) = r { return toGroup }
throw r
}
func initializeChat(start: Bool) throws {
logger.debug("initializeChat")
do {