Parcourir la source

Log calculated trigger date in debug mode

Sebastián Katzer il y a 7 ans
Parent
commit
a720399c0c
2 fichiers modifiés avec 24 ajouts et 6 suppressions
  1. 3 0
      src/android/notification/Notification.java
  2. 21 6
      src/ios/APPNotificationOptions.m

+ 3 - 0
src/android/notification/Notification.java

@@ -33,6 +33,7 @@ import android.service.notification.StatusBarNotification;
 import android.support.v4.app.NotificationCompat;
 import android.support.v4.util.ArraySet;
 import android.support.v4.util.Pair;
+import android.util.Log;
 import android.util.SparseArray;
 
 import org.json.JSONException;
@@ -181,6 +182,8 @@ public final class Notification {
         do {
             Date date = request.getTriggerDate();
 
+            Log.d("local-notification", "Next trigger at: " + date);
+
             if (date == null)
                 continue;
 

+ 21 - 6
src/ios/APPNotificationOptions.m

@@ -413,8 +413,13 @@ static NSInteger WEEKDAYS[8] = { 0, 2, 3, 4, 5, 6, 7, 1 };
         seconds = 60;
     }
 
-    return [UNTimeIntervalNotificationTrigger
-            triggerWithTimeInterval:seconds repeats:YES];
+    UNTimeIntervalNotificationTrigger* trigger =
+    [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:seconds
+                                                       repeats:YES];
+
+    NSLog(@"[local-notification] Next trigger at: %@", trigger.nextTriggerDate);
+
+    return trigger;
 }
 
 /**
@@ -430,8 +435,13 @@ static NSInteger WEEKDAYS[8] = { 0, 2, 3, 4, 5, 6, 7, 1 };
 
     date.timeZone = [NSTimeZone defaultTimeZone];
 
-    return [UNCalendarNotificationTrigger
-            triggerWithDateMatchingComponents:date repeats:repeats];
+    UNCalendarNotificationTrigger* trigger =
+    [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:date
+                                                             repeats:repeats];
+
+    NSLog(@"[local-notification] Next trigger at: %@", trigger.nextTriggerDate);
+
+    return trigger;
 }
 
 /**
@@ -447,8 +457,13 @@ static NSInteger WEEKDAYS[8] = { 0, 2, 3, 4, 5, 6, 7, 1 };
     date.calendar = cal;
     date.timeZone = [NSTimeZone defaultTimeZone];
 
-    return [UNCalendarNotificationTrigger
-            triggerWithDateMatchingComponents:date repeats:YES];
+    UNCalendarNotificationTrigger* trigger =
+    [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:date
+                                                             repeats:YES];
+
+    NSLog(@"[local-notification] Next trigger at: %@", trigger.nextTriggerDate);
+
+    return trigger;
 }
 
 /**