@@ -23,11 +23,8 @@ @implementation FlutterLocalNotificationsPlugin {
2323NSString *const INITIALIZE_METHOD = @" initialize" ;
2424NSString *const GET_CALLBACK_METHOD = @" getCallbackHandle" ;
2525NSString *const SHOW_METHOD = @" show" ;
26- NSString *const SCHEDULE_METHOD = @" schedule" ;
2726NSString *const ZONED_SCHEDULE_METHOD = @" zonedSchedule" ;
2827NSString *const PERIODICALLY_SHOW_METHOD = @" periodicallyShow" ;
29- NSString *const SHOW_DAILY_AT_TIME_METHOD = @" showDailyAtTime" ;
30- NSString *const SHOW_WEEKLY_AT_DAY_AND_TIME_METHOD = @" showWeeklyAtDayAndTime" ;
3128NSString *const CANCEL_METHOD = @" cancel" ;
3229NSString *const CANCEL_ALL_METHOD = @" cancelAll" ;
3330NSString *const PENDING_NOTIFICATIONS_REQUESTS_METHOD =
@@ -77,10 +74,6 @@ @implementation FlutterLocalNotificationsPlugin {
7774NSString *const BADGE_NUMBER = @" badgeNumber" ;
7875NSString *const MILLISECONDS_SINCE_EPOCH = @" millisecondsSinceEpoch" ;
7976NSString *const REPEAT_INTERVAL = @" repeatInterval" ;
80- NSString *const REPEAT_TIME = @" repeatTime" ;
81- NSString *const HOUR = @" hour" ;
82- NSString *const MINUTE = @" minute" ;
83- NSString *const SECOND = @" second" ;
8477NSString *const SCHEDULED_DATE_TIME = @" scheduledDateTimeISO8601" ;
8578NSString *const TIME_ZONE_NAME = @" timeZoneName" ;
8679NSString *const MATCH_DATE_TIME_COMPONENTS = @" matchDateTimeComponents" ;
@@ -167,14 +160,8 @@ - (void)handleMethodCall:(FlutterMethodCall *)call
167160 [self show: call.arguments result: result];
168161 } else if ([ZONED_SCHEDULE_METHOD isEqualToString: call.method]) {
169162 [self zonedSchedule: call.arguments result: result];
170- } else if ([SCHEDULE_METHOD isEqualToString: call.method]) {
171- [self schedule: call.arguments result: result];
172163 } else if ([PERIODICALLY_SHOW_METHOD isEqualToString: call.method]) {
173164 [self periodicallyShow: call.arguments result: result];
174- } else if ([SHOW_DAILY_AT_TIME_METHOD isEqualToString: call.method]) {
175- [self showDailyAtTime: call.arguments result: result];
176- } else if ([SHOW_WEEKLY_AT_DAY_AND_TIME_METHOD isEqualToString: call.method]) {
177- [self showWeeklyAtDayAndTime: call.arguments result: result];
178165 } else if ([REQUEST_PERMISSIONS_METHOD isEqualToString: call.method]) {
179166 [self requestPermissions: call.arguments result: result];
180167 } else if ([CANCEL_METHOD isEqualToString: call.method]) {
@@ -660,44 +647,6 @@ - (void)zonedSchedule:(NSDictionary *_Nonnull)arguments
660647 }
661648}
662649
663- - (void )schedule : (NSDictionary *_Nonnull)arguments
664- result : (FlutterResult _Nonnull)result {
665- NSNumber *secondsSinceEpoch =
666- @([arguments[MILLISECONDS_SINCE_EPOCH] longLongValue ] / 1000 );
667- if (@available (iOS 10.0 , *)) {
668- UNMutableNotificationContent *content =
669- [self buildStandardNotificationContent: arguments result: result];
670- NSDate *date = [NSDate
671- dateWithTimeIntervalSince1970: [secondsSinceEpoch longLongValue ]];
672- NSCalendar *calendar = [NSCalendar currentCalendar ];
673- NSDateComponents *dateComponents =
674- [calendar components: (NSCalendarUnitYear | NSCalendarUnitMonth |
675- NSCalendarUnitDay | NSCalendarUnitHour |
676- NSCalendarUnitMinute | NSCalendarUnitSecond)
677- fromDate: date];
678- UNCalendarNotificationTrigger *trigger = [UNCalendarNotificationTrigger
679- triggerWithDateMatchingComponents: dateComponents
680- repeats: false ];
681- [self addNotificationRequest: [self getIdentifier: arguments]
682- content: content
683- result: result
684- trigger: trigger];
685- } else {
686- #pragma clang diagnostic push
687- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
688- UILocalNotification *notification =
689- [self buildStandardUILocalNotification: arguments];
690- #pragma clang diagnostic pop
691- notification.fireDate = [NSDate
692- dateWithTimeIntervalSince1970: [secondsSinceEpoch longLongValue ]];
693- #pragma clang diagnostic push
694- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
695- [[UIApplication sharedApplication ] scheduleLocalNotification: notification];
696- #pragma clang diagnostic pop
697- result (nil );
698- }
699- }
700-
701650- (void )periodicallyShow : (NSDictionary *_Nonnull)arguments
702651 result : (FlutterResult _Nonnull)result {
703652 if (@available (iOS 10.0 , *)) {
@@ -743,91 +692,6 @@ - (void)periodicallyShow:(NSDictionary *_Nonnull)arguments
743692 }
744693}
745694
746- - (void )showDailyAtTime : (NSDictionary *_Nonnull)arguments
747- result : (FlutterResult _Nonnull)result {
748- NSDictionary *timeArguments = (NSDictionary *)arguments[REPEAT_TIME];
749- NSNumber *hourComponent = timeArguments[HOUR];
750- NSNumber *minutesComponent = timeArguments[MINUTE];
751- NSNumber *secondsComponent = timeArguments[SECOND];
752- if (@available (iOS 10.0 , *)) {
753- UNMutableNotificationContent *content =
754- [self buildStandardNotificationContent: arguments result: result];
755- NSDateComponents *dateComponents = [[NSDateComponents alloc ] init ];
756- [dateComponents setHour: [hourComponent integerValue ]];
757- [dateComponents setMinute: [minutesComponent integerValue ]];
758- [dateComponents setSecond: [secondsComponent integerValue ]];
759- UNCalendarNotificationTrigger *trigger = [UNCalendarNotificationTrigger
760- triggerWithDateMatchingComponents: dateComponents
761- repeats: YES ];
762- [self addNotificationRequest: [self getIdentifier: arguments]
763- content: content
764- result: result
765- trigger: trigger];
766- } else {
767- #pragma clang diagnostic push
768- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
769- UILocalNotification *notification =
770- [self buildStandardUILocalNotification: arguments];
771- #pragma clang diagnostic pop
772- notification.repeatInterval = NSCalendarUnitDay;
773- NSDateComponents *dateComponents = [[NSDateComponents alloc ] init ];
774- [dateComponents setHour: [hourComponent integerValue ]];
775- [dateComponents setMinute: [minutesComponent integerValue ]];
776- [dateComponents setSecond: [secondsComponent integerValue ]];
777- NSCalendar *calendar = [NSCalendar currentCalendar ];
778- notification.fireDate = [calendar dateFromComponents: dateComponents];
779- #pragma clang diagnostic push
780- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
781- [[UIApplication sharedApplication ] scheduleLocalNotification: notification];
782- #pragma clang diagnostic pop
783- result (nil );
784- }
785- }
786-
787- - (void )showWeeklyAtDayAndTime : (NSDictionary *_Nonnull)arguments
788- result : (FlutterResult _Nonnull)result {
789- NSDictionary *timeArguments = (NSDictionary *)arguments[REPEAT_TIME];
790- NSNumber *dayOfWeekComponent = arguments[DAY];
791- NSNumber *hourComponent = timeArguments[HOUR];
792- NSNumber *minutesComponent = timeArguments[MINUTE];
793- NSNumber *secondsComponent = timeArguments[SECOND];
794- if (@available (iOS 10.0 , *)) {
795- UNMutableNotificationContent *content =
796- [self buildStandardNotificationContent: arguments result: result];
797- NSDateComponents *dateComponents = [[NSDateComponents alloc ] init ];
798- [dateComponents setHour: [hourComponent integerValue ]];
799- [dateComponents setMinute: [minutesComponent integerValue ]];
800- [dateComponents setSecond: [secondsComponent integerValue ]];
801- [dateComponents setWeekday: [dayOfWeekComponent integerValue ]];
802- UNCalendarNotificationTrigger *trigger = [UNCalendarNotificationTrigger
803- triggerWithDateMatchingComponents: dateComponents
804- repeats: YES ];
805- [self addNotificationRequest: [self getIdentifier: arguments]
806- content: content
807- result: result
808- trigger: trigger];
809- } else {
810- #pragma clang diagnostic push
811- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
812- UILocalNotification *notification =
813- [self buildStandardUILocalNotification: arguments];
814- #pragma clang diagnostic pop
815- notification.repeatInterval = NSCalendarUnitWeekOfYear;
816- NSDateComponents *dateComponents = [[NSDateComponents alloc ] init ];
817- [dateComponents setHour: [hourComponent integerValue ]];
818- [dateComponents setMinute: [minutesComponent integerValue ]];
819- [dateComponents setSecond: [secondsComponent integerValue ]];
820- [dateComponents setWeekday: [dayOfWeekComponent integerValue ]];
821- NSCalendar *calendar = [NSCalendar currentCalendar ];
822- notification.fireDate = [calendar dateFromComponents: dateComponents];
823- #pragma clang diagnostic push
824- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
825- [[UIApplication sharedApplication ] scheduleLocalNotification: notification];
826- #pragma clang diagnostic pop
827- result (nil );
828- }
829- }
830-
831695- (void )cancel : (NSNumber *)id result : (FlutterResult _Nonnull)result {
832696 if (@available (iOS 10.0 , *)) {
833697 UNUserNotificationCenter *center =
0 commit comments