feat: add complete Mayday iOS Xcode project
- 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>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import Foundation
|
||||
|
||||
struct UserResponse: Codable, Identifiable {
|
||||
let id: UUID
|
||||
let email: String
|
||||
let status: UserStatus
|
||||
let metadata: [String: AnyCodable]?
|
||||
let emailVerifiedAt: Date?
|
||||
let roles: [String]
|
||||
let createdAt: Date
|
||||
let updatedAt: Date
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id, email, status, metadata, roles
|
||||
case emailVerifiedAt = "email_verified_at"
|
||||
case createdAt = "created_at"
|
||||
case updatedAt = "updated_at"
|
||||
}
|
||||
}
|
||||
|
||||
enum UserStatus: String, Codable {
|
||||
case pending
|
||||
case active
|
||||
case suspended
|
||||
case deleted
|
||||
}
|
||||
|
||||
// Helper for Any JSON values
|
||||
struct AnyCodable: Codable {
|
||||
let value: Any
|
||||
|
||||
init(_ value: Any) {
|
||||
self.value = value
|
||||
}
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
if let int = try? container.decode(Int.self) {
|
||||
value = int
|
||||
} else if let double = try? container.decode(Double.self) {
|
||||
value = double
|
||||
} else if let bool = try? container.decode(Bool.self) {
|
||||
value = bool
|
||||
} else if let string = try? container.decode(String.self) {
|
||||
value = string
|
||||
} else {
|
||||
value = ""
|
||||
}
|
||||
}
|
||||
|
||||
func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
switch value {
|
||||
case let int as Int: try container.encode(int)
|
||||
case let double as Double: try container.encode(double)
|
||||
case let bool as Bool: try container.encode(bool)
|
||||
case let string as String: try container.encode(string)
|
||||
default: try container.encode("")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user