- 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
48 lines
1.7 KiB
Markdown
48 lines
1.7 KiB
Markdown
## Fixing Code Review Issues
|
|
|
|
I have addressed all critical issues from the code review:
|
|
|
|
### Fixed Issues in NotificationService.swift
|
|
|
|
1. **Fixed authorization handling** (line 50-65)
|
|
- Changed from switch on Bool to proper `try` block with Boolean result
|
|
- Now correctly handles authorized/denied states
|
|
|
|
2. **Removed invalid icon property** (line 167)
|
|
- Removed `notificationContent.icon = icon` - iOS doesn't support custom notification icons
|
|
|
|
3. **Removed invalid haptic property** (line 169)
|
|
- Removed `notificationContent.haptic = .medium` - not a valid property
|
|
|
|
4. **Fixed deliveryDate** (line 172)
|
|
- Changed from `notificationContent.date` to `notificationContent.deliveryDate`
|
|
|
|
5. **Removed invalid presentNotificationRequest** (line 188)
|
|
- Removed `presentNotificationRequest` call - only `add` is needed
|
|
|
|
6. **Fixed trigger initialization** (line 182)
|
|
- Changed from invalid `dateMatched` to proper `dateComponents` for calendar-based triggers
|
|
|
|
7. **Simplified notification categories**
|
|
- Removed complex category setup using deprecated APIs
|
|
- Implemented delegate methods for foreground notification handling
|
|
|
|
### Fixed Issues in NotificationManager.swift
|
|
|
|
1. **Removed non-existent UNNotificationBadgeManager** (line 75)
|
|
- Replaced with `UIApplication.shared.applicationIconBadgeNumber`
|
|
|
|
2. **Eliminated code duplication** (lines 75-103)
|
|
- Removed 10+ duplicate badge assignment lines
|
|
- Simplified to single badge update call
|
|
|
|
### Additional Changes
|
|
|
|
- Added `import UIKit` to NotificationService
|
|
- Added UNUserNotificationCenterDelegate implementation
|
|
- Fixed NotificationPreferencesStore JSON encoding/decoding
|
|
|
|
### Testing
|
|
|
|
Code should now compile without errors. Ready for re-review.
|