fix(@desktop/onboarding): app loading screen displayed forever when creating a new Status account

Fixes: #11454
This commit is contained in:
Sale Djenic 2023-07-07 17:24:02 +02:00 committed by Jonathan Rainville
parent 3b57915155
commit d550b01e65
5 changed files with 39 additions and 12 deletions

View File

@ -8,9 +8,3 @@ export signal_type
type Signal* = ref object of Args
signalType* {.serializedFieldName("type").}: SignalType
signalTypeStr*: string
type SignalError* = object
error*: string
type NodeSignal* = ref object of Signal
event*: SignalError

View File

@ -0,0 +1,28 @@
import json
import base
import ../../../../app_service/service/accounts/dto/[accounts]
import ../../../../app_service/service/settings/dto/[settings]
type NodeSignal* = ref object of Signal
error*: string
account*: AccountDto
settings*: SettingsDto
proc fromEvent*(T: type NodeSignal, event: JsonNode): NodeSignal =
result = NodeSignal()
if not event.contains("event") or event["event"].kind == JNull:
return
let e = event["event"]
if e.contains("error"):
result.error = e["error"].getStr
if e.contains("account") and e["account"].kind != JNull:
result.account = e["account"].toAccountDto()
if e.contains("settings") and e["settings"].kind != JNull:
result.settings = e["settings"].toSettingsDto()

View File

@ -49,8 +49,8 @@ QtObject:
return
if(signal.signalType == SignalType.NodeLogin):
if(NodeSignal(signal).event.error != ""):
error "node.login", error=NodeSignal(signal).event.error
if NodeSignal(signal).error != "":
error "node.login", error=NodeSignal(signal).error
if(signal.signalType == SignalType.NodeCrashed):
error "node.crashed", error=statusSignal
@ -83,7 +83,12 @@ QtObject:
of SignalType.EnvelopeExpired: EnvelopeExpiredSignal.fromEvent(jsonSignal)
of SignalType.WhisperFilterAdded: WhisperFilterSignal.fromEvent(jsonSignal)
of SignalType.Wallet: WalletSignal.fromEvent(jsonSignal)
of SignalType.NodeLogin: Json.decode($jsonSignal, NodeSignal)
of SignalType.NodeReady,
SignalType.NodeCrashed,
SignalType.NodeStarted,
SignalType.NodeStopped,
SignalType.NodeLogin:
NodeSignal.fromEvent(jsonSignal)
of SignalType.PeerStats: PeerStatsSignal.fromEvent(jsonSignal)
of SignalType.DiscoverySummary: DiscoverySummarySignal.fromEvent(jsonSignal)
of SignalType.MailserverRequestCompleted: MailserverRequestCompletedSignal.fromEvent(jsonSignal)

View File

@ -3,9 +3,9 @@
import ./remote_signals/[base, chronicles_logs, community, discovery_summary, envelope, expired, mailserver, messages,
peerstats, signal_type, stats, wallet, whisper_filter, update_available, status_updates, waku_backed_up_profile,
waku_backed_up_settings, waku_backed_up_keypair, waku_backed_up_watch_only_account,
waku_fetching_backup_progress, pairing]
waku_fetching_backup_progress, pairing, node]
export base, chronicles_logs, community, discovery_summary, envelope, expired, mailserver, messages, peerstats,
signal_type, stats, wallet, whisper_filter, update_available, status_updates, waku_backed_up_profile,
waku_backed_up_settings, waku_backed_up_keypair, waku_backed_up_watch_only_account,
waku_fetching_backup_progress, pairing
waku_fetching_backup_progress, pairing, node

View File

@ -133,7 +133,7 @@ proc delete*(self: Controller) =
proc init*(self: Controller) =
var handlerId = self.events.onWithUUID(SignalType.NodeLogin.event) do(e:Args):
let signal = NodeSignal(e)
self.delegate.onNodeLogin(signal.event.error)
self.delegate.onNodeLogin(signal.error)
self.cleanTmpData()
self.connectionIds.add(handlerId)