Files
simplex-chat/apps/ios/Shared/Views/UserSettings/SimplexNames/WalletSetupView.swift
T
Alain Brenzikofer 31cd2619da SimpleX names v2: Android, desktop and iOS UIs
The names hub and the buy / gift / receive / renew / recovery-key flows
across the Kotlin multiplatform app and the iOS Swift app. Stacked on the
core PR. iOS is written but unbuilt: it needs a Mac build (no iOS job in
CI) and a core lib rebuilt from the new simplexmq pin; expect
MsgContent.assetTransfer exhaustiveness one-liners and a few accessor
fixes on first xcodebuild.
2026-08-17 10:24:27 +02:00

35 lines
1.7 KiB
Swift

import SwiftUI
import SimpleXChat
// How this profile gets its recovery key, asked once. Sharing the key across
// profiles is the default because it means one thing to write down. A separate
// key exists for a profile kept deliberately apart.
struct WalletSetupView: View {
@Environment(\.dismiss) var dismiss
let hasOtherSeed: Bool
@State private var busy = false
var body: some View {
List {
Section {
if hasOtherSeed {
Button { setup("existing") } label: { Label("Use the recovery key I already have", systemImage: "checkmark").foregroundColor(.accentColor) }
}
Button { setup("new") } label: {
Label(hasOtherSeed ? "Give this profile its own recovery key" : "Create a recovery key", systemImage: "plus").foregroundColor(.accentColor)
}
NavigationLink { ImportRecoveryKeyView() } label: { Label("Restore names from a recovery key", systemImage: "square.and.arrow.down") }
} footer: {
Text(hasOtherSeed
? "Using the key you already have means one set of words to write down, and it covers every profile. A separate key keeps this profile's names unconnected to your others, but is a second thing to keep safe."
: "You will be shown the key afterwards. Write it down — it is the only way to get your names back if you lose this device.")
}
}
.navigationTitle("Set up names for this profile")
}
private func setup(_ arg: String) {
Task { busy = true; defer { busy = false }; if await apiNameSetup(arg) { await MainActor.run { dismiss() } } }
}
}