Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32385912
D12536.1765333348.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D12536.1765333348.diff
View Options
diff --git a/lib/reducers/tunnelbroker-device-token-reducer.js b/lib/reducers/tunnelbroker-device-token-reducer.js
--- a/lib/reducers/tunnelbroker-device-token-reducer.js
+++ b/lib/reducers/tunnelbroker-device-token-reducer.js
@@ -1,13 +1,21 @@
// @flow
+import { setDeviceTokenActionTypes } from '../actions/device-actions.js';
import type { BaseAction } from '../types/redux-types.js';
import type { TunnelbrokerDeviceToken } from '../types/tunnelbroker-device-token-types.js';
-/* eslint-disable no-unused-vars */
function reduceTunnelbrokerDeviceToken(
state: TunnelbrokerDeviceToken,
action: BaseAction,
): TunnelbrokerDeviceToken {
+ if (action.type === setDeviceTokenActionTypes.started) {
+ if (!action.payload) {
+ return state;
+ }
+ const { deviceToken } = action.payload;
+ return { ...state, localToken: deviceToken };
+ }
+
return state;
}
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -829,7 +829,9 @@
}
| {
+type: 'SET_DEVICE_TOKEN_STARTED',
- +payload?: void,
+ +payload: ?{
+ +deviceToken: ?string,
+ },
+loadingInfo: LoadingInfo,
}
| {
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
@@ -528,13 +528,18 @@
deviceTokensMap[keyserverID] = deviceToken;
}
}
- this.setDeviceToken(deviceTokensMap);
+ this.setDeviceToken(deviceTokensMap, { deviceToken });
};
- setDeviceToken(deviceTokens: DeviceTokens) {
+ setDeviceToken(
+ deviceTokens: DeviceTokens,
+ payload: ?{ deviceToken: ?string },
+ ) {
void this.props.dispatchActionPromise(
setDeviceTokenActionTypes,
this.props.setDeviceToken(deviceTokens),
+ undefined,
+ payload,
);
}
@@ -542,6 +547,8 @@
void this.props.dispatchActionPromise(
setDeviceTokenActionTypes,
this.props.setDeviceTokenFanout(null),
+ undefined,
+ { deviceToken: null },
);
};
diff --git a/web/push-notif/push-notifs-handler.js b/web/push-notif/push-notifs-handler.js
--- a/web/push-notif/push-notifs-handler.js
+++ b/web/push-notif/push-notifs-handler.js
@@ -60,6 +60,8 @@
void dispatchActionPromise(
setDeviceTokenActionTypes,
callSetDeviceToken(token),
+ undefined,
+ { deviceToken: token },
);
}),
[callSetDeviceToken, dispatchActionPromise],
@@ -146,9 +148,12 @@
applicationServerKey: publicKey,
});
+ const token = JSON.stringify(subscription);
void dispatchActionPromise(
setDeviceTokenActionTypes,
- callSetDeviceToken(JSON.stringify(subscription)),
+ callSetDeviceToken(token),
+ undefined,
+ { deviceToken: token },
);
}, [callSetDeviceToken, dispatchActionPromise, publicKey, staffCanSee]);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 10, 2:22 AM (11 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5859939
Default Alt Text
D12536.1765333348.diff (2 KB)
Attached To
Mode
D12536: [lib][web][native] set local Tunnelbroker device token on client
Attached
Detach File
Event Timeline
Log In to Comment