diff options
Diffstat (limited to 'src/view/com')
-rw-r--r-- | src/view/com/composer/Composer.tsx | 10 | ||||
-rw-r--r-- | src/view/com/composer/state/composer.ts | 25 |
2 files changed, 30 insertions, 5 deletions
diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index 0e9b52ce0..78293f618 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -83,6 +83,7 @@ import { useLanguagePrefs, useLanguagePrefsApi, } from '#/state/preferences/languages' +import {usePreferencesQuery} from '#/state/queries/preferences' import {useProfileQuery} from '#/state/queries/profile' import {Gif} from '#/state/queries/tenor' import {useAgent, useSession} from '#/state/session' @@ -169,6 +170,7 @@ export const ComposePost = ({ const discardPromptControl = Prompt.usePromptControl() const {closeAllDialogs} = useDialogStateControlContext() const {closeAllModals} = useModalControls() + const {data: preferences} = usePreferencesQuery() const [isKeyboardVisible] = useIsKeyboardVisible({iosUseWillEvents: true}) const [isPublishing, setIsPublishing] = useState(false) @@ -177,7 +179,13 @@ export const ComposePost = ({ const [composerState, composerDispatch] = useReducer( composerReducer, - {initImageUris, initQuoteUri: initQuote?.uri, initText, initMention}, + { + initImageUris, + initQuoteUri: initQuote?.uri, + initText, + initMention, + initInteractionSettings: preferences?.postInteractionSettings, + }, createComposerState, ) diff --git a/src/view/com/composer/state/composer.ts b/src/view/com/composer/state/composer.ts index 6d4f10297..f5a55f175 100644 --- a/src/view/com/composer/state/composer.ts +++ b/src/view/com/composer/state/composer.ts @@ -1,5 +1,10 @@ import {ImagePickerAsset} from 'expo-image-picker' -import {AppBskyFeedPostgate, AppBskyRichtextFacet, RichText} from '@atproto/api' +import { + AppBskyFeedPostgate, + AppBskyRichtextFacet, + BskyPreferences, + RichText, +} from '@atproto/api' import {nanoid} from 'nanoid/non-secure' import {SelfLabel} from '#/lib/moderation' @@ -13,7 +18,7 @@ import { import {ComposerImage, createInitialImages} from '#/state/gallery' import {createPostgateRecord} from '#/state/queries/postgate/util' import {Gif} from '#/state/queries/tenor' -import {threadgateViewToAllowUISetting} from '#/state/queries/threadgate' +import {threadgateRecordToAllowUISetting} from '#/state/queries/threadgate' import {ThreadgateAllowUISetting} from '#/state/queries/threadgate' import {ComposerOpts} from '#/state/shell/composer' import { @@ -477,11 +482,15 @@ export function createComposerState({ initMention, initImageUris, initQuoteUri, + initInteractionSettings, }: { initText: string | undefined initMention: string | undefined initImageUris: ComposerOpts['imageUris'] initQuoteUri: string | undefined + initInteractionSettings: + | BskyPreferences['postInteractionSettings'] + | undefined }): ComposerState { let media: ImagesMedia | undefined if (initImageUris?.length) { @@ -591,8 +600,16 @@ export function createComposerState({ }, }, ], - postgate: createPostgateRecord({post: ''}), - threadgate: threadgateViewToAllowUISetting(undefined), + postgate: createPostgateRecord({ + post: '', + embeddingRules: initInteractionSettings?.postgateEmbeddingRules || [], + }), + threadgate: threadgateRecordToAllowUISetting({ + $type: 'app.bsky.feed.threadgate', + post: '', + createdAt: new Date().toString(), + allow: initInteractionSettings?.threadgateAllowRules, + }), }, } } |