diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js --- a/lib/reducers/master-reducer.js +++ b/lib/reducers/master-reducer.js @@ -23,6 +23,7 @@ import reduceGlobalThemeInfo from './theme-reducer.js'; import { reduceThreadActivity } from './thread-activity-reducer.js'; import { reduceThreadInfos } from './thread-reducer.js'; +import reduceTunnelbrokerDeviceToken from './tunnelbroker-device-token-reducer.js'; import { reduceCurrentUserInfo, reduceUserInfos } from './user-reducer.js'; import { addKeyserverActionType } from '../actions/keyserver-actions.js'; import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; @@ -227,6 +228,10 @@ syncedMetadataStore, auxUserStore, threadActivityStore, + tunnelbrokerDeviceToken: reduceTunnelbrokerDeviceToken( + state.tunnelbrokerDeviceToken, + action, + ), }, storeOperations: { draftStoreOperations, diff --git a/lib/reducers/tunnelbroker-device-token-reducer.js b/lib/reducers/tunnelbroker-device-token-reducer.js new file mode 100644 --- /dev/null +++ b/lib/reducers/tunnelbroker-device-token-reducer.js @@ -0,0 +1,14 @@ +// @flow + +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 { + return state; +} + +export default reduceTunnelbrokerDeviceToken; 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 @@ -142,6 +142,7 @@ RoleModificationPayload, RoleDeletionPayload, } from './thread-types.js'; +import type { TunnelbrokerDeviceToken } from './tunnelbroker-device-token-types.js'; import type { ClientUpdatesResultWithUserInfos } from './update-types.js'; import type { CurrentUserInfo, @@ -184,6 +185,7 @@ +dbOpsStore: DBOpsStore, +syncedMetadataStore: SyncedMetadataStore, +auxUserStore: AuxUserStore, + +tunnelbrokerDeviceToken: TunnelbrokerDeviceToken, +_persist: ?PersistState, ... }; diff --git a/lib/types/tunnelbroker-device-token-types.js b/lib/types/tunnelbroker-device-token-types.js new file mode 100644 --- /dev/null +++ b/lib/types/tunnelbroker-device-token-types.js @@ -0,0 +1,6 @@ +// @flow + +export type TunnelbrokerDeviceToken = { + +localToken: ?string, + +tunnelbrokerToken: ?string, +}; diff --git a/lib/utils/reducers-utils.test.js b/lib/utils/reducers-utils.test.js --- a/lib/utils/reducers-utils.test.js +++ b/lib/utils/reducers-utils.test.js @@ -94,6 +94,10 @@ auxUserStore: { auxUserInfos: {}, }, + tunnelbrokerDeviceToken: { + localToken: null, + tunnelbrokerToken: null, + }, }; state = { ...defaultState, diff --git a/native/redux/default-state.js b/native/redux/default-state.js --- a/native/redux/default-state.js +++ b/native/redux/default-state.js @@ -94,6 +94,10 @@ syncedMetadataStore: { syncedMetadata: {}, }, + tunnelbrokerDeviceToken: { + localToken: null, + tunnelbrokerToken: null, + }, }: AppState); export { defaultState }; diff --git a/native/redux/persist.js b/native/redux/persist.js --- a/native/redux/persist.js +++ b/native/redux/persist.js @@ -1399,6 +1399,18 @@ ops: dbOperations, }; }, + [78]: (state: AppState) => { + return { + state: { + ...state, + tunnelbrokerDeviceToken: { + localToken: null, + tunnelbrokerToken: null, + }, + }, + ops: [], + }; + }, }; // NOTE: renaming this object, and especially the `version` property @@ -1409,7 +1421,7 @@ storage: AsyncStorage, blacklist: persistBlacklist, debug: __DEV__, - version: 77, + version: 78, transforms: [ messageStoreMessagesBlocklistTransform, reportStoreTransform, diff --git a/native/redux/state-types.js b/native/redux/state-types.js --- a/native/redux/state-types.js +++ b/native/redux/state-types.js @@ -23,6 +23,7 @@ import type { GlobalThemeInfo } from 'lib/types/theme-types.js'; import type { ThreadActivityStore } from 'lib/types/thread-activity-types'; import type { ThreadStore } from 'lib/types/thread-types.js'; +import type { TunnelbrokerDeviceToken } from 'lib/types/tunnelbroker-device-token-types'; import type { CurrentUserInfo, UserStore } from 'lib/types/user-types.js'; import type { DimensionsInfo } from './dimensions-updater.react.js'; @@ -82,6 +83,7 @@ +dbOpsStore: DBOpsStore, +syncedMetadataStore: SyncedMetadataStore, +auxUserStore: AuxUserStore, + +tunnelbrokerDeviceToken: TunnelbrokerDeviceToken, }; export { nonUserSpecificFieldsNative }; diff --git a/web/redux/default-state.js b/web/redux/default-state.js --- a/web/redux/default-state.js +++ b/web/redux/default-state.js @@ -90,6 +90,10 @@ auxUserStore: { auxUserInfos: {}, }, + tunnelbrokerDeviceToken: { + localToken: null, + tunnelbrokerToken: null, + }, }); export { defaultWebState }; diff --git a/web/redux/handle-redux-migration-failure.js b/web/redux/handle-redux-migration-failure.js --- a/web/redux/handle-redux-migration-failure.js +++ b/web/redux/handle-redux-migration-failure.js @@ -14,6 +14,7 @@ 'globalThemeInfo', 'customServer', 'messageStore', + 'tunnelbrokerDeviceToken', ]; function handleReduxMigrationFailure(oldState: AppState): AppState { diff --git a/web/redux/persist-constants.js b/web/redux/persist-constants.js --- a/web/redux/persist-constants.js +++ b/web/redux/persist-constants.js @@ -3,6 +3,6 @@ const rootKey = 'root'; const rootKeyPrefix = 'persist:'; const completeRootKey = `${rootKeyPrefix}${rootKey}`; -const storeVersion = 77; +const storeVersion = 78; export { rootKey, rootKeyPrefix, completeRootKey, storeVersion }; diff --git a/web/redux/persist.js b/web/redux/persist.js --- a/web/redux/persist.js +++ b/web/redux/persist.js @@ -568,6 +568,18 @@ ops: dbOperations, }; }, + [78]: (state: AppState) => { + return { + state: { + ...state, + tunnelbrokerDeviceToken: { + localToken: null, + tunnelbrokerToken: null, + }, + }, + ops: [], + }; + }, }; const persistConfig: PersistConfig = { diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js --- a/web/redux/redux-setup.js +++ b/web/redux/redux-setup.js @@ -60,6 +60,7 @@ import type { GlobalThemeInfo } from 'lib/types/theme-types.js'; import type { ThreadActivityStore } from 'lib/types/thread-activity-types'; import type { ThreadStore } from 'lib/types/thread-types.js'; +import type { TunnelbrokerDeviceToken } from 'lib/types/tunnelbroker-device-token-types.js'; import type { CurrentUserInfo, UserStore } from 'lib/types/user-types.js'; import { resetUserSpecificState } from 'lib/utils/reducers-utils.js'; @@ -131,6 +132,7 @@ +dbOpsStore: DBOpsStore, +syncedMetadataStore: SyncedMetadataStore, +auxUserStore: AuxUserStore, + +tunnelbrokerDeviceToken: TunnelbrokerDeviceToken, }; export type Action = $ReadOnly<