Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: disable metrics & move imports

xan.lol 4d768cf8 700a50a7

+68 -62
+40 -39
src/analytics/metrics/client.ts
··· 1 1 import {onAppStateChange} from '#/lib/appState' 2 - import {isNetworkError} from '#/lib/strings/errors' 2 + // import {isNetworkError} from '#/lib/strings/errors' 3 3 import {Logger} from '#/logger' 4 - import * as env from '#/env' 4 + // import * as env from '#/env' 5 5 6 6 type Event<M extends Record<string, any>> = { 7 7 source: 'app' ··· 11 11 metadata: Record<string, any> 12 12 } 13 13 14 - const TRACKING_ENDPOINT = env.METRICS_API_HOST + '/t' 14 + // const TRACKING_ENDPOINT = env.METRICS_API_HOST + '/t' 15 15 const logger = Logger.create(Logger.Context.Metric, {}) 16 16 17 17 export class MetricsClient<M extends Record<string, any>> { ··· 71 71 isRetry, 72 72 }) 73 73 74 - try { 75 - const body = JSON.stringify({events}) 76 - if (env.IS_WEB && 'navigator' in globalThis && navigator.sendBeacon) { 77 - const success = navigator.sendBeacon( 78 - TRACKING_ENDPOINT, 79 - new Blob([body], {type: 'application/json'}), 80 - ) 81 - if (!success) { 82 - // construct a "network error" for `isNetworkError` to work 83 - throw new Error(`Failed to fetch: sendBeacon returned false`) 84 - } 85 - } else { 86 - const res = await fetch(TRACKING_ENDPOINT, { 87 - method: 'POST', 88 - headers: { 89 - 'Content-Type': 'application/json', 90 - }, 91 - body: JSON.stringify({events}), 92 - keepalive: true, 93 - }) 74 + // Witchsky: we don't need this :3 75 + // try { 76 + // const body = JSON.stringify({events}) 77 + // if (env.IS_WEB && 'navigator' in globalThis && navigator.sendBeacon) { 78 + // const success = navigator.sendBeacon( 79 + // TRACKING_ENDPOINT, 80 + // new Blob([body], {type: 'application/json'}), 81 + // ) 82 + // if (!success) { 83 + // // construct a "network error" for `isNetworkError` to work 84 + // throw new Error(`Failed to fetch: sendBeacon returned false`) 85 + // } 86 + // } else { 87 + // const res = await fetch(TRACKING_ENDPOINT, { 88 + // method: 'POST', 89 + // headers: { 90 + // 'Content-Type': 'application/json', 91 + // }, 92 + // body: JSON.stringify({events}), 93 + // keepalive: true, 94 + // }) 94 95 95 - if (!res.ok) { 96 - const error = await res.text().catch(() => 'Unknown error') 97 - // construct a "network error" for `isNetworkError` to work 98 - throw new Error(`${res.status} Failed to fetch — ${error}`) 99 - } 100 - } 101 - } catch (e: any) { 102 - if (isNetworkError(e)) { 103 - if (isRetry) return // retry once 104 - this.failedQueue.push(...events) 105 - return 106 - } 107 - logger.error(`Failed to send metrics`, { 108 - safeMessage: e.toString(), 109 - }) 110 - } 96 + // if (!res.ok) { 97 + // const error = await res.text().catch(() => 'Unknown error') 98 + // // construct a "network error" for `isNetworkError` to work 99 + // throw new Error(`${res.status} Failed to fetch — ${error}`) 100 + // } 101 + // } 102 + // } catch (e: any) { 103 + // if (isNetworkError(e)) { 104 + // if (isRetry) return // retry once 105 + // this.failedQueue.push(...events) 106 + // return 107 + // } 108 + // logger.error(`Failed to send metrics`, { 109 + // safeMessage: e.toString(), 110 + // }) 111 + // } 111 112 } 112 113 113 114 private retryFailedLogs() {
+28 -23
src/view/com/profile/ProfileMenu.tsx
··· 7 7 import {useQueryClient} from '@tanstack/react-query' 8 8 9 9 import {HITSLOP_20} from '#/lib/constants' 10 + import {useOpenLink} from '#/lib/hooks/useOpenLink' 10 11 import {makeProfileLink} from '#/lib/routes/links' 11 12 import {type NavigationProp} from '#/lib/routes/types' 12 13 import {shareText, shareUrl} from '#/lib/sharing' 13 - import {useOpenLink} from '#/lib/hooks/useOpenLink' 14 14 import {toShareUrl, toShareUrlBsky} from '#/lib/strings/url-helpers' 15 15 import {type Shadow} from '#/state/cache/types' 16 16 import {useModalControls} from '#/state/modals' ··· 20 20 useSetDeerVerificationTrust, 21 21 } from '#/state/preferences/deer-verification' 22 22 import {useEnableSquareButtons} from '#/state/preferences/enable-square-buttons' 23 + import {useShowExternalShareButtons} from '#/state/preferences/external-share-buttons' 23 24 import {Nux, useNux, useSaveNux} from '#/state/queries/nuxs' 24 25 import { 25 26 RQKEY as profileQueryKey, ··· 72 73 import {Dot} from '#/features/nuxs/components/Dot' 73 74 import {Gradient} from '#/features/nuxs/components/Gradient' 74 75 import {useDevMode} from '#/storage/hooks/dev-mode' 75 - import { useShowExternalShareButtons } from '#/state/preferences/external-share-buttons' 76 76 77 77 let ProfileMenu = ({ 78 78 profile, ··· 263 263 }, [navigation, profile.handle]) 264 264 265 265 const onOpenProfileInPdsls = () => { 266 - openLink(`https://pdsls.dev/at://${profile.did}/app.bsky.actor.profile/self`, true) 266 + openLink( 267 + `https://pdsls.dev/at://${profile.did}/app.bsky.actor.profile/self`, 268 + true, 269 + ) 267 270 } 268 271 269 272 const onOpenRepoInPdsls = () => { ··· 361 364 icon={IS_WEB ? ChainLinkIcon : ArrowOutOfBoxIcon} 362 365 /> 363 366 </Menu.Item> 364 - {showExternalShareButtons && <> 365 - <Menu.Item 366 - testID="profileDropdownOpenProfileInPdsls" 367 - label={_(msg`Open profile in PDSls`)} 368 - onPress={onOpenProfileInPdsls}> 369 - <Menu.ItemText> 370 - <Trans>Open profile in PDSls</Trans> 371 - </Menu.ItemText> 372 - <Menu.ItemIcon icon={ExternalIcon} position="right" /> 373 - </Menu.Item> 374 - <Menu.Item 375 - testID="profileDropdownOpenRepoInPdsls" 376 - label={_(msg`Open repo in PDSls`)} 377 - onPress={onOpenRepoInPdsls}> 378 - <Menu.ItemText> 379 - <Trans>Open repo in PDSls</Trans> 380 - </Menu.ItemText> 381 - <Menu.ItemIcon icon={ExternalIcon} position="right" /> 382 - </Menu.Item> 383 - </>} 367 + {showExternalShareButtons && ( 368 + <> 369 + <Menu.Item 370 + testID="profileDropdownOpenProfileInPdsls" 371 + label={_(msg`Open profile in PDSls`)} 372 + onPress={onOpenProfileInPdsls}> 373 + <Menu.ItemText> 374 + <Trans>Open profile in PDSls</Trans> 375 + </Menu.ItemText> 376 + <Menu.ItemIcon icon={ExternalIcon} position="right" /> 377 + </Menu.Item> 378 + <Menu.Item 379 + testID="profileDropdownOpenRepoInPdsls" 380 + label={_(msg`Open repo in PDSls`)} 381 + onPress={onOpenRepoInPdsls}> 382 + <Menu.ItemText> 383 + <Trans>Open repo in PDSls</Trans> 384 + </Menu.ItemText> 385 + <Menu.ItemIcon icon={ExternalIcon} position="right" /> 386 + </Menu.Item> 387 + </> 388 + )} 384 389 <Menu.Item 385 390 testID="profileHeaderDropdownSearchBtn" 386 391 label={_(msg`Search posts`)}