feat(ios): implement Phase 1 permission methods and fix build issues
Implement checkPermissionStatus() and requestNotificationPermissions() methods for iOS plugin, matching Android functionality. Fix compilation errors across plugin files and add comprehensive build/test infrastructure. Key Changes: - Add checkPermissionStatus() and requestNotificationPermissions() methods - Fix 13+ categories of Swift compilation errors (type conversions, logger API, access control, async/await, etc.) - Create DailyNotificationScheduler, DailyNotificationStorage, DailyNotificationStateActor, and DailyNotificationErrorCodes components - Fix CoreData initialization to handle missing model gracefully for Phase 1 - Add iOS test app build script with simulator auto-detection - Update directive with lessons learned from build and permission work Build Status: ✅ BUILD SUCCEEDED Test App: ✅ Ready for iOS Simulator testing Files Modified: - doc/directives/0003-iOS-Android-Parity-Directive.md (lessons learned) - ios/Plugin/DailyNotificationPlugin.swift (Phase 1 methods) - ios/Plugin/DailyNotificationModel.swift (CoreData fix) - 11+ other plugin files (compilation fixes) Files Added: - ios/Plugin/DailyNotificationScheduler.swift - ios/Plugin/DailyNotificationStorage.swift - ios/Plugin/DailyNotificationStateActor.swift - ios/Plugin/DailyNotificationErrorCodes.swift - scripts/build-ios-test-app.sh - scripts/setup-ios-test-app.sh - test-apps/ios-test-app/ (full test app) - Multiple Phase 1 documentation files
This commit is contained in:
112
ios/Plugin/DailyNotificationErrorCodes.swift
Normal file
112
ios/Plugin/DailyNotificationErrorCodes.swift
Normal file
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* DailyNotificationErrorCodes.swift
|
||||
*
|
||||
* Error code constants matching Android implementation
|
||||
*
|
||||
* @author Matthew Raymer
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
|
||||
/**
|
||||
* Error code constants matching Android error handling
|
||||
*
|
||||
* These error codes must match Android's error response format:
|
||||
* {
|
||||
* "error": "error_code",
|
||||
* "message": "Human-readable error message"
|
||||
* }
|
||||
*/
|
||||
struct DailyNotificationErrorCodes {
|
||||
|
||||
// MARK: - Permission Errors
|
||||
|
||||
static let NOTIFICATIONS_DENIED = "notifications_denied"
|
||||
static let BACKGROUND_REFRESH_DISABLED = "background_refresh_disabled"
|
||||
static let PERMISSION_DENIED = "permission_denied"
|
||||
|
||||
// MARK: - Configuration Errors
|
||||
|
||||
static let INVALID_TIME_FORMAT = "invalid_time_format"
|
||||
static let INVALID_TIME_VALUES = "invalid_time_values"
|
||||
static let CONFIGURATION_FAILED = "configuration_failed"
|
||||
static let MISSING_REQUIRED_PARAMETER = "missing_required_parameter"
|
||||
|
||||
// MARK: - Scheduling Errors
|
||||
|
||||
static let SCHEDULING_FAILED = "scheduling_failed"
|
||||
static let TASK_SCHEDULING_FAILED = "task_scheduling_failed"
|
||||
static let NOTIFICATION_SCHEDULING_FAILED = "notification_scheduling_failed"
|
||||
|
||||
// MARK: - Storage Errors
|
||||
|
||||
static let STORAGE_ERROR = "storage_error"
|
||||
static let DATABASE_ERROR = "database_error"
|
||||
|
||||
// MARK: - Network Errors (Phase 3)
|
||||
|
||||
static let NETWORK_ERROR = "network_error"
|
||||
static let FETCH_FAILED = "fetch_failed"
|
||||
static let TIMEOUT = "timeout"
|
||||
|
||||
// MARK: - System Errors
|
||||
|
||||
static let PLUGIN_NOT_INITIALIZED = "plugin_not_initialized"
|
||||
static let INTERNAL_ERROR = "internal_error"
|
||||
static let SYSTEM_ERROR = "system_error"
|
||||
|
||||
// MARK: - Helper Methods
|
||||
|
||||
/**
|
||||
* Create error response dictionary
|
||||
*
|
||||
* @param code Error code
|
||||
* @param message Human-readable error message
|
||||
* @return Error response dictionary
|
||||
*/
|
||||
static func createErrorResponse(code: String, message: String) -> [String: Any] {
|
||||
return [
|
||||
"error": code,
|
||||
"message": message
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Create error response for missing parameter
|
||||
*
|
||||
* @param parameter Parameter name
|
||||
* @return Error response dictionary
|
||||
*/
|
||||
static func missingParameter(_ parameter: String) -> [String: Any] {
|
||||
return createErrorResponse(
|
||||
code: MISSING_REQUIRED_PARAMETER,
|
||||
message: "Missing required parameter: \(parameter)"
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create error response for invalid time format
|
||||
*
|
||||
* @return Error response dictionary
|
||||
*/
|
||||
static func invalidTimeFormat() -> [String: Any] {
|
||||
return createErrorResponse(
|
||||
code: INVALID_TIME_FORMAT,
|
||||
message: "Invalid time format. Use HH:mm"
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create error response for notifications denied
|
||||
*
|
||||
* @return Error response dictionary
|
||||
*/
|
||||
static func notificationsDenied() -> [String: Any] {
|
||||
return createErrorResponse(
|
||||
code: NOTIFICATIONS_DENIED,
|
||||
message: "Notification permissions denied"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user