diff --git a/src/components/FeedInterstitials.tsx b/src/components/FeedInterstitials.tsx index 3ad9fcb7b..c03660071 100644 --- a/src/components/FeedInterstitials.tsx +++ b/src/components/FeedInterstitials.tsx @@ -32,6 +32,7 @@ import {useDialogControl} from '#/components/Dialog' import * as FeedCard from '#/components/FeedCard' import {ArrowRight_Stroke2_Corner0_Rounded as ArrowRight} from '#/components/icons/Arrow' import {Hashtag_Stroke2_Corner0_Rounded as Hashtag} from '#/components/icons/Hashtag' +import {InlineLinkText} from '#/components/Link' import * as ProfileCard from '#/components/ProfileCard' import {Text} from '#/components/Typography' import type * as bsky from '#/types/bsky' diff --git a/src/components/ageAssurance/AgeAssuranceAdmonition.tsx b/src/components/ageAssurance/AgeAssuranceAdmonition.tsx index 9f250770f..fd5ac9857 100644 --- a/src/components/ageAssurance/AgeAssuranceAdmonition.tsx +++ b/src/components/ageAssurance/AgeAssuranceAdmonition.tsx @@ -2,13 +2,13 @@ import {View} from 'react-native' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' +import {useEnableSquareButtons} from '#/state/preferences/enable-square-buttons' import {atoms as a, select, useTheme, type ViewStyleProp} from '#/alf' import {useDialogControl} from '#/components/ageAssurance/AgeAssuranceInitDialog' import type * as Dialog from '#/components/Dialog' import {ShieldCheck_Stroke2_Corner0_Rounded as Shield} from '#/components/icons/Shield' import {InlineLinkText} from '#/components/Link' import {Text} from '#/components/Typography' -import {useEnableSquareButtons} from '#/state/preferences/enable-square-buttons' import {useAgeAssurance} from '#/ageAssurance' import {logger} from '#/ageAssurance' diff --git a/src/components/ageAssurance/AgeAssuranceDismissibleFeedBanner.tsx b/src/components/ageAssurance/AgeAssuranceDismissibleFeedBanner.tsx index 16e437e16..3de64f470 100644 --- a/src/components/ageAssurance/AgeAssuranceDismissibleFeedBanner.tsx +++ b/src/components/ageAssurance/AgeAssuranceDismissibleFeedBanner.tsx @@ -3,6 +3,7 @@ import {View} from 'react-native' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' +import {useEnableSquareButtons} from '#/state/preferences/enable-square-buttons' import {Nux, useNux, useSaveNux} from '#/state/queries/nuxs' import {atoms as a, select, useTheme} from '#/alf' import {useAgeAssuranceCopy} from '#/components/ageAssurance/useAgeAssuranceCopy' @@ -11,7 +12,6 @@ import {ShieldCheck_Stroke2_Corner0_Rounded as Shield} from '#/components/icons/ import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times' import {Link} from '#/components/Link' import {Text} from '#/components/Typography' -import {useEnableSquareButtons} from '#/state/preferences/enable-square-buttons' import {useAgeAssurance} from '#/ageAssurance' import {logger} from '#/ageAssurance' diff --git a/src/components/ageAssurance/AgeAssuranceDismissibleNotice.tsx b/src/components/ageAssurance/AgeAssuranceDismissibleNotice.tsx index 08182f679..13d3b220e 100644 --- a/src/components/ageAssurance/AgeAssuranceDismissibleNotice.tsx +++ b/src/components/ageAssurance/AgeAssuranceDismissibleNotice.tsx @@ -2,13 +2,13 @@ import {View} from 'react-native' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' +import {useEnableSquareButtons} from '#/state/preferences/enable-square-buttons' import {Nux, useNux, useSaveNux} from '#/state/queries/nuxs' import {atoms as a, type ViewStyleProp} from '#/alf' import {AgeAssuranceAdmonition} from '#/components/ageAssurance/AgeAssuranceAdmonition' import {useAgeAssuranceCopy} from '#/components/ageAssurance/useAgeAssuranceCopy' import {Button, ButtonIcon} from '#/components/Button' import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times' -import {useEnableSquareButtons} from '#/state/preferences/enable-square-buttons' import {useAgeAssurance} from '#/ageAssurance' import {logger} from '#/ageAssurance' @@ -18,11 +18,11 @@ export function AgeAssuranceDismissibleNotice({style}: ViewStyleProp & {}) { const {nux} = useNux(Nux.AgeAssuranceDismissibleNotice) const copy = useAgeAssuranceCopy() const {mutate: save, variables} = useSaveNux() + const enableSquareButtons = useEnableSquareButtons() const hidden = !!variables if (aa.state.access === aa.Access.Full) return null if (aa.state.lastInitiatedAt) return null - const enableSquareButtons = useEnableSquareButtons() if (hidden) return null if (nux && nux.completed) return null diff --git a/src/lib/media/manip.ts b/src/lib/media/manip.ts index 8c978f5e3..9d403dd61 100644 --- a/src/lib/media/manip.ts +++ b/src/lib/media/manip.ts @@ -171,23 +171,16 @@ export async function saveImageToMediaLibrary({uri}: {uri: string}) { } export async function saveVideoToMediaLibrary({uri}: {uri: string}) { - // download the file to cache - const downloadResponse = await RNFetchBlob.config({ - fileCache: true, - }) - .fetch('GET', uri) - .catch(() => null) - if (downloadResponse == null) return false - let videoPath = downloadResponse.path() - let extension = mimeToExt(downloadResponse.respInfo.headers['content-type']) - videoPath = normalizePath( - await moveToPermanentPath(videoPath, '.' + extension), - true, - ) - - // save - await MediaLibrary.createAssetAsync(videoPath) - safeDeleteAsync(videoPath) + const extension = mimeToExt('video/mp4') + const downloadPath = await moveToPermanentPath(createPath(extension), '') + const download = createDownloadResumable(uri, downloadPath) + const res = await download.downloadAsync().catch(() => null) + if (!res || !res.uri) { + safeDeleteAsync(downloadPath) + return false + } + await MediaLibrary.createAssetAsync(res.uri) + safeDeleteAsync(res.uri) return true } diff --git a/src/screens/Settings/AppIconSettings/useAppIconSets.ts b/src/screens/Settings/AppIconSettings/useAppIconSets.ts index a9cc67974..fbc24133f 100644 --- a/src/screens/Settings/AppIconSettings/useAppIconSets.ts +++ b/src/screens/Settings/AppIconSettings/useAppIconSets.ts @@ -150,7 +150,7 @@ export function useAppIconSets() { return { defaults, - // core, + core: [] as AppIconSet[], } }, [_]) } diff --git a/src/state/preferences/country-code.tsx b/src/state/preferences/country-code.tsx deleted file mode 100644 index 3ff103b5e..000000000 --- a/src/state/preferences/country-code.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react' - -import * as persisted from '#/state/persisted' - -type StateContext = persisted.Schema['countryCode'] -type SetContext = (v: persisted.Schema['countryCode']) => void - -const stateContext = React.createContext( - persisted.defaults.countryCode, -) -const setContext = React.createContext( - (_: persisted.Schema['countryCode']) => {}, -) - -export function Provider({children}: React.PropsWithChildren<{}>) { - const [state, setState] = React.useState(persisted.get('countryCode')) - - const setStateWrapped = React.useCallback( - (countryCode: persisted.Schema['countryCode']) => { - setState(countryCode) - persisted.write('countryCode', countryCode) - }, - [setState], - ) - - React.useEffect(() => { - return persisted.onUpdate('countryCode', nextCountryCode => { - setState(nextCountryCode) - }) - }, [setStateWrapped]) - - return ( - - - {children} - - - ) -} - -export function useCountryCode() { - return React.useContext(stateContext) -} - -export function useSetCountryCode() { - return React.useContext(setContext) -} diff --git a/src/state/preferences/custom-appview-did.tsx b/src/state/preferences/custom-appview-did.tsx index 634b0088d..38fa866c2 100644 --- a/src/state/preferences/custom-appview-did.tsx +++ b/src/state/preferences/custom-appview-did.tsx @@ -1,4 +1,4 @@ -import {isDid} from '@atproto/api' +import {type AtprotoProxy, isDid} from '@atproto/api' import {device, useStorage} from '#/storage' @@ -11,11 +11,11 @@ export function useCustomAppViewDid() { return [customAppViewDid, setCustomAppViewDid] as const } -export function readCustomAppViewDidUri() { +export function readCustomAppViewDidUri() { const maybeDid = device.get(['customAppViewDid']) if (!maybeDid || !isDid(maybeDid)) { return undefined } - return `${maybeDid}#bsky_appview` as `did:${string}#bsky_appview` + return `${maybeDid}#bsky_appview` as AtprotoProxy } diff --git a/src/state/queries/deer-verification.ts b/src/state/queries/deer-verification.ts index 1a7170020..aee210f66 100644 --- a/src/state/queries/deer-verification.ts +++ b/src/state/queries/deer-verification.ts @@ -1,4 +1,4 @@ -import {AppBskyGraphVerification, AtUri} from '@atproto/api' +import {AppBskyGraphVerification, AtUri,type Did} from '@atproto/api' import { type VerificationState, type VerificationView, @@ -80,7 +80,7 @@ async function getDeerVerificationLinkedRecords( async link => { const {did, rkey} = link - let service = await resolvePdsServiceUrl(did) + const service = await resolvePdsServiceUrl(did as Did) const request = `${service}/xrpc/com.atproto.repo.getRecord?repo=${did}&collection=app.bsky.graph.verification&rkey=${rkey}` const record = await verificationCache.getOrTryInsertWith( diff --git a/src/state/queries/direct-fetch-record.ts b/src/state/queries/direct-fetch-record.ts index bae65ec01..16a5b8d33 100644 --- a/src/state/queries/direct-fetch-record.ts +++ b/src/state/queries/direct-fetch-record.ts @@ -27,6 +27,7 @@ export async function directFetchRecordAndProfile( const res = await agent.resolveHandle({ handle: urip.host, }) + // @ts-expect-error TODO new-sdk-migration urip.host = res.data.did } diff --git a/src/state/queries/post.ts b/src/state/queries/post.ts index 42b173a74..11759086d 100644 --- a/src/state/queries/post.ts +++ b/src/state/queries/post.ts @@ -56,8 +56,7 @@ export function useGetPost() { const res = await agent.resolveHandle({ handle: urip.host, }) - // @ts-expect-error TODO new-sdk-migration - urip.host = res.data.did + ;(urip as any).host = res.data.did } const res = await agent.getPosts({ diff --git a/src/state/queries/resolve-uri.ts b/src/state/queries/resolve-uri.ts index b40e38072..2580b5501 100644 --- a/src/state/queries/resolve-uri.ts +++ b/src/state/queries/resolve-uri.ts @@ -17,8 +17,8 @@ export function useResolveUriQuery(uri: string | undefined): UriUseQueryResult { const urip = new AtUri(uri || '') const res = useResolveDidQuery(urip.host) if (res.data) { - // @ts-expect-error TODO new-sdk-migration - urip.host = res.data + // @ts-expect-error TODO new-sdk-migration + urip.host = res.data return { ...res, data: {did: urip.host, uri: urip.toString()}, diff --git a/src/state/queries/threadgate/index.ts b/src/state/queries/threadgate/index.ts index e760873fb..10a4a334a 100644 --- a/src/state/queries/threadgate/index.ts +++ b/src/state/queries/threadgate/index.ts @@ -99,6 +99,7 @@ export async function getThreadgateRecord({ }) // @ts-expect-error TODO new-sdk-migration urip.host = res.data.did + } try { diff --git a/src/state/session/agent.ts b/src/state/session/agent.ts index c71ae9ca1..009233a50 100644 --- a/src/state/session/agent.ts +++ b/src/state/session/agent.ts @@ -1,6 +1,7 @@ import { Agent as BaseAgent, type AppBskyActorProfile, + type AtprotoProxy, type AtprotoServiceType, type AtpSessionData, type AtpSessionEvent, @@ -92,8 +93,12 @@ export async function createAgentAndResume( // after session is attached const aa = prefetchAgeAssuranceData({agent}) - const proxyDid = - readCustomAppViewDidUri() || BLUESKY_PROXY_HEADER.get() || APPVIEW_DID_PROXY + const proxyDid = readCustomAppViewDidUri() || BLUESKY_PROXY_HEADER.get() || APPVIEW_DID_PROXY + + if (!proxyDid) { + throw new Error(`Invalid proxy DID: ${proxyDid}`) + } + agent.configureProxy(proxyDid) return agent.prepare({ @@ -415,7 +420,7 @@ class BskyAppAgent extends BskyAgent { } }, }) - const proxyDid = readCustomAppViewDidUri() || APPVIEW_DID_PROXY + const proxyDid = readCustomAppViewDidUri() || APPVIEW_DID_PROXY as AtprotoProxy if (proxyDid) { this.configureProxy(proxyDid) } diff --git a/src/state/unstable-post-source.tsx b/src/state/unstable-post-source.tsx index c5b7d1c2b..fe9e6496a 100644 --- a/src/state/unstable-post-source.tsx +++ b/src/state/unstable-post-source.tsx @@ -81,8 +81,8 @@ export function useUnstablePostSource(key: string) { */ export function buildPostSourceKey(key: string, handle: string) { const urip = new AtUri(key) - // @ts-expect-error TODO new-sdk-migration - urip.host = handle + //@ts-expect-error TODO new-sdk-migration + urip.host = handle return urip.toString() } diff --git a/src/view/com/modals/UserAddRemoveLists.tsx b/src/view/com/modals/UserAddRemoveLists.tsx index ef561267d..94567150a 100644 --- a/src/view/com/modals/UserAddRemoveLists.tsx +++ b/src/view/com/modals/UserAddRemoveLists.tsx @@ -229,7 +229,7 @@ function ListItem({ {isProcessing || typeof membership === 'undefined' ? ( - + ) : (