mobile: clear chat; allow to delete items deleted by sender (#660)

* ios: clear chat

* android: clear chat

* fix chat stats

* fixes

* check if deleted

* delete from files for groups

* android - fixes

* Update apps/android/app/src/main/java/chat/simplex/app/model/ChatModel.kt

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>

* Update apps/android/app/src/main/java/chat/simplex/app/model/ChatModel.kt

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
JRoberts
2022-05-17 22:48:54 +04:00
committed by GitHub
parent 295cec7c53
commit 106dceabfc
14 changed files with 215 additions and 63 deletions
+16
View File
@@ -286,6 +286,22 @@ func apiDeleteChat(type: ChatType, id: Int64) async throws {
throw r
}
func apiClearChat(type: ChatType, id: Int64) async throws {
let r = await chatSendCmd(.apiClearChat(type: type, id: id), bgTask: false)
if case .chatCleared = r { return }
throw r
}
func clearChat(_ chat: Chat) async {
do {
let cInfo = chat.chatInfo
try await apiClearChat(type: cInfo.chatType, id: cInfo.apiId)
DispatchQueue.main.async { ChatModel.shared.clearChat(cInfo) }
} catch {
logger.error("clearChat apiClearChat error: \(responseError(error))")
}
}
func apiUpdateProfile(profile: Profile) async throws -> Profile? {
let r = await chatSendCmd(.apiUpdateProfile(profile: profile))
switch r {