chore: build
This commit is contained in:
@@ -777,6 +777,7 @@ export interface PublicSettings {
|
||||
nowpayments_currencies: string[];
|
||||
telegram_notifications_enabled: boolean;
|
||||
two_fa_enabled: boolean;
|
||||
contact_telegram: string;
|
||||
}
|
||||
|
||||
export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
@@ -792,6 +793,7 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
nowpayments_currencies: [],
|
||||
telegram_notifications_enabled: false,
|
||||
two_fa_enabled: false,
|
||||
contact_telegram: "",
|
||||
};
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/app-settings`);
|
||||
@@ -813,6 +815,7 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
telegram_notifications_enabled:
|
||||
data.telegram_notifications_enabled ?? false,
|
||||
two_fa_enabled: data.two_fa_enabled ?? false,
|
||||
contact_telegram: data.contact_telegram || "",
|
||||
};
|
||||
} catch {
|
||||
return defaults;
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
getReferralBalance,
|
||||
getPublicSettings,
|
||||
getCryptoPaymentStatus,
|
||||
getTelegramStatus,
|
||||
} from "../../api/api";
|
||||
import type { CryptoPaymentStatus } from "../../api/api";
|
||||
import type { ClientStackParamList } from "../../navigation/types";
|
||||
@@ -57,6 +58,7 @@ export default function CheckoutScreen() {
|
||||
// Notif telegram
|
||||
const [telegramNotificationEnabled, setTelegramNotificationEnabled] =
|
||||
useState(false);
|
||||
const [telegramLinked, setTelegramLinked] = useState(false);
|
||||
|
||||
// Crypto
|
||||
const [cryptoEnabled, setCryptoEnabled] = useState(false);
|
||||
@@ -105,6 +107,10 @@ export default function CheckoutScreen() {
|
||||
if (savedPhone) setTelephone(savedPhone);
|
||||
});
|
||||
|
||||
getTelegramStatus().then((res) => {
|
||||
if (res.linked) setTelegramLinked(true);
|
||||
});
|
||||
|
||||
return () => {
|
||||
if (pollRef.current) clearInterval(pollRef.current);
|
||||
};
|
||||
@@ -1027,7 +1033,7 @@ export default function CheckoutScreen() {
|
||||
)}
|
||||
|
||||
{/* Note Telegram */}
|
||||
{telegramNotificationEnabled && (
|
||||
{telegramNotificationEnabled && !telegramLinked && (
|
||||
<View style={styles.telegramNote}>
|
||||
<Ionicons
|
||||
name="paper-plane-outline"
|
||||
|
||||
@@ -5,27 +5,36 @@ import {
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
Linking,
|
||||
TouchableOpacity,
|
||||
} from "react-native";
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
import { useTheme } from "../../context/ThemeContext";
|
||||
import { spacing, borderRadius, fontSize, fontWeight } from "../../theme";
|
||||
import { getReferralBalance } from "../../api/api";
|
||||
import { getReferralBalance, getPublicSettings } from "../../api/api";
|
||||
|
||||
export default function ParrainageScreen() {
|
||||
const { colors } = useTheme();
|
||||
const [balance, setBalance] = useState<number>(0);
|
||||
const [contactTelegram, setContactTelegram] = useState<string>("");
|
||||
|
||||
useEffect(() => {
|
||||
getReferralBalance().then((res) => {
|
||||
if (res.success) setBalance(res.balance);
|
||||
});
|
||||
getPublicSettings().then((settings) => {
|
||||
if (settings.contact_telegram) {
|
||||
setContactTelegram(settings.contact_telegram);
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
const steps = [
|
||||
{
|
||||
icon: "chatbubble-ellipses-outline" as const,
|
||||
title: "1. Contacte-nous sur Telegram",
|
||||
desc: "Envoie un message à @milieu_nantais en indiquant ton username et le username de la personne que tu as parrainée.",
|
||||
desc: contactTelegram
|
||||
? `Envoie un message à @${contactTelegram} en indiquant ton username et le username de la personne que tu as parrainée.`
|
||||
: "Envoie-nous un message sur Telegram en indiquant ton username et le username de la personne que tu as parrainée.",
|
||||
},
|
||||
{
|
||||
icon: "checkmark-circle-outline" as const,
|
||||
@@ -152,6 +161,12 @@ export default function ParrainageScreen() {
|
||||
[colors],
|
||||
);
|
||||
|
||||
const handleTelegramPress = () => {
|
||||
if (contactTelegram) {
|
||||
Linking.openURL(`https://t.me/${contactTelegram}`);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<ScrollView style={styles.container} contentContainerStyle={styles.content}>
|
||||
{/* Solde actuel */}
|
||||
@@ -190,18 +205,14 @@ export default function ParrainageScreen() {
|
||||
</View>
|
||||
|
||||
{/* Bouton Telegram */}
|
||||
<View
|
||||
style={styles.telegramBtn}
|
||||
// Utiliser TouchableOpacity si besoin d'interaction
|
||||
>
|
||||
<Ionicons name="paper-plane-outline" size={20} color="#fff" />
|
||||
<Text
|
||||
style={styles.telegramText}
|
||||
onPress={() => Linking.openURL("https://t.me/milieu_nantais")}
|
||||
>
|
||||
Contacter @milieu_nantais
|
||||
</Text>
|
||||
</View>
|
||||
{contactTelegram ? (
|
||||
<TouchableOpacity style={styles.telegramBtn} onPress={handleTelegramPress}>
|
||||
<Ionicons name="paper-plane-outline" size={20} color="#fff" />
|
||||
<Text style={styles.telegramText}>
|
||||
Contacter @{contactTelegram}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
) : null}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user