move generateRandomAccountAndLogin out of view
This commit is contained in:
parent
2cf1541115
commit
23f72c77bc
|
@ -14,11 +14,6 @@ import eventemitter
|
|||
import view
|
||||
|
||||
proc storeAccountAndLogin(events: EventEmitter, selectedAccount: string, password: string): string =
|
||||
echo "--------------------"
|
||||
echo "--------------------"
|
||||
echo "storeAccountAndLogin"
|
||||
echo "--------------------"
|
||||
echo "--------------------"
|
||||
let account = to(json.parseJson(selectedAccount), Models.GeneratedAccount)
|
||||
let password = "0x" & $keccak_256.digest(password)
|
||||
let multiAccount = %* {
|
||||
|
@ -94,13 +89,17 @@ proc storeAccountAndLogin(events: EventEmitter, selectedAccount: string, passwor
|
|||
events.emit("node:ready", Args())
|
||||
echo "Account saved succesfully"
|
||||
|
||||
proc generateRandomAccountAndLogin*(events: EventEmitter) =
|
||||
discard status_test.setupNewAccount()
|
||||
events.emit("node:ready", Args())
|
||||
|
||||
type OnboardingController* = ref object of SignalSubscriber
|
||||
view*: OnboardingView
|
||||
variant*: QVariant
|
||||
|
||||
proc newController*(events: EventEmitter): OnboardingController =
|
||||
result = OnboardingController()
|
||||
result.view = newOnboardingView(events, storeAccountAndLogin)
|
||||
result.view = newOnboardingView(events, storeAccountAndLogin, generateRandomAccountAndLogin)
|
||||
result.variant = newQVariant(result.view)
|
||||
|
||||
proc delete*(self: OnboardingController) =
|
||||
|
|
|
@ -15,6 +15,7 @@ QtObject:
|
|||
m_generatedAddresses: string
|
||||
events: EventEmitter
|
||||
doStoreAccountAndLogin: proc(events: EventEmitter, selectedAccount: string, password: string): string
|
||||
doGenerateRandomAccountAndLogin: proc(events: EventEmitter)
|
||||
|
||||
proc setup(self: OnboardingView) =
|
||||
self.QObject.setup
|
||||
|
@ -22,10 +23,11 @@ QtObject:
|
|||
proc delete*(self: OnboardingView) =
|
||||
self.QObject.delete
|
||||
|
||||
proc newOnboardingView*(events: EventEmitter, doStoreAccountAndLogin: proc): OnboardingView =
|
||||
proc newOnboardingView*(events: EventEmitter, doStoreAccountAndLogin: proc, doGenerateRandomAccountAndLogin: proc(events: EventEmitter)): OnboardingView =
|
||||
new(result, delete)
|
||||
result.events = events
|
||||
result.doStoreAccountAndLogin = doStoreAccountAndLogin
|
||||
result.doGenerateRandomAccountAndLogin = doGenerateRandomAccountAndLogin
|
||||
result.setup()
|
||||
|
||||
proc getGeneratedAddresses*(self: OnboardingView): string {.slot.} =
|
||||
|
@ -59,5 +61,4 @@ QtObject:
|
|||
result = self.doStoreAccountAndLogin(self.events, selectedAccount, password)
|
||||
|
||||
proc generateRandomAccountAndLogin*(self: OnboardingView) {.slot.} =
|
||||
discard status_test.setupNewAccount()
|
||||
self.events.emit("node:ready", Args())
|
||||
self.doGenerateRandomAccountAndLogin(self.events)
|
||||
|
|
Loading…
Reference in New Issue