Page MenuHomePhabricator

[native] refresh device token after receiving message from Tunnelbroker
ClosedPublic

Authored by kamil on Jul 29 2024, 4:08 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 10:39 AM
Unknown Object (File)
Thu, Dec 19, 10:39 AM
Unknown Object (File)
Thu, Dec 19, 10:39 AM
Unknown Object (File)
Sun, Dec 15, 1:44 PM
Unknown Object (File)
Sat, Dec 7, 8:01 PM
Unknown Object (File)
Wed, Dec 4, 4:23 PM
Unknown Object (File)
Nov 21 2024, 1:14 AM
Unknown Object (File)
Nov 21 2024, 1:14 AM
Subscribers

Details

Summary

ENG-8498.

This is similar to the keyserver's BAD_DEVICE_TOKEN logic.

This is only about localToken which is set for every user, not touching tunnelbrokerToken so it shouldn't affect devices without CSAT and TB connection.

Depends on D12912

Test Plan

Make Tunnelbroker throw an error with an invalid device token, and test that a new token is uploaded (value in DDB changed). Additionally verified this using logs.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Aug 1 2024, 1:42 AM
kamil edited the summary of this revision. (Show Details)
kamil edited the test plan for this revision. (Show Details)
kamil edited the summary of this revision. (Show Details)
native/push/push-handler.react.js
445–459 ↗(On Diff #43013)

Nit: might be best to handle the simple case first and reduce indentation a bit

if (!this.props.loggedIn) {
  return;
}
if (Platform.OS === 'android') {
  await this.ensureAndroidPushNotifsEnabled();
  return;
}
if (Platform.OS !== 'ios') {
  // should not happen... we could consider an invariant here instead
  return;
}
let missingDeviceToken = !this.props.localToken;
if (!missingDeviceToken) {
  for (const keyserverID in this.props.deviceTokens) {
    const deviceToken = this.props.deviceTokens[keyserverID];
    if (deviceToken === null || deviceToken === undefined) {
      missingDeviceToken = true;
      break;
    }
  }
}
await requestIOSPushPermissions(missingDeviceToken);
This revision is now accepted and ready to land.Aug 2 2024, 1:42 AM