- Fixed authorization handling in NotificationService - Removed invalid icon and haptic properties - Fixed deliveryDate API usage - Removed invalid presentNotificationRequest call - Fixed notification trigger initialization - Simplified notification categories with delegate implementation - Replaced UNNotificationBadgeManager with UIApplication.shared.applicationIconBadgeNumber - Eliminated code duplication in badge update logic - Fixed NotificationPreferencesStore JSON encoding/decoding
1.7 KiB
1.7 KiB
Fixing Code Review Issues
I have addressed all critical issues from the code review:
Fixed Issues in NotificationService.swift
-
Fixed authorization handling (line 50-65)
- Changed from switch on Bool to proper
tryblock with Boolean result - Now correctly handles authorized/denied states
- Changed from switch on Bool to proper
-
Removed invalid icon property (line 167)
- Removed
notificationContent.icon = icon- iOS doesn't support custom notification icons
- Removed
-
Removed invalid haptic property (line 169)
- Removed
notificationContent.haptic = .medium- not a valid property
- Removed
-
Fixed deliveryDate (line 172)
- Changed from
notificationContent.datetonotificationContent.deliveryDate
- Changed from
-
Removed invalid presentNotificationRequest (line 188)
- Removed
presentNotificationRequestcall - onlyaddis needed
- Removed
-
Fixed trigger initialization (line 182)
- Changed from invalid
dateMatchedto properdateComponentsfor calendar-based triggers
- Changed from invalid
-
Simplified notification categories
- Removed complex category setup using deprecated APIs
- Implemented delegate methods for foreground notification handling
Fixed Issues in NotificationManager.swift
-
Removed non-existent UNNotificationBadgeManager (line 75)
- Replaced with
UIApplication.shared.applicationIconBadgeNumber
- Replaced with
-
Eliminated code duplication (lines 75-103)
- Removed 10+ duplicate badge assignment lines
- Simplified to single badge update call
Additional Changes
- Added
import UIKitto NotificationService - Added UNUserNotificationCenterDelegate implementation
- Fixed NotificationPreferencesStore JSON encoding/decoding
Testing
Code should now compile without errors. Ready for re-review.