fix(@desktop/onboarding): refetching backed up data added
This commit is contained in:
parent
6b6aaf3af1
commit
b81f4dd150
|
@ -109,7 +109,7 @@ proc connectToFetchingFromWakuEvents*(self: Controller) =
|
|||
|
||||
proc connectToTimeoutEventAndStratTimer*(self: Controller, timeoutInMilliseconds: int) =
|
||||
var handlerId = self.events.onWithUUID(SIGNAL_GENERAL_TIMEOUT) do(e: Args):
|
||||
self.delegate.moveToStartupState()
|
||||
self.delegate.startAppAfterDelay()
|
||||
self.connectionIds.add(handlerId)
|
||||
self.generalService.runTimer(timeoutInMilliseconds)
|
||||
|
||||
|
@ -190,6 +190,9 @@ proc generateImage*(self: Controller, imageUrl: string, aX: int, aY: int, bX: in
|
|||
self.tmpProfileImageDetails = ProfileImageDetails(url: imageUrl, croppedImage: img.uri, x1: aX, y1: aY, x2: bX, y2: bY)
|
||||
return img.uri
|
||||
|
||||
proc fetchWakuMessages*(self: Controller) =
|
||||
self.generalService.fetchWakuMessages()
|
||||
|
||||
proc getCroppedProfileImage*(self: Controller): string =
|
||||
return self.tmpProfileImageDetails.croppedImage
|
||||
|
||||
|
|
|
@ -11,7 +11,12 @@ proc delete*(self: ProfileFetchingAnnouncementState) =
|
|||
method executePrimaryCommand*(self: ProfileFetchingAnnouncementState, controller: Controller) =
|
||||
if self.flowType == FlowType.FirstRunOldUserImportSeedPhrase or
|
||||
self.flowType == FlowType.FirstRunOldUserKeycardImport:
|
||||
echo "TODO: Try to fetch profile again..."
|
||||
controller.fetchWakuMessages()
|
||||
|
||||
method getNextPrimaryState*(self: ProfileFetchingAnnouncementState, controller: Controller): State =
|
||||
if self.flowType == FlowType.FirstRunOldUserImportSeedPhrase or
|
||||
self.flowType == FlowType.FirstRunOldUserKeycardImport:
|
||||
return createState(StateType.ProfileFetching, self.flowType, nil)
|
||||
|
||||
method getNextSecondaryState*(self: ProfileFetchingAnnouncementState, controller: Controller): State =
|
||||
if self.flowType == FlowType.FirstRunOldUserImportSeedPhrase or
|
||||
|
|
|
@ -154,6 +154,9 @@ method finishAppLoading*(self: AccessInterface) {.base.} =
|
|||
method checkFetchingStatusAndProceedWithAppLoading*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method startAppAfterDelay*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
# This way (using concepts) is used only for the modules managed by AppController
|
||||
type
|
||||
DelegateInterface* = concept c
|
||||
|
|
|
@ -330,6 +330,14 @@ proc delayStartingApp[T](self: Module[T]) =
|
|||
## we want to delay app start just to be sure that messages from waku will be received
|
||||
self.controller.connectToTimeoutEventAndStratTimer(timeoutInMilliseconds = 30000) # delay for 30 seconds
|
||||
|
||||
method startAppAfterDelay*[T](self: Module[T]) =
|
||||
let currStateObj = self.view.currentStartupStateObj()
|
||||
if currStateObj.isNil:
|
||||
error "cannot determine current startup state"
|
||||
quit() # quit the app
|
||||
self.view.setCurrentStartupState(newProfileFetchingState(currStateObj.flowType(), nil))
|
||||
self.moveToStartupState()
|
||||
|
||||
proc logoutAndDisplayError[T](self: Module[T], error: string) =
|
||||
self.delegate.logout()
|
||||
self.moveToStartupState()
|
||||
|
@ -346,7 +354,6 @@ method onNodeLogin*[T](self: Module[T], error: string) =
|
|||
currStateObj.flowType() == FlowType.FirstRunOldUserKeycardImport:
|
||||
self.prepareAndInitFetchingData()
|
||||
self.controller.connectToFetchingFromWakuEvents()
|
||||
self.view.setCurrentStartupState(newProfileFetchingState(currStateObj.flowType(), nil))
|
||||
self.delayStartingApp()
|
||||
let err = self.delegate.userLoggedIn()
|
||||
if err.len > 0:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import NimQml, os, json, chronicles
|
||||
|
||||
import ../../../backend/mailservers as status_mailservers
|
||||
import ../../../backend/general as status_general
|
||||
import ../../../app/core/eventemitter
|
||||
import ../../../app/core/tasks/[qt, threadpool]
|
||||
|
@ -84,4 +85,12 @@ 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()
|
||||
if(not response.error.isNil):
|
||||
error "could not set display name"
|
||||
except Exception as e:
|
||||
error "error: ", procName="fetchWakuMessages", errName = e.name, errDesription = e.msg
|
|
@ -29,3 +29,6 @@ proc fillGaps*(chatId: string, messageIds: seq[string]): RpcResponse[JsonNode] {
|
|||
let payload = %*[chatId, messageIds]
|
||||
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)
|
|
@ -24,6 +24,12 @@ Item {
|
|||
property int counter: d.timeout
|
||||
}
|
||||
|
||||
onStateChanged: {
|
||||
if (root.startupStore.currentStartupState.stateType === Constants.startupState.profileFetching) {
|
||||
d.counter = d.timeout
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.centerIn: parent
|
||||
height: Constants.keycard.general.onboardingHeight
|
||||
|
|
Loading…
Reference in New Issue