update delete app password confirmation modal (#803)

zio/stable
GitStart 2023-05-30 19:56:30 +01:00 committed by GitHub
parent a89129fcf6
commit 69bcb72061
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 19 deletions

View File

@ -1,6 +1,5 @@
import React from 'react' import React from 'react'
import {StyleSheet, TouchableOpacity, View} from 'react-native' import {StyleSheet, TouchableOpacity, View} from 'react-native'
import {Alert} from 'view/com/util/Alert'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {ScrollView} from 'react-native-gesture-handler' import {ScrollView} from 'react-native-gesture-handler'
import {Text} from '../com/util/text/Text' import {Text} from '../com/util/text/Text'
@ -160,24 +159,15 @@ function AppPassword({
const store = useStores() const store = useStores()
const onDelete = React.useCallback(async () => { const onDelete = React.useCallback(async () => {
Alert.alert( store.shell.openModal({
'Delete App Password', name: 'confirm',
`Are you sure you want to delete the app password "${name}"?`, title: 'Delete App Password',
[ message: `Are you sure you want to delete the app password "${name}"?`,
{ async onPressConfirm() {
text: 'Cancel', await store.me.deleteAppPassword(name)
style: 'cancel', Toast.show('App password deleted')
}, },
{ })
text: 'Delete',
style: 'destructive',
onPress: async () => {
await store.me.deleteAppPassword(name)
Toast.show('App password deleted')
},
},
],
)
}, [store, name]) }, [store, name])
const {contentLanguages} = store.preferences const {contentLanguages} = store.preferences