about summary refs log tree commit diff
path: root/src/view/screens/AppPasswords.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-11-08 12:34:10 -0600
committerGitHub <noreply@github.com>2023-11-08 10:34:10 -0800
commitf18b15241ab708f8c25a11937a875e361e9f1221 (patch)
tree07829ce8617cb858b4519d6f16c89c7e43f84d9c /src/view/screens/AppPasswords.tsx
parent5eadadffbf5475b233da7b1463e2345ff3e3cfce (diff)
downloadvoidsky-f18b15241ab708f8c25a11937a875e361e9f1221.tar.zst
Add modal state provider, replace usage except methods (#1833)
* Add modal state provider, replace usage except methods

* Replace easy spots

* Fix sticky spots

* Replace final usages

* Memorize context objects

* Add more warnings
Diffstat (limited to 'src/view/screens/AppPasswords.tsx')
-rw-r--r--src/view/screens/AppPasswords.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/view/screens/AppPasswords.tsx b/src/view/screens/AppPasswords.tsx
index b654055c4..338adfbaf 100644
--- a/src/view/screens/AppPasswords.tsx
+++ b/src/view/screens/AppPasswords.tsx
@@ -17,6 +17,7 @@ import {useFocusEffect} from '@react-navigation/native'
 import {ViewHeader} from '../com/util/ViewHeader'
 import {CenteredView} from 'view/com/util/Views'
 import {useSetMinimalShellMode} from '#/state/shell'
+import {useModalControls} from '#/state/modals'
 import {useLanguagePrefs} from '#/state/preferences'
 
 type Props = NativeStackScreenProps<CommonNavigatorParams, 'AppPasswords'>
@@ -27,6 +28,7 @@ export const AppPasswords = withAuthRequired(
     const setMinimalShellMode = useSetMinimalShellMode()
     const {screen} = useAnalytics()
     const {isTabletOrDesktop} = useWebMediaQueries()
+    const {openModal} = useModalControls()
 
     useFocusEffect(
       React.useCallback(() => {
@@ -36,8 +38,8 @@ export const AppPasswords = withAuthRequired(
     )
 
     const onAdd = React.useCallback(async () => {
-      store.shell.openModal({name: 'add-app-password'})
-    }, [store])
+      openModal({name: 'add-app-password'})
+    }, [openModal])
 
     // no app passwords (empty) state
     if (store.me.appPasswords.length === 0) {
@@ -162,10 +164,11 @@ function AppPassword({
 }) {
   const pal = usePalette('default')
   const store = useStores()
+  const {openModal} = useModalControls()
   const {contentLanguages} = useLanguagePrefs()
 
   const onDelete = React.useCallback(async () => {
-    store.shell.openModal({
+    openModal({
       name: 'confirm',
       title: 'Delete App Password',
       message: `Are you sure you want to delete the app password "${name}"?`,
@@ -174,7 +177,7 @@ function AppPassword({
         Toast.show('App password deleted')
       },
     })
-  }, [store, name])
+  }, [store, openModal, name])
 
   const primaryLocale =
     contentLanguages.length > 0 ? contentLanguages[0] : 'en-US'