diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-04-21 19:58:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-21 19:58:42 -0500 |
commit | af2fd3cf29858d1a4f4dafd30fffb168815b34c2 (patch) | |
tree | 47340c8762c0267d9f963c795be15f54ce3420ca /src | |
parent | 16124b5081735d64f2dc0aecc1af4d7c73cf9455 (diff) | |
download | voidsky-af2fd3cf29858d1a4f4dafd30fffb168815b34c2.tar.zst |
More hotfixes to app passwords (#511)
* Fix app passwords modal on web * Fix delete app password on web
Diffstat (limited to 'src')
-rw-r--r-- | src/view/com/modals/Modal.web.tsx | 3 | ||||
-rw-r--r-- | src/view/screens/AppPasswords.tsx | 41 |
2 files changed, 27 insertions, 17 deletions
diff --git a/src/view/com/modals/Modal.web.tsx b/src/view/com/modals/Modal.web.tsx index 1effee69b..e1972f89c 100644 --- a/src/view/com/modals/Modal.web.tsx +++ b/src/view/com/modals/Modal.web.tsx @@ -18,6 +18,7 @@ import * as AltTextImageModal from './AltImage' import * as ChangeHandleModal from './ChangeHandle' import * as WaitlistModal from './Waitlist' import * as InviteCodesModal from './InviteCodes' +import * as AddAppPassword from './AddAppPasswords' import * as ContentFilteringSettingsModal from './ContentFilteringSettings' export const ModalsContainer = observer(function ModalsContainer() { @@ -77,6 +78,8 @@ function Modal({modal}: {modal: ModalIface}) { element = <WaitlistModal.Component /> } else if (modal.name === 'invite-codes') { element = <InviteCodesModal.Component /> + } else if (modal.name === 'add-app-password') { + element = <AddAppPassword.Component /> } else if (modal.name === 'content-filtering-settings') { element = <ContentFilteringSettingsModal.Component /> } else if (modal.name === 'alt-text-image') { diff --git a/src/view/screens/AppPasswords.tsx b/src/view/screens/AppPasswords.tsx index c3e837f84..db8ee98ba 100644 --- a/src/view/screens/AppPasswords.tsx +++ b/src/view/screens/AppPasswords.tsx @@ -159,24 +159,31 @@ function AppPassword({ const store = useStores() const onDelete = React.useCallback(async () => { - Alert.alert( - 'Delete App Password', - `Are you sure you want to delete the app password "${name}"?`, - [ - { - text: 'Cancel', - style: 'cancel', - }, - { - text: 'Delete', - style: 'destructive', - onPress: async () => { - await store.me.deleteAppPassword(name) - Toast.show('App password deleted') + if (isDesktopWeb) { + if (confirm('Delete app password?')) { + await store.me.deleteAppPassword(name) + Toast.show('App password deleted') + } + } else { + Alert.alert( + 'Delete App Password', + `Are you sure you want to delete the app password "${name}"?`, + [ + { + text: 'Cancel', + style: 'cancel', }, - }, - ], - ) + { + text: 'Delete', + style: 'destructive', + onPress: async () => { + await store.me.deleteAppPassword(name) + Toast.show('App password deleted') + }, + }, + ], + ) + } }, [store, name]) return ( |