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/ens/service as ens_service
|
||||
|
||||
import ../core/local_account_settings
|
||||
import ../../app_service/service/profile/service as profile_service
|
||||
import ../../app_service/service/settings/service as settings_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 ../node/core as node
|
||||
import ../utilsView/core as utilsView
|
||||
import ../provider/core as provider
|
||||
import ../keycard/core as keycard
|
||||
import status/types/[account, setting]
|
||||
#################################################
|
||||
|
@ -118,7 +116,6 @@ type
|
|||
chat: ChatController
|
||||
node: NodeController
|
||||
utilsController: UtilsController
|
||||
provider: Web3ProviderController
|
||||
keycard: KeycardController
|
||||
#################################################
|
||||
|
||||
|
@ -145,7 +142,6 @@ proc connect(self: AppController) =
|
|||
self.profile.init(args.account)
|
||||
self.wallet.init()
|
||||
self.wallet2.init()
|
||||
self.provider.init()
|
||||
self.chat.init()
|
||||
self.utilsController.init()
|
||||
self.node.init()
|
||||
|
@ -236,7 +232,6 @@ proc newAppController*(statusFoundation: StatusFoundation): AppController =
|
|||
result.chat = chat.newController(statusFoundation.status, statusFoundation, OPENURI)
|
||||
result.node = node.newController(statusFoundation)
|
||||
result.utilsController = utilsView.newController(statusFoundation.status, statusFoundation)
|
||||
result.provider = provider.newController(statusFoundation.status)
|
||||
result.keycard = keycard.newController(statusFoundation.status)
|
||||
result.connect()
|
||||
#################################################
|
||||
|
@ -270,7 +265,6 @@ proc delete*(self: AppController) =
|
|||
self.chat.delete
|
||||
self.node.delete
|
||||
self.utilsController.delete
|
||||
self.provider.delete
|
||||
self.keycard.delete
|
||||
#################################################
|
||||
|
||||
|
@ -301,7 +295,6 @@ proc startupDidLoad*(self: AppController) =
|
|||
singletonInstance.engine.setRootContextProperty("chatsModel", self.chat.variant)
|
||||
singletonInstance.engine.setRootContextProperty("nodeModel", self.node.variant)
|
||||
singletonInstance.engine.setRootContextProperty("utilsModel", self.utilsController.variant)
|
||||
singletonInstance.engine.setRootContextProperty("web3Provider", self.provider.variant)
|
||||
singletonInstance.engine.setRootContextProperty("keycardModel", self.keycard.variant)
|
||||
#################################################
|
||||
|
||||
|
@ -329,14 +322,7 @@ proc start*(self: AppController) =
|
|||
|
||||
self.startupModule.load()
|
||||
|
||||
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)
|
||||
#################################################
|
||||
|
||||
proc load(self: AppController) =
|
||||
self.settingService.init()
|
||||
self.contactsService.init()
|
||||
self.chatService.init()
|
||||
|
@ -351,6 +337,13 @@ proc load*(self: AppController) =
|
|||
self.transactionService.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
|
||||
self.buildAndRegisterLocalAccountSensitiveSettings()
|
||||
self.buildAndRegisterUserProfile()
|
||||
|
|
|
@ -14,12 +14,22 @@ type MailserverRequestExpiredSignal* = ref object of Signal
|
|||
# TODO
|
||||
|
||||
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
|
||||
requestId*: string
|
||||
|
||||
type HistoryRequestFailedSignal* = ref object of Signal
|
||||
requestId*: string
|
||||
errorMessage*: string
|
||||
error*: bool
|
||||
|
||||
|
||||
proc fromEvent*(T: type MailserverRequestCompletedSignal, jsonSignal: JsonNode): MailserverRequestCompletedSignal =
|
||||
result = MailserverRequestCompletedSignal()
|
||||
result.signalType = SignalType.MailserverRequestCompleted
|
||||
|
@ -38,14 +48,25 @@ proc fromEvent*(T: type MailserverRequestExpiredSignal, jsonSignal: JsonNode): M
|
|||
proc fromEvent*(T: type HistoryRequestStartedSignal, jsonSignal: JsonNode): HistoryRequestStartedSignal =
|
||||
result = HistoryRequestStartedSignal()
|
||||
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 =
|
||||
result = HistoryRequestCompletedSignal()
|
||||
result.signalType = SignalType.HistoryRequestCompleted
|
||||
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
|
||||
|
||||
proc fromEvent*(T: type HistoryRequestFailedSignal, jsonSignal: JsonNode): HistoryRequestFailedSignal =
|
||||
result = HistoryRequestFailedSignal()
|
||||
result.signalType = SignalType.HistoryRequestStarted
|
||||
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
|
||||
if jsonSignal["event"].kind != JNull:
|
||||
result.errorMessage = jsonSignal["event"]{"errorMessage"}.getStr()
|
||||
result.error = result.errorMessage != ""
|
||||
|
|
|
@ -25,6 +25,7 @@ type SignalType* {.pure.} = enum
|
|||
HistoryRequestStarted = "history.request.started"
|
||||
HistoryRequestCompleted = "history.request.completed"
|
||||
HistoryRequestFailed = "history.request.failed"
|
||||
HistoryRequestBatchProcessed = "history.request.batch.processed"
|
||||
KeycardConnected = "keycard.connected"
|
||||
Unknown
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ QtObject:
|
|||
of SignalType.HistoryRequestCompleted: HistoryRequestCompletedSignal.fromEvent(jsonSignal)
|
||||
of SignalType.HistoryRequestStarted: HistoryRequestStartedSignal.fromEvent(jsonSignal)
|
||||
of SignalType.HistoryRequestFailed: HistoryRequestFailedSignal.fromEvent(jsonSignal)
|
||||
of SignalType.HistoryRequestBatchProcessed: HistoryRequestBatchProcessedSignal.fromEvent(jsonSignal)
|
||||
of SignalType.KeycardConnected: KeycardConnectedSignal.fromEvent(jsonSignal)
|
||||
else: Signal()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import ./controller_interface
|
||||
|
||||
import ../../../../core/global_singleton
|
||||
import ../../../../global/global_singleton
|
||||
import ../../../../../app_service/service/profile/service as profile_service
|
||||
import ../../../../../app_service/service/accounts/service as accounts_service
|
||||
import ../../../../../app_service/service/settings/service as settings_service
|
||||
|
|
|
@ -172,12 +172,6 @@ QtObject:
|
|||
QtProperty[QVariant] mutedChats:
|
||||
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,
|
||||
useOSNotifications: bool) {.slot.} =
|
||||
discard
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# include strformat, json
|
||||
include ../../common/json_utils
|
||||
include ../../tasks/common
|
||||
include ../../../app/core/tasks/common
|
||||
import status/[utils, tokens]
|
||||
|
||||
#################################################
|
||||
|
|
|
@ -3,20 +3,17 @@ import eventemitter
|
|||
from sugar import `=>`
|
||||
import web3/ethtypes
|
||||
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 ../settings/service as settings_service
|
||||
|
||||
import ./dto
|
||||
import ../../../app/core/tasks/[qt, threadpool]
|
||||
import ./dto, ./static_token
|
||||
|
||||
export dto
|
||||
|
||||
logScope:
|
||||
topics = "token-service"
|
||||
|
||||
import ../../../app_service/[main]
|
||||
import ../../../app_service/tasks/[qt, threadpool]
|
||||
|
||||
include async_tasks
|
||||
|
||||
# Signals which may be emitted by this service:
|
||||
|
@ -77,21 +74,20 @@ QtObject:
|
|||
|
||||
proc init*(self: Service) =
|
||||
try:
|
||||
let settings = self.settingService.getSetting()
|
||||
var activeTokenSymbols = settings.activeTokenSymbols
|
||||
var activeTokenSymbols = self.settingService.getSetting().activeTokenSymbols
|
||||
if activeTokenSymbols.len == 0:
|
||||
activeTokenSymbols = self.getDefaultVisibleSymbols()
|
||||
|
||||
let response = token_backend.getTokens(settings.currentNetwork.id)
|
||||
let default_tokens = map(
|
||||
response.result.getElems(),
|
||||
proc(x: JsonNode): TokenDto = x.toTokenDto(activeTokenSymbols, hasIcon=true, isCustom=false)
|
||||
let static_tokens = static_token.all().map(
|
||||
proc(x: TokenDto): TokenDto =
|
||||
x.isVisible = activeTokenSymbols.contains(x.symbol)
|
||||
return x
|
||||
)
|
||||
|
||||
let customResponse = token_backend.getCustomTokens()
|
||||
let response = custom_tokens.getCustomTokens()
|
||||
self.tokens = concat(
|
||||
default_tokens,
|
||||
map(customResponse.result.getElems(), proc(x: JsonNode): TokenDto = x.toTokenDto(activeTokenSymbols))
|
||||
static_tokens,
|
||||
map(response.result.getElems(), proc(x: JsonNode): TokenDto = x.toTokenDto(activeTokenSymbols))
|
||||
).filter(
|
||||
proc(x: TokenDto): bool = x.chainId == self.settingService.getSetting().currentNetwork.id
|
||||
)
|
||||
|
@ -105,7 +101,7 @@ QtObject:
|
|||
return self.tokens
|
||||
|
||||
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(
|
||||
name,
|
||||
self.settingService.getSetting().currentNetwork.id,
|
||||
|
@ -131,7 +127,7 @@ QtObject:
|
|||
self.events.emit("token/visibilityToggled", VisibilityToggled(token: tokenChanged))
|
||||
|
||||
proc removeCustomToken*(self: Service, address: string) =
|
||||
token_backend.removeCustomToken(address)
|
||||
custom_tokens.removeCustomToken(address)
|
||||
var index = -1
|
||||
|
||||
for idx, token in self.tokens.pairs():
|
||||
|
|
Loading…
Reference in New Issue