fix(@desktop/wallet): Wallet Footer for watch only accounts should show only "Receive" as an option

fixes #10786
This commit is contained in:
Khushboo Mehta 2023-05-24 14:11:12 +02:00 committed by Khushboo-dev-cpp
parent 06b4b28145
commit a4a2ca4e9c
4 changed files with 21 additions and 0 deletions

View File

@ -8,6 +8,7 @@ type
balanceLoading: bool
color: string
emoji: string
isWatchOnlyAccount: bool
isAllAccounts: bool
hideWatchAccounts: bool
colors: seq[string]
@ -19,6 +20,7 @@ proc initItem*(
balanceLoading: bool = true,
color: string,
emoji: string,
isWatchOnlyAccount: bool=false,
isAllAccounts: bool = false,
hideWatchAccounts: bool = false,
colors: seq[string] = @[]
@ -32,6 +34,7 @@ proc initItem*(
result.isAllAccounts = isAllAccounts
result.hideWatchAccounts = hideWatchAccounts
result.colors = colors
result.isWatchOnlyAccount = isWatchOnlyAccount
proc `$`*(self: Item): string =
result = fmt"""OverviewItem(
@ -41,6 +44,7 @@ proc `$`*(self: Item): string =
balanceLoading: {self.balanceLoading},
color: {self.color},
emoji: {self.emoji},
isWatchOnlyAccount: {self.isWatchOnlyAccount},
isAllAccounts: {self.isAllAccounts},
hideWatchAccounts: {self.hideWatchAccounts},
colors: {self.colors}
@ -78,3 +82,5 @@ proc getColors*(self: Item): string =
result = result & ";" & color
return result
proc getIsWatchOnlyAccount*(self: Item): bool =
return self.isWatchOnlyAccount

View File

@ -75,6 +75,7 @@ method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int],
walletAccounts[0].assetsLoading,
"",
"",
isWatchOnlyAccount=false,
isAllAccounts=true,
hideWatchAccounts=excludeWatchOnly,
self.getWalletAccoutColors(walletAccounts)
@ -89,6 +90,7 @@ method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int],
walletAccount.assetsLoading,
walletAccount.color,
walletAccount.emoji,
isWatchOnlyAccount=walletAccount.walletType == "watch"
)
self.view.setData(item)

View File

@ -19,6 +19,7 @@ QtObject:
isAllAccounts: bool
hideWatchAccounts: bool
colors: string
isWatchOnlyAccount: bool
proc setup(self: View) =
self.QObject.setup
@ -112,6 +113,13 @@ QtObject:
read = getColors
notify = colorsChanged
proc getIsWatchOnlyAccount(self: View): QVariant {.slot.} =
return newQVariant(self.isWatchOnlyAccount)
proc isWatchOnlyAccountChanged(self: View) {.signal.}
QtProperty[QVariant] isWatchOnlyAccount:
read = getIsWatchOnlyAccount
notify = isWatchOnlyAccountChanged
proc setData*(self: View, item: Item) =
if(self.name != item.getName()):
self.name = item.getName()
@ -129,6 +137,9 @@ QtObject:
if(self.emoji != item.getEmoji()):
self.emoji = item.getEmoji()
self.emojiChanged()
if(self.isWatchOnlyAccount != item.getIsWatchOnlyAccount()):
self.isWatchOnlyAccount = item.getIsWatchOnlyAccount()
self.isWatchOnlyAccountChanged()
if(self.isAllAccounts != item.getIsAllAccounts()):
self.isAllAccounts = item.getIsAllAccounts()
self.isAllAccountsChanged()

View File

@ -44,6 +44,7 @@ Rectangle {
sendModal.open()
}
tooltipText: networkConnectionStore.sendBuyBridgeToolTipText
visible: !walletStore.overview.isWatchOnlyAccount
}
StatusFlatButton {
@ -64,6 +65,7 @@ Rectangle {
sendModal.open()
}
tooltipText: networkConnectionStore.sendBuyBridgeToolTipText
visible: !walletStore.overview.isWatchOnlyAccount
}
StatusFlatButton {