fix(@desktop/onboarding): recovering an account from waku

Fixes: #10969
This commit is contained in:
Sale Djenic 2023-06-07 16:59:23 +02:00 committed by saledjenic
parent b5a34fe1e4
commit a0d72f9532
5 changed files with 16 additions and 14 deletions

View File

@ -90,11 +90,13 @@ QtObject:
let index = self.createIndex(ind, 0, nil)
self.dataChanged(index, index, @[ModelRole.LoadedMessages.int])
proc checkLastKnownClockAndReinitModel*(self: Model, backedUpMsgClock: uint64, entities: seq[tuple[entity: string, icon: string]]) =
if self.lastKnownBackedUpMsgClock >= backedUpMsgClock:
return
self.init(entities)
self.lastKnownBackedUpMsgClock = backedUpMsgClock
proc evaluateWhetherToProcessReceivedData*(self: Model, backedUpMsgClock: uint64, entities: seq[tuple[entity: string, icon: string]]): bool =
if self.lastKnownBackedUpMsgClock > backedUpMsgClock:
return false
if self.lastKnownBackedUpMsgClock < backedUpMsgClock:
self.init(entities)
self.lastKnownBackedUpMsgClock = backedUpMsgClock
return true
proc reevaluateAllTotals(self: Model) =
self.allTotalsSet = true
@ -137,8 +139,6 @@ QtObject:
return true
proc isEntityLoaded*(self: Model, entity: string): bool =
if not self.allTotalsSet:
return false
let ind = self.findIndexForEntity(entity)
if(ind == -1):
return false

View File

@ -336,7 +336,8 @@ method checkFetchingStatusAndProceedWithAppLoading*[T](self: Module[T]) =
method onFetchingFromWakuMessageReceived*[T](self: Module[T], backedUpMsgClock: uint64, section: string,
totalMessages: int, receivedMessageAtPosition: int) =
self.view.fetchingDataModel().checkLastKnownClockAndReinitModel(backedUpMsgClock, listOfEntitiesWeExpectToBeSynced)
if not self.view.fetchingDataModel().evaluateWhetherToProcessReceivedData(backedUpMsgClock, listOfEntitiesWeExpectToBeSynced):
return
if self.view.fetchingDataModel().allMessagesLoaded():
return
let currStateObj = self.view.currentStartupStateObj()

View File

@ -43,7 +43,7 @@ QtObject:
discard status_general.logout()
proc getPasswordStrengthScore*(self: Service, password, userName: string): int =
try:
try:
let response = status_general.getPasswordStrengthScore(password, @[userName])
if(response.result.contains("error")):
let errMsg = response.result["error"].getStr()
@ -85,11 +85,11 @@ QtObject:
if self.timeoutInMilliseconds <= 0:
self.events.emit(SIGNAL_GENERAL_TIMEOUT, Args())
else:
self.runTimer()
self.runTimer()
proc fetchWakuMessages*(self: Service) =
try:
let response = status_mailservers.requestAllHistoricMessages()
let response = status_mailservers.requestAllHistoricMessagesWithRetries(forceFetchingBackup = true)
if(not response.error.isNil):
error "could not set display name"
except Exception as e:

View File

@ -30,5 +30,6 @@ proc fillGaps*(chatId: string, messageIds: seq[string]): RpcResponse[JsonNode] {
result = core.callPrivateRPC("fillGaps".prefix, payload)
info "fillGaps", topics="mailserver-interaction", rpc_method="wakuext_fillGaps", chatId, messageIds, result
proc requestAllHistoricMessages*(): RpcResponse[JsonNode] {.raises: [Exception].} =
result = core.callPrivateRPC("requestAllHistoricMessages".prefix)
proc requestAllHistoricMessagesWithRetries*(forceFetchingBackup: bool): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %*[forceFetchingBackup]
result = core.callPrivateRPC("requestAllHistoricMessagesWithRetries".prefix, payload)

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 8589a525a5531cc4f6e7f6d6e04fe99eecae1658
Subproject commit 56cad423f02be916c5ae0661835033ed5938f84b