refactor(communities): use ImportingHistoryArchiveMessages signal for
banner
@John-44 requested that we show the banner only for when messages are indeed
imported into the database, not necessarily already when the torrent data is being downloaded.
This commit ensures Desktop processes the newly introduced
`ImportingHistoryArchiveMessages` signal to render the banner introduced
in d5db1e6356
This needs: https://github.com/status-im/status-go/pull/2998
This commit is contained in:
parent
7bae51335b
commit
40eead1c8f
|
@ -130,6 +130,11 @@ proc downloadingHistoryArchivesStartedFromEvent*(T: type HistoryArchivesSignal,
|
||||||
result.communityId = event["event"]{"communityId"}.getStr()
|
result.communityId = event["event"]{"communityId"}.getStr()
|
||||||
result.signalType = SignalType.DownloadingHistoryArchivesStarted
|
result.signalType = SignalType.DownloadingHistoryArchivesStarted
|
||||||
|
|
||||||
|
proc importingHistoryArchiveMessagesFromEvent*(T: type HistoryArchivesSignal, event: JsonNode): HistoryArchivesSignal =
|
||||||
|
result = HistoryArchivesSignal()
|
||||||
|
result.communityId = event["event"]{"communityId"}.getStr()
|
||||||
|
result.signalType = SignalType.ImportingHistoryArchiveMessages
|
||||||
|
|
||||||
proc downloadingHistoryArchivesFinishedFromEvent*(T: type HistoryArchivesSignal, event: JsonNode): HistoryArchivesSignal =
|
proc downloadingHistoryArchivesFinishedFromEvent*(T: type HistoryArchivesSignal, event: JsonNode): HistoryArchivesSignal =
|
||||||
result = HistoryArchivesSignal()
|
result = HistoryArchivesSignal()
|
||||||
result.communityId = event["event"]{"communityId"}.getStr()
|
result.communityId = event["event"]{"communityId"}.getStr()
|
||||||
|
|
|
@ -41,6 +41,7 @@ type SignalType* {.pure.} = enum
|
||||||
HistoryArchiveDownloaded = "community.historyArchiveDownloaded"
|
HistoryArchiveDownloaded = "community.historyArchiveDownloaded"
|
||||||
DownloadingHistoryArchivesStarted = "community.downloadingHistoryArchivesStarted"
|
DownloadingHistoryArchivesStarted = "community.downloadingHistoryArchivesStarted"
|
||||||
DownloadingHistoryArchivesFinished = "community.downloadingHistoryArchivesFinished"
|
DownloadingHistoryArchivesFinished = "community.downloadingHistoryArchivesFinished"
|
||||||
|
ImportingHistoryArchiveMessages = "community.importingHistoryArchiveMessages"
|
||||||
UpdateAvailable = "update.available"
|
UpdateAvailable = "update.available"
|
||||||
DiscordCategoriesAndChannelsExtracted = "community.discordCategoriesAndChannelsExtracted"
|
DiscordCategoriesAndChannelsExtracted = "community.discordCategoriesAndChannelsExtracted"
|
||||||
StatusUpdatesTimedout = "status.updates.timedout"
|
StatusUpdatesTimedout = "status.updates.timedout"
|
||||||
|
|
|
@ -95,6 +95,7 @@ QtObject:
|
||||||
of SignalType.HistoryArchiveDownloaded: HistoryArchivesSignal.historyArchiveDownloadedFromEvent(jsonSignal)
|
of SignalType.HistoryArchiveDownloaded: HistoryArchivesSignal.historyArchiveDownloadedFromEvent(jsonSignal)
|
||||||
of SignalType.DownloadingHistoryArchivesStarted: HistoryArchivesSignal.downloadingHistoryArchivesStartedFromEvent(jsonSignal)
|
of SignalType.DownloadingHistoryArchivesStarted: HistoryArchivesSignal.downloadingHistoryArchivesStartedFromEvent(jsonSignal)
|
||||||
of SignalType.DownloadingHistoryArchivesFinished: HistoryArchivesSignal.downloadingHistoryArchivesFinishedFromEvent(jsonSignal)
|
of SignalType.DownloadingHistoryArchivesFinished: HistoryArchivesSignal.downloadingHistoryArchivesFinishedFromEvent(jsonSignal)
|
||||||
|
of SignalType.ImportingHistoryArchiveMessages: HistoryArchivesSignal.importingHistoryArchiveMessagesFromEvent(jsonSignal)
|
||||||
of SignalType.UpdateAvailable: UpdateAvailableSignal.fromEvent(jsonSignal)
|
of SignalType.UpdateAvailable: UpdateAvailableSignal.fromEvent(jsonSignal)
|
||||||
of SignalType.DiscordCategoriesAndChannelsExtracted: DiscordCategoriesAndChannelsExtractedSignal.fromEvent(jsonSignal)
|
of SignalType.DiscordCategoriesAndChannelsExtracted: DiscordCategoriesAndChannelsExtractedSignal.fromEvent(jsonSignal)
|
||||||
of SignalType.StatusUpdatesTimedout: StatusUpdatesTimedoutSignal.fromEvent(jsonSignal)
|
of SignalType.StatusUpdatesTimedout: StatusUpdatesTimedoutSignal.fromEvent(jsonSignal)
|
||||||
|
|
|
@ -255,7 +255,7 @@ QtObject:
|
||||||
stopped: receivedData.stopped
|
stopped: receivedData.stopped
|
||||||
))
|
))
|
||||||
|
|
||||||
self.events.on(SignalType.DownloadingHistoryArchivesStarted.event) do(e: Args):
|
self.events.on(SignalType.ImportingHistoryArchiveMessages.event) do(e: Args):
|
||||||
var receivedData = HistoryArchivesSignal(e)
|
var receivedData = HistoryArchivesSignal(e)
|
||||||
if receivedData.communityId notin self.historyArchiveDownloadTaskCommunityIds:
|
if receivedData.communityId notin self.historyArchiveDownloadTaskCommunityIds:
|
||||||
self.historyArchiveDownloadTaskCommunityIds.incl(receivedData.communityId)
|
self.historyArchiveDownloadTaskCommunityIds.incl(receivedData.communityId)
|
||||||
|
|
Loading…
Reference in New Issue