1eb21c71ce
- Swift 6, SwiftUI, MVVM + async/await architecture - iOS 17.0 minimum deployment target - Two targets: Mayday app + MaydayLiveActivity widget extension - Models: UserResponse, TokenPair, AppNotification, SessionResponse, AlertAttributes - Services: HTTPClient (actor), AuthService, KeychainService, NotificationsAPIService, PushNotificationService - ViewModels: AuthViewModel, NotificationsViewModel, SettingsViewModel - Views: Login/Register/VerifyEmail, NotificationsList/Detail, Settings/ChangePassword/Sessions - APNs push notifications with UIApplicationDelegate - ActivityKit Live Activities for Dynamic Island + Lock Screen - Keychain (Security framework) token storage - 30-second polling with pagination for notifications - Xcode project file (project.pbxproj) with correct build phases for both targets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
50 lines
1.0 KiB
Swift
50 lines
1.0 KiB
Swift
import ActivityKit
|
|
import Foundation
|
|
|
|
struct AlertAttributes: ActivityAttributes {
|
|
let topic: String
|
|
let alertId: String
|
|
let severity: Severity
|
|
|
|
struct ContentState: Codable, Hashable {
|
|
let title: String
|
|
let value: String?
|
|
let status: AlertStatus
|
|
let startedAt: Date
|
|
let updatedAt: Date
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case title, value, status
|
|
case startedAt = "startedAt"
|
|
case updatedAt = "updatedAt"
|
|
}
|
|
}
|
|
}
|
|
|
|
enum Severity: String, Codable, Hashable {
|
|
case critical
|
|
case warning
|
|
case info
|
|
|
|
var color: String {
|
|
switch self {
|
|
case .critical: return "red"
|
|
case .warning: return "yellow"
|
|
case .info: return "blue"
|
|
}
|
|
}
|
|
|
|
var emoji: String {
|
|
switch self {
|
|
case .critical: return "🔴"
|
|
case .warning: return "🟡"
|
|
case .info: return "🔵"
|
|
}
|
|
}
|
|
}
|
|
|
|
enum AlertStatus: String, Codable, Hashable {
|
|
case active
|
|
case resolved
|
|
}
|