From 594b3974c9d790af827fbe132cf9d50150b6d982 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 25 May 2020 15:55:36 -0400 Subject: [PATCH] move addPeer to the setupAccount function --- src/models/accounts.nim | 7 ------- src/status/accounts.nim | 6 +++++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/models/accounts.nim b/src/models/accounts.nim index 21bda57cdc..b88762f24d 100644 --- a/src/models/accounts.nim +++ b/src/models/accounts.nim @@ -2,7 +2,6 @@ import eventemitter import json_serialization import ../status/accounts as status_accounts import ../status/types -import ../status/libstatus type Address* = ref object @@ -37,15 +36,9 @@ proc generateAddresses*(self: AccountModel): seq[GeneratedAccount] = proc generateRandomAccountAndLogin*(self: AccountModel) = let generatedAccounts = status_accounts.generateAddresses() let account = status_accounts.setupAccount(generatedAccounts[0], "qwerty") - # TODO this is needed for now for the retrieving of past messages. We'll either move or remove it later - let peer = "enode://44160e22e8b42bd32a06c1532165fa9e096eebedd7fa6d6e5f8bbef0440bc4a4591fe3651be68193a7ec029021cdb496cfe1d7f9f1dc69eb99226e6f39a7a5d4@35.225.221.245:443" - discard libstatus.addPeer(peer) self.events.emit("accountsReady", AccountArgs(account: account)) proc storeAccountAndLogin*(self: AccountModel, selectedAccountIndex: int, password: string): Account = let generatedAccount: GeneratedAccount = self.generatedAddresses[selectedAccountIndex] result = status_accounts.setupAccount(generatedAccount, password) - # TODO this is needed for now for the retrieving of past messages. We'll either move or remove it later - let peer = "enode://44160e22e8b42bd32a06c1532165fa9e096eebedd7fa6d6e5f8bbef0440bc4a4591fe3651be68193a7ec029021cdb496cfe1d7f9f1dc69eb99226e6f39a7a5d4@35.225.221.245:443" - discard libstatus.addPeer(peer) self.events.emit("accountsReady", AccountArgs(account: result)) diff --git a/src/status/accounts.nim b/src/status/accounts.nim index 82caaf9744..88637912c6 100644 --- a/src/status/accounts.nim +++ b/src/status/accounts.nim @@ -130,4 +130,8 @@ proc setupAccount*(account: GeneratedAccount, password: string): Account = let accountData = getAccountData(account, alias, identicon) var settingsJSON = getAccountSettings(account, alias, identicon, multiAccounts, constants.DEFAULT_NETWORKS) - saveAccountAndLogin(multiAccounts, alias, identicon, $accountData, password, $constants.NODE_CONFIG, $settingsJSON) + result = saveAccountAndLogin(multiAccounts, alias, identicon, $accountData, password, $constants.NODE_CONFIG, $settingsJSON) + + # TODO this is needed for now for the retrieving of past messages. We'll either move or remove it later + let peer = "enode://44160e22e8b42bd32a06c1532165fa9e096eebedd7fa6d6e5f8bbef0440bc4a4591fe3651be68193a7ec029021cdb496cfe1d7f9f1dc69eb99226e6f39a7a5d4@35.225.221.245:443" + discard libstatus.addPeer(peer)