Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3538658
D12916.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12916.diff
View Options
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];
@@ -439,8 +442,15 @@
if (!this.props.loggedIn) {
return;
}
- if (Platform.OS === 'ios') {
- let missingDeviceToken = false;
+ if (Platform.OS === 'android') {
+ await this.ensureAndroidPushNotifsEnabled();
+ return;
+ }
+ if (Platform.OS !== 'ios') {
+ 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) {
@@ -448,10 +458,8 @@
break;
}
}
- await requestIOSPushPermissions(missingDeviceToken);
- } else if (Platform.OS === 'android') {
- await this.ensureAndroidPushNotifsEnabled();
}
+ await requestIOSPushPermissions(missingDeviceToken);
}
async ensureAndroidPushNotifsEnabled() {
@@ -801,6 +809,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 +836,7 @@
setDeviceToken={callSetDeviceToken}
setDeviceTokenFanout={callSetDeviceTokenFanout}
rootContext={rootContext}
+ localToken={localToken}
/>
);
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 26, 11:27 PM (10 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2709453
Default Alt Text
D12916.diff (2 KB)
Attached To
Mode
D12916: [native] refresh device token after receiving message from Tunnelbroker
Attached
Detach File
Event Timeline
Log In to Comment