fix(pairing): fix pairing error on too fast login
Fixes #12550 The problem was that we used the pairing event saying "Finished" to show the Login button, however, when that even is received, the Node hasn't started fully yet, so we might try to login when the accounts are still empty in the cache. The solution is to use the return from the async task, since that one returns at the very end when the process is over and the node is ready. Obviously, if tat returns an error, we still use the error instead.
This commit is contained in:
parent
bbfe9a89f8
commit
fd0e4eff43
|
@ -16,6 +16,7 @@ type
|
||||||
EventProcessSuccess
|
EventProcessSuccess
|
||||||
EventProcessError
|
EventProcessError
|
||||||
EventReceivedKeystoreFiles
|
EventReceivedKeystoreFiles
|
||||||
|
EventCompletedAndNodeReady
|
||||||
|
|
||||||
type
|
type
|
||||||
Action* {.pure.} = enum
|
Action* {.pure.} = enum
|
||||||
|
|
|
@ -78,7 +78,7 @@ proc update*(self: LocalPairingStatus, data: LocalPairingEventArgs) =
|
||||||
self.state = LocalPairingState.Finished
|
self.state = LocalPairingState.Finished
|
||||||
|
|
||||||
if self.mode == LocalPairingMode.Receiver and
|
if self.mode == LocalPairingMode.Receiver and
|
||||||
data.eventType == EventTransferSuccess:
|
data.eventType == EventCompletedAndNodeReady:
|
||||||
if self.pairingType == PairingType.AppSync and
|
if self.pairingType == PairingType.AppSync and
|
||||||
data.action == ActionPairingInstallation or
|
data.action == ActionPairingInstallation or
|
||||||
self.pairingType == PairingType.KeypairSync:
|
self.pairingType == PairingType.KeypairSync:
|
||||||
|
|
|
@ -81,7 +81,6 @@ QtObject:
|
||||||
self.localPairingStatus.update(data)
|
self.localPairingStatus.update(data)
|
||||||
self.events.emit(SIGNAL_LOCAL_PAIRING_STATUS_UPDATE, self.localPairingStatus)
|
self.events.emit(SIGNAL_LOCAL_PAIRING_STATUS_UPDATE, self.localPairingStatus)
|
||||||
|
|
||||||
|
|
||||||
proc doConnect(self: Service) =
|
proc doConnect(self: Service) =
|
||||||
self.events.on(SignalType.Message.event) do(e:Args):
|
self.events.on(SignalType.Message.event) do(e:Args):
|
||||||
let receivedData = MessageSignal(e)
|
let receivedData = MessageSignal(e)
|
||||||
|
@ -175,6 +174,12 @@ QtObject:
|
||||||
let response = responseJson.parseJson
|
let response = responseJson.parseJson
|
||||||
let errorDescription = response["error"].getStr
|
let errorDescription = response["error"].getStr
|
||||||
if len(errorDescription) == 0:
|
if len(errorDescription) == 0:
|
||||||
|
let data = LocalPairingEventArgs(
|
||||||
|
eventType: EventCompletedAndNodeReady,
|
||||||
|
action: ActionPairingInstallation,
|
||||||
|
accountData: LocalPairingAccountData(),
|
||||||
|
error: "")
|
||||||
|
self.updateLocalPairingStatus(data)
|
||||||
return
|
return
|
||||||
error "failed to start bootstrapping device", errorDescription
|
error "failed to start bootstrapping device", errorDescription
|
||||||
let data = LocalPairingEventArgs(
|
let data = LocalPairingEventArgs(
|
||||||
|
|
Loading…
Reference in New Issue