mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-02 11:24:18 +00:00
change after merge
This commit is contained in:
@@ -342,7 +342,6 @@ func apiGetChatItems(type: ChatType, id: Int64, pagination: ChatPagination, sear
|
||||
|
||||
func loadChat(type: ChatType, id: Int64, search: String = "", clearItems: Bool = true) async {
|
||||
// do {
|
||||
let cInfo = chat.chatInfo
|
||||
let m = ChatModel.shared
|
||||
let im = ItemsModel.shared
|
||||
m.chatItemStatuses = [:]
|
||||
|
||||
@@ -682,17 +682,23 @@ struct ChatTTLOption: View {
|
||||
) {
|
||||
progressIndicator = true
|
||||
Task {
|
||||
let m = ChatModel.shared
|
||||
do {
|
||||
try await setChatTTL(chatType: chat.chatInfo.chatType, id: chat.chatInfo.apiId, ttl)
|
||||
await loadChat(chat: chat, clearItems: true, replaceChat: true)
|
||||
await loadChat(type: chat.chatInfo.chatType, id: chat.chatInfo.apiId, clearItems: true)
|
||||
await MainActor.run {
|
||||
progressIndicator = false
|
||||
currentChatItemTTL = chatItemTTL
|
||||
if ItemsModel.shared.reversedChatItems.isEmpty && m.chatId == chat.id,
|
||||
let chat = m.getChat(chat.id) {
|
||||
chat.chatItems = []
|
||||
m.replaceChat(chat.id, chat)
|
||||
}
|
||||
}
|
||||
}
|
||||
catch let error {
|
||||
logger.error("setChatTTL error \(responseError(error))")
|
||||
await loadChat(chat: chat, clearItems: true, replaceChat: true)
|
||||
await loadChat(type: chat.chatInfo.chatType, id: chat.chatInfo.apiId, clearItems: true)
|
||||
await MainActor.run {
|
||||
chatItemTTL = currentChatItemTTL
|
||||
progressIndicator = false
|
||||
|
||||
Reference in New Issue
Block a user