Show live swap status, explorer links, and full kyc.rip route details
This commit is contained in:
@@ -3,12 +3,12 @@ import SwiftUI
|
||||
|
||||
struct DashboardView: View {
|
||||
@EnvironmentObject private var model: AppModel
|
||||
@EnvironmentObject private var drawers: DrawerCoordinator
|
||||
@Binding var route: Route
|
||||
|
||||
@State private var showSeed = false
|
||||
@State private var revealedSeed: String?
|
||||
@State private var seedError: String?
|
||||
@State private var selectedTransaction: TransactionRecord?
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 18) {
|
||||
@@ -70,14 +70,14 @@ struct DashboardView: View {
|
||||
Text("Activity")
|
||||
.font(.system(size: 13, weight: .semibold))
|
||||
.foregroundStyle(Theme.muted)
|
||||
ForEach(model.transactions) { record in
|
||||
ForEach(Array(model.transactions.enumerated()), id: \.offset) { index, record in
|
||||
Button {
|
||||
selectedTransaction = record
|
||||
drawers.transaction = record
|
||||
} label: {
|
||||
TransactionRow(record: record, symbol: model.symbol)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
if record.id != model.transactions.last?.id {
|
||||
if index < model.transactions.count - 1 {
|
||||
Divider().overlay(Theme.border)
|
||||
}
|
||||
}
|
||||
@@ -108,16 +108,6 @@ struct DashboardView: View {
|
||||
MessageBanner(message: seedError, isError: true)
|
||||
}
|
||||
}
|
||||
.bottomDrawer(isPresented: Binding(
|
||||
get: { selectedTransaction != nil },
|
||||
set: { if !$0 { selectedTransaction = nil } }
|
||||
)) {
|
||||
if let record = selectedTransaction {
|
||||
TransactionDetailView(record: record,
|
||||
symbol: model.symbol,
|
||||
chain: model.chain) { selectedTransaction = nil }
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showSeed) {
|
||||
if let revealedSeed {
|
||||
SeedRevealView(seed: revealedSeed, symbol: model.symbol) { showSeed = false }
|
||||
@@ -134,6 +124,8 @@ struct SendView: View {
|
||||
@State private var amount = ""
|
||||
@State private var tag = ""
|
||||
@State private var priority: TransactionPriority = .defaultPriority
|
||||
@State private var accountIndex = 0
|
||||
@State private var accountPicked = false
|
||||
@State private var localError: String?
|
||||
@State private var status: String?
|
||||
@State private var showScanner = false
|
||||
@@ -159,6 +151,12 @@ struct SendView: View {
|
||||
}
|
||||
}
|
||||
|
||||
if model.chain == .xmr, model.moneroAccounts.count > 1 {
|
||||
MoneroAccountPicker(accounts: model.moneroAccounts,
|
||||
selection: $accountIndex,
|
||||
onSelect: { accountPicked = true })
|
||||
}
|
||||
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
FieldLabel(text: model.chain == .xrp ? "Destination address" : "Recipient address")
|
||||
KoinsTextField(placeholder: model.chain == .xrp ? "r…" : "4…", text: $destination)
|
||||
@@ -203,7 +201,11 @@ struct SendView: View {
|
||||
localError = nil
|
||||
model.clearMessages()
|
||||
do {
|
||||
try await model.send(to: destination, amount: amount, tag: tag, priority: priority)
|
||||
try await model.send(to: destination,
|
||||
amount: amount,
|
||||
tag: tag,
|
||||
priority: priority,
|
||||
accountIndex: accountIndex)
|
||||
amount = ""
|
||||
tag = ""
|
||||
route = .dashboard
|
||||
@@ -239,6 +241,12 @@ struct SendView: View {
|
||||
photoItem = nil
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if !accountPicked { accountIndex = model.defaultMoneroAccountIndex }
|
||||
}
|
||||
.onChange(of: model.moneroAccounts.count) { _ in
|
||||
if !accountPicked { accountIndex = model.defaultMoneroAccountIndex }
|
||||
}
|
||||
}
|
||||
|
||||
/// Fills the form from a scanned code, accepting both plain addresses and
|
||||
|
||||
Reference in New Issue
Block a user