diff --git a/mobile/app.config.ts b/mobile/app.config.ts
index 8e7015dad..b5c76649a 100644
--- a/mobile/app.config.ts
+++ b/mobile/app.config.ts
@@ -18,7 +18,7 @@ const expoConfig: ExpoConfig = {
},
assetBundlePatterns: ['**/*'],
ios: {
- buildNumber: '1',
+ buildNumber: '4',
supportsTablet: true,
bundleIdentifier: 'org.commitglobal.vic',
entitlements: {
@@ -32,7 +32,7 @@ const expoConfig: ExpoConfig = {
},
},
android: {
- versionCode: 1,
+ versionCode: 3,
adaptiveIcon: {
foregroundImage: './src/assets/images/adaptive-icon.png',
backgroundColor: '#ffffff',
@@ -55,7 +55,8 @@ const expoConfig: ExpoConfig = {
[
'expo-image-picker',
{
- photosPermission: 'The app accesses your photos to let you share them with your friends.',
+ photosPermission: 'The app accesses your photos to allow you to set a profile picture.',
+ cameraPermission: 'The app accesses your camera to allow you to set a profile picture.',
},
],
],
diff --git a/mobile/src/assets/locales/en/translation.json b/mobile/src/assets/locales/en/translation.json
index 6d26c3a08..c3653814b 100644
--- a/mobile/src/assets/locales/en/translation.json
+++ b/mobile/src/assets/locales/en/translation.json
@@ -215,7 +215,8 @@
"password": "Change password",
"notification": "Notifications settings",
"information": "Information",
- "logout": "Log out"
+ "logout": "Log out",
+ "delete": "Delete account"
},
"account_data": {
"title": "Date cont",
@@ -738,5 +739,11 @@
"rejected": "was rejected"
}
}
+ },
+ "delete_account": {
+ "title": "Confirm account deletion",
+ "paragraph": "To delete your account on the VIC application, please confirm your decision below. Deleting your account will result in the permanent loss of your data and access to the application. If you are certain about this action, click the 'Confirm Deletion' button. Keep in mind that this process is irreversible, and you will need to create a new account if you wish to use VIC in the future.",
+ "confirm": "Confirm Deletion",
+ "error": "Error on account deletion."
}
}
diff --git a/mobile/src/assets/locales/ro/translation.json b/mobile/src/assets/locales/ro/translation.json
index 23bfd8c1e..18d2feecc 100644
--- a/mobile/src/assets/locales/ro/translation.json
+++ b/mobile/src/assets/locales/ro/translation.json
@@ -215,7 +215,8 @@
"password": "Schimbă parola",
"notification": "Setări notificări",
"information": "Informații",
- "logout": "Log out"
+ "logout": "Log out",
+ "delete": "Sterge cont"
},
"account_data": {
"title": "Date cont",
@@ -733,5 +734,11 @@
"rejected": "a fost respinsă"
}
}
+ },
+ "delete_account": {
+ "title": "Confirma ștergerea contului",
+ "paragraph": "Pentru a șterge contul tău în aplicația VIC, te rugăm să confirmi decizia mai jos. Ștergerea contului va duce la pierderea permanentă a datelor tale și a accesului la aplicație. Dacă ești sigur în privința acestei acțiuni, apasă butonul 'Confirmă Ștergerea'. Menționează că acest proces este ireversibil și va trebui să creezi un cont nou dacă dorești să utilizezi VIC în viitor.",
+ "confirm": "Confirmă Ștergerea",
+ "error": "Eroare la stergerea contului"
}
}
diff --git a/mobile/src/assets/svg/trash.js b/mobile/src/assets/svg/trash.js
new file mode 100644
index 000000000..72acac8cc
--- /dev/null
+++ b/mobile/src/assets/svg/trash.js
@@ -0,0 +1,3 @@
+export default ``;
diff --git a/mobile/src/routes/Private.tsx b/mobile/src/routes/Private.tsx
index 3db604b43..c2a7b2e69 100644
--- a/mobile/src/routes/Private.tsx
+++ b/mobile/src/routes/Private.tsx
@@ -26,6 +26,7 @@ import ContractRejectedReason from '../screens/ContractRejectedReason';
import PendingContracts from '../screens/PendingContracts';
import ContractHistory from '../screens/ContractHistory';
import RequestRejectedReason from '../screens/RequestRejectedReason';
+import DeleteAccount from '../screens/DeleteAccount';
const { Navigator, Screen, Group } = createNativeStackNavigator();
@@ -60,6 +61,7 @@ const Private = () => (
+
);
diff --git a/mobile/src/screens/DeleteAccount.tsx b/mobile/src/screens/DeleteAccount.tsx
new file mode 100644
index 000000000..0859c8f36
--- /dev/null
+++ b/mobile/src/screens/DeleteAccount.tsx
@@ -0,0 +1,59 @@
+import React from 'react';
+import ModalLayout from '../layouts/ModalLayout';
+import { Text, useTheme } from '@ui-kitten/components';
+import { ALLOW_FONT_SCALLING } from '../common/constants/constants';
+import { ButtonType } from '../common/enums/button-type.enum';
+import { useTranslation } from 'react-i18next';
+import FormLayout from '../layouts/FormLayout';
+import { useDeleteAccountMutation } from '../services/user/user.service';
+import { useAuth } from '../hooks/useAuth';
+
+const DeleteAccount = ({ navigation }: any) => {
+ const { t } = useTranslation('delete_account');
+ const { logout } = useAuth();
+ const theme = useTheme();
+
+ const {
+ mutate: deleteAccount,
+ isLoading: isDeletingAccount,
+ error: deleteAccountError,
+ } = useDeleteAccountMutation();
+
+ const onConfirmDeleteAccount = () => {
+ deleteAccount(undefined, {
+ onSuccess: () => {
+ logout();
+ },
+ });
+ };
+
+ return (
+
+
+
+ {`${t('paragraph')}`}
+
+ {!!deleteAccountError && (
+
+ {`${t('error')}`}
+
+ )}
+
+
+ );
+};
+
+export default DeleteAccount;
diff --git a/mobile/src/screens/Settings.tsx b/mobile/src/screens/Settings.tsx
index b1a9c12e4..103945ad3 100644
--- a/mobile/src/screens/Settings.tsx
+++ b/mobile/src/screens/Settings.tsx
@@ -3,6 +3,7 @@ import bell from '../assets/svg/bell';
import identification from '../assets/svg/identification';
import information from '../assets/svg/information';
import key from '../assets/svg/key';
+import trash from '../assets/svg/trash';
import logoutIcon from '../assets/svg/logout';
import user from '../assets/svg/user';
import PageLayout from '../layouts/PageLayout';
@@ -27,6 +28,7 @@ export enum SETTINGS_ROUTES {
NOTIFICATIONS_SETTINGS = 'notifications-settings',
INFORMATION = 'information',
LOGOUT = 'logout',
+ DELETE_ACCOUNT = 'delete-account',
}
export const SETTING_SCREENS = [
@@ -43,6 +45,7 @@ export const SETTING_SCREENS = [
route: SETTINGS_ROUTES.NOTIFICATIONS_SETTINGS,
},
{ icon: information, label: i18n.t('settings:information'), route: SETTINGS_ROUTES.INFORMATION },
+ { icon: trash, label: i18n.t('settings:delete'), route: SETTINGS_ROUTES.DELETE_ACCOUNT },
{ icon: logoutIcon, label: i18n.t('settings:logout'), route: SETTINGS_ROUTES.LOGOUT },
];
diff --git a/mobile/src/services/user/user.api.ts b/mobile/src/services/user/user.api.ts
index ca211cbeb..a966d94f2 100644
--- a/mobile/src/services/user/user.api.ts
+++ b/mobile/src/services/user/user.api.ts
@@ -46,3 +46,7 @@ export const updateUserProfile = async (
headers: { 'Content-Type': 'multipart/form-data' },
}).then((res) => res.data);
};
+
+export const deleteAccount = async () => {
+ return API.delete('/mobile/user').then((res) => res.data);
+};
diff --git a/mobile/src/services/user/user.service.ts b/mobile/src/services/user/user.service.ts
index 7a1a9ada5..062e9b080 100644
--- a/mobile/src/services/user/user.service.ts
+++ b/mobile/src/services/user/user.service.ts
@@ -1,6 +1,7 @@
import { useMutation, useQuery } from 'react-query';
import {
createUserProfile,
+ deleteAccount,
getUserProfile,
updateUserPersonalData,
updateUserProfile,
@@ -64,3 +65,7 @@ export const useUpdateUserProfileMutation = () => {
{ onSuccess: (data) => setUserProfile({ ...oldProfile, ...data }) },
);
};
+
+export const useDeleteAccountMutation = () => {
+ return useMutation(['delete-account'], () => deleteAccount());
+};