diff --git a/keyserver/src/responders/website-responders.js b/keyserver/src/responders/website-responders.js --- a/keyserver/src/responders/website-responders.js +++ b/keyserver/src/responders/website-responders.js @@ -508,6 +508,7 @@ updatesCurrentAsOf, urlPrefix, connection: defaultConnectionInfo, + lastCommunicatedPlatformDetails: null, }, }, }; diff --git a/lib/reducers/keyserver-reducer.js b/lib/reducers/keyserver-reducer.js --- a/lib/reducers/keyserver-reducer.js +++ b/lib/reducers/keyserver-reducer.js @@ -1,6 +1,7 @@ // @flow import reduceConnectionInfo from './connection-reducer.js'; +import reduceLastCommunicatedPlatformDetails from './last-communicated-platform-details-reducer.js'; import reduceUpdatesCurrentAsOf from './updates-reducer.js'; import { siweAuthActionTypes } from '../actions/siwe-actions.js'; import { @@ -90,11 +91,19 @@ }; } + const lastCommunicatedPlatformDetails = reduceLastCommunicatedPlatformDetails( + state.keyserverInfos[ashoatKeyserverID].lastCommunicatedPlatformDetails, + action, + ); const connection = reduceConnectionInfo( state.keyserverInfos[ashoatKeyserverID].connection, action, ); - if (connection !== state.keyserverInfos[ashoatKeyserverID].connection) { + if ( + connection !== state.keyserverInfos[ashoatKeyserverID].connection || + lastCommunicatedPlatformDetails !== + state.keyserverInfos[ashoatKeyserverID].lastCommunicatedPlatformDetails + ) { state = { ...state, keyserverInfos: { @@ -102,6 +111,7 @@ [ashoatKeyserverID]: { ...state.keyserverInfos[ashoatKeyserverID], connection, + lastCommunicatedPlatformDetails, }, }, }; diff --git a/lib/types/keyserver-types.js b/lib/types/keyserver-types.js --- a/lib/types/keyserver-types.js +++ b/lib/types/keyserver-types.js @@ -2,9 +2,10 @@ import t, { type TInterface } from 'tcomb'; +import type { PlatformDetails } from './device-types.js'; import { connectionInfoValidator } from './socket-types.js'; import type { ConnectionInfo } from './socket-types.js'; -import { tShape } from '../utils/validation-utils.js'; +import { tShape, tPlatformDetails } from '../utils/validation-utils.js'; // Once we start using the cookie field on web, // the cookie field should be mandatory, of type ?string. @@ -15,6 +16,7 @@ +updatesCurrentAsOf: number, // millisecond timestamp +urlPrefix: string, +connection: ConnectionInfo, + +lastCommunicatedPlatformDetails: ?PlatformDetails, }; export type KeyserverStore = { @@ -28,6 +30,7 @@ updatesCurrentAsOf: t.Number, urlPrefix: t.String, connection: connectionInfoValidator, + lastCommunicatedPlatformDetails: t.maybe(tPlatformDetails), }); export const keyserverStoreValidator: TInterface = 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 @@ -128,6 +128,7 @@ updatesCurrentAsOf: 0, urlPrefix: defaultURLPrefix, connection: defaultConnectionInfo, + lastCommunicatedPlatformDetails: null, }, }, },