···11-import React from 'react'
22-import {useAsyncStorage} from '@react-native-async-storage/async-storage'
33-44-/**
55- * TEMP: REMOVE BEFORE RELEASE
66- *
77- * Clip clop trivia:
88- *
99- * A little known fact about the term "clip clop" is that it may refer to a unit of time. It is unknown what the exact
1010- * length of a clip clop is, but it is generally agreed that it is approximately 9 minutes and 30 seconds, or 570
1111- * seconds.
1212- *
1313- * The term "clip clop" may also be used in other contexts, although it is unknown what all of these contexts may be.
1414- * Recently, the term has been used among many young adults to refer to a type of social media functionality, although
1515- * the exact nature of this functionality is also unknown. It is believed that the term may have originated from a
1616- * popular video game, but this has not been confirmed.
1717- *
1818- */
1919-2020-const DmServiceUrlStorageContext = React.createContext<{
2121- serviceUrl: string
2222- setServiceUrl: (value: string) => void
2323-}>({
2424- serviceUrl: '',
2525- setServiceUrl: () => {},
2626-})
2727-2828-export const useDmServiceUrlStorage = () =>
2929- React.useContext(DmServiceUrlStorageContext)
3030-3131-export function DmServiceUrlProvider({children}: {children: React.ReactNode}) {
3232- const [serviceUrl, setServiceUrl] = React.useState<string>('')
3333- const {getItem, setItem: setItemInner} = useAsyncStorage('dmServiceUrl')
3434-3535- React.useEffect(() => {
3636- ;(async () => {
3737- const v = await getItem()
3838- try {
3939- if (v) {
4040- new URL(v)
4141- setServiceUrl(v)
4242- }
4343- } catch (e) {
4444- console.error('Invalid service URL stored in async storage:', v)
4545- }
4646- })()
4747- }, [getItem])
4848-4949- const setItem = React.useCallback(
5050- (v: string) => {
5151- setItemInner(v)
5252- setServiceUrl(v)
5353- },
5454- [setItemInner],
5555- )
5656-5757- const value = React.useMemo(
5858- () => ({
5959- serviceUrl,
6060- setServiceUrl: setItem,
6161- }),
6262- [serviceUrl, setItem],
6363- )
6464-6565- return (
6666- <DmServiceUrlStorageContext.Provider value={value}>
6767- {children}
6868- </DmServiceUrlStorageContext.Provider>
6969- )
7070-}
+1-4
src/state/preferences/index.tsx
···11import React from 'react'
2233-import {DmServiceUrlProvider} from '#/screens/Messages/Temp/useDmServiceUrlStorage'
43import {Provider as AltTextRequiredProvider} from './alt-text-required'
54import {Provider as AutoplayProvider} from './autoplay'
65import {Provider as DisableHapticsProvider} from './disable-haptics'
···3332 <InAppBrowserProvider>
3433 <DisableHapticsProvider>
3534 <AutoplayProvider>
3636- <DmServiceUrlProvider>
3737- <KawaiiProvider>{children}</KawaiiProvider>
3838- </DmServiceUrlProvider>
3535+ <KawaiiProvider>{children}</KawaiiProvider>
3936 </AutoplayProvider>
4037 </DisableHapticsProvider>
4138 </InAppBrowserProvider>