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:
Pascal Precht 2022-12-02 15:23:40 +01:00 committed by r4bbit
parent 7bae51335b
commit 40eead1c8f
4 changed files with 8 additions and 1 deletions

View File

@ -130,6 +130,11 @@ proc downloadingHistoryArchivesStartedFromEvent*(T: type HistoryArchivesSignal,
result.communityId = event["event"]{"communityId"}.getStr()
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 =
result = HistoryArchivesSignal()
result.communityId = event["event"]{"communityId"}.getStr()

View File

@ -41,6 +41,7 @@ type SignalType* {.pure.} = enum
HistoryArchiveDownloaded = "community.historyArchiveDownloaded"
DownloadingHistoryArchivesStarted = "community.downloadingHistoryArchivesStarted"
DownloadingHistoryArchivesFinished = "community.downloadingHistoryArchivesFinished"
ImportingHistoryArchiveMessages = "community.importingHistoryArchiveMessages"
UpdateAvailable = "update.available"
DiscordCategoriesAndChannelsExtracted = "community.discordCategoriesAndChannelsExtracted"
StatusUpdatesTimedout = "status.updates.timedout"

View File

@ -95,6 +95,7 @@ QtObject:
of SignalType.HistoryArchiveDownloaded: HistoryArchivesSignal.historyArchiveDownloadedFromEvent(jsonSignal)
of SignalType.DownloadingHistoryArchivesStarted: HistoryArchivesSignal.downloadingHistoryArchivesStartedFromEvent(jsonSignal)
of SignalType.DownloadingHistoryArchivesFinished: HistoryArchivesSignal.downloadingHistoryArchivesFinishedFromEvent(jsonSignal)
of SignalType.ImportingHistoryArchiveMessages: HistoryArchivesSignal.importingHistoryArchiveMessagesFromEvent(jsonSignal)
of SignalType.UpdateAvailable: UpdateAvailableSignal.fromEvent(jsonSignal)
of SignalType.DiscordCategoriesAndChannelsExtracted: DiscordCategoriesAndChannelsExtractedSignal.fromEvent(jsonSignal)
of SignalType.StatusUpdatesTimedout: StatusUpdatesTimedoutSignal.fromEvent(jsonSignal)

View File

@ -255,7 +255,7 @@ QtObject:
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)
if receivedData.communityId notin self.historyArchiveDownloadTaskCommunityIds:
self.historyArchiveDownloadTaskCommunityIds.incl(receivedData.communityId)