Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
APP_VERSION=2.0.14
APP_VERSION=2.0.15

APP_BUILD_NUMBER=372
APP_BUILD_NUMBER=373
1 change: 1 addition & 0 deletions src/assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/config/settingsKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/useAccountConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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");
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/hooks/usePostInvoice.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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 = "";
Expand Down
22 changes: 20 additions & 2 deletions src/screens/Pos/Pos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import {
faCog,
faListCheck,
faPen,
faShop
faShop,
faUser
} from "@fortawesome/free-solid-svg-icons";
import {
useSafeAreaInsets,
Expand All @@ -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";
Expand Down Expand Up @@ -71,6 +72,8 @@ export const Pos = () => {
[accountConfig, isLoading]
);

const [isGuestMode, setIsGuestMode] = useState(false);

const [fiatAmount, setFiatAmount] = useState(0);
const [maxFiatAmount, setMaxFiatAmount] = useState<number>();
const [deviceName, setDeviceName] = useState<string>();
Expand All @@ -88,6 +91,12 @@ export const Pos = () => {
[]
);

useEffect(() => {
(async () => {
setIsGuestMode((await AsyncStorage.getItem(keyStoreIsGuest)) === "true");
})();
}, []);

const requestInvoice = useCallback(async () => {
await postInvoice({
amount: decimalFiat,
Expand Down Expand Up @@ -249,6 +258,15 @@ export const Pos = () => {
icon={faShop}
/>
)}
{isGuestMode && (
<S.ATMButton
secondaryColor={colors.primary}
disabled
size="small"
title={t("guestMode")}
icon={faUser}
/>
)}
{isBackgroundLoading && <S.BackgroundLoader size={20} />}
<S.FiatAmountComponentStack direction="horizontal" gapSize={10}>
<Text color={colors.white} h2 weight={700}>
Expand Down