diff --git a/src/components/Global/AnimatedNumber.tsx b/src/components/Global/AnimatedNumber.tsx index f6aff6614..d2a7edc9f 100644 --- a/src/components/Global/AnimatedNumber.tsx +++ b/src/components/Global/AnimatedNumber.tsx @@ -50,7 +50,7 @@ const AnimatedNumber: React.FC = ({ }, contentContainerStyle]} layout={animPapillon(LinearTransition)} > - {value.toString().split("").map((n, i) => ( + {value.toString().split("").map((n: string, i: number) => ( = ({ navigation }) => { const theme = useTheme(); const { colors } = theme; const [sound, setSound] = useState(null); - const { showAlert } = useAlert(); - type Services = "pronote" | "ed" | "skolengo"; const [service, setService] = useState(null); @@ -85,13 +83,6 @@ const ServiceSelector: Screen<"ServiceSelector"> = ({ navigation }) => { }, ]; - const UnsupportedAlert = () => { - showAlert({ - title: "Service non supporté", - message: "Désolé, ce service n'est pas encore supporté. Réessaye dans une prochaine version." - }); - }; - useEffect(() => { const loadSound = async () => { const { sound } = await Audio.Sound.createAsync( @@ -182,7 +173,12 @@ const ServiceSelector: Screen<"ServiceSelector"> = ({ navigation }) => { padding: 3, }} > - {React.cloneElement(srv.icon, { size: 26, strokeWidth: 2.5, color: srv.name === service ? colors.primary : colors.text })} + {React.cloneElement(srv.icon, { + size: 26, + strokeWidth: 2.5, + color: + srv.name === service ? colors.primary : colors.text, + })} : = ({ navigation }) => { + + + + Seuls les comptes élèves sont supportés pour le moment. Se connecter + avec un autre type de compte ne fonctionnera pas et + provoquera des bugs. + + = ({ route, navigation }) => { const theme = useTheme(); - const { showAlert } = useAlert(); - const [, setLoading] = useState(true); - const [, setLoadProgress] = useState(0); const [showWebView, setShowWebView] = useState(false); const [loggingIn, setLoggingIn] = useState(false); - const [, setCurrentURL] = useState(""); - const [deviceUUID] = useState(uuid()); const [sound, setSound] = useState(null); const [sound2, setSound2] = useState(null); @@ -268,17 +261,11 @@ const PronoteWebview: Screen<"PronoteWebview"> = ({ route, navigation }) => { ]} source={{ uri: infoMobileURL }} setSupportMultipleWindows={false} - onLoadProgress={({ nativeEvent }) => { - setLoadProgress(nativeEvent.progress); - }} onError={(e) => { console.error("Pronote webview error", e); }} onLoadStart={(e) => { const { url } = e.nativeEvent; - setCurrentURL(url); - - setLoading(true); if (url.includes("mobile.eleve.html")) { setLoginStep("En attente de ton établissement"); @@ -306,14 +293,18 @@ const PronoteWebview: Screen<"PronoteWebview"> = ({ route, navigation }) => { kind: pronote.AccountKind.STUDENT, username: message.data.login, token: message.data.mdp, - deviceUUID - } - ).catch((error) => { - if (error instanceof pronote.SecurityError && !error.handle.shouldCustomPassword && !error.handle.shouldCustomDoubleAuth) { + deviceUUID, + }) + .catch((error) => { + if ( + error instanceof pronote.SecurityError && + !error.handle.shouldCustomPassword && + !error.handle.shouldCustomDoubleAuth + ) { navigation.navigate("Pronote2FA_Auth", { session, error, - accountID: deviceUUID + accountID: deviceUUID, }); } else { throw error; @@ -345,12 +336,11 @@ const PronoteWebview: Screen<"PronoteWebview"> = ({ route, navigation }) => { authentication: { ...refresh, deviceUUID }, personalization: await defaultPersonalization(session), - identity: {} + identity: {}, }; pronote.startPresenceInterval(session); createStoredAccount(account); - setLoading(false); switchTo(account); // We need to wait a tick to make sure the account is set before navigating. @@ -379,42 +369,16 @@ const PronoteWebview: Screen<"PronoteWebview"> = ({ route, navigation }) => { ) { webViewRef.current?.injectJavaScript(INJECT_PRONOTE_JSON); } else { - setLoading(false); - if (url.includes("pronote/mobile.eleve.html")) { - if (!url.includes("identifiant")) { - if (Platform.OS === "ios") { - Alert.alert( - "Attention", - "Désolé, seuls les comptes élèves sont compatibles pour le moment.", - [ - { - text: "OK", - onPress: () => navigation.goBack(), - }, - ] - ); - } else { - showAlert({ - title: "Attention", - message: - "Désolé, seuls les comptes élèves sont compatibles pour le moment.", - actions: [ - { - title: "OK", - onPress: () => navigation.goBack(), - backgroundColor: theme.colors.card, - }, - ], - }); - } - } else { - webViewRef.current?.injectJavaScript( - INJECT_PRONOTE_INITIAL_LOGIN_HOOK - ); - webViewRef.current?.injectJavaScript( - INJECT_PRONOTE_CURRENT_LOGIN_STATE - ); - } + if ( + url.includes("pronote/mobile.eleve.html") && + url.includes("identifiant") + ) { + webViewRef.current?.injectJavaScript( + INJECT_PRONOTE_INITIAL_LOGIN_HOOK + ); + webViewRef.current?.injectJavaScript( + INJECT_PRONOTE_CURRENT_LOGIN_STATE + ); } if (url.split("?")[0].includes("mobile.eleve.html") == false) { diff --git a/src/views/welcome/DevMenu.tsx b/src/views/welcome/DevMenu.tsx index cfd7cd302..0644a352d 100644 --- a/src/views/welcome/DevMenu.tsx +++ b/src/views/welcome/DevMenu.tsx @@ -101,7 +101,30 @@ const DevMenu: Screen<"DevMenu"> = ({ navigation }) => { navigation.navigate("NoteReaction")} + onPress={() => navigation.navigate("GradeReaction", { + grade: { + id: "mmmhm", + subjectName: "Éval TS", + description: "Note de test", + timestamp: 1735996215000, + average: { + value: 0.2 + }, + coefficient: 40, + min: { + value: 0 + }, + max: { + value: 20 + }, + student: { + value: 0 + }, + outOf: { + value: 20 + } + } + })} > NoteReaction