Page MenuHomePhabricator

D12916.id43013.diff
No OneTemporary

D12916.id43013.diff

diff --git a/native/push/push-handler.react.js b/native/push/push-handler.react.js
--- a/native/push/push-handler.react.js
+++ b/native/push/push-handler.react.js
@@ -133,6 +133,7 @@
) => Promise<SetDeviceTokenActionPayload>,
// withRootContext
+rootContext: ?RootContextType,
+ +localToken: ?string,
};
type State = {
+inAppNotifProps: ?{
@@ -286,6 +287,8 @@
if (this.props.loggedIn && !prevProps.loggedIn) {
void this.ensurePushNotifsEnabled();
+ } else if (!this.props.localToken && prevProps.localToken) {
+ void this.ensurePushNotifsEnabled();
} else {
for (const keyserverID in this.props.deviceTokens) {
const deviceToken = this.props.deviceTokens[keyserverID];
@@ -440,12 +443,14 @@
return;
}
if (Platform.OS === 'ios') {
- let missingDeviceToken = false;
- for (const keyserverID in this.props.deviceTokens) {
- const deviceToken = this.props.deviceTokens[keyserverID];
- if (deviceToken === null || deviceToken === undefined) {
- missingDeviceToken = true;
- break;
+ 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);
@@ -801,6 +806,9 @@
const allUpdatesCurrentAsOf = useSelector(allUpdatesCurrentAsOfSelector);
const activeTheme = useSelector(state => state.globalThemeInfo.activeTheme);
const loggedIn = useSelector(isLoggedIn);
+ const localToken = useSelector(
+ state => state.tunnelbrokerDeviceToken.localToken,
+ );
const navigateToThread = useNavigateToThread();
const dispatch = useDispatch();
const dispatchActionPromise = useDispatchActionPromise();
@@ -825,6 +833,7 @@
setDeviceToken={callSetDeviceToken}
setDeviceTokenFanout={callSetDeviceTokenFanout}
rootContext={rootContext}
+ localToken={localToken}
/>
);
});

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 11:29 AM (6 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2712821
Default Alt Text
D12916.id43013.diff (2 KB)

Event Timeline