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
F3544306: D12916.id43070.diff
Thu, Dec 26, 12:23 PM
F3544179: D12916.id43110.diff
Thu, Dec 26, 12:04 PM
F3543597: D12916.id43013.diff
Thu, Dec 26, 11:29 AM
F3538658: D12916.diff
Wed, Dec 25, 11:27 PM
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
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
Branch
publish-device-token
Lint
No Lint Coverage
Unit
No Test Coverage

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