remove libstatus accounts references

This commit is contained in:
Iuri Matias 2021-06-08 12:03:06 -04:00
parent be696ad20f
commit daed733ebb
9 changed files with 21 additions and 16 deletions

View File

@ -4,7 +4,6 @@ import ../../status/libstatus/chat as libstatus_chat
import ../../status/libstatus/accounts/constants import ../../status/libstatus/accounts/constants
import ../../status/libstatus/chat as core_chat import ../../status/libstatus/chat as core_chat
import ../../status/libstatus/utils as status_utils import ../../status/libstatus/utils as status_utils
import ../../status/accounts as status_accounts
import ../../status/chat as status_chat import ../../status/chat as status_chat
import ../../status/messages as status_messages import ../../status/messages as status_messages
import ../../status/contacts as status_contacts import ../../status/contacts as status_contacts

View File

@ -1,6 +1,5 @@
import NimQml, Tables, import NimQml, Tables,
../../../status/[status, ens] ../../../status/[status, ens]
import ../../../status/accounts as status_accounts
type type
CommunityMembersRoles {.pure.} = enum CommunityMembersRoles {.pure.} = enum
UserName = UserRole + 1, UserName = UserRole + 1,
@ -58,13 +57,13 @@ QtObject:
if self.status.chat.contacts.hasKey(pk): if self.status.chat.contacts.hasKey(pk):
result = self.status.chat.contacts[pk].identicon result = self.status.chat.contacts[pk].identicon
else: else:
result = status_accounts.generateIdenticon(pk) result = self.status.accounts.generateIdenticon(pk)
proc alias(self: CommunityMembersView, pk: string): string = proc alias(self: CommunityMembersView, pk: string): string =
if self.status.chat.contacts.hasKey(pk): if self.status.chat.contacts.hasKey(pk):
result = self.status.chat.contacts[pk].alias result = self.status.chat.contacts[pk].alias
else: else:
result = status_accounts.generateAlias(pk) result = self.status.accounts.generateAlias(pk)
method data(self: CommunityMembersView, index: QModelIndex, role: int): QVariant = method data(self: CommunityMembersView, index: QModelIndex, role: int): QVariant =

View File

@ -3,7 +3,6 @@ import ../../status/libstatus/types as status_types
import ../../status/signals/types import ../../status/signals/types
import ../../status/status import ../../status/status
import view import view
import ../../status/accounts as status_accounts
import ../../eventemitter import ../../eventemitter
type LoginController* = ref object type LoginController* = ref object

View File

@ -1,7 +1,6 @@
import NimQml, Tables, json, nimcrypto, strformat, json_serialization, chronicles import NimQml, Tables, json, nimcrypto, strformat, json_serialization, chronicles
import ../../status/signals/types import ../../status/signals/types
import ../../status/libstatus/types as status_types import ../../status/libstatus/types as status_types
import ../../status/libstatus/accounts as status_accounts
import ../../status/accounts as AccountModel import ../../status/accounts as AccountModel
import ../onboarding/views/account_info import ../onboarding/views/account_info
import ../../status/status import ../../status/status

View File

@ -1,6 +1,5 @@
import NimQml, chronicles, std/wrapnils import NimQml, chronicles, std/wrapnils
import ../../status/libstatus/types as status_types import ../../status/libstatus/types as status_types
import ../../status/libstatus/accounts as status_accounts
import ../../status/accounts as AccountModel import ../../status/accounts as AccountModel
import ../../status/status import ../../status/status
import ../../status/signals/types import ../../status/signals/types

View File

@ -5,7 +5,6 @@ import ../chat/views/channels_list
import ../../status/profile/profile import ../../status/profile/profile
import ../../status/profile as status_profile import ../../status/profile as status_profile
import ../../status/contacts as status_contacts import ../../status/contacts as status_contacts
import ../../status/accounts as status_accounts
import ../../status/status import ../../status/status
import ../../status/ens as status_ens import ../../status/ens as status_ens
import ../../status/chat/chat import ../../status/chat/chat

View File

@ -1,8 +1,7 @@
import NimQml import NimQml
import chronicles, strutils import chronicles, strutils
import ../../../status/libstatus/types as status_types import ../../../status/libstatus/types as status_types
import ../../../status/libstatus/accounts as status_accounts import ../../../status/[status, settings, accounts]
import ../../../status/[status, settings]
QtObject: QtObject:
type Fleets * = ref object of QObject type Fleets * = ref object of QObject
@ -29,7 +28,7 @@ QtObject:
discard self.status.settings.saveSetting(Setting.Fleet, newFleet) discard self.status.settings.saveSetting(Setting.Fleet, newFleet)
let fleet = parseEnum[Fleet](newFleet) let fleet = parseEnum[Fleet](newFleet)
let installationId = self.status.settings.getSetting[:string](Setting.InstallationId) let installationId = self.status.settings.getSetting[:string](Setting.InstallationId)
let updatedNodeConfig = status_accounts.getNodeConfig(self.status.fleet.config, installationId, $self.status.settings.getCurrentNetwork(), fleet) let updatedNodeConfig = self.status.accounts.getNodeConfig(self.status.fleet.config, installationId, $self.status.settings.getCurrentNetwork(), fleet)
discard self.status.settings.saveSetting(Setting.NodeConfig, updatedNodeConfig) discard self.status.settings.saveSetting(Setting.NodeConfig, updatedNodeConfig)
self.fleetChanged(newFleet) self.fleetChanged(newFleet)

View File

@ -1,7 +1,6 @@
import NimQml, os, strformat, strutils, parseUtils, chronicles import NimQml, os, strformat, strutils, parseUtils, chronicles
import stint import stint
import ../../status/[status, wallet] import ../../status/[status, wallet]
import ../../status/accounts as status_accounts
import ../../status/stickers import ../../status/stickers
import ../../status/libstatus/accounts/constants as accountConstants import ../../status/libstatus/accounts/constants as accountConstants
import ../../status/libstatus/tokens import ../../status/libstatus/tokens
@ -98,10 +97,10 @@ QtObject:
return status_utils.wei2Eth(weiValue, decimals) return status_utils.wei2Eth(weiValue, decimals)
proc generateAlias*(self: UtilsView, pk: string): string {.slot.} = proc generateAlias*(self: UtilsView, pk: string): string {.slot.} =
result = status_accounts.generateAlias(pk) result = self.status.accounts.generateAlias(pk)
proc generateIdenticon*(self: UtilsView, pk: string): string {.slot.} = proc generateIdenticon*(self: UtilsView, pk: string): string {.slot.} =
result = status_accounts.generateIdenticon(pk) result = self.status.accounts.generateIdenticon(pk)
proc getNetworkName*(self: UtilsView): string {.slot.} = proc getNetworkName*(self: UtilsView): string {.slot.} =
getCurrentNetworkDetails().name getCurrentNetworkDetails().name

View File

@ -1,6 +1,7 @@
import options, chronicles, json, json_serialization, sequtils, sugar import options, chronicles, json, json_serialization, sequtils, sugar
import libstatus/accounts as status_accounts import libstatus/accounts as status_accounts
import libstatus/settings as status_settings import libstatus/settings as status_settings
import libstatus/accounts/constants
import libstatus/types import libstatus/types
import libstatus/utils import libstatus/utils
import ../eventemitter import ../eventemitter
@ -54,6 +55,12 @@ proc generateAlias*(publicKey: string): string =
proc generateIdenticon*(publicKey: string): string = proc generateIdenticon*(publicKey: string): string =
result = status_accounts.generateIdenticon(publicKey) result = status_accounts.generateIdenticon(publicKey)
proc generateAlias*(self: AccountModel, publicKey: string): string =
result = generateAlias(publicKey)
proc generateIdenticon*(self: AccountModel, publicKey: string): string =
result = generateIdenticon(publicKey)
proc changeNetwork*(self: AccountModel, fleetConfig: FleetConfig, network: string) = proc changeNetwork*(self: AccountModel, fleetConfig: FleetConfig, network: string) =
# 1. update current network setting # 1. update current network setting
@ -81,3 +88,9 @@ proc changeNetwork*(self: AccountModel, fleetConfig: FleetConfig, network: strin
statusGoResult = status_settings.saveSetting(Setting.Stickers_Recent, %* {}) statusGoResult = status_settings.saveSetting(Setting.Stickers_Recent, %* {})
if statusGoResult.error != "": if statusGoResult.error != "":
error "Error removing all recent stickers", msg=statusGoResult.error error "Error removing all recent stickers", msg=statusGoResult.error
proc getNodeConfig*(self: AccountModel, fleetConfig: FleetConfig, installationId: string, networkConfig: JsonNode, fleet: Fleet = Fleet.PROD): JsonNode =
result = status_accounts.getNodeConfig(fleetConfig, installationId, networkConfig, fleet)
proc getNodeConfig*(self: AccountModel, fleetConfig: FleetConfig, installationId: string, currentNetwork: string = constants.DEFAULT_NETWORK_NAME, fleet: Fleet = Fleet.PROD): JsonNode =
result = status_accounts.getNodeConfig(fleetConfig, installationId, currentNetwork, fleet)