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:
@@ -13,6 +13,38 @@ struct PersistedAppState: Codable, Equatable {
|
||||
let profile: MemberProfile
|
||||
let requests: [ApprovalRequest]
|
||||
let notifications: [AppNotification]
|
||||
let devices: [PassportDeviceRecord]
|
||||
|
||||
init(
|
||||
session: AuthSession,
|
||||
profile: MemberProfile,
|
||||
requests: [ApprovalRequest],
|
||||
notifications: [AppNotification],
|
||||
devices: [PassportDeviceRecord] = []
|
||||
) {
|
||||
self.session = session
|
||||
self.profile = profile
|
||||
self.requests = requests
|
||||
self.notifications = notifications
|
||||
self.devices = devices
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case session
|
||||
case profile
|
||||
case requests
|
||||
case notifications
|
||||
case devices
|
||||
}
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
session = try container.decode(AuthSession.self, forKey: .session)
|
||||
profile = try container.decode(MemberProfile.self, forKey: .profile)
|
||||
requests = try container.decode([ApprovalRequest].self, forKey: .requests)
|
||||
notifications = try container.decode([AppNotification].self, forKey: .notifications)
|
||||
devices = try container.decodeIfPresent([PassportDeviceRecord].self, forKey: .devices) ?? []
|
||||
}
|
||||
}
|
||||
|
||||
protocol AppStateStoring {
|
||||
|
||||
Reference in New Issue
Block a user