chore: fix
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
"expo": {
|
||||
"name": "Milieu Nantais",
|
||||
"slug": "frontend-client",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"orientation": "portrait",
|
||||
"icon": "./assets/icon.png",
|
||||
"userInterfaceStyle": "dark",
|
||||
|
||||
@@ -60,6 +60,10 @@ export default function ProfileScreen() {
|
||||
|
||||
// Modal changement de mot de passe
|
||||
const [showPasswordModal, setShowPasswordModal] = useState(false);
|
||||
|
||||
// Modals Telegram unlink
|
||||
const [showTelegramUnlinkModal, setShowTelegramUnlinkModal] = useState(false);
|
||||
const [showTelegramSuccessModal, setShowTelegramSuccessModal] = useState(false);
|
||||
const [currentPwd, setCurrentPwd] = useState("");
|
||||
const [newPwd, setNewPwd] = useState("");
|
||||
const [confirmPwd, setConfirmPwd] = useState("");
|
||||
@@ -116,6 +120,11 @@ export default function ProfileScreen() {
|
||||
Alert.alert("Enregistré", "Informations par défaut sauvegardées");
|
||||
};
|
||||
|
||||
const saveAddress = async () => {
|
||||
await AsyncStorage.setItem(STORAGE_ADDRESS, defaultAddress.trim());
|
||||
Alert.alert("Enregistré", "Adresse par défaut sauvegardée");
|
||||
};
|
||||
|
||||
const handleLinkTelegram = async () => {
|
||||
setTelegramLoading(true);
|
||||
const res = await generateTelegramLinkToken();
|
||||
@@ -134,23 +143,16 @@ export default function ProfileScreen() {
|
||||
);
|
||||
};
|
||||
|
||||
const handleUnlinkTelegram = async () => {
|
||||
Alert.alert(
|
||||
"Délier Telegram",
|
||||
"Vous ne recevrez plus de notifications Telegram. Continuer ?",
|
||||
[
|
||||
{ text: "Annuler", style: "cancel" },
|
||||
{
|
||||
text: "Délier",
|
||||
style: "destructive",
|
||||
onPress: async () => {
|
||||
await unlinkTelegram();
|
||||
setTelegramLinked(false);
|
||||
setTwoFAEnabled(false);
|
||||
},
|
||||
},
|
||||
],
|
||||
);
|
||||
const handleUnlinkTelegram = () => {
|
||||
setShowTelegramUnlinkModal(true);
|
||||
};
|
||||
|
||||
const confirmUnlinkTelegram = async () => {
|
||||
setShowTelegramUnlinkModal(false);
|
||||
await unlinkTelegram();
|
||||
setTelegramLinked(false);
|
||||
setTwoFAEnabled(false);
|
||||
setShowTelegramSuccessModal(true);
|
||||
};
|
||||
|
||||
const handleChangePassword = async () => {
|
||||
@@ -447,6 +449,15 @@ export default function ProfileScreen() {
|
||||
multiline
|
||||
numberOfLines={2}
|
||||
/>
|
||||
<TouchableOpacity
|
||||
style={[styles.saveBtn, styles.saveBtnSecondary, { marginTop: spacing.m }]}
|
||||
onPress={saveAddress}
|
||||
>
|
||||
<Ionicons name="save-outline" size={16} color={colors.accent} />
|
||||
<Text style={[styles.saveBtnText, styles.saveBtnTextSecondary]}>
|
||||
Enregistrer l'adresse
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
{/* Carte contact livraison */}
|
||||
@@ -712,6 +723,80 @@ export default function ProfileScreen() {
|
||||
</TouchableOpacity>
|
||||
</Modal>
|
||||
|
||||
{/* Modal confirmation déliaison Telegram */}
|
||||
<Modal
|
||||
visible={showTelegramUnlinkModal}
|
||||
transparent
|
||||
animationType="fade"
|
||||
onRequestClose={() => setShowTelegramUnlinkModal(false)}
|
||||
>
|
||||
<TouchableOpacity
|
||||
style={styles.modalOverlay}
|
||||
activeOpacity={1}
|
||||
onPress={() => setShowTelegramUnlinkModal(false)}
|
||||
>
|
||||
<TouchableOpacity activeOpacity={1} onPress={() => {}}>
|
||||
<View style={styles.modalBox}>
|
||||
<View style={[styles.modalIconWrap, { borderColor: "#ef444433", backgroundColor: "#ef444411" }]}>
|
||||
<Ionicons name="unlink-outline" size={24} color="#ef4444" />
|
||||
</View>
|
||||
<Text style={styles.modalTitle}>Délier Telegram ?</Text>
|
||||
<Text style={styles.modalBody}>
|
||||
Vous ne recevrez plus de notifications Telegram. La double authentification sera également désactivée.
|
||||
</Text>
|
||||
<View style={styles.modalActions}>
|
||||
<TouchableOpacity
|
||||
style={styles.modalBtnCancel}
|
||||
onPress={() => setShowTelegramUnlinkModal(false)}
|
||||
>
|
||||
<Text style={styles.modalBtnCancelText}>Annuler</Text>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
style={[styles.modalBtnConfirm, { backgroundColor: "#ef444422", borderColor: "#ef444466" }]}
|
||||
onPress={confirmUnlinkTelegram}
|
||||
>
|
||||
<Text style={[styles.modalBtnConfirmText, { color: "#ef4444" }]}>Délier</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
</TouchableOpacity>
|
||||
</Modal>
|
||||
|
||||
{/* Modal succès déliaison Telegram */}
|
||||
<Modal
|
||||
visible={showTelegramSuccessModal}
|
||||
transparent
|
||||
animationType="fade"
|
||||
onRequestClose={() => setShowTelegramSuccessModal(false)}
|
||||
>
|
||||
<TouchableOpacity
|
||||
style={styles.modalOverlay}
|
||||
activeOpacity={1}
|
||||
onPress={() => setShowTelegramSuccessModal(false)}
|
||||
>
|
||||
<TouchableOpacity activeOpacity={1} onPress={() => {}}>
|
||||
<View style={styles.modalBox}>
|
||||
<View style={[styles.modalIconWrap, { borderColor: "#10b98133", backgroundColor: "#10b98111" }]}>
|
||||
<Ionicons name="checkmark-circle-outline" size={24} color="#10b981" />
|
||||
</View>
|
||||
<Text style={styles.modalTitle}>Compte délié</Text>
|
||||
<Text style={styles.modalBody}>
|
||||
Votre compte Telegram a été délié avec succès. Vous ne recevrez plus de notifications via Telegram.
|
||||
</Text>
|
||||
<View style={styles.modalActions}>
|
||||
<TouchableOpacity
|
||||
style={[styles.modalBtnConfirm, { flex: 1, borderColor: "#10b98166" }]}
|
||||
onPress={() => setShowTelegramSuccessModal(false)}
|
||||
>
|
||||
<Text style={[styles.modalBtnConfirmText, { color: "#10b981" }]}>Fermer</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
</TouchableOpacity>
|
||||
</Modal>
|
||||
|
||||
</KeyboardAvoidingView>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user