diff --git a/lib/reducers/aux-user-reducer.js b/lib/reducers/aux-user-reducer.js --- a/lib/reducers/aux-user-reducer.js +++ b/lib/reducers/aux-user-reducer.js @@ -1,6 +1,7 @@ // @flow import { setFarcasterFriendsFIDActionType } from '../actions/aux-user-actions.js'; +import { setClientDBStoreActionType } from '../actions/client-db-store-actions.js'; import { auxUserStoreOpsHandlers, type AuxUserStoreOperation, @@ -36,7 +37,27 @@ auxUserStore: processStoreOps(state, replaceOperations), auxUserStoreOperations: replaceOperations, }; + } else if (action.type === setClientDBStoreActionType) { + const newAuxUserInfos = action.payload.auxUserInfos; + + if (!newAuxUserInfos) { + return { + auxUserStore: state, + auxUserStoreOperations: [], + }; + } + + const newAuxUserStore: AuxUserStore = { + ...state, + auxUserInfos: newAuxUserInfos, + }; + + return { + auxUserStore: newAuxUserStore, + auxUserStoreOperations: [], + }; } + return { auxUserStore: state, auxUserStoreOperations: [], diff --git a/lib/reducers/message-reducer.test.js b/lib/reducers/message-reducer.test.js --- a/lib/reducers/message-reducer.test.js +++ b/lib/reducers/message-reducer.test.js @@ -294,6 +294,7 @@ keyserverInfos: {}, communityInfos: {}, threadHashes: {}, + auxUserInfos: {}, }, }, { diff --git a/lib/types/store-ops-types.js b/lib/types/store-ops-types.js --- a/lib/types/store-ops-types.js +++ b/lib/types/store-ops-types.js @@ -1,5 +1,6 @@ // @flow +import type { AuxUserInfos } from './aux-user-types.js'; import type { CommunityInfos } from './community-types.js'; import type { DraftStoreOperation, @@ -100,4 +101,5 @@ +keyserverInfos: ?KeyserverInfos, +communityInfos: ?CommunityInfos, +threadHashes: ?ThreadHashes, + +auxUserInfos: ?AuxUserInfos, }; diff --git a/native/data/sqlite-data-handler.js b/native/data/sqlite-data-handler.js --- a/native/data/sqlite-data-handler.js +++ b/native/data/sqlite-data-handler.js @@ -7,6 +7,7 @@ import { MediaCacheContext } from 'lib/components/media-cache-provider.react.js'; import type { CallKeyserverEndpoint } from 'lib/keyserver-conn/keyserver-conn-types.js'; import { useKeyserverRecoveryLogIn } from 'lib/keyserver-conn/recovery-utils.js'; +import { auxUserStoreOpsHandlers } from 'lib/ops/aux-user-store-ops.js'; import { communityStoreOpsHandlers } from 'lib/ops/community-store-ops.js'; import { integrityStoreOpsHandlers } from 'lib/ops/integrity-store-ops.js'; import { keyserverStoreOpsHandlers } from 'lib/ops/keyserver-store-ops.js'; @@ -208,6 +209,7 @@ keyservers, communities, integrityThreadHashes, + auxUserInfos, } = await commCoreModule.getClientDBStore(); const threadInfosFromDB = threadStoreOpsHandlers.translateClientDBData(threads); @@ -222,6 +224,8 @@ integrityStoreOpsHandlers.translateClientDBData( integrityThreadHashes, ); + const auxUserInfosFromDB = + auxUserStoreOpsHandlers.translateClientDBData(auxUserInfos); dispatch({ type: setClientDBStoreActionType, @@ -236,6 +240,7 @@ keyserverInfos: keyserverInfosFromDB, communities: communityInfosFromDB, threadHashes: threadHashesFromDB, + auxUserInfos: auxUserInfosFromDB, }, }); } catch (setStoreException) { diff --git a/web/shared-worker/utils/store.js b/web/shared-worker/utils/store.js --- a/web/shared-worker/utils/store.js +++ b/web/shared-worker/utils/store.js @@ -29,6 +29,7 @@ keyserverInfos: defaultWebState.keyserverStore.keyserverInfos, communityInfos: null, threadHashes: null, + auxUserInfos: null, }; const data = await sharedWorker.schedule({ type: workerRequestMessageTypes.GET_CLIENT_STORE, @@ -79,6 +80,14 @@ ), }; } + if (data?.store?.auxUserInfos) { + result = { + ...result, + auxUserInfos: auxUserStoreOpsHandlers.translateClientDBData( + data.store.auxUserInfos, + ), + }; + } return result; }