replace mock passport flows with live server integration
CI / test (push) Has been cancelled

Switch the app to the real passport enrollment, dashboard, device, alert, and challenge APIs so it can pair with idp.global and act on server-backed state instead of demo data.
This commit is contained in:
2026-04-20 13:21:39 +00:00
parent 271d9657bf
commit a298b5e421
7 changed files with 1136 additions and 48 deletions
+20 -3
View File
@@ -14,6 +14,7 @@ final class AppViewModel: ObservableObject {
@Published var profile: MemberProfile?
@Published var requests: [ApprovalRequest] = []
@Published var notifications: [AppNotification] = []
@Published var devices: [PassportDeviceRecord] = []
@Published var notificationPermission: NotificationPermissionState = .unknown
@Published var selectedSection: AppSection = .inbox
@Published var isBootstrapping = false
@@ -56,7 +57,7 @@ final class AppViewModel: ObservableObject {
}
init(
service: IDPServicing = MockIDPService.shared,
service: IDPServicing = DefaultIDPService.shared,
notificationCoordinator: NotificationCoordinating = NotificationCoordinator(),
appStateStore: AppStateStoring = UserDefaultsAppStateStore(),
launchArguments: [String] = ProcessInfo.processInfo.arguments
@@ -118,6 +119,8 @@ final class AppViewModel: ObservableObject {
if let preferredLaunchSection {
selectedSection = preferredLaunchSection
}
} else if session != nil {
await refreshDashboard()
}
} catch {
if session == nil {
@@ -260,6 +263,8 @@ final class AppViewModel: ObservableObject {
apply(snapshot: snapshot)
persistCurrentState()
errorMessage = nil
} catch let error as AppError {
errorMessage = error.errorDescription
} catch {
errorMessage = "Unable to refresh the dashboard."
}
@@ -282,6 +287,8 @@ final class AppViewModel: ObservableObject {
persistCurrentState()
selectedSection = .inbox
errorMessage = nil
} catch let error as AppError {
errorMessage = error.errorDescription
} catch {
errorMessage = "Unable to create a mock identity check right now."
}
@@ -315,6 +322,8 @@ final class AppViewModel: ObservableObject {
apply(snapshot: snapshot)
persistCurrentState()
errorMessage = nil
} catch let error as AppError {
errorMessage = error.errorDescription
} catch {
errorMessage = "Unable to update the notification."
}
@@ -326,6 +335,7 @@ final class AppViewModel: ObservableObject {
profile = nil
requests = []
notifications = []
devices = []
selectedSection = .inbox
manualPairingPayload = suggestedPairingPayload
isShowingPairingSuccess = false
@@ -371,6 +381,8 @@ final class AppViewModel: ObservableObject {
apply(snapshot: snapshot)
persistCurrentState()
errorMessage = nil
} catch let error as AppError {
errorMessage = error.errorDescription
} catch {
errorMessage = "Unable to update the identity check."
}
@@ -387,7 +399,8 @@ final class AppViewModel: ObservableObject {
snapshot: DashboardSnapshot(
profile: state.profile,
requests: state.requests,
notifications: state.notifications
notifications: state.notifications,
devices: state.devices
)
)
}
@@ -403,7 +416,8 @@ final class AppViewModel: ObservableObject {
session: session,
profile: profile,
requests: requests,
notifications: notifications
notifications: notifications,
devices: devices
)
)
}
@@ -413,6 +427,9 @@ final class AppViewModel: ObservableObject {
self.profile = snapshot.profile
self.requests = snapshot.requests.sorted { $0.createdAt > $1.createdAt }
self.notifications = snapshot.notifications.sorted { $0.sentAt > $1.sentAt }
self.devices = snapshot.devices.sorted {
($0.lastSeenAt ?? .distantPast) > ($1.lastSeenAt ?? .distantPast)
}
}
let profileValue = snapshot.profile