ソースを参照

Added interval support

Sebastián Katzer 12 年 前
コミット
ea3b9d6ae3
1 ファイル変更12 行追加1 行削除
  1. 12 1
      src/android/LocalNotificationOptions.java

+ 12 - 1
src/android/LocalNotificationOptions.java

@@ -33,10 +33,21 @@ public class LocalNotificationOptions {
      * Parse options passed from javascript part of this plugin.
      */
     LocalNotificationOptions (JSONObject options) {
+        String repeat = options.optString("repeat");
+
         this.options = options;
         date         = options.optLong("date") * 1000;
-        //interval   = options.optString("repeat");
         id           = options.optString("id");
+
+        if (repeat.equalsIgnoreCase("daily")) {
+            interval = 86400000;
+        } else if (repeat.equalsIgnoreCase("weekly")) {
+            interval = 604800000;
+        } else if (repeat.equalsIgnoreCase("monthly")) {
+            interval = 2678400000L; // 31 days
+        } else if (repeat.equalsIgnoreCase("yearly")) {
+            interval = 31536000000L;
+        }
     }
 
     /**