feat(@desktop/wallet): Watch only account toggle + persisted
fixes #11221
This commit is contained in:
parent
29d78a99be
commit
a2dd87c18b
|
@ -48,3 +48,9 @@ proc getKeypairs*(self: Controller): seq[KeypairDto] =
|
||||||
|
|
||||||
proc getAllKnownKeycardsGroupedByKeyUid*(self: Controller): seq[KeycardDto] =
|
proc getAllKnownKeycardsGroupedByKeyUid*(self: Controller): seq[KeycardDto] =
|
||||||
return self.walletAccountService.getAllKnownKeycardsGroupedByKeyUid()
|
return self.walletAccountService.getAllKnownKeycardsGroupedByKeyUid()
|
||||||
|
|
||||||
|
proc toggleIncludeWatchOnlyAccount*(self: Controller) =
|
||||||
|
self.walletAccountService.toggleIncludeWatchOnlyAccount()
|
||||||
|
|
||||||
|
proc isIncludeWatchOnlyAccount*(self: Controller): bool =
|
||||||
|
return self.walletAccountService.isIncludeWatchOnlyAccount()
|
||||||
|
|
|
@ -36,3 +36,6 @@ method viewDidLoad*(self: AccessInterface) {.base.} =
|
||||||
|
|
||||||
method getModuleAsVariant*(self: AccessInterface): QVariant {.base.} =
|
method getModuleAsVariant*(self: AccessInterface): QVariant {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method toggleIncludeWatchOnlyAccount*(self: AccessInterface) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
|
@ -10,6 +10,7 @@ import ../../../../../core/eventemitter
|
||||||
import ../../../../../../app_service/service/keycard/service as keycard_service
|
import ../../../../../../app_service/service/keycard/service as keycard_service
|
||||||
import ../../../../../../app_service/service/wallet_account/service as wallet_account_service
|
import ../../../../../../app_service/service/wallet_account/service as wallet_account_service
|
||||||
import ../../../../../../app_service/service/network/service as network_service
|
import ../../../../../../app_service/service/network/service as network_service
|
||||||
|
import ../../../../../../app_service/service/settings/service
|
||||||
|
|
||||||
export io_interface
|
export io_interface
|
||||||
|
|
||||||
|
@ -107,8 +108,12 @@ method load*(self: Module) =
|
||||||
self.events.on(SIGNAL_WALLET_ACCOUNT_POSITION_UPDATED) do(e:Args):
|
self.events.on(SIGNAL_WALLET_ACCOUNT_POSITION_UPDATED) do(e:Args):
|
||||||
self.refreshWalletAccounts()
|
self.refreshWalletAccounts()
|
||||||
|
|
||||||
|
self.events.on(SIGNAL_INCLUDE_WATCH_ONLY_ACCOUNTS_UPDATED) do(e: Args):
|
||||||
|
self.view.setIncludeWatchOnlyAccount(self.controller.isIncludeWatchOnlyAccount())
|
||||||
|
|
||||||
self.controller.init()
|
self.controller.init()
|
||||||
self.view.load()
|
self.view.load()
|
||||||
|
self.view.setIncludeWatchOnlyAccount(self.controller.isIncludeWatchOnlyAccount())
|
||||||
|
|
||||||
method isLoaded*(self: Module): bool =
|
method isLoaded*(self: Module): bool =
|
||||||
return self.moduleLoaded
|
return self.moduleLoaded
|
||||||
|
@ -126,3 +131,6 @@ method updateAccountPosition*(self: Module, address: string, position: int) =
|
||||||
|
|
||||||
method deleteAccount*(self: Module, address: string) =
|
method deleteAccount*(self: Module, address: string) =
|
||||||
self.controller.deleteAccount(address)
|
self.controller.deleteAccount(address)
|
||||||
|
|
||||||
|
method toggleIncludeWatchOnlyAccount*(self: Module) =
|
||||||
|
self.controller.toggleIncludeWatchOnlyAccount()
|
||||||
|
|
|
@ -12,6 +12,7 @@ QtObject:
|
||||||
accounts: Model
|
accounts: Model
|
||||||
accountsVariant: QVariant
|
accountsVariant: QVariant
|
||||||
keyPairModel: KeyPairModel
|
keyPairModel: KeyPairModel
|
||||||
|
includeWatchOnlyAccount: bool
|
||||||
|
|
||||||
proc delete*(self: View) =
|
proc delete*(self: View) =
|
||||||
self.accounts.delete
|
self.accounts.delete
|
||||||
|
@ -65,3 +66,17 @@ QtObject:
|
||||||
proc setKeyPairModelItems*(self: View, items: seq[KeyPairItem]) =
|
proc setKeyPairModelItems*(self: View, items: seq[KeyPairItem]) =
|
||||||
self.keyPairModel.setItems(items)
|
self.keyPairModel.setItems(items)
|
||||||
self.keyPairModelChanged()
|
self.keyPairModelChanged()
|
||||||
|
|
||||||
|
proc includeWatchOnlyAccountChanged*(self: View) {.signal.}
|
||||||
|
proc getIncludeWatchOnlyAccount(self: View): bool {.slot.} =
|
||||||
|
return self.includeWatchOnlyAccount
|
||||||
|
QtProperty[bool] includeWatchOnlyAccount:
|
||||||
|
read = getIncludeWatchOnlyAccount
|
||||||
|
notify = includeWatchOnlyAccountChanged
|
||||||
|
|
||||||
|
proc toggleIncludeWatchOnlyAccount*(self: View) {.slot.} =
|
||||||
|
self.delegate.toggleIncludeWatchOnlyAccount()
|
||||||
|
|
||||||
|
proc setIncludeWatchOnlyAccount*(self: View, includeWatchOnlyAccount: bool) =
|
||||||
|
self.includeWatchOnlyAccount = includeWatchOnlyAccount
|
||||||
|
self.includeWatchOnlyAccountChanged()
|
||||||
|
|
|
@ -19,7 +19,7 @@ method deleteAccount*(self: AccessInterface, address: string) {.base.} =
|
||||||
method refreshWalletAccounts*(self: AccessInterface) {.base.} =
|
method refreshWalletAccounts*(self: AccessInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method filterChanged*(self: AccessInterface, addresses: seq[string], chainIds: seq[int], excludeWatchOnly: bool) {.base.} =
|
method filterChanged*(self: AccessInterface, addresses: seq[string], chainIds: seq[int]) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method updateAccount*(self: AccessInterface, address: string, accountName: string, colorId: string, emoji: string) {.base.} =
|
method updateAccount*(self: AccessInterface, address: string, accountName: string, colorId: string, emoji: string) {.base.} =
|
||||||
|
|
|
@ -42,11 +42,11 @@ method delete*(self: Module) =
|
||||||
self.view.delete
|
self.view.delete
|
||||||
self.controller.delete
|
self.controller.delete
|
||||||
|
|
||||||
method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int], excludeWatchOnly: bool) =
|
method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int]) =
|
||||||
let walletAccounts = self.controller.getWalletAccounts()
|
let walletAccounts = self.controller.getWalletAccounts()
|
||||||
let currency = self.controller.getCurrentCurrency()
|
let currency = self.controller.getCurrentCurrency()
|
||||||
let currencyFormat = self.controller.getCurrencyFormat(currency)
|
let currencyFormat = self.controller.getCurrencyFormat(currency)
|
||||||
let items = walletAccounts.filter(w => not excludeWatchOnly or w.walletType != "watch").map(w => (block:
|
let items = walletAccounts.map(w => (block:
|
||||||
let keycardAccount = self.controller.isKeycardAccount(w)
|
let keycardAccount = self.controller.isKeycardAccount(w)
|
||||||
walletAccountToWalletAccountsItem(
|
walletAccountToWalletAccountsItem(
|
||||||
w,
|
w,
|
||||||
|
|
|
@ -65,3 +65,9 @@ proc getWalletAccounts*(self: Controller): seq[wallet_account_service.WalletAcco
|
||||||
|
|
||||||
proc getEnabledChainIds*(self: Controller): seq[int] =
|
proc getEnabledChainIds*(self: Controller): seq[int] =
|
||||||
return self.networkService.getNetworks().filter(n => n.enabled).map(n => n.chainId)
|
return self.networkService.getNetworks().filter(n => n.enabled).map(n => n.chainId)
|
||||||
|
|
||||||
|
proc toggleIncludeWatchOnlyAccount*(self: Controller) =
|
||||||
|
self.walletAccountService.toggleIncludeWatchOnlyAccount()
|
||||||
|
|
||||||
|
proc isIncludeWatchOnlyAccount*(self: Controller): bool =
|
||||||
|
return self.walletAccountService.isIncludeWatchOnlyAccount()
|
||||||
|
|
|
@ -8,7 +8,6 @@ type Filter* = ref object
|
||||||
activityController: activityc.Controller
|
activityController: activityc.Controller
|
||||||
addresses*: seq[string]
|
addresses*: seq[string]
|
||||||
chainIds*: seq[int]
|
chainIds*: seq[int]
|
||||||
excludeWatchOnly*: bool
|
|
||||||
allAddresses*: bool
|
allAddresses*: bool
|
||||||
|
|
||||||
proc initFilter*(
|
proc initFilter*(
|
||||||
|
@ -20,7 +19,6 @@ proc initFilter*(
|
||||||
result.activityController = activityController
|
result.activityController = activityController
|
||||||
result.addresses = @[]
|
result.addresses = @[]
|
||||||
result.chainIds = @[]
|
result.chainIds = @[]
|
||||||
result.excludeWatchOnly = false
|
|
||||||
result.allAddresses = false
|
result.allAddresses = false
|
||||||
|
|
||||||
proc `$`*(self: Filter): string =
|
proc `$`*(self: Filter): string =
|
||||||
|
@ -29,7 +27,6 @@ proc `$`*(self: Filter): string =
|
||||||
chainIds: {self.chainIds},
|
chainIds: {self.chainIds},
|
||||||
)"""
|
)"""
|
||||||
|
|
||||||
|
|
||||||
proc setFillterAllAddresses*(self: Filter) =
|
proc setFillterAllAddresses*(self: Filter) =
|
||||||
self.allAddresses = true
|
self.allAddresses = true
|
||||||
self.addresses = self.controller.getWalletAccounts().map(a => a.address)
|
self.addresses = self.controller.getWalletAccounts().map(a => a.address)
|
||||||
|
@ -37,16 +34,19 @@ proc setFillterAllAddresses*(self: Filter) =
|
||||||
self.activityController.updateFilter()
|
self.activityController.updateFilter()
|
||||||
|
|
||||||
proc toggleWatchOnlyAccounts*(self: Filter) =
|
proc toggleWatchOnlyAccounts*(self: Filter) =
|
||||||
self.excludeWatchOnly = not self.excludeWatchOnly
|
self.controller.toggleIncludeWatchOnlyAccount()
|
||||||
if self.excludeWatchOnly:
|
|
||||||
|
proc includeWatchOnlyToggled*(self: Filter) =
|
||||||
|
let includeWatchOnly = self.controller.isIncludeWatchOnlyAccount()
|
||||||
|
if includeWatchOnly:
|
||||||
|
self.setFillterAllAddresses()
|
||||||
|
else:
|
||||||
self.addresses = self.controller.getWalletAccounts().filter(a => a.walletType != "watch").map(a => a.address)
|
self.addresses = self.controller.getWalletAccounts().filter(a => a.walletType != "watch").map(a => a.address)
|
||||||
self.activityController.setFilterAddresses(self.addresses)
|
self.activityController.setFilterAddresses(self.addresses)
|
||||||
self.activityController.updateFilter()
|
self.activityController.updateFilter()
|
||||||
else:
|
|
||||||
self.setFillterAllAddresses()
|
|
||||||
|
|
||||||
proc load*(self: Filter) =
|
proc load*(self: Filter) =
|
||||||
self.setFillterAllAddresses()
|
self.includeWatchOnlyToggled()
|
||||||
self.chainIds = self.controller.getEnabledChainIds()
|
self.chainIds = self.controller.getEnabledChainIds()
|
||||||
self.activityController.setFilterChains(self.chainIds)
|
self.activityController.setFilterChains(self.chainIds)
|
||||||
self.activityController.updateFilter()
|
self.activityController.updateFilter()
|
||||||
|
|
|
@ -132,29 +132,29 @@ method getCurrentCurrency*(self: Module): string =
|
||||||
method setTotalCurrencyBalance*(self: Module) =
|
method setTotalCurrencyBalance*(self: Module) =
|
||||||
var addresses: seq[string] = @[]
|
var addresses: seq[string] = @[]
|
||||||
let walletAccounts = self.controller.getWalletAccounts()
|
let walletAccounts = self.controller.getWalletAccounts()
|
||||||
if self.filter.excludeWatchOnly:
|
if self.controller.isIncludeWatchOnlyAccount():
|
||||||
addresses = walletAccounts.filter(a => a.walletType != "watch").map(a => a.address)
|
|
||||||
else:
|
|
||||||
addresses = walletAccounts.map(a => a.address)
|
addresses = walletAccounts.map(a => a.address)
|
||||||
|
else:
|
||||||
|
addresses = walletAccounts.filter(a => a.walletType != "watch").map(a => a.address)
|
||||||
|
|
||||||
self.view.setTotalCurrencyBalance(self.controller.getCurrencyBalance(addresses))
|
self.view.setTotalCurrencyBalance(self.controller.getCurrencyBalance(addresses))
|
||||||
|
|
||||||
method notifyFilterChanged(self: Module) =
|
method notifyFilterChanged(self: Module) =
|
||||||
self.overviewModule.filterChanged(self.filter.addresses, self.filter.chainIds, self.filter.excludeWatchOnly, self.filter.allAddresses)
|
let includeWatchOnly = self.controller.isIncludeWatchOnlyAccount()
|
||||||
|
self.overviewModule.filterChanged(self.filter.addresses, self.filter.chainIds, includeWatchOnly, self.filter.allAddresses)
|
||||||
self.assetsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
self.assetsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
||||||
self.collectiblesModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
self.collectiblesModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
||||||
self.transactionsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
self.transactionsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
||||||
self.accountsModule.filterChanged(self.filter.addresses, self.filter.chainIds, self.filter.excludeWatchOnly)
|
self.accountsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
||||||
self.sendModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
self.sendModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
||||||
self.view.filterChanged(self.filter.addresses[0], self.filter.excludeWatchOnly, self.filter.allAddresses)
|
if self.filter.addresses.len > 0:
|
||||||
|
self.view.filterChanged(self.filter.addresses[0], includeWatchOnly, self.filter.allAddresses)
|
||||||
|
|
||||||
method getCurrencyAmount*(self: Module, amount: float64, symbol: string): CurrencyAmount =
|
method getCurrencyAmount*(self: Module, amount: float64, symbol: string): CurrencyAmount =
|
||||||
return self.controller.getCurrencyAmount(amount, symbol)
|
return self.controller.getCurrencyAmount(amount, symbol)
|
||||||
|
|
||||||
method toggleWatchOnlyAccounts*(self: Module) =
|
method toggleWatchOnlyAccounts*(self: Module) =
|
||||||
self.filter.toggleWatchOnlyAccounts()
|
self.filter.toggleWatchOnlyAccounts()
|
||||||
self.notifyFilterChanged()
|
|
||||||
self.setTotalCurrencyBalance()
|
|
||||||
|
|
||||||
method setFilterAddress*(self: Module, address: string) =
|
method setFilterAddress*(self: Module, address: string) =
|
||||||
self.filter.setAddress(address)
|
self.filter.setAddress(address)
|
||||||
|
@ -202,6 +202,10 @@ method load*(self: Module) =
|
||||||
self.notifyFilterChanged()
|
self.notifyFilterChanged()
|
||||||
self.events.on(SIGNAL_WALLET_ACCOUNT_POSITION_UPDATED) do(e:Args):
|
self.events.on(SIGNAL_WALLET_ACCOUNT_POSITION_UPDATED) do(e:Args):
|
||||||
self.notifyFilterChanged()
|
self.notifyFilterChanged()
|
||||||
|
self.events.on(SIGNAL_INCLUDE_WATCH_ONLY_ACCOUNTS_UPDATED) do(e: Args):
|
||||||
|
self.filter.includeWatchOnlyToggled()
|
||||||
|
self.notifyFilterChanged()
|
||||||
|
self.setTotalCurrencyBalance()
|
||||||
|
|
||||||
self.controller.init()
|
self.controller.init()
|
||||||
self.view.load()
|
self.view.load()
|
||||||
|
|
|
@ -17,5 +17,5 @@ method isLoaded*(self: AccessInterface): bool {.base.} =
|
||||||
method viewDidLoad*(self: AccessInterface) {.base.} =
|
method viewDidLoad*(self: AccessInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method filterChanged*(self: AccessInterface, addresses: seq[string], chainIds: seq[int], excludeWatchOnly: bool, allAddresses: bool) {.base.} =
|
method filterChanged*(self: AccessInterface, addresses: seq[string], chainIds: seq[int], includeWatchOnly: bool, allAddresses: bool) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
|
@ -10,7 +10,7 @@ type
|
||||||
emoji: string
|
emoji: string
|
||||||
isWatchOnlyAccount: bool
|
isWatchOnlyAccount: bool
|
||||||
isAllAccounts: bool
|
isAllAccounts: bool
|
||||||
hideWatchAccounts: bool
|
includeWatchOnly: bool
|
||||||
colorIds: seq[string]
|
colorIds: seq[string]
|
||||||
|
|
||||||
proc initItem*(
|
proc initItem*(
|
||||||
|
@ -22,7 +22,7 @@ proc initItem*(
|
||||||
emoji: string,
|
emoji: string,
|
||||||
isWatchOnlyAccount: bool=false,
|
isWatchOnlyAccount: bool=false,
|
||||||
isAllAccounts: bool = false,
|
isAllAccounts: bool = false,
|
||||||
hideWatchAccounts: bool = false,
|
includeWatchOnly: bool = true,
|
||||||
colorIds: seq[string] = @[]
|
colorIds: seq[string] = @[]
|
||||||
): Item =
|
): Item =
|
||||||
result.name = name
|
result.name = name
|
||||||
|
@ -32,7 +32,7 @@ proc initItem*(
|
||||||
result.colorId = colorId
|
result.colorId = colorId
|
||||||
result.emoji = emoji
|
result.emoji = emoji
|
||||||
result.isAllAccounts = isAllAccounts
|
result.isAllAccounts = isAllAccounts
|
||||||
result.hideWatchAccounts = hideWatchAccounts
|
result.includeWatchOnly = includeWatchOnly
|
||||||
result.colorIds = colorIds
|
result.colorIds = colorIds
|
||||||
result.isWatchOnlyAccount = isWatchOnlyAccount
|
result.isWatchOnlyAccount = isWatchOnlyAccount
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ proc `$`*(self: Item): string =
|
||||||
emoji: {self.emoji},
|
emoji: {self.emoji},
|
||||||
isWatchOnlyAccount: {self.isWatchOnlyAccount},
|
isWatchOnlyAccount: {self.isWatchOnlyAccount},
|
||||||
isAllAccounts: {self.isAllAccounts},
|
isAllAccounts: {self.isAllAccounts},
|
||||||
hideWatchAccounts: {self.hideWatchAccounts},
|
includeWatchOnly: {self.includeWatchOnly},
|
||||||
colorIds: {self.colorIds}
|
colorIds: {self.colorIds}
|
||||||
]"""
|
]"""
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ proc getEmoji*(self: Item): string =
|
||||||
proc getIsAllAccounts*(self: Item): bool =
|
proc getIsAllAccounts*(self: Item): bool =
|
||||||
return self.isAllAccounts
|
return self.isAllAccounts
|
||||||
|
|
||||||
proc getHideWatchAccounts*(self: Item): bool =
|
proc getIncludeWatchOnly*(self: Item): bool =
|
||||||
return self.hideWatchAccounts
|
return self.includeWatchOnly
|
||||||
|
|
||||||
proc getColorIds*(self: Item): string =
|
proc getColorIds*(self: Item): string =
|
||||||
return self.colorIds.join(";")
|
return self.colorIds.join(";")
|
||||||
|
|
|
@ -65,7 +65,7 @@ proc getWalletAccoutColors(self: Module, walletAccounts: seq[WalletAccountDto])
|
||||||
colors.add(account.colorId)
|
colors.add(account.colorId)
|
||||||
return colors
|
return colors
|
||||||
|
|
||||||
method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int], excludeWatchOnly: bool, allAddresses: bool) =
|
method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int], includeWatchOnly: bool, allAddresses: bool) =
|
||||||
let walletAccounts = self.controller.getWalletAccountsByAddresses(addresses)
|
let walletAccounts = self.controller.getWalletAccountsByAddresses(addresses)
|
||||||
if allAddresses:
|
if allAddresses:
|
||||||
let item = initItem(
|
let item = initItem(
|
||||||
|
@ -77,7 +77,7 @@ method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int],
|
||||||
"",
|
"",
|
||||||
isWatchOnlyAccount=false,
|
isWatchOnlyAccount=false,
|
||||||
isAllAccounts=true,
|
isAllAccounts=true,
|
||||||
hideWatchAccounts=excludeWatchOnly,
|
includeWatchOnly=includeWatchOnly,
|
||||||
self.getWalletAccoutColors(walletAccounts)
|
self.getWalletAccoutColors(walletAccounts)
|
||||||
)
|
)
|
||||||
self.view.setData(item)
|
self.view.setData(item)
|
||||||
|
|
|
@ -17,7 +17,7 @@ QtObject:
|
||||||
colorId: string
|
colorId: string
|
||||||
emoji: string
|
emoji: string
|
||||||
isAllAccounts: bool
|
isAllAccounts: bool
|
||||||
hideWatchAccounts: bool
|
includeWatchOnly: bool
|
||||||
colorIds: string
|
colorIds: string
|
||||||
isWatchOnlyAccount: bool
|
isWatchOnlyAccount: bool
|
||||||
|
|
||||||
|
@ -99,12 +99,12 @@ QtObject:
|
||||||
read = getIsAllAccounts
|
read = getIsAllAccounts
|
||||||
notify = isAllAccountsChanged
|
notify = isAllAccountsChanged
|
||||||
|
|
||||||
proc getHideWatchAccounts(self: View): QVariant {.slot.} =
|
proc getIncludeWatchOnly(self: View): QVariant {.slot.} =
|
||||||
return newQVariant(self.hideWatchAccounts)
|
return newQVariant(self.includeWatchOnly)
|
||||||
proc hideWatchAccountsChanged(self: View) {.signal.}
|
proc includeWatchOnlyChanged(self: View) {.signal.}
|
||||||
QtProperty[QVariant] hideWatchAccounts:
|
QtProperty[QVariant] includeWatchOnly:
|
||||||
read = getHideWatchAccounts
|
read = getIncludeWatchOnly
|
||||||
notify = hideWatchAccountsChanged
|
notify = includeWatchOnlyChanged
|
||||||
|
|
||||||
proc getColorIds(self: View): QVariant {.slot.} =
|
proc getColorIds(self: View): QVariant {.slot.} =
|
||||||
return newQVariant(self.colorIds)
|
return newQVariant(self.colorIds)
|
||||||
|
@ -113,10 +113,10 @@ QtObject:
|
||||||
read = getColorIds
|
read = getColorIds
|
||||||
notify = colorIdsChanged
|
notify = colorIdsChanged
|
||||||
|
|
||||||
proc getIsWatchOnlyAccount(self: View): QVariant {.slot.} =
|
proc getIsWatchOnlyAccount(self: View): bool {.slot.} =
|
||||||
return newQVariant(self.isWatchOnlyAccount)
|
return self.isWatchOnlyAccount
|
||||||
proc isWatchOnlyAccountChanged(self: View) {.signal.}
|
proc isWatchOnlyAccountChanged(self: View) {.signal.}
|
||||||
QtProperty[QVariant] isWatchOnlyAccount:
|
QtProperty[bool] isWatchOnlyAccount:
|
||||||
read = getIsWatchOnlyAccount
|
read = getIsWatchOnlyAccount
|
||||||
notify = isWatchOnlyAccountChanged
|
notify = isWatchOnlyAccountChanged
|
||||||
|
|
||||||
|
@ -147,6 +147,6 @@ QtObject:
|
||||||
if(self.isAllAccounts != item.getIsAllAccounts()):
|
if(self.isAllAccounts != item.getIsAllAccounts()):
|
||||||
self.isAllAccounts = item.getIsAllAccounts()
|
self.isAllAccounts = item.getIsAllAccounts()
|
||||||
self.isAllAccountsChanged()
|
self.isAllAccountsChanged()
|
||||||
if(self.hideWatchAccounts != item.getHideWatchAccounts()):
|
if(self.includeWatchOnly != item.getIncludeWatchOnly()):
|
||||||
self.hideWatchAccounts = item.getHideWatchAccounts()
|
self.includeWatchOnly = item.getIncludeWatchOnly()
|
||||||
self.hideWatchAccountsChanged()
|
self.includeWatchOnlyChanged()
|
||||||
|
|
|
@ -39,7 +39,7 @@ QtObject:
|
||||||
QtProperty[string] currentCurrency:
|
QtProperty[string] currentCurrency:
|
||||||
read = getCurrentCurrency
|
read = getCurrentCurrency
|
||||||
|
|
||||||
proc filterChanged*(self: View, addresses: string, excludeWatchOnly: bool, allAddresses: bool) {.signal.}
|
proc filterChanged*(self: View, addresses: string, includeWatchOnly: bool, allAddresses: bool) {.signal.}
|
||||||
|
|
||||||
proc totalCurrencyBalanceChanged*(self: View) {.signal.}
|
proc totalCurrencyBalanceChanged*(self: View) {.signal.}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ const KEY_GIF_API_KEY* = "gifs/api-key"
|
||||||
const KEY_DISPLAY_NAME* = "display-name"
|
const KEY_DISPLAY_NAME* = "display-name"
|
||||||
const KEY_BIO* = "bio"
|
const KEY_BIO* = "bio"
|
||||||
const KEY_TEST_NETWORKS_ENABLED* = "test-networks-enabled?"
|
const KEY_TEST_NETWORKS_ENABLED* = "test-networks-enabled?"
|
||||||
|
const INCLUDE_WATCH_ONLY_ACCOUNT* = "include-watch-only-account?"
|
||||||
|
|
||||||
# Notifications Settings Values
|
# Notifications Settings Values
|
||||||
const VALUE_NOTIF_SEND_ALERTS* = "SendAlerts"
|
const VALUE_NOTIF_SEND_ALERTS* = "SendAlerts"
|
||||||
|
@ -136,6 +137,7 @@ type
|
||||||
notificationsSoundsEnabled*: bool
|
notificationsSoundsEnabled*: bool
|
||||||
notificationsVolume*: int
|
notificationsVolume*: int
|
||||||
notificationsMessagePreview*: int
|
notificationsMessagePreview*: int
|
||||||
|
includeWatchOnlyAccount*: bool
|
||||||
|
|
||||||
proc toPinnedMailserver*(jsonObj: JsonNode): PinnedMailserver =
|
proc toPinnedMailserver*(jsonObj: JsonNode): PinnedMailserver =
|
||||||
# we maintain pinned mailserver per fleet
|
# we maintain pinned mailserver per fleet
|
||||||
|
@ -192,6 +194,7 @@ proc toSettingsDto*(jsonObj: JsonNode): SettingsDto =
|
||||||
discard jsonObj.getProp(KEY_GIF_RECENTS, result.gifRecents)
|
discard jsonObj.getProp(KEY_GIF_RECENTS, result.gifRecents)
|
||||||
discard jsonObj.getProp(KEY_GIF_FAVORITES, result.gifFavorites)
|
discard jsonObj.getProp(KEY_GIF_FAVORITES, result.gifFavorites)
|
||||||
discard jsonObj.getProp(KEY_TEST_NETWORKS_ENABLED, result.testNetworksEnabled)
|
discard jsonObj.getProp(KEY_TEST_NETWORKS_ENABLED, result.testNetworksEnabled)
|
||||||
|
discard jsonObj.getProp(INCLUDE_WATCH_ONLY_ACCOUNT, result.includeWatchOnlyAccount)
|
||||||
|
|
||||||
var pinnedMailserverObj: JsonNode
|
var pinnedMailserverObj: JsonNode
|
||||||
if(jsonObj.getProp(KEY_PINNED_MAILSERVERS, pinnedMailserverObj)):
|
if(jsonObj.getProp(KEY_PINNED_MAILSERVERS, pinnedMailserverObj)):
|
||||||
|
|
|
@ -27,6 +27,7 @@ const SIGNAL_BIO_UPDATED* = "bioUpdated"
|
||||||
const SIGNAL_MNEMONIC_REMOVED* = "mnemonicRemoved"
|
const SIGNAL_MNEMONIC_REMOVED* = "mnemonicRemoved"
|
||||||
const SIGNAL_SOCIAL_LINKS_UPDATED* = "socialLinksUpdated"
|
const SIGNAL_SOCIAL_LINKS_UPDATED* = "socialLinksUpdated"
|
||||||
const SIGNAL_CURRENT_USER_STATUS_UPDATED* = "currentUserStatusUpdated"
|
const SIGNAL_CURRENT_USER_STATUS_UPDATED* = "currentUserStatusUpdated"
|
||||||
|
const SIGNAL_INCLUDE_WATCH_ONLY_ACCOUNTS_UPDATED* = "includeWatchOnlyAccounts"
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "settings-service"
|
topics = "settings-service"
|
||||||
|
@ -109,6 +110,9 @@ QtObject:
|
||||||
if settingsField.name == KEY_MNEMONIC:
|
if settingsField.name == KEY_MNEMONIC:
|
||||||
self.settings.mnemonic = ""
|
self.settings.mnemonic = ""
|
||||||
self.events.emit(SIGNAL_MNEMONIC_REMOVED, Args())
|
self.events.emit(SIGNAL_MNEMONIC_REMOVED, Args())
|
||||||
|
if settingsField.name == INCLUDE_WATCH_ONLY_ACCOUNT:
|
||||||
|
self.settings.includeWatchOnlyAccount = parseBool(settingsField.value)
|
||||||
|
self.events.emit(SIGNAL_INCLUDE_WATCH_ONLY_ACCOUNTS_UPDATED, Args())
|
||||||
|
|
||||||
if receivedData.socialLinksInfo.links.len > 0 or
|
if receivedData.socialLinksInfo.links.len > 0 or
|
||||||
receivedData.socialLinksInfo.removed:
|
receivedData.socialLinksInfo.removed:
|
||||||
|
@ -966,3 +970,12 @@ QtObject:
|
||||||
data.error = e.msg
|
data.error = e.msg
|
||||||
error "error saving social links", errDescription=data.error
|
error "error saving social links", errDescription=data.error
|
||||||
self.storeSocialLinksAndNotify(data)
|
self.storeSocialLinksAndNotify(data)
|
||||||
|
|
||||||
|
proc isIncludeWatchOnlyAccount*(self: Service): bool =
|
||||||
|
return self.settings.includeWatchOnlyAccount
|
||||||
|
|
||||||
|
proc toggleIncludeWatchOnlyAccount*(self: Service) =
|
||||||
|
let newValue = not self.settings.includeWatchOnlyAccount
|
||||||
|
if(self.saveSetting(INCLUDE_WATCH_ONLY_ACCOUNT, newValue)):
|
||||||
|
self.settings.includeWatchOnlyAccount = newValue
|
||||||
|
self.events.emit(SIGNAL_INCLUDE_WATCH_ONLY_ACCOUNTS_UPDATED, Args())
|
||||||
|
|
|
@ -965,3 +965,9 @@ QtObject:
|
||||||
totalTokenBalance += token.getTotalBalanceOfSupportedChains()
|
totalTokenBalance += token.getTotalBalanceOfSupportedChains()
|
||||||
|
|
||||||
return totalTokenBalance
|
return totalTokenBalance
|
||||||
|
|
||||||
|
proc isIncludeWatchOnlyAccount*(self: Service): bool =
|
||||||
|
return self.settingsService.isIncludeWatchOnlyAccount()
|
||||||
|
|
||||||
|
proc toggleIncludeWatchOnlyAccount*(self: Service) =
|
||||||
|
self.settingsService.toggleIncludeWatchOnlyAccount()
|
||||||
|
|
|
@ -48,7 +48,7 @@ SplitView {
|
||||||
displayDecimals: 4,
|
displayDecimals: 4,
|
||||||
stripTrailingZeroes: false}),
|
stripTrailingZeroes: false}),
|
||||||
isAllAccounts: false,
|
isAllAccounts: false,
|
||||||
hideWatchAccounts: false
|
includeWatchOnly: false
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ SplitView {
|
||||||
displayDecimals: 4,
|
displayDecimals: 4,
|
||||||
stripTrailingZeroes: false}),
|
stripTrailingZeroes: false}),
|
||||||
isAllAccounts: false,
|
isAllAccounts: false,
|
||||||
hideWatchAccounts: false
|
includeWatchOnly: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ SplitView {
|
||||||
displayDecimals: 4,
|
displayDecimals: 4,
|
||||||
stripTrailingZeroes: false}),
|
stripTrailingZeroes: false}),
|
||||||
isAllAccounts: true,
|
isAllAccounts: true,
|
||||||
hideWatchAccounts: true,
|
includeWatchOnly: true,
|
||||||
colorIds: "purple;pink;magenta"
|
colorIds: "purple;pink;magenta"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,10 @@ Rectangle {
|
||||||
|
|
||||||
property string chainShortNames
|
property string chainShortNames
|
||||||
property string userProfilePublicKey
|
property string userProfilePublicKey
|
||||||
|
property bool includeWatchOnlyAccount
|
||||||
|
|
||||||
signal goToAccountView(var account)
|
signal goToAccountView(var account)
|
||||||
|
signal toggleIncludeWatchOnlyAccount()
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
@ -68,9 +70,8 @@ Rectangle {
|
||||||
},
|
},
|
||||||
StatusSwitch {
|
StatusSwitch {
|
||||||
visible: d.isWatchOnly
|
visible: d.isWatchOnly
|
||||||
// To-do connect in different task
|
checked: root.includeWatchOnlyAccount
|
||||||
// checked: false
|
onClicked: root.toggleIncludeWatchOnlyAccount()
|
||||||
// onCheckedChanged: {}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,11 @@ QtObject {
|
||||||
property var assets: walletSectionAssets.assets
|
property var assets: walletSectionAssets.assets
|
||||||
property var accounts: Global.appIsReady? accountsModule.accounts : null
|
property var accounts: Global.appIsReady? accountsModule.accounts : null
|
||||||
property var originModel: accountsModule.keyPairModel
|
property var originModel: accountsModule.keyPairModel
|
||||||
|
property bool includeWatchOnlyAccount: accountsModule.includeWatchOnlyAccount
|
||||||
|
|
||||||
|
function toggleIncludeWatchOnlyAccount() {
|
||||||
|
accountsModule.toggleIncludeWatchOnlyAccount()
|
||||||
|
}
|
||||||
|
|
||||||
property string userProfilePublicKey: userProfile.pubKey
|
property string userProfilePublicKey: userProfile.pubKey
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,9 @@ Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
chainShortNames: walletStore.getAllNetworksSupportedPrefix()
|
chainShortNames: walletStore.getAllNetworksSupportedPrefix()
|
||||||
userProfilePublicKey: walletStore.userProfilePublicKey
|
userProfilePublicKey: walletStore.userProfilePublicKey
|
||||||
|
includeWatchOnlyAccount: walletStore.includeWatchOnlyAccount
|
||||||
onGoToAccountView: root.goToAccountView(account)
|
onGoToAccountView: root.goToAccountView(account)
|
||||||
|
onToggleIncludeWatchOnlyAccount: walletStore.toggleIncludeWatchOnlyAccount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,9 +96,9 @@ Item {
|
||||||
|
|
||||||
font.weight: Font.Normal
|
font.weight: Font.Normal
|
||||||
textColor: Theme.palette.baseColor1
|
textColor: Theme.palette.baseColor1
|
||||||
text: overview.hideWatchAccounts ? qsTr("Show watch-only"): qsTr("Hide watch-only")
|
text: overview.includeWatchOnly ? qsTr("Hide watch-only"): qsTr("Show watch-only")
|
||||||
|
|
||||||
icon.name: overview.hideWatchAccounts ? "show" : "hide"
|
icon.name: overview.includeWatchOnly ? "hide" : "show"
|
||||||
icon.height: 16
|
icon.height: 16
|
||||||
icon.width: 16
|
icon.width: 16
|
||||||
icon.color: Theme.palette.baseColor1
|
icon.color: Theme.palette.baseColor1
|
||||||
|
|
|
@ -125,7 +125,7 @@ Rectangle {
|
||||||
function onDestroyAddAccountPopup() {
|
function onDestroyAddAccountPopup() {
|
||||||
addAccount.active = false
|
addAccount.active = false
|
||||||
}
|
}
|
||||||
function onFilterChanged(address, excludeWatchOnly, allAddresses) {
|
function onFilterChanged(address, includeWatchOnly, allAddresses) {
|
||||||
root.currentAddress = allAddresses ? "" : address
|
root.currentAddress = allAddresses ? "" : address
|
||||||
root.showAllAccounts = allAddresses
|
root.showAllAccounts = allAddresses
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f07a79cd189964e31f67ecb8b90036fb1ffeec5e
|
Subproject commit bada9fee11eee132f5bcf535d66b7c9311e1a8e6
|
Loading…
Reference in New Issue