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) =
|
proc connectToTimeoutEventAndStratTimer*(self: Controller, timeoutInMilliseconds: int) =
|
||||||
var handlerId = self.events.onWithUUID(SIGNAL_GENERAL_TIMEOUT) do(e: Args):
|
var handlerId = self.events.onWithUUID(SIGNAL_GENERAL_TIMEOUT) do(e: Args):
|
||||||
self.delegate.moveToStartupState()
|
self.delegate.startAppAfterDelay()
|
||||||
self.connectionIds.add(handlerId)
|
self.connectionIds.add(handlerId)
|
||||||
self.generalService.runTimer(timeoutInMilliseconds)
|
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)
|
self.tmpProfileImageDetails = ProfileImageDetails(url: imageUrl, croppedImage: img.uri, x1: aX, y1: aY, x2: bX, y2: bY)
|
||||||
return img.uri
|
return img.uri
|
||||||
|
|
||||||
|
proc fetchWakuMessages*(self: Controller) =
|
||||||
|
self.generalService.fetchWakuMessages()
|
||||||
|
|
||||||
proc getCroppedProfileImage*(self: Controller): string =
|
proc getCroppedProfileImage*(self: Controller): string =
|
||||||
return self.tmpProfileImageDetails.croppedImage
|
return self.tmpProfileImageDetails.croppedImage
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,12 @@ proc delete*(self: ProfileFetchingAnnouncementState) =
|
||||||
method executePrimaryCommand*(self: ProfileFetchingAnnouncementState, controller: Controller) =
|
method executePrimaryCommand*(self: ProfileFetchingAnnouncementState, controller: Controller) =
|
||||||
if self.flowType == FlowType.FirstRunOldUserImportSeedPhrase or
|
if self.flowType == FlowType.FirstRunOldUserImportSeedPhrase or
|
||||||
self.flowType == FlowType.FirstRunOldUserKeycardImport:
|
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 =
|
method getNextSecondaryState*(self: ProfileFetchingAnnouncementState, controller: Controller): State =
|
||||||
if self.flowType == FlowType.FirstRunOldUserImportSeedPhrase or
|
if self.flowType == FlowType.FirstRunOldUserImportSeedPhrase or
|
||||||
|
|
|
@ -154,6 +154,9 @@ method finishAppLoading*(self: AccessInterface) {.base.} =
|
||||||
method checkFetchingStatusAndProceedWithAppLoading*(self: AccessInterface) {.base.} =
|
method checkFetchingStatusAndProceedWithAppLoading*(self: AccessInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
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
|
# This way (using concepts) is used only for the modules managed by AppController
|
||||||
type
|
type
|
||||||
DelegateInterface* = concept c
|
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
|
## 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
|
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) =
|
proc logoutAndDisplayError[T](self: Module[T], error: string) =
|
||||||
self.delegate.logout()
|
self.delegate.logout()
|
||||||
self.moveToStartupState()
|
self.moveToStartupState()
|
||||||
|
@ -346,7 +354,6 @@ method onNodeLogin*[T](self: Module[T], error: string) =
|
||||||
currStateObj.flowType() == FlowType.FirstRunOldUserKeycardImport:
|
currStateObj.flowType() == FlowType.FirstRunOldUserKeycardImport:
|
||||||
self.prepareAndInitFetchingData()
|
self.prepareAndInitFetchingData()
|
||||||
self.controller.connectToFetchingFromWakuEvents()
|
self.controller.connectToFetchingFromWakuEvents()
|
||||||
self.view.setCurrentStartupState(newProfileFetchingState(currStateObj.flowType(), nil))
|
|
||||||
self.delayStartingApp()
|
self.delayStartingApp()
|
||||||
let err = self.delegate.userLoggedIn()
|
let err = self.delegate.userLoggedIn()
|
||||||
if err.len > 0:
|
if err.len > 0:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import NimQml, os, json, chronicles
|
import NimQml, os, json, chronicles
|
||||||
|
|
||||||
|
import ../../../backend/mailservers as status_mailservers
|
||||||
import ../../../backend/general as status_general
|
import ../../../backend/general as status_general
|
||||||
import ../../../app/core/eventemitter
|
import ../../../app/core/eventemitter
|
||||||
import ../../../app/core/tasks/[qt, threadpool]
|
import ../../../app/core/tasks/[qt, threadpool]
|
||||||
|
@ -85,3 +86,11 @@ QtObject:
|
||||||
self.events.emit(SIGNAL_GENERAL_TIMEOUT, Args())
|
self.events.emit(SIGNAL_GENERAL_TIMEOUT, Args())
|
||||||
else:
|
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]
|
let payload = %*[chatId, messageIds]
|
||||||
result = core.callPrivateRPC("fillGaps".prefix, payload)
|
result = core.callPrivateRPC("fillGaps".prefix, payload)
|
||||||
info "fillGaps", topics="mailserver-interaction", rpc_method="wakuext_fillGaps", chatId, messageIds, result
|
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
|
property int counter: d.timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onStateChanged: {
|
||||||
|
if (root.startupStore.currentStartupState.stateType === Constants.startupState.profileFetching) {
|
||||||
|
d.counter = d.timeout
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
height: Constants.keycard.general.onboardingHeight
|
height: Constants.keycard.general.onboardingHeight
|
||||||
|
|
Loading…
Reference in New Issue