Bluesky app fork with some witchin' additions 💫

tweak to disable "via repost" notifications

+88 -3
+25
src/screens/Settings/DeerSettings.tsx
··· 34 34 useSetDirectFetchRecords, 35 35 } from '#/state/preferences/direct-fetch-records' 36 36 import { 37 + useDisableViaRepostNotification, 38 + useSetDisableViaRepostNotification, 39 + } from '#/state/preferences/disable-via-repost-notification' 40 + import { 37 41 useHideFeedsPromoTab, 38 42 useSetHideFeedsPromoTab, 39 43 } from '#/state/preferences/hide-feeds-promo-tab' ··· 226 230 227 231 const hideFeedsPromoTab = useHideFeedsPromoTab() 228 232 const setHideFeedsPromoTab = useSetHideFeedsPromoTab() 233 + 234 + const disableViaRepostNotification = useDisableViaRepostNotification() 235 + const setDisableViaRepostNotification = useSetDisableViaRepostNotification() 229 236 230 237 const constellationInstance = useConstellationInstance() 231 238 const setConstellationInstanceControl = Dialog.useDialogControl() ··· 504 511 </Toggle.LabelText> 505 512 <Toggle.Platform /> 506 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> 507 532 </SettingsList.Group> 508 533 509 534 <SettingsList.Group contentContainerStyle={[a.gap_sm]}>
+2
src/state/persisted/schema.ts
··· 134 134 constellationInstance: z.string().optional(), 135 135 showLinkInHandle: z.boolean().optional(), 136 136 hideFeedsPromoTab: z.boolean().optional(), 137 + disableViaRepostNotification: z.boolean().optional(), 137 138 deerVerification: z 138 139 .object({ 139 140 enabled: z.boolean(), ··· 204 205 constellationInstance: 'https://constellation.microcosm.blue/', 205 206 showLinkInHandle: false, 206 207 hideFeedsPromoTab: false, 208 + disableViaRepostNotification: false, 207 209 deerVerification: { 208 210 enabled: false, 209 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 7 import {Provider as DeerVerificationProvider} from './deer-verification' 8 8 import {Provider as DirectFetchRecordsProvider} from './direct-fetch-records' 9 9 import {Provider as DisableHapticsProvider} from './disable-haptics' 10 + import {Provider as DisableViaRepostNotificationProvider} from './disable-via-repost-notification' 10 11 import {Provider as ExternalEmbedsProvider} from './external-embeds-prefs' 11 12 import {Provider as GoLinksProvider} from './go-links-enabled' 12 13 import {Provider as HiddenPostsProvider} from './hidden-posts' ··· 69 70 <RepostCarouselProvider> 70 71 <KawaiiProvider> 71 72 <HideFeedsPromoTabProvider> 72 - {children} 73 + <DisableViaRepostNotificationProvider> 74 + {children} 75 + </DisableViaRepostNotificationProvider> 73 76 </HideFeedsPromoTabProvider> 74 77 </KawaiiProvider> 75 78 </RepostCarouselProvider>
+5 -2
src/state/queries/post.ts
··· 7 7 import {logger} from '#/logger' 8 8 import {updatePostShadow} from '#/state/cache/post-shadow' 9 9 import {type Shadow} from '#/state/cache/types' 10 + import {useDisableViaRepostNotification} from '#/state/preferences/disable-via-repost-notification' 10 11 import {useAgent, useSession} from '#/state/session' 11 12 import * as userActionHistory from '#/state/userActionHistory' 12 13 import {useIsThreadMuted, useSetThreadMute} from '../cache/thread-mutes' ··· 110 111 const initialLikeUri = post.viewer?.like 111 112 const likeMutation = usePostLikeMutation(feedDescriptor, logContext, post) 112 113 const unlikeMutation = usePostUnlikeMutation(feedDescriptor, logContext) 114 + const disableViaRepostNotification = useDisableViaRepostNotification() 113 115 114 116 const queueToggle = useToggleMutationQueue({ 115 117 initialState: initialLikeUri, ··· 118 120 const {uri: likeUri} = await likeMutation.mutateAsync({ 119 121 uri: postUri, 120 122 cid: postCid, 121 - via: viaRepost, 123 + via: disableViaRepostNotification ? undefined : viaRepost, 122 124 }) 123 125 userActionHistory.like([postUri]) 124 126 return likeUri ··· 227 229 const initialRepostUri = post.viewer?.repost 228 230 const repostMutation = usePostRepostMutation(feedDescriptor, logContext) 229 231 const unrepostMutation = usePostUnrepostMutation(feedDescriptor, logContext) 232 + const disableViaRepostNotification = useDisableViaRepostNotification() 230 233 231 234 const queueToggle = useToggleMutationQueue({ 232 235 initialState: initialRepostUri, ··· 235 238 const {uri: repostUri} = await repostMutation.mutateAsync({ 236 239 uri: postUri, 237 240 cid: postCid, 238 - via: viaRepost, 241 + via: disableViaRepostNotification ? undefined : viaRepost, 239 242 }) 240 243 return repostUri 241 244 } else {