diff --git a/src/analytics/metrics/client.ts b/src/analytics/metrics/client.ts index 2aab90f26..34802524d 100644 --- a/src/analytics/metrics/client.ts +++ b/src/analytics/metrics/client.ts @@ -1,7 +1,7 @@ import {onAppStateChange} from '#/lib/appState' -import {isNetworkError} from '#/lib/strings/errors' +// import {isNetworkError} from '#/lib/strings/errors' import {Logger} from '#/logger' -import * as env from '#/env' +// import * as env from '#/env' type Event> = { source: 'app' @@ -11,7 +11,7 @@ type Event> = { metadata: Record } -const TRACKING_ENDPOINT = env.METRICS_API_HOST + '/t' +// const TRACKING_ENDPOINT = env.METRICS_API_HOST + '/t' const logger = Logger.create(Logger.Context.Metric, {}) export class MetricsClient> { @@ -71,43 +71,44 @@ export class MetricsClient> { isRetry, }) - try { - const body = JSON.stringify({events}) - if (env.IS_WEB && 'navigator' in globalThis && navigator.sendBeacon) { - const success = navigator.sendBeacon( - TRACKING_ENDPOINT, - new Blob([body], {type: 'application/json'}), - ) - if (!success) { - // construct a "network error" for `isNetworkError` to work - throw new Error(`Failed to fetch: sendBeacon returned false`) - } - } else { - const res = await fetch(TRACKING_ENDPOINT, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({events}), - keepalive: true, - }) + // Witchsky: we don't need this :3 + // try { + // const body = JSON.stringify({events}) + // if (env.IS_WEB && 'navigator' in globalThis && navigator.sendBeacon) { + // const success = navigator.sendBeacon( + // TRACKING_ENDPOINT, + // new Blob([body], {type: 'application/json'}), + // ) + // if (!success) { + // // construct a "network error" for `isNetworkError` to work + // throw new Error(`Failed to fetch: sendBeacon returned false`) + // } + // } else { + // const res = await fetch(TRACKING_ENDPOINT, { + // method: 'POST', + // headers: { + // 'Content-Type': 'application/json', + // }, + // body: JSON.stringify({events}), + // keepalive: true, + // }) - if (!res.ok) { - const error = await res.text().catch(() => 'Unknown error') - // construct a "network error" for `isNetworkError` to work - throw new Error(`${res.status} Failed to fetch — ${error}`) - } - } - } catch (e: any) { - if (isNetworkError(e)) { - if (isRetry) return // retry once - this.failedQueue.push(...events) - return - } - logger.error(`Failed to send metrics`, { - safeMessage: e.toString(), - }) - } + // if (!res.ok) { + // const error = await res.text().catch(() => 'Unknown error') + // // construct a "network error" for `isNetworkError` to work + // throw new Error(`${res.status} Failed to fetch — ${error}`) + // } + // } + // } catch (e: any) { + // if (isNetworkError(e)) { + // if (isRetry) return // retry once + // this.failedQueue.push(...events) + // return + // } + // logger.error(`Failed to send metrics`, { + // safeMessage: e.toString(), + // }) + // } } private retryFailedLogs() { diff --git a/src/view/com/profile/ProfileMenu.tsx b/src/view/com/profile/ProfileMenu.tsx index f91d99930..466829076 100644 --- a/src/view/com/profile/ProfileMenu.tsx +++ b/src/view/com/profile/ProfileMenu.tsx @@ -7,10 +7,10 @@ import {useNavigation} from '@react-navigation/native' import {useQueryClient} from '@tanstack/react-query' import {HITSLOP_20} from '#/lib/constants' +import {useOpenLink} from '#/lib/hooks/useOpenLink' import {makeProfileLink} from '#/lib/routes/links' import {type NavigationProp} from '#/lib/routes/types' import {shareText, shareUrl} from '#/lib/sharing' -import {useOpenLink} from '#/lib/hooks/useOpenLink' import {toShareUrl, toShareUrlBsky} from '#/lib/strings/url-helpers' import {type Shadow} from '#/state/cache/types' import {useModalControls} from '#/state/modals' @@ -20,6 +20,7 @@ import { useSetDeerVerificationTrust, } from '#/state/preferences/deer-verification' import {useEnableSquareButtons} from '#/state/preferences/enable-square-buttons' +import {useShowExternalShareButtons} from '#/state/preferences/external-share-buttons' import {Nux, useNux, useSaveNux} from '#/state/queries/nuxs' import { RQKEY as profileQueryKey, @@ -72,7 +73,6 @@ import {GoLiveDisabledDialog} from '#/features/liveNow/components/GoLiveDisabled import {Dot} from '#/features/nuxs/components/Dot' import {Gradient} from '#/features/nuxs/components/Gradient' import {useDevMode} from '#/storage/hooks/dev-mode' -import { useShowExternalShareButtons } from '#/state/preferences/external-share-buttons' let ProfileMenu = ({ profile, @@ -263,7 +263,10 @@ let ProfileMenu = ({ }, [navigation, profile.handle]) const onOpenProfileInPdsls = () => { - openLink(`https://pdsls.dev/at://${profile.did}/app.bsky.actor.profile/self`, true) + openLink( + `https://pdsls.dev/at://${profile.did}/app.bsky.actor.profile/self`, + true, + ) } const onOpenRepoInPdsls = () => { @@ -361,26 +364,28 @@ let ProfileMenu = ({ icon={IS_WEB ? ChainLinkIcon : ArrowOutOfBoxIcon} /> - {showExternalShareButtons && <> - - - Open profile in PDSls - - - - - - Open repo in PDSls - - - - } + {showExternalShareButtons && ( + <> + + + Open profile in PDSls + + + + + + Open repo in PDSls + + + + + )}