core, iOS: hidden and muted user profiles (#2025)

* core, ios: profile privacy design

* migration

* core: user profile privacy

* update nix dependencies

* update simplexmq

* import stateTVar

* update core library

* update UI

* update hide/show user profile

* update API, UI, fix test

* update api, UI, test

* update api call

* fix api

* update UI for hidden profiles

* filter notifications on hidden/muted profiles when inactive, alerts

* updates

* update schema, test, icon
This commit is contained in:
Evgeny Poberezkin
2023-03-22 15:58:01 +00:00
committed by GitHub
parent bcdf502ce6
commit 06a0dbd0f2
29 changed files with 1067 additions and 228 deletions
+16 -2
View File
@@ -151,6 +151,11 @@ public func chatResponse(_ s: String) -> ChatResponse {
let chat = try? parseChatData(jChat) {
return .apiChat(user: user, chat: chat)
}
} else if type == "chatCmdError" {
if let jError = jResp["chatCmdError"] as? NSDictionary {
let user: User? = try? decodeObject(jError["user_"] as Any)
return .chatCmdError(user_: user, chatError: .invalidJSON(json: prettyJSON(jError) ?? ""))
}
}
}
json = prettyJSON(j)
@@ -185,12 +190,21 @@ func prettyJSON(_ obj: Any) -> String? {
public func responseError(_ err: Error) -> String {
if let r = err as? ChatResponse {
return String(describing: r)
switch r {
case let .chatCmdError(_, chatError): return chatErrorString(chatError)
case let .chatError(_, chatError): return chatErrorString(chatError)
default: return String(describing: r)
}
} else {
return err.localizedDescription
return String(describing: err)
}
}
func chatErrorString(_ err: ChatError) -> String {
if case let .invalidJSON(json) = err { return json }
return String(describing: err)
}
public enum DBMigrationResult: Decodable, Equatable {
case ok
case errorNotADatabase(dbFile: String)