Skip to content

Commit

Permalink
feat: Add warning alert for account deletion in EditProfile screen
Browse files Browse the repository at this point in the history
This commit adds a warning alert in the EditProfile screen to inform users about the permanent nature of account deletion. The alert provides a cancel option and a delete option, allowing users to make an informed decision. The alert is triggered when the user taps on the delete button.

Code changes:
- Added warning alert for account deletion in EditProfile screen
  • Loading branch information
noriega2112 committed Aug 29, 2024
1 parent fd08597 commit 5b1a4f8
Showing 1 changed file with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,24 @@ export const EditProfile = () => {
}

const showWarningAlert = () => {
Alert.alert('WARNING', 'Deleting your account is permanent and cannot be undone. If you would like to use this app again, you will need to create a new account.', [
{
text: 'Cancel',
onPress: () => console.log('Cancel Pressed'),
style: 'cancel',
},
{text: 'Delete', onPress: () => {
if (!user) return
deleteUser(user?.id)
}},
])
Alert.alert(
'WARNING',
'Deleting your account is permanent and cannot be undone. If you would like to use this app again, you will need to create a new account.',
[
{
text: 'Cancel',
onPress: () => console.log('Cancel Pressed'),
style: 'cancel',
},
{
text: 'Delete',
onPress: () => {
if (!user) return
deleteUser(user?.id)
},
},
],
)
}

if (!user) return <></> //never
Expand All @@ -119,9 +126,7 @@ export const EditProfile = () => {
<Bounceable onPress={onCancel} disabled={isDeleting || isLoggingOut || isSaving}>
<Ionicons size={26} name="chevron-back" color={colors.grey[280]} />
</Bounceable>
<Text className="text-xl">
Edit Profile
</Text>
<Text className="text-xl">Edit Profile</Text>
<Bounceable
onPress={handleSave}
disabled={isDeleting || isLoggingOut || isSaving || (unsavedChanges && !isValid)}
Expand All @@ -143,9 +148,7 @@ export const EditProfile = () => {
<View className="pt-10">
<View>
<View className="justify-center flex-1">
<Text className="text-grey-280 text-lg font-primary-bold">
Full Name
</Text>
<Text className="text-grey-280 text-lg font-primary-bold">Full Name</Text>
</View>
<Separator />
<View className="justify-center flex-3">
Expand All @@ -167,10 +170,8 @@ export const EditProfile = () => {
) : null}
<Separator />
<View>
<View className="flex-1">
<Text className="text-grey-280 text-lg font-primary-bold">
Email
</Text>
<View className="flex">
<Text className="text-grey-280 text-lg font-primary-bold">Email</Text>
</View>
<Separator />
<View className="flex-3">
Expand Down Expand Up @@ -199,4 +200,3 @@ export const EditProfile = () => {
</Container>
)
}

0 comments on commit 5b1a4f8

Please sign in to comment.