@@ -103,22 +103,22 @@ struct NotificationHelper {
103
103
} else if contact. preferenceIsWeekly ( ) || contact. preferenceIsMonthly ( ) {
104
104
components. hour = contact. notification_preference_hour
105
105
components. minute = contact. notification_preference_minute
106
- components. weekday = contact. notification_preference_weekday + 1
106
+ components. weekday = contact. notification_preference_weekday+ 1
107
107
if contact. notification_preference_week_of_month != 0 {
108
- components. weekOfMonth = contact. notification_preference_week_of_month + 1
108
+ components. weekOfMonth = contact. notification_preference_week_of_month+ 1
109
109
}
110
110
} else if contact. preferenceIsQuarterly ( ) {
111
- print ( " Quarterly is handled separately by UNTimeIntervalNotificationTrigger " )
111
+ print ( " Quarterly is handled separately by UNTimeIntervalNotificationTrigger. Fallthrough. " )
112
112
} else if contact. preferenceIsAnnually ( ) || contact. preferenceIsCustom ( ) {
113
- components. hour = contact. notification_preference_hour
114
113
components. minute = contact. notification_preference_minute
114
+ components. hour = contact. notification_preference_hour
115
+ components. day = contact. notification_preference_custom_day
116
+ components. month = contact. notification_preference_custom_month
115
117
if contact. preferenceIsAnnually ( ) {
116
- components. month = contact . notification_preference_custom_month + 1
118
+ components. year = nil
117
119
} else if contact. preferenceIsCustom ( ) {
118
- components. month = contact. notification_preference_custom_month
120
+ components. year = contact. notification_preference_custom_year
119
121
}
120
- components. day = contact. notification_preference_custom_day
121
- components. year = contact. notification_preference_custom_year
122
122
}
123
123
124
124
var soonestUpcomingNotificationDateString = " "
@@ -163,12 +163,12 @@ struct NotificationHelper {
163
163
dateComponents. weekOfMonth = contact. notification_preference_week_of_month
164
164
} else if contact. preferenceIsAnnually ( ) || contact. preferenceIsCustom ( ) {
165
165
if contact. preferenceIsAnnually ( ) {
166
- dateComponents. month = contact . notification_preference_custom_month + 1
166
+ dateComponents. year = nil
167
167
} else if contact. preferenceIsCustom ( ) {
168
- dateComponents. month = contact. notification_preference_custom_month
168
+ dateComponents. year = contact. notification_preference_custom_year
169
169
}
170
+ dateComponents. month = contact. notification_preference_custom_month
170
171
dateComponents. day = contact. notification_preference_custom_day
171
- dateComponents. year = contact. notification_preference_custom_year
172
172
dateComponents. hour = contact. notification_preference_hour
173
173
dateComponents. minute = contact. notification_preference_minute
174
174
}
@@ -399,20 +399,16 @@ struct NotificationHelper {
399
399
return formattedDate
400
400
}
401
401
402
- // print("returning Unknown")
403
402
return " Unknown "
404
403
}
405
404
406
405
static func setYearPreference( for contact: SelectedContact ) {
407
406
var contactDateComponents = NotificationHelper . getNotificationDateComponents ( for: contact)
408
407
contactDateComponents. year = Calendar . current. component ( . year, from: Date ( ) )
409
408
if let nextNotificationDate = Calendar . current. date ( from: contactDateComponents) {
410
- print ( " nextNotificationDate for bee: \( nextNotificationDate) " )
411
409
if nextNotificationDate < Date ( ) {
412
- print ( " \( Date ( ) ) for bee is greater than \( nextNotificationDate) " )
413
- contact. notification_preference_custom_year = Calendar . current. component ( . year, from: Date ( ) ) + 1
410
+ contact. notification_preference_custom_year = Calendar . current. component ( . year, from: Date ( ) ) + 1
414
411
} else {
415
- print ( " \( Date ( ) ) for bee is less than \( nextNotificationDate) " )
416
412
contact. notification_preference_custom_year = Calendar . current. component ( . year, from: Date ( ) )
417
413
}
418
414
print ( " set \( contact. name) 's year preference to \( contact. notification_preference_custom_year) " )
0 commit comments