start of activity center function calls
This commit is contained in:
parent
bee54e628f
commit
18b26a1c67
|
@ -59,6 +59,7 @@ type
|
||||||
channels*: Table[string, Chat]
|
channels*: Table[string, Chat]
|
||||||
msgCursor*: Table[string, string]
|
msgCursor*: Table[string, string]
|
||||||
pinnedMsgCursor*: Table[string, string]
|
pinnedMsgCursor*: Table[string, string]
|
||||||
|
activityCenterCursor*: string
|
||||||
emojiCursor*: Table[string, string]
|
emojiCursor*: Table[string, string]
|
||||||
lastMessageTimestamps*: Table[string, int64]
|
lastMessageTimestamps*: Table[string, int64]
|
||||||
|
|
||||||
|
@ -176,6 +177,21 @@ proc requestMissingCommunityInfos*(self: ChatModel) =
|
||||||
for communityId in self.communitiesToFetch:
|
for communityId in self.communitiesToFetch:
|
||||||
status_chat.requestCommunityInfo(communityId)
|
status_chat.requestCommunityInfo(communityId)
|
||||||
|
|
||||||
|
proc activityCenterNotification*(self: ChatModel, initialLoad:bool = true) =
|
||||||
|
# Notifications were already loaded, since cursor will
|
||||||
|
# be nil/empty if there are no more notifs
|
||||||
|
if(not initialLoad and self.activityCenterCursor == ""): return
|
||||||
|
|
||||||
|
status_chat.activityCenterNotification(self.activityCenterCursor)
|
||||||
|
# self.activityCenterCursor[chatId] = messageTuple[0];
|
||||||
|
|
||||||
|
# if messageTuple[1].len > 0:
|
||||||
|
# let lastMsgIndex = messageTuple[1].len - 1
|
||||||
|
# let ts = times.convert(Milliseconds, Seconds, messageTuple[1][lastMsgIndex].whisperTimestamp.parseInt())
|
||||||
|
# self.lastMessageTimestamps[chatId] = ts
|
||||||
|
|
||||||
|
# self.events.emit("messagesLoaded", MsgsLoadedArgs(messages: messageTuple[1]))
|
||||||
|
|
||||||
proc init*(self: ChatModel, pubKey: string, messagesFromContactsOnly: bool) =
|
proc init*(self: ChatModel, pubKey: string, messagesFromContactsOnly: bool) =
|
||||||
self.publicKey = pubKey
|
self.publicKey = pubKey
|
||||||
self.messagesFromContactsOnly = messagesFromContactsOnly
|
self.messagesFromContactsOnly = messagesFromContactsOnly
|
||||||
|
@ -186,6 +202,8 @@ proc init*(self: ChatModel, pubKey: string, messagesFromContactsOnly: bool) =
|
||||||
if (messagesFromContactsOnly):
|
if (messagesFromContactsOnly):
|
||||||
chatList = self.cleanSpamChatGroups(chatList, contacts)
|
chatList = self.cleanSpamChatGroups(chatList, contacts)
|
||||||
|
|
||||||
|
# self.activityCenterNotification()
|
||||||
|
|
||||||
let profileUpdatesChatIds = chatList.filter(c => c.chatType == ChatType.Profile).map(c => c.id)
|
let profileUpdatesChatIds = chatList.filter(c => c.chatType == ChatType.Profile).map(c => c.id)
|
||||||
|
|
||||||
if chatList.filter(c => c.chatType == ChatType.Timeline).len == 0:
|
if chatList.filter(c => c.chatType == ChatType.Timeline).len == 0:
|
||||||
|
|
|
@ -508,4 +508,26 @@ proc setPinMessage*(messageId: string, chatId: string, pinned: bool) =
|
||||||
"message_id": messageId,
|
"message_id": messageId,
|
||||||
"pinned": pinned,
|
"pinned": pinned,
|
||||||
"chat_id": chatId
|
"chat_id": chatId
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
proc rpcActivityCenterNotifications*(cursorVal: JsonNode, limit: int, success: var bool): string =
|
||||||
|
success = true
|
||||||
|
try:
|
||||||
|
result = callPrivateRPC("activityCenterNotifications".prefix, %* [cursorVal, limit])
|
||||||
|
except RpcException as e:
|
||||||
|
success = false
|
||||||
|
result = e.msg
|
||||||
|
|
||||||
|
proc activityCenterNotification*(cursor: string = "") =
|
||||||
|
var cursorVal: JsonNode
|
||||||
|
|
||||||
|
if cursor == "":
|
||||||
|
cursorVal = newJNull()
|
||||||
|
else:
|
||||||
|
cursorVal = newJString(cursor)
|
||||||
|
|
||||||
|
var success: bool
|
||||||
|
let callResult = rpcActivityCenterNotifications(cursorVal, 20, success)
|
||||||
|
debug "Activity center", callResult
|
||||||
|
# if success:
|
||||||
|
# result = parseChatMessagesResponse(chatId, callResult.parseJson()["result"])
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 71f66f68064e9897cd17b6bcecba426a91405034
|
Subproject commit 3cb9db2ac8c4ead31beac8f29b1e9b5d8620bb9e
|
Loading…
Reference in New Issue