Skip to content

Commit 0a0fc71

Browse files
committed
add additional delayed donor check after successful payment
1 parent cb91561 commit 0a0fc71

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

assets/en.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
},
102102
"purchase": {
103103
"restore": "Restore Purchases",
104-
"success": "Your order is processing. An app restart is required to see your perks.",
104+
"success": "Your order is processing. An app restart may be required to see your perks.",
105105
"error": "An error occurred"
106106
},
107107
"disclaimer": "VShop is not endorsed by Riot Games in any way.\nRiot Games, Valorant, and all associated properties are trademarks or registered trademarks of Riot Games, Inc.",

src/components/popups/DonatePopup.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ import {
1313
import { Linking, ToastAndroid, View } from "react-native";
1414
import { create } from "zustand";
1515
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
16-
import { getBackendUrl, getCurrencies } from "../../utils/VShopAPI";
16+
import {
17+
checkDonator,
18+
getBackendUrl,
19+
getCurrencies,
20+
} from "../../utils/VShopAPI";
1721
import { useStripe } from "@stripe/stripe-react-native";
1822
import axios from "axios";
1923
import { useUserStore } from "../../stores/user";
2024
import TextInputMask from "react-native-text-input-mask";
2125
import { getCurrencies as getUserCurrencies } from "react-native-localize";
26+
import { useFeatureStore } from "../../stores/features";
2227

2328
interface IStore {
2429
visible: boolean;
@@ -41,6 +46,7 @@ export default function DonatePopup() {
4146
: false;
4247
const { user } = useUserStore();
4348
const { initPaymentSheet, presentPaymentSheet } = useStripe();
49+
const { enableDonator } = useFeatureStore();
4450

4551
const initializePaymentSheet = async () => {
4652
const response = await axios(`${getBackendUrl()}/stripe/payment-sheet`, {
@@ -78,6 +84,10 @@ export default function DonatePopup() {
7884
} else {
7985
ToastAndroid.show(t("purchase.success"), ToastAndroid.LONG);
8086
hideDonatePopup();
87+
setTimeout(async () => {
88+
const isDonator = await checkDonator(user.id);
89+
if (isDonator) enableDonator();
90+
}, 2500);
8191
}
8292
}
8393
};

src/utils/VShopAPI.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from "axios";
22

33
export const getBackendUrl = () => {
4-
if (__DEV__) return "http://10.0.2.2:8787";
4+
if (__DEV__) return "http://10.0.2.2:8000";
55
return "https://api.vshop.one";
66
};
77

0 commit comments

Comments
 (0)