chore: fix push notif

This commit is contained in:
2026-03-18 21:08:25 +01:00
parent a00dd475f3
commit a656ee96c0
2 changed files with 46 additions and 29 deletions
+4 -2
View File
@@ -768,11 +768,12 @@ export interface PublicSettings {
referral_enabled: boolean; referral_enabled: boolean;
pool_names: string[]; pool_names: string[];
crypto_payment_enabled: boolean; crypto_payment_enabled: boolean;
crypto_only: boolean;
nowpayments_currencies: string[]; nowpayments_currencies: string[];
} }
export const getPublicSettings = async (): Promise<PublicSettings> => { export const getPublicSettings = async (): Promise<PublicSettings> => {
const defaults: PublicSettings = { penalties_enabled: true, show_amende_score: true, points_enabled: true, points_separated: true, referral_enabled: true, pool_names: ['Pool 1', 'Pool 2'], crypto_payment_enabled: false, nowpayments_currencies: [] }; const defaults: PublicSettings = { penalties_enabled: true, show_amende_score: true, points_enabled: true, points_separated: true, referral_enabled: true, pool_names: ['Pool 1', 'Pool 2'], crypto_payment_enabled: false, crypto_only: false, nowpayments_currencies: [] };
try { try {
const { data } = await apiClient.get(`${V1}/app-settings`); const { data } = await apiClient.get(`${V1}/app-settings`);
return { return {
@@ -785,6 +786,7 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
? data.pool_names ? data.pool_names
: defaults.pool_names, : defaults.pool_names,
crypto_payment_enabled: data.crypto_payment_enabled ?? false, crypto_payment_enabled: data.crypto_payment_enabled ?? false,
crypto_only: data.crypto_only ?? false,
nowpayments_currencies: Array.isArray(data.nowpayments_currencies) ? data.nowpayments_currencies : [], nowpayments_currencies: Array.isArray(data.nowpayments_currencies) ? data.nowpayments_currencies : [],
}; };
} catch { } catch {
@@ -813,7 +815,7 @@ export const getCryptoPaymentStatus = async (commandId: number): Promise<CryptoP
export const registerPushToken = async (token: string): Promise<void> => { export const registerPushToken = async (token: string): Promise<void> => {
try { try {
await apiClient.post(`${V1}/push-token`, { token }); await apiClient.post(`${V1}/push-token`, { push_token: token });
} catch { } catch {
// silencieux // silencieux
} }
+25 -10
View File
@@ -56,6 +56,7 @@ export default function CheckoutScreen() {
// Crypto // Crypto
const [cryptoEnabled, setCryptoEnabled] = useState(false); const [cryptoEnabled, setCryptoEnabled] = useState(false);
const [cryptoOnly, setCryptoOnly] = useState(false);
const [cryptoCurrencies, setCryptoCurrencies] = useState<string[]>([]); const [cryptoCurrencies, setCryptoCurrencies] = useState<string[]>([]);
const [paymentMethod, setPaymentMethod] = useState<"especes" | "crypto">("especes"); const [paymentMethod, setPaymentMethod] = useState<"especes" | "crypto">("especes");
const [payCurrency, setPayCurrency] = useState(""); const [payCurrency, setPayCurrency] = useState("");
@@ -73,6 +74,10 @@ export default function CheckoutScreen() {
setCryptoEnabled(true); setCryptoEnabled(true);
setCryptoCurrencies(settings.nowpayments_currencies); setCryptoCurrencies(settings.nowpayments_currencies);
setPayCurrency(settings.nowpayments_currencies[0]); setPayCurrency(settings.nowpayments_currencies[0]);
if (settings.crypto_only) {
setCryptoOnly(true);
setPaymentMethod("crypto");
}
} }
}); });
AsyncStorage.multiGet([ AsyncStorage.multiGet([
@@ -379,6 +384,14 @@ export default function CheckoutScreen() {
color: colors.textMuted, fontSize: fontSize.xs, textAlign: "center", color: colors.textMuted, fontSize: fontSize.xs, textAlign: "center",
}, },
cryptoSuccessText: { color: colors.success, fontSize: fontSize.sm, textAlign: "center" }, cryptoSuccessText: { color: colors.success, fontSize: fontSize.sm, textAlign: "center" },
// Crypto only badge
cryptoOnlyBadge: {
flexDirection: "row", alignItems: "center", gap: spacing.s,
backgroundColor: "rgba(247,147,26,0.10)", borderRadius: borderRadius.md,
borderWidth: 1, borderColor: CRYPTO_COLOR + "55",
padding: spacing.m, marginBottom: spacing.s,
},
cryptoOnlyText: { color: CRYPTO_COLOR, fontSize: fontSize.sm, fontWeight: fontWeight.medium, flex: 1 },
}), }),
[colors], [colors],
); );
@@ -470,16 +483,21 @@ export default function CheckoutScreen() {
{cryptoEnabled && ( {cryptoEnabled && (
<View style={styles.section}> <View style={styles.section}>
<Text style={styles.sectionTitle}>Méthode de paiement</Text> <Text style={styles.sectionTitle}>Méthode de paiement</Text>
{cryptoOnly ? (
<View style={styles.cryptoOnlyBadge}>
<Ionicons name="logo-bitcoin" size={18} color={CRYPTO_COLOR} />
<Text style={styles.cryptoOnlyText}>
Paiement uniquement en cryptomonnaie
</Text>
</View>
) : (
<View style={styles.paymentMethodRow}> <View style={styles.paymentMethodRow}>
<TouchableOpacity <TouchableOpacity
style={[styles.paymentMethodBtn, paymentMethod === "especes" && styles.paymentMethodBtnActive]} style={[styles.paymentMethodBtn, paymentMethod === "especes" && styles.paymentMethodBtnActive]}
onPress={() => setPaymentMethod("especes")} onPress={() => setPaymentMethod("especes")}
> >
<Ionicons <Ionicons name="cash-outline" size={22} color={paymentMethod === "especes" ? CRYPTO_COLOR : colors.textMuted} />
name="cash-outline"
size={22}
color={paymentMethod === "especes" ? CRYPTO_COLOR : colors.textMuted}
/>
<Text style={[styles.paymentMethodBtnText, paymentMethod === "especes" && styles.paymentMethodBtnTextActive]}> <Text style={[styles.paymentMethodBtnText, paymentMethod === "especes" && styles.paymentMethodBtnTextActive]}>
Espèces Espèces
</Text> </Text>
@@ -488,16 +506,13 @@ export default function CheckoutScreen() {
style={[styles.paymentMethodBtn, paymentMethod === "crypto" && styles.paymentMethodBtnActive]} style={[styles.paymentMethodBtn, paymentMethod === "crypto" && styles.paymentMethodBtnActive]}
onPress={() => setPaymentMethod("crypto")} onPress={() => setPaymentMethod("crypto")}
> >
<Ionicons <Ionicons name="logo-bitcoin" size={22} color={paymentMethod === "crypto" ? CRYPTO_COLOR : colors.textMuted} />
name="logo-bitcoin"
size={22}
color={paymentMethod === "crypto" ? CRYPTO_COLOR : colors.textMuted}
/>
<Text style={[styles.paymentMethodBtnText, paymentMethod === "crypto" && styles.paymentMethodBtnTextActive]}> <Text style={[styles.paymentMethodBtnText, paymentMethod === "crypto" && styles.paymentMethodBtnTextActive]}>
Crypto Crypto
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
)}
{paymentMethod === "crypto" && ( {paymentMethod === "crypto" && (
<> <>