NativeScript / NativeScript/plugins

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

オープン
#87 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
206
フォーク
123
平均マージ
2日 1時間
マージ済み PR(30日)
1

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

index.ios.js の LocalNotificationsImpl.schedulePendingNotificationsNew() から始め、次に calendarWithMondayAsFirstDay() と、レポートに示されている trigger の構築を調べます。仏暦を有効にした iOS 14.4 で再現し、schedule() が動作する通知を作成しつつ、既存の繰り返し動作が維持されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
ios, javascript, typescript
領域
mobile-dev
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。