Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ private fun SelectedWalletLoadingScreen(
val primaryText = MaterialTheme.colorScheme.onSurface
val secondaryText = MaterialTheme.colorScheme.onSurfaceVariant
val canGoBack = app.canGoBack()
val showsShieldIcon =
metadata.walletType == WalletType.COLD ||
metadata.walletType == WalletType.XPUB_ONLY

ForceLightStatusBarIcons()

Expand All @@ -329,7 +332,7 @@ private fun SelectedWalletLoadingScreen(
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
) {
if (metadata.walletType == WalletType.COLD) {
if (showsShieldIcon) {
BitcoinShieldIcon(size = 13.dp, color = Color.White)
Spacer(modifier = Modifier.size(8.dp))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ fun SelectedWalletScreen(

// state for wallet name rename dropdown
var showRenameMenu by remember { mutableStateOf(false) }
val isColdWallet = manager.walletMetadata?.walletType == WalletType.COLD
val showsShieldIcon =
manager.walletMetadata?.walletType == WalletType.COLD ||
manager.walletMetadata?.walletType == WalletType.XPUB_ONLY
val isWatchOnly = manager.walletMetadata?.walletType == WalletType.WATCH_ONLY
Comment on lines +194 to 197

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The showsShieldIcon computation dereferences manager.walletMetadata twice in the same expression. While walletMetadata is a state field and not a heavy computation, storing the type once in a local before composing the boolean keeps the intent clearer and matches the style used for isWatchOnly on the next line.

Suggested change
val showsShieldIcon =
manager.walletMetadata?.walletType == WalletType.COLD ||
manager.walletMetadata?.walletType == WalletType.XPUB_ONLY
val isWatchOnly = manager.walletMetadata?.walletType == WalletType.WATCH_ONLY
val walletType = manager.walletMetadata?.walletType
val showsShieldIcon =
walletType == WalletType.COLD ||
walletType == WalletType.XPUB_ONLY
val isWatchOnly = walletType == WalletType.WATCH_ONLY

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


// force white status bar icons for midnight blue background
Expand Down Expand Up @@ -231,7 +233,7 @@ fun SelectedWalletScreen(
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
) {
if (isColdWallet) {
if (showsShieldIcon) {
BitcoinShieldIcon(size = 13.dp, color = Color.White)
Spacer(modifier = Modifier.size(8.dp))
}
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<string name="label_wallet_account_number">Account number</string>
<string name="label_wallet_fingerprint">Fingerprint</string>
<string name="label_wallet_type">Wallet type</string>
<string name="label_wallet_address_type">Address type</string>
<string name="title_wallet_settings">Settings</string>
<string name="label_wallet_name">Name</string>
<string name="change_name">Change Name</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private struct SelectedWalletLoadingScreen: View {

private var titleContent: some View {
HStack(spacing: 10) {
if case .cold = metadata.walletType {
if metadata.walletType == .cold || metadata.walletType == .xpubOnly {
BitcoinShieldIcon(width: 13, color: toolbarTextColor)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct SelectedWalletTitleContent: View {

var body: some View {
HStack(spacing: 10) {
if case .cold = metadata.walletType {
if metadata.walletType == .cold || metadata.walletType == .xpubOnly {
BitcoinShieldIcon(width: 13, color: toolbarTextColor)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct SendFlowAccountSection: View {
.padding(.trailing, 6)
}

if case .cold = metadata.walletType {
if metadata.walletType == .cold || metadata.walletType == .xpubOnly {
BitcoinShieldIcon(width: 24, color: .orange)
}

Expand Down
Loading