change after merge

This commit is contained in:
Avently
2025-01-21 19:25:50 -08:00
parent 0e8c981b46
commit 702e405bb4
2 changed files with 8 additions and 3 deletions
-1
View File
@@ -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