Commit 99df92d9 by Sebastián Katzer

Support for firstAt on Android

parent 63aa4c00
......@@ -263,7 +263,7 @@ The properties depend on the trigger type. Not all of them are supported across
| Type | Property | Type | Value | Android | iOS | Windows |
| :----------- | :------------ | :------ | :--------------- | :------ | :-- | :------ |
| Fix |
| | at | Date | | x | x | x |
| | at | Date | | x | x | x |
| Timespan |
| | in | Int | | x | x | x |
| | unit | String | `second` | x | x | x |
......@@ -283,8 +283,7 @@ The properties depend on the trigger type. Not all of them are supported across
| | every | String | `month` | x | x | x |
| | every | String | `year` | x | x | x |
| | before | Date | |
| | firstAt | Date | |
| | after | Date | |
| | firstAt | Date | | x |
| Match |
| | count | Int | | x | | x |
| | every | Object | `minute` | x | x | x |
......@@ -298,7 +297,7 @@ The properties depend on the trigger type. Not all of them are supported across
| | every | Object | `quarter` | | x |
| | every | Object | `year` | x | x | x |
| | before | Date | |
| | after | Date | |
| | after | Date | | x |
| Location |
| | center | Array | `[lat, long]` | | x |
| | radius | Int | | | x |
......
......@@ -241,7 +241,13 @@ public final class Request {
*/
private Date getBaseDate() {
if (spec.has("at")) {
return new Date(spec.optLong("at", 0) * 1000);
return new Date(1000 * spec.optLong("at", 0));
} else
if (spec.has("firstAt")) {
return new Date(1000 * spec.optLong("firstAt", 0));
} else
if (spec.has("after")) {
return new Date(1000 * spec.optLong("after", 0));
} else {
return new Date();
}
......
......@@ -201,6 +201,11 @@ exports.convertTrigger = function (options) {
var trigger = options.trigger || {},
date = this.getValueFor(trigger, 'at', 'firstAt', 'date');
var dateToNum = function (date) {
var num = typeof date == 'object' ? date.getTime() : date;
return Math.round(num / 1000);
};
if (!options.trigger)
return;
......@@ -223,8 +228,19 @@ exports.convertTrigger = function (options) {
}
if (isCal && date) {
date = typeof date == 'object' ? date.getTime() : date;
trigger.at = Math.round(date / 1000);
trigger.at = dateToNum(date);
}
if (isCal && trigger.firstAt) {
trigger.firstAt = dateToNum(trigger.firstAt);
}
if (isCal && trigger.before) {
trigger.before = dateToNum(trigger.before);
}
if (isCal && trigger.after) {
trigger.after = dateToNum(trigger.after);
}
if (!trigger.count && device.platform == 'windows') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment