diff --git a/lib/reducers/enabled-apps-reducer.js b/lib/reducers/enabled-apps-reducer.js --- a/lib/reducers/enabled-apps-reducer.js +++ b/lib/reducers/enabled-apps-reducer.js @@ -11,6 +11,7 @@ defaultWebEnabledApps, } from '../types/enabled-apps.js'; import type { BaseAction } from '../types/redux-types.js'; +import { usingCommServicesAccessToken } from '../utils/services-utils.js'; export const enableAppActionType = 'ENABLE_APP'; export const disableAppActionType = 'DISABLE_APP'; @@ -32,7 +33,9 @@ (action.type === setNewSessionActionType && action.payload.sessionChange.cookieInvalidated) ) { - return process.env.BROWSER ? defaultWebEnabledApps : defaultEnabledApps; + if (!usingCommServicesAccessToken) { + return process.env.BROWSER ? defaultWebEnabledApps : defaultEnabledApps; + } } return state; } diff --git a/lib/reducers/services-access-token-reducer.js b/lib/reducers/services-access-token-reducer.js --- a/lib/reducers/services-access-token-reducer.js +++ b/lib/reducers/services-access-token-reducer.js @@ -7,6 +7,7 @@ } from '../actions/user-actions.js'; import { setNewSessionActionType } from '../keyserver-conn/keyserver-conn-types.js'; import type { BaseAction } from '../types/redux-types.js'; +import { usingCommServicesAccessToken } from '../utils/services-utils.js'; export default function reduceServicesAccessToken( state: ?string, @@ -25,7 +26,9 @@ action.type === logOutActionTypes.success || action.type === deleteKeyserverAccountActionTypes.success ) { - return null; + if (!usingCommServicesAccessToken) { + return null; + } } return state; } diff --git a/lib/reducers/theme-reducer.js b/lib/reducers/theme-reducer.js --- a/lib/reducers/theme-reducer.js +++ b/lib/reducers/theme-reducer.js @@ -15,6 +15,7 @@ defaultGlobalThemeInfo, type GlobalThemeInfo, } from '../types/theme-types.js'; +import { usingCommServicesAccessToken } from '../utils/services-utils.js'; export default function reduceGlobalThemeInfo( state: GlobalThemeInfo, @@ -38,7 +39,9 @@ action.type === logOutActionTypes.success || action.type === deleteKeyserverAccountActionTypes.success ) { - return defaultGlobalThemeInfo; + if (!usingCommServicesAccessToken) { + return defaultGlobalThemeInfo; + } } else if (action.type === updateThemeInfoActionType) { return { ...state, diff --git a/lib/reducers/user-reducer.js b/lib/reducers/user-reducer.js --- a/lib/reducers/user-reducer.js +++ b/lib/reducers/user-reducer.js @@ -56,11 +56,19 @@ if ( action.type === logInActionTypes.success || action.type === siweAuthActionTypes.success || - action.type === registerActionTypes.success || + action.type === registerActionTypes.success + ) { + if (!_isEqual(action.payload.currentUserInfo)(state)) { + return action.payload.currentUserInfo; + } + } else if ( action.type === logOutActionTypes.success || action.type === deleteKeyserverAccountActionTypes.success ) { - if (!_isEqual(action.payload.currentUserInfo)(state)) { + if ( + !usingCommServicesAccessToken && + !_isEqual(action.payload.currentUserInfo)(state) + ) { return action.payload.currentUserInfo; } } else if ( diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js --- a/native/redux/redux-setup.js +++ b/native/redux/redux-setup.js @@ -27,6 +27,7 @@ import { rehydrateActionType } from 'lib/types/redux-types.js'; import type { SetSessionPayload } from 'lib/types/session-types.js'; import { reduxLoggerMiddleware } from 'lib/utils/action-logger.js'; +import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import { @@ -196,12 +197,14 @@ action.type === logOutActionTypes.success || action.type === deleteKeyserverAccountActionTypes.success ) { - state = { - ...state, - localSettings: { - isBackupEnabled: false, - }, - }; + if (!usingCommServicesAccessToken) { + state = { + ...state, + localSettings: { + isBackupEnabled: false, + }, + }; + } } if (action.type === setNewSessionActionType) { diff --git a/web/redux/crypto-store-reducer.js b/web/redux/crypto-store-reducer.js --- a/web/redux/crypto-store-reducer.js +++ b/web/redux/crypto-store-reducer.js @@ -6,6 +6,7 @@ } from 'lib/actions/user-actions.js'; import { setNewSessionActionType } from 'lib/keyserver-conn/keyserver-conn-types.js'; import type { CryptoStore } from 'lib/types/crypto-types.js'; +import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; import type { Action } from './redux-setup.js'; @@ -20,7 +21,9 @@ (action.type === setNewSessionActionType && action.payload.sessionChange.cookieInvalidated) ) { - return null; + if (!usingCommServicesAccessToken) { + return null; + } } return state; }