diff --git a/demo/app/tests/internal/sensor-callback-manager.spec.ts b/demo/app/tests/internal/sensor-callback-manager.spec.ts index cc075c3..49cec35 100644 --- a/demo/app/tests/internal/sensor-callback-manager.spec.ts +++ b/demo/app/tests/internal/sensor-callback-manager.spec.ts @@ -10,15 +10,15 @@ describe("Sensor callback manager", () => { const sensorRecordA1: SensorRecord = { deviceId: "test", - timestamp: new Date() + timestamp: Date.now() }; const sensorRecordA2: SensorRecord = { deviceId: "test", - timestamp: new Date() + timestamp: Date.now() }; const sensorRecordB1: SensorRecord = { deviceId: "test", - timestamp: new Date() + timestamp: Date.now() }; const noNotificationTimeout = 100; diff --git a/demo/app/tests/internal/sensors/heart-rate/record-messaging-service.android.spec.ts b/demo/app/tests/internal/sensors/heart-rate/record-messaging-service.android.spec.ts index d49daa3..2fec5d5 100644 --- a/demo/app/tests/internal/sensors/heart-rate/record-messaging-service.android.spec.ts +++ b/demo/app/tests/internal/sensors/heart-rate/record-messaging-service.android.spec.ts @@ -37,7 +37,7 @@ describe("Heart rate record messaging service", () => { function getFakeHeartRateData() { return { - timestamp: new Date(), + timestamp: Date.now(), value: Math.floor(Math.random() * 100), }; } @@ -51,7 +51,7 @@ function buildFakeEncodedMessage(expectedRecords: HeartRateSensorRecord[]) { buff.putInt(expectedRecords.length); expectedRecords.forEach((record) => { buff.putInt(record.value); - buff.putLong(record.timestamp.getTime()); + buff.putLong(record.timestamp); }) return bytes; diff --git a/demo/app/tests/internal/sensors/location/record-messaging-service.android.spec.ts b/demo/app/tests/internal/sensors/location/record-messaging-service.android.spec.ts index af6f2c0..27a93ab 100644 --- a/demo/app/tests/internal/sensors/location/record-messaging-service.android.spec.ts +++ b/demo/app/tests/internal/sensors/location/record-messaging-service.android.spec.ts @@ -39,7 +39,7 @@ describe("Location record messaging service", () => { function getFakeLocationData() { return { - timestamp: new Date(), + timestamp: Date.now(), latitude: 39.9939752904, longitude: -0.0741332084749, altitude: 20, @@ -57,7 +57,7 @@ function buildFakeEncodedMessage(expectedRecords: LocationSensorRecord[]) { buff.putDouble(record.latitude); buff.putDouble(record.longitude); buff.putDouble(record.altitude); - buff.putLong(record.timestamp.getTime()); + buff.putLong(record.timestamp); }) return bytes; diff --git a/demo/app/tests/internal/sensors/triaxial/index.spec.ts b/demo/app/tests/internal/sensors/triaxial/index.spec.ts index 49c3e25..b04efae 100644 --- a/demo/app/tests/internal/sensors/triaxial/index.spec.ts +++ b/demo/app/tests/internal/sensors/triaxial/index.spec.ts @@ -2,7 +2,7 @@ import { TriAxialSensorRecord } from "nativescript-wearos-sensors/internal/senso export function getFakeTriAxialData() { return { - timestamp: new Date(), + timestamp: Date.now(), x: Math.random(), y: Math.random(), z: Math.random(), @@ -20,7 +20,7 @@ export function buildFakeEncodedMessage(expectedRecords: TriAxialSensorRecord[]) buff.putFloat(record.x); buff.putFloat(record.y); buff.putFloat(record.z); - buff.putLong(record.timestamp.getTime()); + buff.putLong(record.timestamp); }) return bytes; diff --git a/src/internal/sensors/heart-rate/android/record-messaging-service.android.ts b/src/internal/sensors/heart-rate/android/record-messaging-service.android.ts index 22429ee..da7f668 100644 --- a/src/internal/sensors/heart-rate/android/record-messaging-service.android.ts +++ b/src/internal/sensors/heart-rate/android/record-messaging-service.android.ts @@ -19,7 +19,7 @@ export class HeartRateRecordMessagingService extends AbstractRecordMessagingServ records.push({ deviceId: messageEvent.getSourceNodeId(), - timestamp: new Date(time), + timestamp: time, value, }); } diff --git a/src/internal/sensors/location/android/record-messaging-service.android.ts b/src/internal/sensors/location/android/record-messaging-service.android.ts index abc45f0..c7e50e8 100644 --- a/src/internal/sensors/location/android/record-messaging-service.android.ts +++ b/src/internal/sensors/location/android/record-messaging-service.android.ts @@ -21,7 +21,7 @@ export class LocationRecordMessagingService extends AbstractRecordMessagingServi records.push({ deviceId: messageEvent.getSourceNodeId(), - timestamp: new Date(time), + timestamp: time, latitude: lat, longitude: lon, altitude: alt, diff --git a/src/internal/sensors/sensor-record.ts b/src/internal/sensors/sensor-record.ts index c04ca35..e64826c 100644 --- a/src/internal/sensors/sensor-record.ts +++ b/src/internal/sensors/sensor-record.ts @@ -2,7 +2,7 @@ import { SensorType } from "./sensor-type"; export interface SensorRecord { deviceId: string; - timestamp: Date; + timestamp: number; } export interface SensorRecords { diff --git a/src/internal/sensors/triaxial/triaxial-record-messaging-service.android.ts b/src/internal/sensors/triaxial/triaxial-record-messaging-service.android.ts index 22c8b04..2f4b399 100644 --- a/src/internal/sensors/triaxial/triaxial-record-messaging-service.android.ts +++ b/src/internal/sensors/triaxial/triaxial-record-messaging-service.android.ts @@ -20,7 +20,7 @@ export class TriAxialRecordMessagingService extends AbstractRecordMessagingServi time = buff.getLong(); records.push({ deviceId: messageEvent.getSourceNodeId(), - timestamp: new Date(time), + timestamp: time, x, y, z, diff --git a/src/package-lock.json b/src/package-lock.json index 14629c9..c7f7052 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -1,12 +1,12 @@ { "name": "nativescript-wearos-sensors", - "version": "2.0.0", + "version": "3.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "nativescript-wearos-sensors", - "version": "2.0.0", + "version": "3.0.0", "license": "Apache-2.0", "dependencies": { "nativescript-task-dispatcher": "^3.1.1", diff --git a/src/package.json b/src/package.json index 411214f..40777c1 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-wearos-sensors", - "version": "2.0.0", + "version": "3.0.0", "description": "Your awesome NativeScript plugin.", "main": "wearos-sensors", "typings": "index.d.ts",