montana/Монтана-iOS/Sources/MontanaApp/App/RootView.swift

56 lines
1.7 KiB
Swift

import SwiftUI
struct RootView: View {
@EnvironmentObject private var identityManager: IdentityManager
var body: some View {
Group {
if identityManager.identity == nil {
OnboardingView()
} else {
PlaceholderMainView()
}
}
.task {
identityManager.loadIfPresent()
}
}
}
struct PlaceholderMainView: View {
@EnvironmentObject private var identityManager: IdentityManager
var body: some View {
NavigationStack {
VStack(spacing: 16) {
Image(systemName: "checkmark.seal.fill")
.font(.system(size: 60))
.foregroundStyle(.green)
Text("Identity создана")
.font(.title2)
if let id = identityManager.identity {
Text("account_id (placeholder):")
.font(.caption)
.foregroundStyle(.secondary)
Text(id.accountIdHex.prefix(16) + "")
.font(.system(.body, design: .monospaced))
}
Text("Wallet / Messenger / Channels — следующие фазы реализации.")
.font(.footnote)
.multilineTextAlignment(.center)
.foregroundStyle(.secondary)
.padding(.horizontal)
}
.padding()
.navigationTitle("Montana")
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button("Сбросить") {
identityManager.wipe()
}
}
}
}
}
}