From 9527ecf335b741150ae545fba2b4c74441ae1ad2 Mon Sep 17 00:00:00 2001 From: Arash Date: Mon, 22 Apr 2024 02:47:06 +0200 Subject: [PATCH 1/2] use latest iOS SDK --- mobile/eas.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mobile/eas.json b/mobile/eas.json index 316dc8b..59e42d1 100644 --- a/mobile/eas.json +++ b/mobile/eas.json @@ -1,7 +1,8 @@ { "cli": { "version": ">= 2.2.1", - "appVersionSource": "remote" + "appVersionSource": "remote", + "promptToConfigurePushNotifications": false }, "build": { "development": { @@ -21,8 +22,11 @@ }, "production": { "autoIncrement": true, - "channel":"test", + "channel": "test", "distribution": "store", + "ios": { + "image": "latest" + }, "env": { "APP_ENV": "production", "APP_NAME": "Quantoz Blockchain Services", From 20813e254841a6e6f6b7fb507907541f7b1b8390 Mon Sep 17 00:00:00 2001 From: Arash Date: Mon, 22 Apr 2024 02:48:05 +0200 Subject: [PATCH 2/2] Implement removeAccount function --- mobile/src/screens/RemoveAccount.tsx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/mobile/src/screens/RemoveAccount.tsx b/mobile/src/screens/RemoveAccount.tsx index a6d66d3..bc00148 100644 --- a/mobile/src/screens/RemoveAccount.tsx +++ b/mobile/src/screens/RemoveAccount.tsx @@ -13,15 +13,32 @@ import { theme, } from "native-base"; import ScreenWrapper from "../components/ScreenWrapper"; +import { paymentsApi } from "../utils/axios"; +import { useAuth } from "../auth/AuthContext"; +import { useNotification } from "../context/NotificationContext"; export function RemoveAccount() { + const auth = useAuth(); const [email, setEmail] = useState(""); const [isLoading, setIsLoading] = useState(false); + const { showErrorNotification, showSuccessNotification } = useNotification(); const removeAccount = async () => { setIsLoading(true); - // Temporary solution to simulate the removal of the account until the API is implemented - await new Promise((resolve) => setTimeout(resolve, 3000)); + try { + const response = await paymentsApi.delete("/api/customers"); + if (response.status === 201) { + showSuccessNotification("Account removed successfully"); + } else { + showErrorNotification( + "Account removal failed. please contact support." + ); + } + auth?.logout(); + } catch (error) { + showErrorNotification("Account removal failed. please contact support."); + auth?.logout(); + } setIsLoading(false); };