Skip to content

Commit

Permalink
Merge branch 'main' into feature/canteen-alise
Browse files Browse the repository at this point in the history
  • Loading branch information
ecnivtwelve authored Dec 17, 2024
2 parents 66543cb + f33aa00 commit 5a66a93
Show file tree
Hide file tree
Showing 15 changed files with 407 additions and 163 deletions.
118 changes: 70 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
![Papillon, un client de vie scolaire alternatif open source](https://raw.githubusercontent.com/PapillonApp/Papillon/main/.github/assets/main_banner_light.svg#gh-light-mode-only)
![Papillon, un client de vie scolaire alternatif open source](https://raw.githubusercontent.com/PapillonApp/Papillon/main/.github/assets/main_banner_dark.svg#gh-dark-mode-only)

<!--
![Ce projet est en cours de développement actif. Des changements majeurs peuvent survenir au cours des prochaines mises à jour.](https://raw.githubusercontent.com/PapillonApp/Papillon/main/.github/assets/warning_devt_light.svg#gh-light-mode-only)
![Ce projet est en cours de développement actif. Des changements majeurs peuvent survenir au cours des prochaines mises à jour.](https://raw.githubusercontent.com/PapillonApp/Papillon/main/.github/assets/warning_devt_dark.svg#gh-dark-mode-only)
-->

#

Expand All @@ -11,54 +13,74 @@

> **Papillon est une application mobile qui vise à simplifier la vie scolaire des étudiants en France.**
Voici un aperçu de ce que nous avons accompli jusqu'à présent et de ce qu'il reste à faire :

- 🏗️ Structure
- 🗺️ Routage & Navigation (React Navigation)
- 🔄 Appels à l'API
- 🗄️ Gestion des données utilisateurs (Expo AsyncStorage)
- 🎨 Intégration du Framework UI
- 🎓 Connexion à un service scolaire
- 🏫 Interface de choix du service scolaire
- [x] 🟢 Pronote
- [x] 🔵 EcoleDirecte
- [x] 🟡 Skolengo
- [x] 🏫 Universités
- Limoges
- Lorraine
- Nîmes
- Polytechnique Hauts-de-France (UPHF)
- Rennes 1
- Rennes 2
- Sorbonne Paris Nord
- 🏠 Interface de sélection de l'établissement
- **Pour PRONOTE**
- URL de l'établissement
- Localisation de l'utilisateur
- Renseignement de la localité (code postal / ville)
- QR-code PRONOTE mobile
- 🔑 Interface de connexion au service
- **Pour PRONOTE**
- Connexion par identifiants et mots de passe
- Connexion par QR-Code mobile
- Connexion par cookie d'ENT
- 🔐 Appel à l'API pour se connecter et conservation de la session
- 📊 Affichage des données
- 👤 Données utilisateur
- 📅 Emploi du temps
- 📝 Devoirs
- 🏅 Notes
- 🧠 Compétences
- 📚 Contenu des cours
- 📁 Fichiers
- 📰 Actualités
- 💬 Conversations
- 🎒 Vie scolaire
- 📩 Messagerie

### Progression

Voici un aperçu de ce qui a été accompli et ce qui est en cours de développement :

#### 🏗️ Structure

- 🗺️ Routage & Navigation (React Navigation)
- 🔄 Appels à l'API
- 🗄️ Gestion des données utilisateurs (Expo AsyncStorage)
- 🎨 Intégration du Framework UI

#### 🎓 Connexion à un service scolaire

- 🏫 Interface de choix du service scolaire
- [x] Pronote
- [x] EcoleDirecte
- [x] Skolengo
- [x] Universités :
- Limoges
- Lorraine
- Nîmes
- Polytechnique Hauts-de-France (UPHF)
- Rennes 1
- Rennes 2
- Sorbonne Paris Nord
- 🏠 Interface de sélection de l'établissement pour PRONOTE :
- URL de l'établissement
- Localisation de l'utilisateur
- Renseignement de la localité (code postal / ville)
- QR-code PRONOTE mobile
- 🔑 Interface de connexion au service pour PRONOTE :
- Connexion par identifiants et mots de passe
- Connexion par QR-Code mobile
- Connexion par cookie d'ENT
- 🔐 Appel à l'API pour se connecter et conservation de la session

#### 🍽️ Services de restauration

La gestion de tes repas et transactions au sein de ton établissement est simplifiée grâce aux services de cantine intégrés suivants :
- **Turboself**
- **ARD**
- **Izly**
- **Alise**

#### 📊 Affichage des données

- 👤 Données utilisateur
- 📅 Emploi du temps
- 📝 Devoirs
- 🏅 Notes
- 🧠 Compétences
- 📚 Contenu des cours
- 📁 Fichiers
- 📰 Actualités
- 💬 Conversations
- 🎒 Vie scolaire
- 📩 Messagerie

#### 🌐 Rejoins la communauté

Viens discuter avec nous, poser tes questions et te tenir informé des dernières actus sur Papillon !
👉 [Rejoins le Discord officiel](https://discord.com/invite/wVKWBRTbfh)

#

![A propos du projet](https://raw.githubusercontent.com/PapillonApp/Papillon/main/.github/assets/part_dev_light.svg#gh-light-mode-only)
![A propos du projet](https://raw.githubusercontent.com/PapillonApp/Papillon/main/.github/assets/part_dev_dark.svg#gh-dark-mode-only)
![À propos du projet](https://raw.githubusercontent.com/PapillonApp/Papillon/main/.github/assets/part_dev_light.svg#gh-light-mode-only)
![À propos du projet](https://raw.githubusercontent.com/PapillonApp/Papillon/main/.github/assets/part_dev_dark.svg#gh-dark-mode-only)

Pour commencer à développer sur Papillon v7, consulte le [centre de documentation pour développeurs](https://developers.papillon.bzh/).


Pour commencer à développer sur Papillon v7, référez vous au [centre de documentation pour développeurs](https://developers.papillon.bzh/getting-started/quick-start).
4 changes: 2 additions & 2 deletions src/components/Restaurant/RestaurantCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const RestaurantCard: React.FC<RestaurantCardProps> = ({ solde, repas }) => {
<View
style={{
flexDirection: "row",
gap: 2,
justifyContent: "center",
gap: 6,
justifyContent: "center"
}}
>
<AnimatedNumber
Expand Down
20 changes: 13 additions & 7 deletions src/router/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,21 @@ export type RouteParameters = {

// login.identityProvider
IdentityProviderSelector: undefined;
Multi_Login: { instanceURL: string, title: string, image: ImageSourcePropType };
Multi_Login: {
instanceURL: string;
title: string;
image: ImageSourcePropType;
};
UnivRennes1_Login: undefined;
UnivRennes2_Login: undefined;
UnivIUTLannion_Login: undefined;
UnivLimoges_Login: undefined;
UnivSorbonneParisNord_login: undefined;
UnivUphf_Login: undefined;
BackgroundIUTLannion: { url?: string; username: string; password: string, firstLogin?: boolean } | undefined;
BackgroundIdentityProvider: undefined;
BackgroundIUTLannion:
| { url?: string; username: string; password: string; firstLogin?: boolean }
| undefined;

// login.skolengo
SkolengoAuthenticationSelector: undefined;
Expand Down Expand Up @@ -121,10 +128,10 @@ export type RouteParameters = {

Menu?: undefined;
RestaurantQrCode: {
QrCodes: string[]
QrCodes: string[];
};
RestaurantHistory: {
histories: ReservationHistory[]
histories: ReservationHistory[];
};

Messages: undefined;
Expand All @@ -138,14 +145,13 @@ export type RouteParameters = {
ExternalArdLogin: undefined;
ExternalIzlyLogin: undefined;
ExternalAliseLogin: undefined;
IzlyActivation: { username: string, password: string };
PriceError: { account: Client, accountId: string };
IzlyActivation: { username: string; password: string };
PriceError: { account: Client; accountId: string };
QrcodeScanner: { accountID: string };
PriceDetectionOnboarding: { accountID: string };
PriceBeforeScan: { accountID: string };
PriceAfterScan: { accountID: string };


AddonSettingsPage: {
addon: AddonPlacementManifest;
from: keyof RouteParameters;
Expand Down
5 changes: 5 additions & 0 deletions src/router/screens/views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import ScodocWebview from "@/views/login/IdentityProvider/actions/BackgroundIUTL
import ScodocBackgroundWebview from "@/views/login/IdentityProvider/actions/BackgroundIUTLannion";
import BackgroundIUTLannion from "@/views/login/IdentityProvider/actions/BackgroundIUTLannion";
import { Platform } from "react-native";
import BackgroundIdentityProvider from "@/views/login/IdentityProvider/BackgroundIdentityProvider";

export default [
createScreen("NoteReaction", NoteReaction, {
Expand Down Expand Up @@ -87,4 +88,8 @@ export default [
headerTitle: "IUT de Lannion",
presentation: "modal",
}),
createScreen("BackgroundIdentityProvider", BackgroundIdentityProvider, {
headerTitle: "Fournisseur d'identité",
presentation: "modal",
}),
] as const;
25 changes: 19 additions & 6 deletions src/services/attendance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,25 @@ export async function updateAttendanceInCache <T extends Account> (account: T, p
break;
}
case AccountService.Local: {
attendance = {
delays: [],
absences: [],
punishments: [],
observations: []
};
if (account.identityProvider.identifier == "iut-lannion") {
const { saveIUTLanAttendance } = await import("./iutlan/attendance");
const data = await saveIUTLanAttendance(account);

attendance = {
delays: data.delays,
absences: data.absences,
punishments: data.punishments,
observations: data.observations
};
}
else {
attendance = {
delays: [],
absences: [],
punishments: [],
observations: []
};
}

break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/homework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function updateHomeworkForWeekInCache <T extends Account> (account:
switch (account.service) {
case AccountService.Pronote: {
const { getHomeworkForWeek } = await import("./pronote/homework");
const weekNumber = translateToWeekNumber(date, account.instance?.instance.firstDate || pronoteFirstDate);
const weekNumber = translateToWeekNumber(date, account.instance?.instance.firstMonday || pronoteFirstDate);
homeworks = await getHomeworkForWeek(account, weekNumber);
break;
}
Expand Down
48 changes: 48 additions & 0 deletions src/services/iutlan/attendance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { LocalAccount } from "@/stores/account/types";
import uuid from "@/utils/uuid-v4";
import { Attendance } from "../shared/Attendance";

export const saveIUTLanAttendance = async (account: LocalAccount): Promise<Attendance> => {
try {
// Il faudrait peut-être penser à typer cette partie, tous les types sont any :(
const scodocData = account.identityProvider.rawData;

const allAbsences = [];

// for all scodocData.absences
if(scodocData.absences && Object.keys(scodocData.absences).length > 0) {
for (const day of Object.keys(scodocData.absences)) {
for (const absence of scodocData.absences[day]) {
let from = new Date(day);
from.setHours(absence.debut);

let to = new Date(absence.dateFin);
to.setHours(absence.fin);

allAbsences.push({
id: absence.idAbs,
fromTimestamp: from ? new Date(from).getTime() : undefined,
toTimestamp: to ? new Date(to).getTime() : undefined,
justified: absence.justifie ?? false,
hours: (parseInt(absence.fin) - parseInt(absence.debut)) + "h 00",
administrativelyFixed: absence.justifie ?? false,
reasons: undefined,
});
}
}
}

// sort allAbsences by fromTimestamp
allAbsences.sort((a, b) => a.fromTimestamp - b.fromTimestamp);

return {
delays: [],
absences: allAbsences,
punishments: [],
observations: [],
};
} catch (error) {
console.error(error);
}

};
Loading

0 comments on commit 5a66a93

Please sign in to comment.