fix(ios): resolve compilation errors and enable successful build
Fixed critical compilation errors preventing iOS plugin build: - Updated logger API calls from logger.debug(TAG, msg) to logger.log(.debug, msg) across all iOS plugin files to match DailyNotificationLogger interface - Fixed async/await concurrency in makeConditionalRequest using semaphore pattern - Fixed NotificationContent immutability by creating new instances instead of mutation - Changed private access control to internal for extension-accessible methods - Added iOS 15.0+ availability checks for interruptionLevel property - Fixed static member references using Self.MEMBER_NAME syntax - Added missing .scheduling case to exhaustive switch statement - Fixed variable initialization in retry state closures Added DailyNotificationStorage.swift implementation matching Android pattern. Updated build scripts with improved error reporting and full log visibility. iOS plugin now compiles successfully. All build errors resolved.
This commit is contained in:
@@ -68,7 +68,7 @@ class DailyNotificationErrorHandler {
|
||||
self.logger = logger
|
||||
self.config = ErrorConfiguration()
|
||||
|
||||
logger.debug(DailyNotificationErrorHandler.TAG, "ErrorHandler initialized with max retries: \(config.maxRetries)")
|
||||
logger.log(.debug, "ErrorHandler initialized with max retries: \(config.maxRetries)")
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ class DailyNotificationErrorHandler {
|
||||
self.logger = logger
|
||||
self.config = config
|
||||
|
||||
logger.debug(DailyNotificationErrorHandler.TAG, "ErrorHandler initialized with max retries: \(config.maxRetries)")
|
||||
logger.log(.debug, "ErrorHandler initialized with max retries: \(config.maxRetries)")
|
||||
}
|
||||
|
||||
// MARK: - Error Handling
|
||||
@@ -96,7 +96,7 @@ class DailyNotificationErrorHandler {
|
||||
*/
|
||||
func handleError(operationId: String, error: Error, retryable: Bool) -> ErrorResult {
|
||||
do {
|
||||
logger.debug(DailyNotificationErrorHandler.TAG, "Handling error for operation: \(operationId)")
|
||||
logger.log(.debug, "Handling error for operation: \(operationId)")
|
||||
|
||||
// Categorize error
|
||||
let errorInfo = categorizeError(error)
|
||||
@@ -112,7 +112,7 @@ class DailyNotificationErrorHandler {
|
||||
}
|
||||
|
||||
} catch {
|
||||
logger.error(DailyNotificationErrorHandler.TAG, "Error in error handler: \(error)")
|
||||
logger.log(.error, "Error in error handler: \(error)")
|
||||
return ErrorResult.fatal(message: "Error handler failure: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ class DailyNotificationErrorHandler {
|
||||
*/
|
||||
func handleError(operationId: String, error: Error, retryConfig: RetryConfiguration) -> ErrorResult {
|
||||
do {
|
||||
logger.debug(DailyNotificationErrorHandler.TAG, "Handling error with custom retry config for operation: \(operationId)")
|
||||
logger.log(.debug, "Handling error with custom retry config for operation: \(operationId)")
|
||||
|
||||
// Categorize error
|
||||
let errorInfo = categorizeError(error)
|
||||
@@ -143,7 +143,7 @@ class DailyNotificationErrorHandler {
|
||||
}
|
||||
|
||||
} catch {
|
||||
logger.error(DailyNotificationErrorHandler.TAG, "Error in error handler with custom config: \(error)")
|
||||
logger.log(.error, "Error in error handler with custom config: \(error)")
|
||||
return ErrorResult.fatal(message: "Error handler failure: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
@@ -170,11 +170,11 @@ class DailyNotificationErrorHandler {
|
||||
timestamp: Date()
|
||||
)
|
||||
|
||||
logger.debug(DailyNotificationErrorHandler.TAG, "Error categorized: \(errorInfo)")
|
||||
logger.log(.debug, "Error categorized: \(errorInfo)")
|
||||
return errorInfo
|
||||
|
||||
} catch {
|
||||
logger.error(DailyNotificationErrorHandler.TAG, "Error during categorization: \(error)")
|
||||
logger.log(.error, "Error during categorization: \(error)")
|
||||
return ErrorInfo(
|
||||
error: error,
|
||||
category: .unknown,
|
||||
@@ -299,7 +299,7 @@ class DailyNotificationErrorHandler {
|
||||
private func shouldRetry(operationId: String, errorInfo: ErrorInfo, retryConfig: RetryConfiguration?) -> Bool {
|
||||
do {
|
||||
// Get retry state
|
||||
var state: RetryState
|
||||
var state: RetryState!
|
||||
retryQueue.sync {
|
||||
if retryStates[operationId] == nil {
|
||||
retryStates[operationId] = RetryState()
|
||||
@@ -310,18 +310,18 @@ class DailyNotificationErrorHandler {
|
||||
// Check retry limits
|
||||
let maxRetries = retryConfig?.maxRetries ?? config.maxRetries
|
||||
if state.attemptCount >= maxRetries {
|
||||
logger.debug(DailyNotificationErrorHandler.TAG, "Max retries exceeded for operation: \(operationId)")
|
||||
logger.log(.debug, "Max retries exceeded for operation: \(operationId)")
|
||||
return false
|
||||
}
|
||||
|
||||
// Check if error is retryable based on category
|
||||
let isRetryable = isErrorRetryable(errorInfo.category)
|
||||
|
||||
logger.debug(DailyNotificationErrorHandler.TAG, "Should retry: \(isRetryable) (attempt: \(state.attemptCount)/\(maxRetries))")
|
||||
logger.log(.debug, "Should retry: \(isRetryable) (attempt: \(state.attemptCount)/\(maxRetries))")
|
||||
return isRetryable
|
||||
|
||||
} catch {
|
||||
logger.error(DailyNotificationErrorHandler.TAG, "Error checking retry eligibility: \(error)")
|
||||
logger.log(.error, "Error checking retry eligibility: \(error)")
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -336,7 +336,7 @@ class DailyNotificationErrorHandler {
|
||||
switch category {
|
||||
case .network, .storage:
|
||||
return true
|
||||
case .permission, .configuration, .system, .unknown:
|
||||
case .permission, .configuration, .system, .unknown, .scheduling:
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -362,8 +362,11 @@ class DailyNotificationErrorHandler {
|
||||
*/
|
||||
private func handleRetryableError(operationId: String, errorInfo: ErrorInfo, retryConfig: RetryConfiguration?) -> ErrorResult {
|
||||
do {
|
||||
var state: RetryState
|
||||
var state: RetryState!
|
||||
retryQueue.sync {
|
||||
if retryStates[operationId] == nil {
|
||||
retryStates[operationId] = RetryState()
|
||||
}
|
||||
state = retryStates[operationId]!
|
||||
state.attemptCount += 1
|
||||
}
|
||||
@@ -372,12 +375,12 @@ class DailyNotificationErrorHandler {
|
||||
let delay = calculateRetryDelay(attemptCount: state.attemptCount, retryConfig: retryConfig)
|
||||
state.nextRetryTime = Date().addingTimeInterval(delay)
|
||||
|
||||
logger.info(DailyNotificationErrorHandler.TAG, "Retryable error handled - retry in \(delay)s (attempt \(state.attemptCount))")
|
||||
logger.log(.info, "Retryable error handled - retry in \(delay)s (attempt \(state.attemptCount))")
|
||||
|
||||
return ErrorResult.retryable(errorInfo: errorInfo, retryDelaySeconds: delay, attemptCount: state.attemptCount)
|
||||
|
||||
} catch {
|
||||
logger.error(DailyNotificationErrorHandler.TAG, "Error handling retryable error: \(error)")
|
||||
logger.log(.error, "Error handling retryable error: \(error)")
|
||||
return ErrorResult.fatal(message: "Retry handling failure: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
@@ -391,7 +394,7 @@ class DailyNotificationErrorHandler {
|
||||
*/
|
||||
private func handleNonRetryableError(operationId: String, errorInfo: ErrorInfo) -> ErrorResult {
|
||||
do {
|
||||
logger.warning(DailyNotificationErrorHandler.TAG, "Non-retryable error handled for operation: \(operationId)")
|
||||
logger.log(.warning, "Non-retryable error handled for operation: \(operationId)")
|
||||
|
||||
// Clean up retry state
|
||||
retryQueue.async(flags: .barrier) {
|
||||
@@ -401,7 +404,7 @@ class DailyNotificationErrorHandler {
|
||||
return ErrorResult.fatal(errorInfo: errorInfo)
|
||||
|
||||
} catch {
|
||||
logger.error(DailyNotificationErrorHandler.TAG, "Error handling non-retryable error: \(error)")
|
||||
logger.log(.error, "Error handling non-retryable error: \(error)")
|
||||
return ErrorResult.fatal(message: "Non-retryable error handling failure: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
@@ -429,11 +432,11 @@ class DailyNotificationErrorHandler {
|
||||
let jitter = delay * 0.1 * Double.random(in: 0...1)
|
||||
delay += jitter
|
||||
|
||||
logger.debug(DailyNotificationErrorHandler.TAG, "Calculated retry delay: \(delay)s (attempt \(attemptCount))")
|
||||
logger.log(.debug, "Calculated retry delay: \(delay)s (attempt \(attemptCount))")
|
||||
return delay
|
||||
|
||||
} catch {
|
||||
logger.error(DailyNotificationErrorHandler.TAG, "Error calculating retry delay: \(error)")
|
||||
logger.log(.error, "Error calculating retry delay: \(error)")
|
||||
return config.baseDelaySeconds
|
||||
}
|
||||
}
|
||||
@@ -454,7 +457,7 @@ class DailyNotificationErrorHandler {
|
||||
*/
|
||||
func resetMetrics() {
|
||||
metrics.reset()
|
||||
logger.debug(DailyNotificationErrorHandler.TAG, "Error metrics reset")
|
||||
logger.log(.debug, "Error metrics reset")
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -487,7 +490,7 @@ class DailyNotificationErrorHandler {
|
||||
retryQueue.async(flags: .barrier) {
|
||||
self.retryStates.removeAll()
|
||||
}
|
||||
logger.debug(DailyNotificationErrorHandler.TAG, "Retry states cleared")
|
||||
logger.log(.debug, "Retry states cleared")
|
||||
}
|
||||
|
||||
// MARK: - Data Classes
|
||||
|
||||
Reference in New Issue
Block a user