Skip to content

Commit

Permalink
Don't send old FCM tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Sightler committed Jun 25, 2024
1 parent 01b9636 commit 391023f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/ring-client-api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,16 @@ export class RingApi extends Subscribed {
cameras: RingCamera[],
intercoms: RingIntercom[],
) {
const credentials =
this.restClient._internalOnly_pushNotificationCredentials?.config &&
this.restClient._internalOnly_pushNotificationCredentials,
pushReceiver = new PushReceiver({
const pushReceiver = new PushReceiver({
firebase: {
apiKey: 'AIzaSyCv-hdFBmmdBBJadNy-TFwB-xN_H5m3Bk8',
projectId: 'ring-17770',
messagingSenderId: '876313859327', // for Ring android app. 703521446232 for ring-site
appId: '1:876313859327:android:e10ec6ddb3c81f39',
},
credentials,
credentials:
this.restClient._internalOnly_pushNotificationCredentials?.config &&
this.restClient._internalOnly_pushNotificationCredentials,
debug: false,
}),
devicesById: { [id: number]: RingCamera | RingIntercom | undefined } = {},
Expand Down Expand Up @@ -359,8 +358,11 @@ export class RingApi extends Subscribed {
})

// If we already have credentials, use them immediately
if (credentials) {
onPushNotificationToken.next(credentials.fcm.token)
if (this.restClient._internalOnly_pushNotificationCredentials?.fcm?.token) {
// Use the source in case credentials were updated prior to
onPushNotificationToken.next(
this.restClient._internalOnly_pushNotificationCredentials.fcm.token,
)
}
}

Expand Down

0 comments on commit 391023f

Please sign in to comment.