diff --git a/.env b/.env index dfb4c589..df40fb21 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -APP_VERSION=2.0.14 +APP_VERSION=2.0.15 -APP_BUILD_NUMBER=372 +APP_BUILD_NUMBER=373 \ No newline at end of file diff --git a/src/assets/translations/en.json b/src/assets/translations/en.json index 669d6a66..15e5d466 100644 --- a/src/assets/translations/en.json +++ b/src/assets/translations/en.json @@ -106,6 +106,7 @@ "downloadApp": "Download the app", "note": "Note", "atmAccount": "ATM account", + "guestMode": "Guest mode", "allowWithdraw": "Allow withdraw", "cannotGoHigher": "Maximum amount is {{maxAmount}}", "addToHomeScreen": "Add to home screen" diff --git a/src/assets/translations/fr.json b/src/assets/translations/fr.json index 85e5d62b..4dd28c83 100644 --- a/src/assets/translations/fr.json +++ b/src/assets/translations/fr.json @@ -106,6 +106,7 @@ "downloadApp": "Télécharger l'application", "note": "Note", "atmAccount": "Compte ATM", + "guestMode": "Mode invité", "allowWithdraw": "Autoriser le retrait", "cannotGoHigher": "Le montant maximum est de {{maxAmount}}", "addToHomeScreen": "Ajouter à l'écran d'accueil" diff --git a/src/config/settingsKeys.ts b/src/config/settingsKeys.ts index 6fd0290a..ce87a8ab 100644 --- a/src/config/settingsKeys.ts +++ b/src/config/settingsKeys.ts @@ -14,6 +14,7 @@ export const keyStoreIsAtm = "settings.isAtm"; export const keyStoreUserType = "settings.userType"; export const keyStoreDeviceName = "settings.deviceName"; export const keyStoreHmac = "settings.hmac"; +export const keyStoreIsGuest = "settings.isGuest"; export const keyStoreTransactionsHistory = "data.transactionsHistory"; // Local wallet config diff --git a/src/hooks/useAccountConfig.ts b/src/hooks/useAccountConfig.ts index 21a3e110..42af7adb 100644 --- a/src/hooks/useAccountConfig.ts +++ b/src/hooks/useAccountConfig.ts @@ -3,7 +3,8 @@ import { AppState } from "react-native"; import { keyStoreAccountConfig, keyStoreDeviceName, - keyStoreHmac + keyStoreHmac, + keyStoreIsGuest } from "@config/settingsKeys"; import { AsyncStorage } from "@utils"; import { useNavigate } from "@components/Router"; @@ -107,6 +108,8 @@ export const useAccountConfig = (props?: UseAccountConfigParams) => { await AsyncStorage.setItem(keyStoreDeviceName, value); } else if (key === "hmac") { await AsyncStorage.setItem(keyStoreHmac, value); + } else if (key === "isGuest") { + await AsyncStorage.setItem(keyStoreIsGuest, "true"); } } } diff --git a/src/hooks/usePostInvoice.ts b/src/hooks/usePostInvoice.ts index 9076eb7d..ff4fb31c 100644 --- a/src/hooks/usePostInvoice.ts +++ b/src/hooks/usePostInvoice.ts @@ -1,5 +1,8 @@ import { useCallback, useContext } from "react"; -import { keyStoreTransactionsHistory } from "@config/settingsKeys"; +import { + keyStoreIsGuest, + keyStoreTransactionsHistory +} from "@config/settingsKeys"; import { intlFormat } from "date-fns"; import { AsyncStorage, Biometrics, getSha256 } from "@utils"; import { useToast } from "react-native-toast-notifications"; @@ -34,7 +37,10 @@ export const usePostInvoice = () => { deviceType }: PostInvoiceParams) => { try { - const isLocalInvoice = true; + const isGuestMode = + (await AsyncStorage.getItem(keyStoreIsGuest)) === "true"; + + const isLocalInvoice = !isAtm && !isGuestMode; let decimalFiat = amount; let finalUrl = ""; diff --git a/src/screens/Pos/Pos.tsx b/src/screens/Pos/Pos.tsx index 89a08bc0..2ae160ac 100644 --- a/src/screens/Pos/Pos.tsx +++ b/src/screens/Pos/Pos.tsx @@ -18,7 +18,8 @@ import { faCog, faListCheck, faPen, - faShop + faShop, + faUser } from "@fortawesome/free-solid-svg-icons"; import { useSafeAreaInsets, @@ -27,7 +28,7 @@ import { useModalInput } from "@hooks"; import { SBPContext, apiRootUrl, currencies, platform } from "@config"; -import { keyStoreDeviceName } from "@config/settingsKeys"; +import { keyStoreDeviceName, keyStoreIsGuest } from "@config/settingsKeys"; import { useToast } from "react-native-toast-notifications"; import { useTheme } from "styled-components"; import { TextInput, TouchableOpacity } from "react-native"; @@ -71,6 +72,8 @@ export const Pos = () => { [accountConfig, isLoading] ); + const [isGuestMode, setIsGuestMode] = useState(false); + const [fiatAmount, setFiatAmount] = useState(0); const [maxFiatAmount, setMaxFiatAmount] = useState(); const [deviceName, setDeviceName] = useState(); @@ -88,6 +91,12 @@ export const Pos = () => { [] ); + useEffect(() => { + (async () => { + setIsGuestMode((await AsyncStorage.getItem(keyStoreIsGuest)) === "true"); + })(); + }, []); + const requestInvoice = useCallback(async () => { await postInvoice({ amount: decimalFiat, @@ -249,6 +258,15 @@ export const Pos = () => { icon={faShop} /> )} + {isGuestMode && ( + + )} {isBackgroundLoading && }