diff --git a/lib/actions/client-db-store-actions.js b/lib/actions/client-db-store-actions.js new file mode 100644 --- /dev/null +++ b/lib/actions/client-db-store-actions.js @@ -0,0 +1,5 @@ +// @flow + +const setClientDBStoreActionType = 'SET_CLIENT_DB_STORE'; + +export { setClientDBStoreActionType }; diff --git a/lib/types/draft-types.js b/lib/types/draft-types.js --- a/lib/types/draft-types.js +++ b/lib/types/draft-types.js @@ -4,6 +4,11 @@ +drafts: { +[key: string]: string }, }; +export type ClientDBDraftInfo = { + +key: string, + +text: string, +}; + export type UpdateDraftOperation = { +type: 'update', +payload: { +key: string, +text: string }, @@ -22,4 +27,5 @@ | UpdateDraftOperation | MoveDraftOperation | RemoveAllDraftsOperation; + export type ClientDBDraftStoreOperation = DraftStoreOperation; 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 @@ -13,7 +13,7 @@ QueueActivityUpdatesPayload, SetThreadUnreadStatusPayload, } from './activity-types'; -import type { DraftStore } from './draft-types'; +import type { ClientDBDraftInfo, DraftStore } from './draft-types'; import type { EnabledApps, SupportedApps } from './enabled-apps'; import type { RawEntryInfo, @@ -556,6 +556,15 @@ +type: 'SET_DRAFT_STORE_DRAFTS', +payload: $ReadOnlyArray<{ +key: string, +text: string }>, } + | { + +type: 'SET_CLIENT_DB_STORE', + +payload: { + +currentUserID: ?string, + +drafts: $ReadOnlyArray, + +messages: $ReadOnlyArray, + +threadStore: ThreadStore, + }, + } | { +type: 'UPDATE_ACTIVITY_STARTED', +payload?: void, diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js --- a/native/schema/CommCoreModuleSchema.js +++ b/native/schema/CommCoreModuleSchema.js @@ -5,7 +5,10 @@ import { TurboModuleRegistry } from 'react-native'; import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport'; -import type { ClientDBDraftStoreOperation } from 'lib/types/draft-types'; +import type { + ClientDBDraftInfo, + ClientDBDraftStoreOperation, +} from 'lib/types/draft-types'; import type { ClientDBMessageInfo, ClientDBMessageStoreOperation, @@ -15,11 +18,6 @@ ClientDBThreadStoreOperation, } from 'lib/types/thread-types'; -type ClientDBDraftInfo = { - +key: string, - +text: string, -}; - export interface Spec extends TurboModule { +getDraft: (key: string) => Promise; +updateDraft: (draft: ClientDBDraftInfo) => Promise;