NativeScript / NativeScript/plugins

[@nativescript/local-notifications] Schedule not work on iOS with Buddhist calendar

Đang mở
#87 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
TypeScript
Star
206
Fork
123
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
1

Mô tả

Dear sir,
I had upgraded my app to NativeScript 7 and the notification (@nativescript/local-notifications, version 5.1.0) does not work on iOS (14.4). After debugging all day, I found that LocalNotifications.schedule() not work because my iPhone is set the calendar to Buddhist.

The bug is in the index.ios.js file, in the method schedulePendingNotificationsNew() of class LocalNotificationsImpl as part of code below:

 // Notification trigger and repeat
 let trigger;
 if (options.at) {
   const cal = NSCalendar.currentCalendar;  //LocalNotificationsImpl.calendarWithMondayAsFirstDay();
   const date = cal.componentsFromDate(LocalNotificationsImpl.getInterval(options.interval), options.at);
   date.timeZone = NSTimeZone.defaultTimeZone;
   trigger = UNCalendarNotificationTrigger.triggerWithDateMatchingComponentsRepeats(date, options.interval !== undefined);
 }
 else {
   trigger = UNTimeIntervalNotificationTrigger.triggerWithTimeIntervalRepeats(2, false);
 }

At the line 137, the LocalNotificationsImpl.calendarWithMondayAsFirstDay() which return ISO8601 (Gregorian) calendar make a wrong matching trigger. So, I change the code to use the NSCalendar.currentCalendar and It work well.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu trong index.ios.js tại LocalNotificationsImpl.schedulePendingNotificationsNew(), sau đó kiểm tra calendarWithMondayAsFirstDay() và cách xây dựng trigger được trình bày trong báo cáo. Tái hiện trên iOS 14.4 với lịch Phật giáo được bật và xác minh rằng schedule() tạo ra một thông báo hoạt động, đồng thời giữ nguyên hành vi lặp hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
ios, javascript, typescript
Lĩnh vực
mobile-dev
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
52/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.