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>
48 lines
1.0 KiB
Swift
48 lines
1.0 KiB
Swift
import Foundation
|
|
|
|
struct AppNotification: Codable, Identifiable {
|
|
let id: UUID
|
|
let topic: String
|
|
let subject: String
|
|
let body: String
|
|
let metadata: [String: String]?
|
|
let status: NotificationStatus
|
|
let channel: NotificationChannel
|
|
let readAt: Date?
|
|
let createdAt: Date
|
|
let updatedAt: Date
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case id, topic, subject, body, metadata, status, channel
|
|
case readAt = "read_at"
|
|
case createdAt = "created_at"
|
|
case updatedAt = "updated_at"
|
|
}
|
|
|
|
var isRead: Bool { readAt != nil }
|
|
}
|
|
|
|
enum NotificationStatus: String, Codable {
|
|
case sent
|
|
case delivered
|
|
case read
|
|
}
|
|
|
|
enum NotificationChannel: String, Codable {
|
|
case inApp = "in_app"
|
|
case push
|
|
case email
|
|
}
|
|
|
|
struct NotificationsPage: Codable {
|
|
let items: [AppNotification]
|
|
let total: Int
|
|
let page: Int
|
|
let perPage: Int
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case items, total, page
|
|
case perPage = "per_page"
|
|
}
|
|
}
|