Skip to content
Open
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
138 changes: 7 additions & 131 deletions app/src/main/kotlin/com/wisp/app/ui/screen/WalletScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3337,137 +3337,13 @@ private fun WalletSettingsContent(
}
}

// Relay backup status section (when logged in). Skipped for default
// wallets — the nsec already serves as their backup.
if (isLoggedIn && !isDefaultWallet) {
Spacer(Modifier.height(16.dp))

Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Text(
"Relay Backup Status",
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.onSurface
)
IconButton(
onClick = onCheckRelayBackups,
enabled = !relayBackupCheckLoading
) {
if (relayBackupCheckLoading) {
CircularProgressIndicator(
modifier = Modifier.size(18.dp),
strokeWidth = 2.dp
)
} else {
Icon(
Icons.Default.Refresh,
contentDescription = "Check relay backups",
modifier = Modifier.size(20.dp)
)
}
}
}

if (relayBackupStatuses.isNotEmpty()) {
Card(
modifier = Modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant
)
) {
Column(modifier = Modifier.padding(12.dp)) {
relayBackupStatuses.forEach { info ->
Row(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 4.dp),
verticalAlignment = Alignment.CenterVertically
) {
Box(
modifier = Modifier
.size(8.dp)
.background(
if (info.hasBackup) Color(0xFF4CAF50) else Color(0xFF9E9E9E),
CircleShape
)
)
Spacer(Modifier.width(8.dp))
Text(
info.relayUrl.removePrefix("wss://").removePrefix("ws://"),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurface,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
}
}
}

Spacer(Modifier.height(8.dp))

var showDeleteDialog by remember { mutableStateOf(false) }

TextButton(
onClick = { showDeleteDialog = true },
colors = ButtonDefaults.textButtonColors(contentColor = Color(0xFFD32F2F)),
enabled = deleteBackupStatus !is DeleteBackupStatus.InProgress
) {
if (deleteBackupStatus is DeleteBackupStatus.InProgress) {
CircularProgressIndicator(
modifier = Modifier.size(16.dp),
strokeWidth = 2.dp,
color = Color(0xFFD32F2F)
)
Spacer(Modifier.width(8.dp))
}
Text("Delete Relay Backup")
}

if (deleteBackupStatus is DeleteBackupStatus.Success) {
Text(
"Backup deleted",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.primary
)
} else if (deleteBackupStatus is DeleteBackupStatus.Error) {
Text(
deleteBackupStatus.message,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.error
)
}

if (showDeleteDialog) {
AlertDialog(
onDismissRequest = { showDeleteDialog = false },
title = { Text("Delete Relay Backup?") },
text = {
Text("This will delete your wallet backup from your relays. Make sure you have your recovery phrase saved elsewhere.")
},
confirmButton = {
TextButton(
onClick = {
showDeleteDialog = false
onDeleteRelayBackup()
},
colors = ButtonDefaults.textButtonColors(contentColor = Color(0xFFD32F2F))
) {
Text("Delete")
}
},
dismissButton = {
TextButton(onClick = { showDeleteDialog = false }) {
Text("Cancel")
}
}
)
}
}
}
// Relay backup status list intentionally omitted — iOS doesn't
// surface a per-relay backup display, and the majority of users
// will use the default Spark wallet (which doesn't need relay
// backup since the nsec is the canonical backup). Non-default
// wallets can still tap "Backup to Nostr Relays" above; the
// status / delete plumbing in WalletViewModel stays alive in
// case we want to surface it again later.
}

// Disclaimer
Expand Down