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/chat as core_chat
import ../../status/libstatus/utils as status_utils
import ../../status/accounts as status_accounts
import ../../status/chat as status_chat
import ../../status/messages as status_messages
import ../../status/contacts as status_contacts

View File

@ -1,6 +1,5 @@
import NimQml, Tables,
../../../status/[status, ens]
import ../../../status/accounts as status_accounts
type
CommunityMembersRoles {.pure.} = enum
UserName = UserRole + 1,
@ -58,13 +57,13 @@ QtObject:
if self.status.chat.contacts.hasKey(pk):
result = self.status.chat.contacts[pk].identicon
else:
result = status_accounts.generateIdenticon(pk)
result = self.status.accounts.generateIdenticon(pk)
proc alias(self: CommunityMembersView, pk: string): string =
if self.status.chat.contacts.hasKey(pk):
result = self.status.chat.contacts[pk].alias
else:
result = status_accounts.generateAlias(pk)
result = self.status.accounts.generateAlias(pk)
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/status
import view
import ../../status/accounts as status_accounts
import ../../eventemitter
type LoginController* = ref object

View File

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

View File

@ -1,6 +1,5 @@
import NimQml, chronicles, std/wrapnils
import ../../status/libstatus/types as status_types
import ../../status/libstatus/accounts as status_accounts
import ../../status/accounts as AccountModel
import ../../status/status
import ../../status/signals/types
@ -39,4 +38,4 @@ proc init*(self: OnboardingController) =
self.status.events.on(SignalType.NodeLogin.event) do(e:Args):
self.handleNodeLogin(NodeSignal(e))

View File

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

View File

@ -1,8 +1,7 @@
import NimQml
import chronicles, strutils
import ../../../status/libstatus/types as status_types
import ../../../status/libstatus/accounts as status_accounts
import ../../../status/[status, settings]
import ../../../status/[status, settings, accounts]
QtObject:
type Fleets * = ref object of QObject
@ -29,7 +28,7 @@ QtObject:
discard self.status.settings.saveSetting(Setting.Fleet, newFleet)
let fleet = parseEnum[Fleet](newFleet)
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)
self.fleetChanged(newFleet)

View File

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

View File

@ -1,6 +1,7 @@
import options, chronicles, json, json_serialization, sequtils, sugar
import libstatus/accounts as status_accounts
import libstatus/settings as status_settings
import libstatus/accounts/constants
import libstatus/types
import libstatus/utils
import ../eventemitter
@ -54,6 +55,12 @@ proc generateAlias*(publicKey: string): string =
proc generateIdenticon*(publicKey: string): string =
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) =
# 1. update current network setting
@ -80,4 +87,10 @@ proc changeNetwork*(self: AccountModel, fleetConfig: FleetConfig, network: strin
# 4. remove all recent stickers (pack ids do not match across networks)
statusGoResult = status_settings.saveSetting(Setting.Stickers_Recent, %* {})
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)