Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: New Pronote ✨ response format ✨ #633

Merged
merged 45 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d0f0681
feat(Grades/Document): show `??` instead of `-1.00`
Gabriel29306 Jan 11, 2025
da1caf1
chore(deps): Pawnote to 1.3.6
Gabriel29306 Jan 11, 2025
bc45569
fix: Pressable import
Gabriel29306 Jan 11, 2025
ad5509c
chore(dev): remove dev logs
Gabriel29306 Jan 11, 2025
4a57dd3
lint: correct type for `AnimatedNumber`
Gabriel29306 Jan 11, 2025
f4ec494
fix: grade reaction in dev menu
Gabriel29306 Jan 11, 2025
7def8aa
feat(errors): better description for `evaluation.ts`, `grades.ts`, `h…
Gabriel29306 Jan 11, 2025
914b419
lint
Gabriel29306 Jan 11, 2025
bbf9b32
feat(Grades/Subject): Show `N.Not` instead of `N/A`
Gabriel29306 Jan 12, 2025
e19689f
fix(Grade/Graph): ignore -1 in grade history
Gabriel29306 Jan 12, 2025
a3fbe49
fix(Grades/SubjectDocument): Show `N.Not` instead of `-1.00`
Gabriel29306 Jan 12, 2025
e0dfcc2
lint: code simplification
Gabriel29306 Jan 12, 2025
75f455f
Merge branch 'main' into repair-pronote
Gabriel29306 Jan 12, 2025
ba4fa2d
Merge branch 'main' into repair-pronote
Gabriel29306 Jan 12, 2025
f525b0d
Merge branch 'main' of https://github.com/PapillonApp/Papillon into r…
Gabriel29306 Jan 17, 2025
fafdd79
fix: bad comparaison
Gabriel29306 Jan 17, 2025
a41fd1c
lint: wrong indentation
Gabriel29306 Jan 17, 2025
242496d
chore(deps): update pawnote to 1.4.0
Gabriel29306 Jan 17, 2025
a37092c
Merge branch 'main' into repair-pronote
Gabriel29306 Jan 18, 2025
880c3ec
fix(merge): error during merge
Gabriel29306 Jan 18, 2025
6e9f305
fix(lint): incompatble type
Gabriel29306 Jan 18, 2025
37cdf17
lint: unused imports
Gabriel29306 Jan 18, 2025
8eaeee7
fix(average): enhance overall avarage calcul
Gabriel29306 Jan 18, 2025
8426b91
Merge branch 'main' into repair-pronote
Gabriel29306 Jan 21, 2025
ceb7da6
fix(DevMenu): add status to grades for GradeReaction screen
Gabriel29306 Jan 24, 2025
2cb4c05
fix(Subject): PickerDataItem => PickerData
Gabriel29306 Jan 24, 2025
df869f6
fix: PickerData type is already a array
Gabriel29306 Jan 24, 2025
c4ddf67
fix: is it going to work this way ?
Gabriel29306 Jan 24, 2025
8119ac4
fix(missing import): MissingItem
Gabriel29306 Jan 24, 2025
8c09208
chore: revert `src/components/Global/PapillonPicker.tsx` to `8426b918`
Gabriel29306 Jan 24, 2025
6f75754
lint: the final show
Gabriel29306 Jan 24, 2025
884fbc0
lint: unused import
Gabriel29306 Jan 24, 2025
a88b935
feat(grade): Don't show category if there is no value (keep value wit…
Gabriel29306 Jan 24, 2025
cd914ad
feat(Grades/Subject): simplify logic
Gabriel29306 Jan 24, 2025
4f4520d
Merge branch 'main' into repair-pronote
Gabriel29306 Jan 25, 2025
a888eb6
Merge remote-tracking branch 'origin' into repair-pronote
Gabriel29306 Jan 25, 2025
4ad231e
chore: update `Pawote` to v1.4.1
Gabriel29306 Jan 25, 2025
7722256
lint
Gabriel29306 Jan 25, 2025
f22cfc1
lint: missing `Maximize2`
Gabriel29306 Jan 25, 2025
47529e4
fix: don't import anything from `react-native-share`
Gabriel29306 Jan 26, 2025
bb74c74
Merge remote-tracking branch 'origin/main' into better-logs
Gabriel29306 Jan 26, 2025
5db139f
feat(PapiReal): Show warning when no authorization
godetremy Jan 26, 2025
7fc314f
Merge branch 'main' into repair-pronote
Gabriel29306 Jan 26, 2025
5752e5b
fix(GradesAverageGraph): filter out NaN values from grades history
ecnivtwelve Jan 28, 2025
1b40e76
Merge branch 'main' into repair-pronote
ecnivtwelve Jan 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"openid-client": "^5.7.0",
"pawdirecte": "^1.7.1",
"pawnilim": "^0.2.0",
"pawnote": "^1.3.4",
"pawnote": "^1.4.1",
"pawrd": "^0.6.1",
"react": "18.2.0",
"react-native": "^0.74.3",
Expand Down
6 changes: 3 additions & 3 deletions src/components/Global/AnimatedNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface AnimatedNumberProps {
* d'animer chaque chiffre et d'avoir un
* flottant fixé, par exemple.
*/
value: string | any;
value: string | number;

/**
* Style du texte du nombre.
Expand Down Expand Up @@ -50,7 +50,7 @@ const AnimatedNumber: React.FC<AnimatedNumberProps> = ({
}, contentContainerStyle]}
layout={animPapillon(LinearTransition)}
>
{value.toString().split("").map((n:number, i:number) => (
{value.toString().split("").map((n, i) => (
<Reanimated.View
key={i + "_" + n}
entering={animPapillon(FadeInDown).delay(i * 20 + 20).mass(1).damping(30).stiffness(700)}
Expand All @@ -66,4 +66,4 @@ const AnimatedNumber: React.FC<AnimatedNumberProps> = ({
);
};

export default AnimatedNumber;
export default AnimatedNumber;
12 changes: 7 additions & 5 deletions src/components/Global/PapillonPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ import { NativeText } from "./NativeComponents";
import { BlurView } from "expo-blur";
import { Check } from "lucide-react-native";

type PickerData = string[] | { label: string, icon?: JSX.Element, onPress: () => unknown, checked?: boolean }[];
export type PickerDataItem = string | { label: string, icon?: JSX.Element, onPress?: () => unknown, checked?: boolean };

type PickerData = PickerDataItem[];

interface PapillonPickerProps {
children: React.ReactNode
data: PickerData
selected?: string
selected?: PickerDataItem
contentContainerStyle?: StyleProp<AnimatedStyle<StyleProp<ViewStyle>>>
delay?: number,
direction?: "left" | "right",
animated?: boolean,
onSelectionChange?: (item: string) => unknown
onSelectionChange?: any
}

const PapillonPicker: React.FC<PapillonPickerProps> = ({
Expand All @@ -37,7 +39,7 @@ const PapillonPicker: React.FC<PapillonPickerProps> = ({
const [contentHeight, setContentHeight] = useState(0);
const [opened, setOpened] = useState(false);

const handleSelectionChange = (item: string) => {
const handleSelectionChange = (item: PickerDataItem) => {
if (onSelectionChange) {
setTimeout(() => {
onSelectionChange(item);
Expand Down Expand Up @@ -115,7 +117,7 @@ const PapillonPicker: React.FC<PapillonPickerProps> = ({
onPressItem();
} : () => {
setOpened(false);
handleSelectionChange(item as string);
handleSelectionChange(item);
}}
style={[
styles.item
Expand Down
43 changes: 33 additions & 10 deletions src/components/Grades/GradeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,51 @@ import {
View,
Image,
Text,
Alert, ScrollView, StyleSheet, Dimensions
Alert,
ScrollView,
StyleSheet,
Dimensions
} from "react-native";
import {Download, Trash2, Ellipsis} from "lucide-react-native";
import { Download, Trash2, Ellipsis } from "lucide-react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { BlurView } from "expo-blur";
import * as FileSystem from "expo-file-system";
import * as MediaLibrary from "expo-media-library";
import {PressableScale} from "react-native-pressable-scale";
import {NativeText} from "@/components/Global/NativeComponents";
import {Reel} from "@/services/shared/Reel";
import {captureRef} from "react-native-view-shot";
import { PressableScale } from "react-native-pressable-scale";
import { NativeText } from "@/components/Global/NativeComponents";
import { Reel } from "@/services/shared/Reel";
import { captureRef } from "react-native-view-shot";
import Constants from "expo-constants";
import Animated, {Easing, FadeInRight, ZoomIn} from "react-native-reanimated";
import Animated, { Easing, FadeInRight, ZoomIn } from "react-native-reanimated";
import PapillonBottomSheet from "@/components/Modals/PapillonBottomSheet";
import {useTheme} from "@react-navigation/native";
import { useTheme } from "@react-navigation/native";
interface GradeModalProps {
isVisible: boolean;
reel: Reel;
onClose: () => void;
DeleteGrade: () => void;
}

interface ShareOptions {
appId: string;
urls?: string[];
url?: string;
type?: string;
filename?: string;
message?: string;
title?: string;
subject?: string;
email?: string;
recipient?: string;
social: "facebook"|"facebookstories"|"pagesmanager"|"twitter"|"whatsapp"
|"whatsappbusiness" |"instagram"|"instagramstories"|"googleplus"
|"email"|"pinterest"|"linkedin"|"sms" |"telegram"|"snapchat"
|"messenger"|"viber"|"discord";
forceDialog?: boolean;
stickerImage?: string;
backgroundImage?: string;
}

const convertToBase64 = async (uri: string): Promise<string> => {
const response = await fetch(uri);
const blob = await response.blob();
Expand All @@ -47,7 +70,7 @@ const GradeModal: React.FC<GradeModalProps> = ({
const stickersRef = React.useRef<View>(null);
const [showDeleteWarning, setShowDeleteWarning] = React.useState(false);

const shareToSocial = async (option) => {
const shareToSocial = async (option: ShareOptions) => {
const isExpoGo = Constants.appOwnership === "expo";
if (isExpoGo) {
Alert.alert("Fonctionnalité indisponible", "Cette fonctionnalité n'est pas disponible dans Expo Go. Pour l'utiliser, tu peux tester l'application sur ton propre appareil.");
Expand Down Expand Up @@ -507,4 +530,4 @@ const styles = StyleSheet.create({
},
});

export default GradeModal;
export default GradeModal;
2 changes: 1 addition & 1 deletion src/components/Settings/ReelGallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const ReelGallery = ({ reels }: ReelGalleryProps) => {
{selectedReel && (
<GradeModal
isVisible={!!selectedReel}
imageBase64={selectedReel.image || ""}
reel={selectedReel}
onClose={() => setSelectedReel(null)}
DeleteGrade={() => selectedReel.id && deleteReel(selectedReel.id)}
/>
Expand Down
10 changes: 5 additions & 5 deletions src/router/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect } from "react";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import {NavigationContainer, NavigationState, PartialState, Theme} from "@react-navigation/native";
import {Platform, StatusBar, View, useColorScheme } from "react-native";
import { NavigationContainer, NavigationState, PartialState, Theme } from "@react-navigation/native";
import { Platform, StatusBar, View, useColorScheme } from "react-native";
import * as Linking from "expo-linking";
import screens from "@/router/screens";
import type { RouteParameters } from "@/router/helpers/types";
Expand All @@ -13,7 +13,7 @@ import * as NavigationBar from "expo-navigation-bar";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { useCurrentAccount } from "@/stores/account";
import { navigatorScreenOptions } from "./helpers/create-screen";
import {navigate} from "@/utils/logger/logger";
import { navigate } from "@/utils/logger/logger";
import { PapillonNavigation } from "./refs";
import AsyncStorage from "@react-native-async-storage/async-storage";

Expand Down Expand Up @@ -74,9 +74,9 @@ const Router: React.FC = () => {


const account = useCurrentAccount(store => store.account!);
if (account && account.personalization?.color !== undefined) {
if (account?.personalization?.color) {

if (account.personalization?.color?.hex?.primary !== undefined) {
if (account.personalization?.color?.hex?.primary) {
theme.colors.primary = account.personalization.color.hex.primary;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/router/navigator/atoms/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const MenuItem: React.FC<{
const theme = useTheme();

const { options } = descriptor;
const label = options.tabBarLabel !== undefined ? options.tabBarLabel : options.title !== undefined ? options.title : route.name;
const label = options.tabBarLabel ?? options.title ?? route.name;

const onPress = () => {
const event = navigation.emit({
Expand Down Expand Up @@ -140,4 +140,4 @@ const styles = StyleSheet.create({
},
});

export default React.memo(MenuItem);
export default React.memo(MenuItem);
5 changes: 2 additions & 3 deletions src/router/navigator/atoms/TabItem.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from "react";
import { useTheme } from "@react-navigation/native";
import { StyleSheet, Platform } from "react-native";
import { StyleSheet, Platform, Pressable } from "react-native";
import LottieView from "lottie-react-native";
import colorsList from "@/utils/data/colors.json";
import { Pressable } from "react-native-gesture-handler";
import * as Haptics from "expo-haptics";
import Reanimated, { FadeIn, FadeOut, LinearTransition, ZoomIn } from "react-native-reanimated";
import { anim2Papillon } from "@/utils/ui/animations";
Expand All @@ -18,7 +17,7 @@ const TabItem: React.FC<{
const theme = useTheme();

const { options } = descriptor;
const label = options.tabBarLabel !== undefined ? options.tabBarLabel : options.title !== undefined ? options.title : route.name;
const label: string = options.tabBarLabel ?? options.title ?? route.name;

const onPress = () => {
const event = navigation.emit({
Expand Down
2 changes: 1 addition & 1 deletion src/router/navigator/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ const styles = StyleSheet.create({
menuBarIOS: {},
});

export default PapillonNavigatorMenu;
export default PapillonNavigatorMenu;
2 changes: 1 addition & 1 deletion src/router/navigator/navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ const BottomTabNavigator: React.ComponentType<any> = ({
);
};

export default createNavigatorFactory(BottomTabNavigator);
export default createNavigatorFactory(BottomTabNavigator);
2 changes: 1 addition & 1 deletion src/router/navigator/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ const styles = StyleSheet.create({
tabBarIOS: {},
});

export default PapillonNavigatorTabs;
export default PapillonNavigatorTabs;
10 changes: 5 additions & 5 deletions src/services/evaluation.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type Account, AccountService } from "@/stores/account/types";
import type { Period } from "./shared/Period";
import {useEvaluationStore} from "@/stores/evaluation";
import {Evaluation} from "@/services/shared/Evaluation";
import {error} from "@/utils/logger/logger";
import { useEvaluationStore } from "@/stores/evaluation";
import { Evaluation } from "@/services/shared/Evaluation";
import { error } from "@/utils/logger/logger";

const getDefaultPeriod = (periods: Period[]): string => {
const now = Date.now();
Expand Down Expand Up @@ -47,6 +47,6 @@ export async function updateEvaluationsInCache <T extends Account> (account: T,
useEvaluationStore.getState().updateEvaluations(periodName, evaluations);
}
catch (err) {
error(`not updated, see:${err}`, "updateGradesAndAveragesInCache");
error(`evaluations not updated, see:${err}`, "updateGradesAndAveragesInCache");
}
}
}
4 changes: 2 additions & 2 deletions src/services/grades.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type Account, AccountService } from "@/stores/account/types";
import { useGradesStore } from "@/stores/grades";
import type { Period } from "./shared/Period";
import type { AverageOverview, Grade } from "./shared/Grade";
import {error } from "@/utils/logger/logger";
import { error } from "@/utils/logger/logger";
import { checkIfSkoSupported } from "./skolengo/default-personalization";

const getDefaultPeriod = (periods: Period[]): string => {
Expand Down Expand Up @@ -126,6 +126,6 @@ export async function updateGradesAndAveragesInCache <T extends Account> (accoun
useGradesStore.getState().updateGradesAndAverages(periodName, grades, averages);
}
catch (err) {
error(`not updated, see:${err}`, "updateGradesAndAveragesInCache");
error(`grades not updated, see:${err}`, "updateGradesAndAveragesInCache");
}
}
2 changes: 1 addition & 1 deletion src/services/homework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function updateHomeworkForWeekInCache <T extends Account> (account:
useHomeworkStore.getState().updateHomeworks(dateToEpochWeekNumber(date), homeworks);
}
catch (err) {
error(`not updated, see:${err}`, "updateHomeworkForWeekInCache");
error(`homeworks not updated, see:${err}`, "updateHomeworkForWeekInCache");
}
}

Expand Down
Loading
Loading