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;
pool_names: string[];
crypto_payment_enabled: boolean;
crypto_only: boolean;
nowpayments_currencies: string[];
}
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 {
const { data } = await apiClient.get(`${V1}/app-settings`);
return {
@@ -785,6 +786,7 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
? data.pool_names
: defaults.pool_names,
crypto_payment_enabled: data.crypto_payment_enabled ?? false,
crypto_only: data.crypto_only ?? false,
nowpayments_currencies: Array.isArray(data.nowpayments_currencies) ? data.nowpayments_currencies : [],
};
} catch {
@@ -813,7 +815,7 @@ export const getCryptoPaymentStatus = async (commandId: number): Promise<CryptoP
export const registerPushToken = async (token: string): Promise<void> => {
try {
await apiClient.post(`${V1}/push-token`, { token });
await apiClient.post(`${V1}/push-token`, { push_token: token });
} catch {
// silencieux
}
+42 -27
View File
@@ -56,6 +56,7 @@ export default function CheckoutScreen() {
// Crypto
const [cryptoEnabled, setCryptoEnabled] = useState(false);
const [cryptoOnly, setCryptoOnly] = useState(false);
const [cryptoCurrencies, setCryptoCurrencies] = useState<string[]>([]);
const [paymentMethod, setPaymentMethod] = useState<"especes" | "crypto">("especes");
const [payCurrency, setPayCurrency] = useState("");
@@ -73,6 +74,10 @@ export default function CheckoutScreen() {
setCryptoEnabled(true);
setCryptoCurrencies(settings.nowpayments_currencies);
setPayCurrency(settings.nowpayments_currencies[0]);
if (settings.crypto_only) {
setCryptoOnly(true);
setPaymentMethod("crypto");
}
}
});
AsyncStorage.multiGet([
@@ -379,6 +384,14 @@ export default function CheckoutScreen() {
color: colors.textMuted, fontSize: fontSize.xs, 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],
);
@@ -470,34 +483,36 @@ export default function CheckoutScreen() {
{cryptoEnabled && (
<View style={styles.section}>
<Text style={styles.sectionTitle}>Méthode de paiement</Text>
<View style={styles.paymentMethodRow}>
<TouchableOpacity
style={[styles.paymentMethodBtn, paymentMethod === "especes" && styles.paymentMethodBtnActive]}
onPress={() => setPaymentMethod("especes")}
>
<Ionicons
name="cash-outline"
size={22}
color={paymentMethod === "especes" ? CRYPTO_COLOR : colors.textMuted}
/>
<Text style={[styles.paymentMethodBtnText, paymentMethod === "especes" && styles.paymentMethodBtnTextActive]}>
Espèces
{cryptoOnly ? (
<View style={styles.cryptoOnlyBadge}>
<Ionicons name="logo-bitcoin" size={18} color={CRYPTO_COLOR} />
<Text style={styles.cryptoOnlyText}>
Paiement uniquement en cryptomonnaie
</Text>
</TouchableOpacity>
<TouchableOpacity
style={[styles.paymentMethodBtn, paymentMethod === "crypto" && styles.paymentMethodBtnActive]}
onPress={() => setPaymentMethod("crypto")}
>
<Ionicons
name="logo-bitcoin"
size={22}
color={paymentMethod === "crypto" ? CRYPTO_COLOR : colors.textMuted}
/>
<Text style={[styles.paymentMethodBtnText, paymentMethod === "crypto" && styles.paymentMethodBtnTextActive]}>
Crypto
</Text>
</TouchableOpacity>
</View>
</View>
) : (
<View style={styles.paymentMethodRow}>
<TouchableOpacity
style={[styles.paymentMethodBtn, paymentMethod === "especes" && styles.paymentMethodBtnActive]}
onPress={() => setPaymentMethod("especes")}
>
<Ionicons name="cash-outline" size={22} color={paymentMethod === "especes" ? CRYPTO_COLOR : colors.textMuted} />
<Text style={[styles.paymentMethodBtnText, paymentMethod === "especes" && styles.paymentMethodBtnTextActive]}>
Espèces
</Text>
</TouchableOpacity>
<TouchableOpacity
style={[styles.paymentMethodBtn, paymentMethod === "crypto" && styles.paymentMethodBtnActive]}
onPress={() => setPaymentMethod("crypto")}
>
<Ionicons name="logo-bitcoin" size={22} color={paymentMethod === "crypto" ? CRYPTO_COLOR : colors.textMuted} />
<Text style={[styles.paymentMethodBtnText, paymentMethod === "crypto" && styles.paymentMethodBtnTextActive]}>
Crypto
</Text>
</TouchableOpacity>
</View>
)}
{paymentMethod === "crypto" && (
<>