fix: order of recent stickers incorrect on app start
Order of recent stickers was being loaded in reverse order.
This commit is contained in:
parent
8e6eb65509
commit
f54d66bf24
|
@ -153,16 +153,17 @@ proc sendMessage*(self: ChatModel, chatId: string, msg: string): string =
|
|||
self.emitUpdate(sentMessage)
|
||||
sentMessage
|
||||
|
||||
proc addStickerToRecent*(self: ChatModel, sticker: Sticker) =
|
||||
proc addStickerToRecent*(self: ChatModel, sticker: Sticker, save: bool = false) =
|
||||
self.recentStickers.insert(sticker, 0)
|
||||
self.recentStickers = self.recentStickers.deduplicate()
|
||||
if self.recentStickers.len > 24:
|
||||
self.recentStickers = self.recentStickers[0..23] # take top 24 most recent
|
||||
status_stickers.saveRecentStickers(self.recentStickers)
|
||||
if save:
|
||||
status_stickers.saveRecentStickers(self.recentStickers)
|
||||
|
||||
proc sendSticker*(self: ChatModel, chatId: string, sticker: Sticker) =
|
||||
var response = status_chat.sendStickerMessage(chatId, sticker)
|
||||
self.addStickerToRecent(sticker)
|
||||
self.addStickerToRecent(sticker, save = true)
|
||||
self.emitUpdate(response)
|
||||
|
||||
proc chatMessages*(self: ChatModel, chatId: string, initialLoad:bool = true) =
|
||||
|
|
|
@ -3,7 +3,7 @@ import json, tables
|
|||
import json_serialization
|
||||
|
||||
var settings: JsonNode = %*{}
|
||||
var dirty: bool = false
|
||||
var dirty: bool = true
|
||||
|
||||
proc saveSettings*(key: string, value: string | JsonNode): StatusGoError =
|
||||
let response = callPrivateRPC("settings_saveSetting", %* [
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue