Bring the SwiftUI app in line with the Apple-native mock and keep pending approvals actionable from Live Activities and watch complications.
This commit is contained in:
@@ -5,9 +5,27 @@ struct IDPGlobalApp: App {
|
||||
@StateObject private var model = AppViewModel()
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
RootView(model: model)
|
||||
.tint(AppTheme.accent)
|
||||
#if os(macOS)
|
||||
MenuBarExtra("idp.global", systemImage: "shield.lefthalf.filled") {
|
||||
RootSceneContent(model: model)
|
||||
.frame(minWidth: 400, minHeight: 560)
|
||||
.tint(IdP.tint)
|
||||
.task {
|
||||
await model.bootstrap()
|
||||
}
|
||||
.alert("Something went wrong", isPresented: errorPresented) {
|
||||
Button("OK") {
|
||||
model.errorMessage = nil
|
||||
}
|
||||
} message: {
|
||||
Text(model.errorMessage ?? "")
|
||||
}
|
||||
}
|
||||
.menuBarExtraStyle(.window)
|
||||
#else
|
||||
WindowGroup {
|
||||
RootSceneContent(model: model)
|
||||
.tint(IdP.tint)
|
||||
.task {
|
||||
await model.bootstrap()
|
||||
}
|
||||
@@ -19,8 +37,6 @@ struct IDPGlobalApp: App {
|
||||
Text(model.errorMessage ?? "")
|
||||
}
|
||||
}
|
||||
#if os(macOS)
|
||||
.defaultSize(width: 1380, height: 920)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -36,19 +52,47 @@ struct IDPGlobalApp: App {
|
||||
}
|
||||
}
|
||||
|
||||
private struct RootView: View {
|
||||
private struct RootSceneContent: View {
|
||||
@ObservedObject var model: AppViewModel
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if model.session == nil {
|
||||
LoginRootView(model: model)
|
||||
} else if model.isShowingPairingSuccess {
|
||||
PairingSuccessView()
|
||||
} else {
|
||||
#if os(macOS)
|
||||
MenuBarPopover(model: model)
|
||||
#else
|
||||
HomeRootView(model: model)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
.background {
|
||||
AppBackground()
|
||||
Color.idpGroupedBackground.ignoresSafeArea()
|
||||
}
|
||||
.onOpenURL { url in
|
||||
model.openDeepLink(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct PairingSuccessView: View {
|
||||
var body: some View {
|
||||
VStack(spacing: 18) {
|
||||
Image(systemName: "checkmark.circle.fill")
|
||||
.font(.system(size: 72, weight: .semibold))
|
||||
.foregroundStyle(.green)
|
||||
|
||||
Text("Passport linked")
|
||||
.font(.title2.weight(.semibold))
|
||||
|
||||
Text("Your device is ready to approve sign-ins.")
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.padding(32)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user