Bluesky app fork with some witchin' additions 💫

tweak to disable "via repost" notifications

+88 -3
+25
src/screens/Settings/DeerSettings.tsx
··· 34 useSetDirectFetchRecords, 35 } from '#/state/preferences/direct-fetch-records' 36 import { 37 useHideFeedsPromoTab, 38 useSetHideFeedsPromoTab, 39 } from '#/state/preferences/hide-feeds-promo-tab' ··· 226 227 const hideFeedsPromoTab = useHideFeedsPromoTab() 228 const setHideFeedsPromoTab = useSetHideFeedsPromoTab() 229 230 const constellationInstance = useConstellationInstance() 231 const setConstellationInstanceControl = Dialog.useDialogControl() ··· 504 </Toggle.LabelText> 505 <Toggle.Platform /> 506 </Toggle.Item> 507 </SettingsList.Group> 508 509 <SettingsList.Group contentContainerStyle={[a.gap_sm]}>
··· 34 useSetDirectFetchRecords, 35 } from '#/state/preferences/direct-fetch-records' 36 import { 37 + useDisableViaRepostNotification, 38 + useSetDisableViaRepostNotification, 39 + } from '#/state/preferences/disable-via-repost-notification' 40 + import { 41 useHideFeedsPromoTab, 42 useSetHideFeedsPromoTab, 43 } from '#/state/preferences/hide-feeds-promo-tab' ··· 230 231 const hideFeedsPromoTab = useHideFeedsPromoTab() 232 const setHideFeedsPromoTab = useSetHideFeedsPromoTab() 233 + 234 + const disableViaRepostNotification = useDisableViaRepostNotification() 235 + const setDisableViaRepostNotification = useSetDisableViaRepostNotification() 236 237 const constellationInstance = useConstellationInstance() 238 const setConstellationInstanceControl = Dialog.useDialogControl() ··· 511 </Toggle.LabelText> 512 <Toggle.Platform /> 513 </Toggle.Item> 514 + 515 + <Toggle.Item 516 + name="disable_via_repost_notification" 517 + label={_(msg`Disable via repost notifications`)} 518 + value={disableViaRepostNotification} 519 + onChange={value => setDisableViaRepostNotification(value)} 520 + style={[a.w_full]}> 521 + <Toggle.LabelText style={[a.flex_1]}> 522 + <Trans>Disable via repost notifications</Trans> 523 + </Toggle.LabelText> 524 + <Toggle.Platform /> 525 + </Toggle.Item> 526 + <Admonition type="info" style={[a.flex_1]}> 527 + <Trans> 528 + Forcefully disables the notifications other people receive when 529 + you like/repost a post someone else has reposted for privacy. 530 + </Trans> 531 + </Admonition> 532 </SettingsList.Group> 533 534 <SettingsList.Group contentContainerStyle={[a.gap_sm]}>
+2
src/state/persisted/schema.ts
··· 134 constellationInstance: z.string().optional(), 135 showLinkInHandle: z.boolean().optional(), 136 hideFeedsPromoTab: z.boolean().optional(), 137 deerVerification: z 138 .object({ 139 enabled: z.boolean(), ··· 204 constellationInstance: 'https://constellation.microcosm.blue/', 205 showLinkInHandle: false, 206 hideFeedsPromoTab: false, 207 deerVerification: { 208 enabled: false, 209 // https://social.daniela.lol/profile/did:plc:p2cp5gopk7mgjegy6wadk3ep/post/3lndyqyyr4k2k
··· 134 constellationInstance: z.string().optional(), 135 showLinkInHandle: z.boolean().optional(), 136 hideFeedsPromoTab: z.boolean().optional(), 137 + disableViaRepostNotification: z.boolean().optional(), 138 deerVerification: z 139 .object({ 140 enabled: z.boolean(), ··· 205 constellationInstance: 'https://constellation.microcosm.blue/', 206 showLinkInHandle: false, 207 hideFeedsPromoTab: false, 208 + disableViaRepostNotification: false, 209 deerVerification: { 210 enabled: false, 211 // https://social.daniela.lol/profile/did:plc:p2cp5gopk7mgjegy6wadk3ep/post/3lndyqyyr4k2k
+52
src/state/preferences/disable-via-repost-notification.tsx
···
··· 1 + import React from 'react' 2 + 3 + import * as persisted from '#/state/persisted' 4 + 5 + // Preference: disableViaRepostNotification – when true, disables notifications sent when liking/reposting a post someone else reposted 6 + 7 + type StateContext = persisted.Schema['disableViaRepostNotification'] 8 + // Same setter signature used across other preference modules 9 + type SetContext = (v: persisted.Schema['disableViaRepostNotification']) => void 10 + 11 + const stateContext = React.createContext<StateContext>( 12 + persisted.defaults.disableViaRepostNotification, 13 + ) 14 + const setContext = React.createContext<SetContext>( 15 + (_: persisted.Schema['disableViaRepostNotification']) => {}, 16 + ) 17 + 18 + export function Provider({children}: React.PropsWithChildren<{}>) { 19 + const [state, setState] = React.useState( 20 + persisted.get('disableViaRepostNotification'), 21 + ) 22 + 23 + const setStateWrapped = React.useCallback( 24 + (value: persisted.Schema['disableViaRepostNotification']) => { 25 + setState(value) 26 + persisted.write('disableViaRepostNotification', value) 27 + }, 28 + [setState], 29 + ) 30 + 31 + React.useEffect(() => { 32 + return persisted.onUpdate('disableViaRepostNotification', next => { 33 + setState(next) 34 + }) 35 + }, [setStateWrapped]) 36 + 37 + return ( 38 + <stateContext.Provider value={state}> 39 + <setContext.Provider value={setStateWrapped}> 40 + {children} 41 + </setContext.Provider> 42 + </stateContext.Provider> 43 + ) 44 + } 45 + 46 + export function useDisableViaRepostNotification() { 47 + return React.useContext(stateContext) 48 + } 49 + 50 + export function useSetDisableViaRepostNotification() { 51 + return React.useContext(setContext) 52 + }
+4 -1
src/state/preferences/index.tsx
··· 7 import {Provider as DeerVerificationProvider} from './deer-verification' 8 import {Provider as DirectFetchRecordsProvider} from './direct-fetch-records' 9 import {Provider as DisableHapticsProvider} from './disable-haptics' 10 import {Provider as ExternalEmbedsProvider} from './external-embeds-prefs' 11 import {Provider as GoLinksProvider} from './go-links-enabled' 12 import {Provider as HiddenPostsProvider} from './hidden-posts' ··· 69 <RepostCarouselProvider> 70 <KawaiiProvider> 71 <HideFeedsPromoTabProvider> 72 - {children} 73 </HideFeedsPromoTabProvider> 74 </KawaiiProvider> 75 </RepostCarouselProvider>
··· 7 import {Provider as DeerVerificationProvider} from './deer-verification' 8 import {Provider as DirectFetchRecordsProvider} from './direct-fetch-records' 9 import {Provider as DisableHapticsProvider} from './disable-haptics' 10 + import {Provider as DisableViaRepostNotificationProvider} from './disable-via-repost-notification' 11 import {Provider as ExternalEmbedsProvider} from './external-embeds-prefs' 12 import {Provider as GoLinksProvider} from './go-links-enabled' 13 import {Provider as HiddenPostsProvider} from './hidden-posts' ··· 70 <RepostCarouselProvider> 71 <KawaiiProvider> 72 <HideFeedsPromoTabProvider> 73 + <DisableViaRepostNotificationProvider> 74 + {children} 75 + </DisableViaRepostNotificationProvider> 76 </HideFeedsPromoTabProvider> 77 </KawaiiProvider> 78 </RepostCarouselProvider>
+5 -2
src/state/queries/post.ts
··· 7 import {logger} from '#/logger' 8 import {updatePostShadow} from '#/state/cache/post-shadow' 9 import {type Shadow} from '#/state/cache/types' 10 import {useAgent, useSession} from '#/state/session' 11 import * as userActionHistory from '#/state/userActionHistory' 12 import {useIsThreadMuted, useSetThreadMute} from '../cache/thread-mutes' ··· 110 const initialLikeUri = post.viewer?.like 111 const likeMutation = usePostLikeMutation(feedDescriptor, logContext, post) 112 const unlikeMutation = usePostUnlikeMutation(feedDescriptor, logContext) 113 114 const queueToggle = useToggleMutationQueue({ 115 initialState: initialLikeUri, ··· 118 const {uri: likeUri} = await likeMutation.mutateAsync({ 119 uri: postUri, 120 cid: postCid, 121 - via: viaRepost, 122 }) 123 userActionHistory.like([postUri]) 124 return likeUri ··· 227 const initialRepostUri = post.viewer?.repost 228 const repostMutation = usePostRepostMutation(feedDescriptor, logContext) 229 const unrepostMutation = usePostUnrepostMutation(feedDescriptor, logContext) 230 231 const queueToggle = useToggleMutationQueue({ 232 initialState: initialRepostUri, ··· 235 const {uri: repostUri} = await repostMutation.mutateAsync({ 236 uri: postUri, 237 cid: postCid, 238 - via: viaRepost, 239 }) 240 return repostUri 241 } else {
··· 7 import {logger} from '#/logger' 8 import {updatePostShadow} from '#/state/cache/post-shadow' 9 import {type Shadow} from '#/state/cache/types' 10 + import {useDisableViaRepostNotification} from '#/state/preferences/disable-via-repost-notification' 11 import {useAgent, useSession} from '#/state/session' 12 import * as userActionHistory from '#/state/userActionHistory' 13 import {useIsThreadMuted, useSetThreadMute} from '../cache/thread-mutes' ··· 111 const initialLikeUri = post.viewer?.like 112 const likeMutation = usePostLikeMutation(feedDescriptor, logContext, post) 113 const unlikeMutation = usePostUnlikeMutation(feedDescriptor, logContext) 114 + const disableViaRepostNotification = useDisableViaRepostNotification() 115 116 const queueToggle = useToggleMutationQueue({ 117 initialState: initialLikeUri, ··· 120 const {uri: likeUri} = await likeMutation.mutateAsync({ 121 uri: postUri, 122 cid: postCid, 123 + via: disableViaRepostNotification ? undefined : viaRepost, 124 }) 125 userActionHistory.like([postUri]) 126 return likeUri ··· 229 const initialRepostUri = post.viewer?.repost 230 const repostMutation = usePostRepostMutation(feedDescriptor, logContext) 231 const unrepostMutation = usePostUnrepostMutation(feedDescriptor, logContext) 232 + const disableViaRepostNotification = useDisableViaRepostNotification() 233 234 const queueToggle = useToggleMutationQueue({ 235 initialState: initialRepostUri, ··· 238 const {uri: repostUri} = await repostMutation.mutateAsync({ 239 uri: postUri, 240 cid: postCid, 241 + via: disableViaRepostNotification ? undefined : viaRepost, 242 }) 243 return repostUri 244 } else {