Browse Source

Fix bug in match trigger where interval is every minute [ref #1533]

Sebastián Katzer 7 năm trước cách đây
mục cha
commit
b93cf65cc9

+ 5 - 1
src/android/notification/trigger/MatchTrigger.java

@@ -191,7 +191,11 @@ public class MatchTrigger extends IntervalTrigger {
                     else
                         return null;
                 case HOUR:
-                    addToDate(cal, now, Calendar.HOUR_OF_DAY, 0);
+                    if (cal.get(Calendar.MINUTE) < now.get(Calendar.MINUTE)) {
+                        addToDate(cal, now, Calendar.HOUR_OF_DAY, 1);
+                    } else {
+                        addToDate(cal, now, Calendar.HOUR_OF_DAY, 0);
+                    }
                     break;
                 case DAY:
                 case WEEK:

+ 9 - 1
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Trigger/MatchTrigger.cs

@@ -207,7 +207,15 @@ namespace LocalNotificationProxy.LocalNotification.Trigger
 
                         break;
                     case Unit.HOUR:
-                        date = date.AddHours(now.Hour - date.Hour);
+                        if (date.Minute < now.Minute)
+                        {
+                            date = date.AddHours(now.Hour - date.Hour + 1);
+                        }
+                        else
+                        {
+                            date = date.AddHours(now.Hour - date.Hour);
+                        }
+
                         break;
                     case Unit.DAY:
                     case Unit.WEEK: