mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-28 20:38:20 +00:00
ios: Multiusers feature continue (#1793)
* ios: Multiusers feature continue * Logging of user in responses * UserId Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> * Undo ugly user inclusion into functions. Now it's in backend * Do not set active user if it's unchanged * Blank line * if * Change active user function * refactor * refactor Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com> * Alert Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
This commit is contained in:
co-authored by
Evgeny Poberezkin
JRoberts
parent
ba29d0242e
commit
ad6aa10cd2
@@ -134,6 +134,7 @@ public func chatResponse(_ s: String) -> ChatResponse {
|
||||
type = jResp.allKeys[0] as? String
|
||||
if type == "apiChats" {
|
||||
if let jApiChats = jResp["apiChats"] as? NSDictionary,
|
||||
let user: User = try? decodeObject(jApiChats["user"] as Any),
|
||||
let jChats = jApiChats["chats"] as? NSArray {
|
||||
let chats = jChats.map { jChat in
|
||||
if let chatData = try? parseChatData(jChat) {
|
||||
@@ -141,13 +142,14 @@ public func chatResponse(_ s: String) -> ChatResponse {
|
||||
}
|
||||
return ChatData.invalidJSON(prettyJSON(jChat) ?? "")
|
||||
}
|
||||
return .apiChats(chats: chats)
|
||||
return .apiChats(user: user, chats: chats)
|
||||
}
|
||||
} else if type == "apiChat" {
|
||||
if let jApiChat = jResp["apiChat"] as? NSDictionary,
|
||||
let user: User = try? decodeObject(jApiChat["user"] as Any),
|
||||
let jChat = jApiChat["chat"] as? NSDictionary,
|
||||
let chat = try? parseChatData(jChat) {
|
||||
return .apiChat(chat: chat)
|
||||
return .apiChat(user: user, chat: chat)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user