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:
Stanislav Dmitrenko
2023-01-19 16:22:56 +00:00
committed by GitHub
co-authored by Evgeny Poberezkin JRoberts
parent ba29d0242e
commit ad6aa10cd2
16 changed files with 557 additions and 407 deletions
+4 -2
View File
@@ -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)
}
}
}