ring-client-api 13.0.0-beta.5 → 13.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api.js +25 -15
- package/lib/ring-camera.d.ts +2 -2
- package/lib/ring-camera.js +3 -1
- package/lib/ring-intercom.d.ts +2 -2
- package/package.json +1 -1
package/lib/api.js
CHANGED
|
@@ -202,23 +202,33 @@ class RingApi extends subscribed_1.Subscribed {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
const notification = messageData;
|
|
205
|
-
if (
|
|
206
|
-
|
|
207
|
-
(
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
if ('android_config' in notification) {
|
|
206
|
+
const deviceId = notification.data?.device?.id;
|
|
207
|
+
if (deviceId) {
|
|
208
|
+
sendToDevice(deviceId, notification);
|
|
209
|
+
}
|
|
210
|
+
const eventCategory = notification.android_config.category;
|
|
211
|
+
if (eventCategory !== ring_types_1.PushNotificationAction.Ding &&
|
|
212
|
+
eventCategory !== ring_types_1.PushNotificationAction.Motion &&
|
|
213
|
+
eventCategory !== ring_types_1.PushNotificationAction.IntercomDing) {
|
|
214
|
+
(0, util_1.logDebug)('Received v2 push notification with unknown category: ' +
|
|
215
|
+
eventCategory);
|
|
216
|
+
(0, util_1.logDebug)(JSON.stringify(message));
|
|
217
|
+
}
|
|
210
218
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
219
|
+
else if ('data' in notification &&
|
|
220
|
+
'gcmData' in notification.data &&
|
|
221
|
+
'alarm_meta' in notification.data.gcmData) {
|
|
222
|
+
const deviceId = notification.data.gcmData.alarm_meta.device_zid;
|
|
223
|
+
if (deviceId) {
|
|
224
|
+
sendToDevice(deviceId, notification);
|
|
225
|
+
}
|
|
214
226
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
eventCategory);
|
|
221
|
-
(0, util_1.logInfo)(JSON.stringify(message));
|
|
227
|
+
else {
|
|
228
|
+
// This is not a v1 or v2 style notification, so we can't process it
|
|
229
|
+
(0, util_1.logDebug)('Received push notification in unknown format');
|
|
230
|
+
(0, util_1.logDebug)(JSON.stringify(message));
|
|
231
|
+
return;
|
|
222
232
|
}
|
|
223
233
|
}
|
|
224
234
|
catch (e) {
|
package/lib/ring-camera.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CameraData, CameraDeviceSettingsData, CameraEventOptions, CameraEventResponse, CameraHealth, HistoryOptions, PeriodicFootageResponse, PushNotificationDingV2, VideoSearchResponse, OnvifCameraData, RingCameraKind } from './ring-types';
|
|
1
|
+
import { CameraData, CameraDeviceSettingsData, CameraEventOptions, CameraEventResponse, CameraHealth, HistoryOptions, PeriodicFootageResponse, PushNotificationDingV2, VideoSearchResponse, OnvifCameraData, RingCameraKind, PushNotification } from './ring-types';
|
|
2
2
|
import { RingRestClient } from './rest-client';
|
|
3
3
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
4
4
|
import { DeepPartial } from './util';
|
|
@@ -61,7 +61,7 @@ export declare class RingCamera extends Subscribed {
|
|
|
61
61
|
private createStreamingConnection;
|
|
62
62
|
startLiveCall(options?: StreamingConnectionOptions): Promise<StreamingSession>;
|
|
63
63
|
private removeDingById;
|
|
64
|
-
processPushNotification(notification:
|
|
64
|
+
processPushNotification(notification: PushNotification): void;
|
|
65
65
|
getEvents(options?: CameraEventOptions): Promise<CameraEventResponse & import("./rest-client").ExtendedResponse>;
|
|
66
66
|
videoSearch({ dateFrom, dateTo, order }?: {
|
|
67
67
|
dateFrom: number;
|
package/lib/ring-camera.js
CHANGED
|
@@ -270,7 +270,9 @@ class RingCamera extends subscribed_1.Subscribed {
|
|
|
270
270
|
this.onActiveNotifications.next(otherDings);
|
|
271
271
|
}
|
|
272
272
|
processPushNotification(notification) {
|
|
273
|
-
if (!('
|
|
273
|
+
if (!('android_config' in notification) ||
|
|
274
|
+
!('event' in notification.data) ||
|
|
275
|
+
!('ding' in notification.data?.event)) {
|
|
274
276
|
// only process ding/motion notifications
|
|
275
277
|
return;
|
|
276
278
|
}
|
package/lib/ring-intercom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IntercomHandsetAudioData,
|
|
1
|
+
import { IntercomHandsetAudioData, PushNotification } from './ring-types';
|
|
2
2
|
import { RingRestClient } from './rest-client';
|
|
3
3
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
4
4
|
export declare class RingIntercom {
|
|
@@ -22,5 +22,5 @@ export declare class RingIntercom {
|
|
|
22
22
|
private doorbotUrl;
|
|
23
23
|
subscribeToDingEvents(): Promise<void & import("./rest-client").ExtendedResponse>;
|
|
24
24
|
unsubscribeFromDingEvents(): Promise<void & import("./rest-client").ExtendedResponse>;
|
|
25
|
-
processPushNotification(notification:
|
|
25
|
+
processPushNotification(notification: PushNotification): void;
|
|
26
26
|
}
|