chore(general): necessary changes applied after rebasing
This commit is contained in:
parent
caf7fd2072
commit
7c36e98cf3
|
@ -20,7 +20,6 @@ import ../../app_service/service/privacy/service as privacy_service
|
||||||
import ../../app_service/service/provider/service as provider_service
|
import ../../app_service/service/provider/service as provider_service
|
||||||
import ../../app_service/service/ens/service as ens_service
|
import ../../app_service/service/ens/service as ens_service
|
||||||
|
|
||||||
import ../core/local_account_settings
|
|
||||||
import ../../app_service/service/profile/service as profile_service
|
import ../../app_service/service/profile/service as profile_service
|
||||||
import ../../app_service/service/settings/service as settings_service
|
import ../../app_service/service/settings/service as settings_service
|
||||||
import ../../app_service/service/about/service as about_service
|
import ../../app_service/service/about/service as about_service
|
||||||
|
@ -45,7 +44,6 @@ import ../wallet/v1/core as wallet
|
||||||
import ../wallet/v2/core as walletV2
|
import ../wallet/v2/core as walletV2
|
||||||
import ../node/core as node
|
import ../node/core as node
|
||||||
import ../utilsView/core as utilsView
|
import ../utilsView/core as utilsView
|
||||||
import ../provider/core as provider
|
|
||||||
import ../keycard/core as keycard
|
import ../keycard/core as keycard
|
||||||
import status/types/[account, setting]
|
import status/types/[account, setting]
|
||||||
#################################################
|
#################################################
|
||||||
|
@ -118,7 +116,6 @@ type
|
||||||
chat: ChatController
|
chat: ChatController
|
||||||
node: NodeController
|
node: NodeController
|
||||||
utilsController: UtilsController
|
utilsController: UtilsController
|
||||||
provider: Web3ProviderController
|
|
||||||
keycard: KeycardController
|
keycard: KeycardController
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
|
@ -145,7 +142,6 @@ proc connect(self: AppController) =
|
||||||
self.profile.init(args.account)
|
self.profile.init(args.account)
|
||||||
self.wallet.init()
|
self.wallet.init()
|
||||||
self.wallet2.init()
|
self.wallet2.init()
|
||||||
self.provider.init()
|
|
||||||
self.chat.init()
|
self.chat.init()
|
||||||
self.utilsController.init()
|
self.utilsController.init()
|
||||||
self.node.init()
|
self.node.init()
|
||||||
|
@ -236,7 +232,6 @@ proc newAppController*(statusFoundation: StatusFoundation): AppController =
|
||||||
result.chat = chat.newController(statusFoundation.status, statusFoundation, OPENURI)
|
result.chat = chat.newController(statusFoundation.status, statusFoundation, OPENURI)
|
||||||
result.node = node.newController(statusFoundation)
|
result.node = node.newController(statusFoundation)
|
||||||
result.utilsController = utilsView.newController(statusFoundation.status, statusFoundation)
|
result.utilsController = utilsView.newController(statusFoundation.status, statusFoundation)
|
||||||
result.provider = provider.newController(statusFoundation.status)
|
|
||||||
result.keycard = keycard.newController(statusFoundation.status)
|
result.keycard = keycard.newController(statusFoundation.status)
|
||||||
result.connect()
|
result.connect()
|
||||||
#################################################
|
#################################################
|
||||||
|
@ -270,7 +265,6 @@ proc delete*(self: AppController) =
|
||||||
self.chat.delete
|
self.chat.delete
|
||||||
self.node.delete
|
self.node.delete
|
||||||
self.utilsController.delete
|
self.utilsController.delete
|
||||||
self.provider.delete
|
|
||||||
self.keycard.delete
|
self.keycard.delete
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
|
@ -301,7 +295,6 @@ proc startupDidLoad*(self: AppController) =
|
||||||
singletonInstance.engine.setRootContextProperty("chatsModel", self.chat.variant)
|
singletonInstance.engine.setRootContextProperty("chatsModel", self.chat.variant)
|
||||||
singletonInstance.engine.setRootContextProperty("nodeModel", self.node.variant)
|
singletonInstance.engine.setRootContextProperty("nodeModel", self.node.variant)
|
||||||
singletonInstance.engine.setRootContextProperty("utilsModel", self.utilsController.variant)
|
singletonInstance.engine.setRootContextProperty("utilsModel", self.utilsController.variant)
|
||||||
singletonInstance.engine.setRootContextProperty("web3Provider", self.provider.variant)
|
|
||||||
singletonInstance.engine.setRootContextProperty("keycardModel", self.keycard.variant)
|
singletonInstance.engine.setRootContextProperty("keycardModel", self.keycard.variant)
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
|
@ -329,14 +322,7 @@ proc start*(self: AppController) =
|
||||||
|
|
||||||
self.startupModule.load()
|
self.startupModule.load()
|
||||||
|
|
||||||
proc load*(self: AppController) =
|
proc load(self: AppController) =
|
||||||
#################################################
|
|
||||||
# Once SettingService gets added, `pubKey` should be fetched from there, instead the following line:
|
|
||||||
let pubKey = self.statusFoundation.status.settings.getSetting[:string](Setting.PublicKey, "0x0")
|
|
||||||
singletonInstance.localAccountSensitiveSettings.setFileName(pubKey)
|
|
||||||
singletonInstance.engine.setRootContextProperty("localAccountSensitiveSettings", self.localAccountSensitiveSettingsVariant)
|
|
||||||
#################################################
|
|
||||||
|
|
||||||
self.settingService.init()
|
self.settingService.init()
|
||||||
self.contactsService.init()
|
self.contactsService.init()
|
||||||
self.chatService.init()
|
self.chatService.init()
|
||||||
|
@ -351,6 +337,13 @@ proc load*(self: AppController) =
|
||||||
self.transactionService.init()
|
self.transactionService.init()
|
||||||
self.languageService.init()
|
self.languageService.init()
|
||||||
|
|
||||||
|
#################################################
|
||||||
|
# Once SettingService gets added, `pubKey` should be fetched from there, instead the following line:
|
||||||
|
let pubKey = self.settingsService.getPubKey()
|
||||||
|
singletonInstance.localAccountSensitiveSettings.setFileName(pubKey)
|
||||||
|
singletonInstance.engine.setRootContextProperty("localAccountSensitiveSettings", self.localAccountSensitiveSettingsVariant)
|
||||||
|
#################################################
|
||||||
|
|
||||||
# other global instances
|
# other global instances
|
||||||
self.buildAndRegisterLocalAccountSensitiveSettings()
|
self.buildAndRegisterLocalAccountSensitiveSettings()
|
||||||
self.buildAndRegisterUserProfile()
|
self.buildAndRegisterUserProfile()
|
||||||
|
|
|
@ -14,12 +14,22 @@ type MailserverRequestExpiredSignal* = ref object of Signal
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
type HistoryRequestStartedSignal* = ref object of Signal
|
type HistoryRequestStartedSignal* = ref object of Signal
|
||||||
|
requestId*: string
|
||||||
|
numBatches*: int
|
||||||
|
|
||||||
|
type HistoryRequestBatchProcessedSignal* = ref object of Signal
|
||||||
|
requestId*: string
|
||||||
|
batchIndex*: int
|
||||||
|
numBatches*: int
|
||||||
|
|
||||||
type HistoryRequestCompletedSignal* = ref object of Signal
|
type HistoryRequestCompletedSignal* = ref object of Signal
|
||||||
|
requestId*: string
|
||||||
|
|
||||||
type HistoryRequestFailedSignal* = ref object of Signal
|
type HistoryRequestFailedSignal* = ref object of Signal
|
||||||
|
requestId*: string
|
||||||
errorMessage*: string
|
errorMessage*: string
|
||||||
error*: bool
|
error*: bool
|
||||||
|
|
||||||
|
|
||||||
proc fromEvent*(T: type MailserverRequestCompletedSignal, jsonSignal: JsonNode): MailserverRequestCompletedSignal =
|
proc fromEvent*(T: type MailserverRequestCompletedSignal, jsonSignal: JsonNode): MailserverRequestCompletedSignal =
|
||||||
result = MailserverRequestCompletedSignal()
|
result = MailserverRequestCompletedSignal()
|
||||||
result.signalType = SignalType.MailserverRequestCompleted
|
result.signalType = SignalType.MailserverRequestCompleted
|
||||||
|
@ -38,14 +48,25 @@ proc fromEvent*(T: type MailserverRequestExpiredSignal, jsonSignal: JsonNode): M
|
||||||
proc fromEvent*(T: type HistoryRequestStartedSignal, jsonSignal: JsonNode): HistoryRequestStartedSignal =
|
proc fromEvent*(T: type HistoryRequestStartedSignal, jsonSignal: JsonNode): HistoryRequestStartedSignal =
|
||||||
result = HistoryRequestStartedSignal()
|
result = HistoryRequestStartedSignal()
|
||||||
result.signalType = SignalType.HistoryRequestStarted
|
result.signalType = SignalType.HistoryRequestStarted
|
||||||
|
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
|
||||||
|
result.numBatches = jsonSIgnal["event"]{"numBatches"}.getInt()
|
||||||
|
|
||||||
|
proc fromEvent*(T: type HistoryRequestBatchProcessedSignal, jsonSignal: JsonNode): HistoryRequestBatchProcessedSignal =
|
||||||
|
result = HistoryRequestBatchProcessedSignal()
|
||||||
|
result.signalType = SignalType.HistoryRequestBatchProcessed
|
||||||
|
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
|
||||||
|
result.batchIndex = jsonSIgnal["event"]{"batchIndex"}.getInt()
|
||||||
|
result.numBatches = jsonSIgnal["event"]{"numBatches"}.getInt()
|
||||||
|
|
||||||
proc fromEvent*(T: type HistoryRequestCompletedSignal, jsonSignal: JsonNode): HistoryRequestCompletedSignal =
|
proc fromEvent*(T: type HistoryRequestCompletedSignal, jsonSignal: JsonNode): HistoryRequestCompletedSignal =
|
||||||
result = HistoryRequestCompletedSignal()
|
result = HistoryRequestCompletedSignal()
|
||||||
result.signalType = SignalType.HistoryRequestCompleted
|
result.signalType = SignalType.HistoryRequestCompleted
|
||||||
|
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
|
||||||
|
|
||||||
proc fromEvent*(T: type HistoryRequestFailedSignal, jsonSignal: JsonNode): HistoryRequestFailedSignal =
|
proc fromEvent*(T: type HistoryRequestFailedSignal, jsonSignal: JsonNode): HistoryRequestFailedSignal =
|
||||||
result = HistoryRequestFailedSignal()
|
result = HistoryRequestFailedSignal()
|
||||||
result.signalType = SignalType.HistoryRequestStarted
|
result.signalType = SignalType.HistoryRequestStarted
|
||||||
|
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
|
||||||
if jsonSignal["event"].kind != JNull:
|
if jsonSignal["event"].kind != JNull:
|
||||||
result.errorMessage = jsonSignal["event"]{"errorMessage"}.getStr()
|
result.errorMessage = jsonSignal["event"]{"errorMessage"}.getStr()
|
||||||
result.error = result.errorMessage != ""
|
result.error = result.errorMessage != ""
|
||||||
|
|
|
@ -25,6 +25,7 @@ type SignalType* {.pure.} = enum
|
||||||
HistoryRequestStarted = "history.request.started"
|
HistoryRequestStarted = "history.request.started"
|
||||||
HistoryRequestCompleted = "history.request.completed"
|
HistoryRequestCompleted = "history.request.completed"
|
||||||
HistoryRequestFailed = "history.request.failed"
|
HistoryRequestFailed = "history.request.failed"
|
||||||
|
HistoryRequestBatchProcessed = "history.request.batch.processed"
|
||||||
KeycardConnected = "keycard.connected"
|
KeycardConnected = "keycard.connected"
|
||||||
Unknown
|
Unknown
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ QtObject:
|
||||||
of SignalType.HistoryRequestCompleted: HistoryRequestCompletedSignal.fromEvent(jsonSignal)
|
of SignalType.HistoryRequestCompleted: HistoryRequestCompletedSignal.fromEvent(jsonSignal)
|
||||||
of SignalType.HistoryRequestStarted: HistoryRequestStartedSignal.fromEvent(jsonSignal)
|
of SignalType.HistoryRequestStarted: HistoryRequestStartedSignal.fromEvent(jsonSignal)
|
||||||
of SignalType.HistoryRequestFailed: HistoryRequestFailedSignal.fromEvent(jsonSignal)
|
of SignalType.HistoryRequestFailed: HistoryRequestFailedSignal.fromEvent(jsonSignal)
|
||||||
|
of SignalType.HistoryRequestBatchProcessed: HistoryRequestBatchProcessedSignal.fromEvent(jsonSignal)
|
||||||
of SignalType.KeycardConnected: KeycardConnectedSignal.fromEvent(jsonSignal)
|
of SignalType.KeycardConnected: KeycardConnectedSignal.fromEvent(jsonSignal)
|
||||||
else: Signal()
|
else: Signal()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import ./controller_interface
|
import ./controller_interface
|
||||||
|
|
||||||
import ../../../../core/global_singleton
|
import ../../../../global/global_singleton
|
||||||
import ../../../../../app_service/service/profile/service as profile_service
|
import ../../../../../app_service/service/profile/service as profile_service
|
||||||
import ../../../../../app_service/service/accounts/service as accounts_service
|
import ../../../../../app_service/service/accounts/service as accounts_service
|
||||||
import ../../../../../app_service/service/settings/service as settings_service
|
import ../../../../../app_service/service/settings/service as settings_service
|
||||||
|
|
|
@ -172,12 +172,6 @@ QtObject:
|
||||||
QtProperty[QVariant] mutedChats:
|
QtProperty[QVariant] mutedChats:
|
||||||
read = getMutedChats
|
read = getMutedChats
|
||||||
|
|
||||||
proc setSendUserStatus*(self: ProfileView, sendUserStatus: bool) {.slot.} =
|
|
||||||
if (sendUserStatus == self.profile.sendUserStatus):
|
|
||||||
return
|
|
||||||
self.profile.setSendUserStatus(sendUserStatus)
|
|
||||||
self.status.saveSetting(Setting.SendUserStatus, sendUserStatus)
|
|
||||||
|
|
||||||
proc showOSNotification*(self: ProfileView, title: string, message: string, notificationType: int,
|
proc showOSNotification*(self: ProfileView, title: string, message: string, notificationType: int,
|
||||||
useOSNotifications: bool) {.slot.} =
|
useOSNotifications: bool) {.slot.} =
|
||||||
discard
|
discard
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# include strformat, json
|
# include strformat, json
|
||||||
include ../../common/json_utils
|
include ../../common/json_utils
|
||||||
include ../../tasks/common
|
include ../../../app/core/tasks/common
|
||||||
import status/[utils, tokens]
|
import status/[utils, tokens]
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
|
|
|
@ -3,20 +3,17 @@ import eventemitter
|
||||||
from sugar import `=>`
|
from sugar import `=>`
|
||||||
import web3/ethtypes
|
import web3/ethtypes
|
||||||
from web3/conversions import `$`
|
from web3/conversions import `$`
|
||||||
import status/statusgo_backend_new/tokens as token_backend
|
import status/statusgo_backend_new/custom_tokens as custom_tokens
|
||||||
import ../setting/service as setting_service
|
import ../setting/service as setting_service
|
||||||
import ../settings/service as settings_service
|
import ../settings/service as settings_service
|
||||||
|
import ../../../app/core/tasks/[qt, threadpool]
|
||||||
import ./dto
|
import ./dto, ./static_token
|
||||||
|
|
||||||
export dto
|
export dto
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "token-service"
|
topics = "token-service"
|
||||||
|
|
||||||
import ../../../app_service/[main]
|
|
||||||
import ../../../app_service/tasks/[qt, threadpool]
|
|
||||||
|
|
||||||
include async_tasks
|
include async_tasks
|
||||||
|
|
||||||
# Signals which may be emitted by this service:
|
# Signals which may be emitted by this service:
|
||||||
|
@ -77,21 +74,20 @@ QtObject:
|
||||||
|
|
||||||
proc init*(self: Service) =
|
proc init*(self: Service) =
|
||||||
try:
|
try:
|
||||||
let settings = self.settingService.getSetting()
|
var activeTokenSymbols = self.settingService.getSetting().activeTokenSymbols
|
||||||
var activeTokenSymbols = settings.activeTokenSymbols
|
|
||||||
if activeTokenSymbols.len == 0:
|
if activeTokenSymbols.len == 0:
|
||||||
activeTokenSymbols = self.getDefaultVisibleSymbols()
|
activeTokenSymbols = self.getDefaultVisibleSymbols()
|
||||||
|
|
||||||
let response = token_backend.getTokens(settings.currentNetwork.id)
|
let static_tokens = static_token.all().map(
|
||||||
let default_tokens = map(
|
proc(x: TokenDto): TokenDto =
|
||||||
response.result.getElems(),
|
x.isVisible = activeTokenSymbols.contains(x.symbol)
|
||||||
proc(x: JsonNode): TokenDto = x.toTokenDto(activeTokenSymbols, hasIcon=true, isCustom=false)
|
return x
|
||||||
)
|
)
|
||||||
|
|
||||||
let customResponse = token_backend.getCustomTokens()
|
let response = custom_tokens.getCustomTokens()
|
||||||
self.tokens = concat(
|
self.tokens = concat(
|
||||||
default_tokens,
|
static_tokens,
|
||||||
map(customResponse.result.getElems(), proc(x: JsonNode): TokenDto = x.toTokenDto(activeTokenSymbols))
|
map(response.result.getElems(), proc(x: JsonNode): TokenDto = x.toTokenDto(activeTokenSymbols))
|
||||||
).filter(
|
).filter(
|
||||||
proc(x: TokenDto): bool = x.chainId == self.settingService.getSetting().currentNetwork.id
|
proc(x: TokenDto): bool = x.chainId == self.settingService.getSetting().currentNetwork.id
|
||||||
)
|
)
|
||||||
|
@ -105,7 +101,7 @@ QtObject:
|
||||||
return self.tokens
|
return self.tokens
|
||||||
|
|
||||||
proc addCustomToken*(self: Service, address: string, name: string, symbol: string, decimals: int) =
|
proc addCustomToken*(self: Service, address: string, name: string, symbol: string, decimals: int) =
|
||||||
token_backend.addCustomToken(address, name, symbol, decimals, "")
|
custom_tokens.addCustomToken(address, name, symbol, decimals, "")
|
||||||
let token = newDto(
|
let token = newDto(
|
||||||
name,
|
name,
|
||||||
self.settingService.getSetting().currentNetwork.id,
|
self.settingService.getSetting().currentNetwork.id,
|
||||||
|
@ -131,7 +127,7 @@ QtObject:
|
||||||
self.events.emit("token/visibilityToggled", VisibilityToggled(token: tokenChanged))
|
self.events.emit("token/visibilityToggled", VisibilityToggled(token: tokenChanged))
|
||||||
|
|
||||||
proc removeCustomToken*(self: Service, address: string) =
|
proc removeCustomToken*(self: Service, address: string) =
|
||||||
token_backend.removeCustomToken(address)
|
custom_tokens.removeCustomToken(address)
|
||||||
var index = -1
|
var index = -1
|
||||||
|
|
||||||
for idx, token in self.tokens.pairs():
|
for idx, token in self.tokens.pairs():
|
||||||
|
|
Loading…
Reference in New Issue