mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
mobile: group invitations ui (#816)
* ios: group invitations ui * fix * memberActive (crashes) * adjustments * android ui * android - memberActive * update group invitation item layout * update texts * typo * update layout * do not add contacts added via groups * filter contacts by conn_level * turn off address sanitizer * fix layout * android: filter on update chat * android adjustments * divider fix * android chat previews * ios previews Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
@@ -526,6 +526,21 @@ func apiNewGroup(_ gp: GroupProfile) throws -> GroupInfo {
|
||||
throw r
|
||||
}
|
||||
|
||||
func joinGroup(groupId: Int64) async {
|
||||
do {
|
||||
let groupInfo = try await apiJoinGroup(groupId: groupId)
|
||||
DispatchQueue.main.async { ChatModel.shared.updateGroup(groupInfo) }
|
||||
} catch let error {
|
||||
logger.error("joinGroup error: \(responseError(error))")
|
||||
}
|
||||
}
|
||||
|
||||
func apiJoinGroup(groupId: Int64) async throws -> GroupInfo {
|
||||
let r = await chatSendCmd(.apiJoinGroup(groupId: groupId))
|
||||
if case let .userAcceptedGroupSent(groupInfo) = r { return groupInfo }
|
||||
throw r
|
||||
}
|
||||
|
||||
func initializeChat(start: Bool) throws {
|
||||
logger.debug("initializeChat")
|
||||
do {
|
||||
@@ -695,6 +710,14 @@ func processReceivedMsg(_ res: ChatResponse) async {
|
||||
// currently only broadcast deletion of rcv message can be received, and only this case should happen
|
||||
_ = m.upsertChatItem(cInfo, cItem)
|
||||
}
|
||||
case let .receivedGroupInvitation(groupInfo, _, _):
|
||||
m.addChat(Chat(
|
||||
chatInfo: .group(groupInfo: groupInfo),
|
||||
chatItems: []
|
||||
))
|
||||
// NtfManager.shared.notifyContactRequest(contactRequest) // TODO notifyGroupInvitation?
|
||||
case let .userJoinedGroup(groupInfo):
|
||||
m.updateGroup(groupInfo)
|
||||
case let .rcvFileStart(aChatItem):
|
||||
chatItemSimpleUpdate(aChatItem)
|
||||
case let .rcvFileComplete(aChatItem):
|
||||
|
||||
Reference in New Issue
Block a user