mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user