diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/hooks/useAccountSwitcher.ts | 5 | ||||
-rw-r--r-- | src/lib/hooks/useOTAUpdate.ts | 8 | ||||
-rw-r--r-- | src/lib/media/alt-text.ts | 12 | ||||
-rw-r--r-- | src/lib/media/picker.web.tsx | 5 |
4 files changed, 11 insertions, 19 deletions
diff --git a/src/lib/hooks/useAccountSwitcher.ts b/src/lib/hooks/useAccountSwitcher.ts index 1ddb181a8..b165fddb5 100644 --- a/src/lib/hooks/useAccountSwitcher.ts +++ b/src/lib/hooks/useAccountSwitcher.ts @@ -7,6 +7,7 @@ import {AccountData} from 'state/models/session' import {reset as resetNavigation} from '../../Navigation' import * as Toast from 'view/com/util/Toast' import {useSetDrawerOpen} from '#/state/shell/drawer-open' +import {useModalControls} from '#/state/modals' export function useAccountSwitcher(): [ boolean, @@ -16,6 +17,7 @@ export function useAccountSwitcher(): [ const {track} = useAnalytics() const store = useStores() const setDrawerOpen = useSetDrawerOpen() + const {closeModal} = useModalControls() const [isSwitching, setIsSwitching] = useState(false) const navigation = useNavigation<NavigationProp>() @@ -25,6 +27,7 @@ export function useAccountSwitcher(): [ setIsSwitching(true) const success = await store.session.resumeSession(acct) setDrawerOpen(false) + closeModal() store.shell.closeAllActiveElements() if (success) { resetNavigation() @@ -36,7 +39,7 @@ export function useAccountSwitcher(): [ store.session.clear() } }, - [track, setIsSwitching, navigation, store, setDrawerOpen], + [track, setIsSwitching, navigation, store, setDrawerOpen, closeModal], ) return [isSwitching, setIsSwitching, onPressSwitchAccount] diff --git a/src/lib/hooks/useOTAUpdate.ts b/src/lib/hooks/useOTAUpdate.ts index 0ce97a4c8..a3584fc9d 100644 --- a/src/lib/hooks/useOTAUpdate.ts +++ b/src/lib/hooks/useOTAUpdate.ts @@ -1,15 +1,15 @@ import * as Updates from 'expo-updates' import {useCallback, useEffect} from 'react' import {AppState} from 'react-native' -import {useStores} from 'state/index' import {logger} from '#/logger' +import {useModalControls} from '#/state/modals' export function useOTAUpdate() { - const store = useStores() + const {openModal} = useModalControls() // HELPER FUNCTIONS const showUpdatePopup = useCallback(() => { - store.shell.openModal({ + openModal({ name: 'confirm', title: 'Update Available', message: @@ -20,7 +20,7 @@ export function useOTAUpdate() { }) }, }) - }, [store.shell]) + }, [openModal]) const checkForUpdate = useCallback(async () => { logger.debug('useOTAUpdate: Checking for update...') try { diff --git a/src/lib/media/alt-text.ts b/src/lib/media/alt-text.ts deleted file mode 100644 index 4109f667a..000000000 --- a/src/lib/media/alt-text.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {RootStoreModel} from 'state/index' -import {ImageModel} from 'state/models/media/image' - -export async function openAltTextModal( - store: RootStoreModel, - image: ImageModel, -) { - store.shell.openModal({ - name: 'alt-text-image', - image, - }) -} diff --git a/src/lib/media/picker.web.tsx b/src/lib/media/picker.web.tsx index d12685b0c..50b9c73e9 100644 --- a/src/lib/media/picker.web.tsx +++ b/src/lib/media/picker.web.tsx @@ -4,6 +4,7 @@ import {CameraOpts, CropperOptions} from './types' import {RootStoreModel} from 'state/index' import {Image as RNImage} from 'react-native-image-crop-picker' export {openPicker} from './picker.shared' +import {unstable__openModal} from '#/state/modals' export async function openCamera( _store: RootStoreModel, @@ -14,12 +15,12 @@ export async function openCamera( } export async function openCropper( - store: RootStoreModel, + _store: RootStoreModel, opts: CropperOptions, ): Promise<RNImage> { // TODO handle more opts return new Promise((resolve, reject) => { - store.shell.openModal({ + unstable__openModal({ name: 'crop-image', uri: opts.path, onSelect: (img?: RNImage) => { |