Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Commit

Permalink
v1.5.3
Browse files Browse the repository at this point in the history
upgrade expo sdk 51
changement couleurs absences
bugfixes divers
  • Loading branch information
hugofnm committed May 13, 2024
1 parent d0f0db6 commit 13744c8
Show file tree
Hide file tree
Showing 20 changed files with 2,064 additions and 2,401 deletions.
93 changes: 56 additions & 37 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { captureRef } from 'react-native-view-shot';

// Disable this when using Expo Go
import { setAppIcon } from "expo-dynamic-app-icon";
import { setAppIcon } from "@hugofnm/expo-dynamic-app-icon";

// ---------------------------------------------
// VARIABLES GLOBALES
// ---------------------------------------------

// IMPORTANT !!!
var appVersion = '1.5.2';
var appVersion = '1.5.3';
var isBeta = false;
// IMPORTANT !!!

Expand Down Expand Up @@ -955,7 +955,7 @@ function OOBE({ navigation }) {
autoComplete='password'
autoCorrect={false}
editable={editable}
style={{ marginBottom: 16, borderRadius: 10, fontSize: 16, lineHeight: 20, padding: 8, backgroundColor: 'rgba(151, 151, 151, 0.25)', color: choosenTheme.colors.onBackground }}
style={{ marginBottom: 8, borderRadius: 10, fontSize: 16, lineHeight: 20, padding: 8, backgroundColor: 'rgba(151, 151, 151, 0.25)', color: choosenTheme.colors.onBackground }}
/>
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 16 }} >
<Switch onValueChange={ (value) => setRememberMe(value) } disabled={!editable} value={rememberMe}/>
Expand Down Expand Up @@ -1142,7 +1142,7 @@ function HomeScreen({ navigation }) {
{
text: "Oui",
onPress: () => {
handleURL("https://notes.metrixmedia.fr/bug");
handleURL("https://notes.metrixmedia.fr/support");
}
}
]);
Expand All @@ -1152,7 +1152,7 @@ function HomeScreen({ navigation }) {
{ text: "Oui",
onPress: async () => {
if (await StoreReview.hasAction()) {
StoreReview.requestReview();
StoreReview.requestReview();
} else (
showError("alreadyrated")
)
Expand Down Expand Up @@ -1316,8 +1316,8 @@ function Semesters ({ navigation }) {
return <Text style={{ textAlign: 'center', marginTop : 8 }} variant="titleMedium">Aucun autre semestre disponible. Veuillez vous reconnecter ultérieurement.</Text>

}
return semesters.map((semester) => (
<Chip style={{ height: 48, marginBottom: 8, justifyContent: 'center' }} disabled={!selectable} onPress={ () => loadGrades(semester) } icon="adjust" > {semester} </Chip>
return semesters.map((sem) => (
<Chip key={sem.id} style={{ height: 48, marginBottom: 8, justifyContent: 'center' }} disabled={!selectable} onPress={ () => loadGrades(sem.semester) } icon="adjust" > {sem.semester} </Chip>
))
}

Expand Down Expand Up @@ -1486,6 +1486,9 @@ function ShowGrades({ navigation }) {
const [title, setTitle] = useState("Infos");
const [subtitle, setSubtitle] = useState("");
const [gradeRefs, setGradeRefs] = useState([]);
const [moyenneString, setMoyenneString] = useState("");
const [calculated, setCalculated] = useState(false);
const [count, setCount] = useState(0);
const insets = useSafeAreaInsets();

const renderBackdrop = useCallback(
Expand Down Expand Up @@ -1518,6 +1521,13 @@ function ShowGrades({ navigation }) {
}
}, []);

useEffect(() => {
if (count == 0) {
isCalculated();
setCount(1);
}
});

async function forceRefresh() {
var res;
dataIsLoaded = false;
Expand Down Expand Up @@ -1645,9 +1655,11 @@ function ShowGrades({ navigation }) {

function isCalculated() {
if (average != "") {
return (average)
setCalculated(false);
setMoyenneString(average);
} else {
return (showGlobalAverage() + " (calculée)")
setCalculated(true);
setMoyenneString(showGlobalAverage() + " (calculée)");
}
}

Expand Down Expand Up @@ -1791,14 +1803,16 @@ function ShowGrades({ navigation }) {
}>
<Button style={style.buttonActionChange} loading={loading} icon="sync" mode="contained-tonal" onPress={ () => changeSemester() }> Changer de semestre </Button>
<View style={{ display: "flex", flexDirection: 'row', justifyContent:'left' }}>
<Text style={{ textAlign: 'left', marginTop: 16 }} variant="titleMedium">Moyenne générale : {isCalculated()}</Text>
<IconButton style={{ marginLeft: 8, marginTop: 8 }} mode='contained-tonal' icon="information" onPress={() => {
setTitle("Attention !");
setSubtitle('Lorsqu\'elle est accompagnée de la mention "Calculée", la moyenne générale est calculée par UniceNotes et ne tient pas compte des UE et de certains coefficients. Elle est donc à titre indicatif et peut être erronée.');
if(bottomSheetInfo != null) {
bottomSheetInfo.expand()
}
}} />
<Text style={{ textAlign: 'left', marginTop: 16 }} variant="titleMedium">Moyenne générale : {moyenneString}</Text>
{calculated ?
<IconButton style={{ marginLeft: 8, marginTop: 8 }} mode='contained-tonal' icon="information" onPress={() => {
setTitle("Attention !");
setSubtitle('Lorsqu\'elle est accompagnée de la mention "Calculée", la moyenne générale est calculée par UniceNotes et ne tient pas compte des UE et de certains coefficients. Elle est donc à titre indicatif et peut être erronée.');
if(bottomSheetInfo != null) {
bottomSheetInfo.expand()
}
}} />
: null}
</View>

{ // Affiche position si disponible
Expand Down Expand Up @@ -1925,7 +1939,7 @@ function ShowAbsences({ navigation }) {
if (absences.length > 0) {
return (absences.map((item) => (
<View>
<Card style={{ marginBottom: 16, backgroundColor: choosenTheme.colors.primaryContainer }} >
<Card style={{ marginTop: 16, marginBottom: 16, backgroundColor: choosenTheme.colors.primaryContainer }} >
<Card.Title title={item.class} subtitle={"Professeur : " + item.prof} />
<Card.Content>
<Text>Date : {item.date}</Text>
Expand All @@ -1936,7 +1950,7 @@ function ShowAbsences({ navigation }) {
<Text>Justifié : {item.justified ? 'Oui' : 'Non'}</Text>
</Card.Content>
</Card>
<Divider style={{ marginBottom: 16 }} />
<Divider/>
</View>
)))
}
Expand All @@ -1946,7 +1960,7 @@ function ShowAbsences({ navigation }) {
if (retards.length > 0) {
return (retards.map((item) => (
<View>
<Card style={{ marginBottom: 16, backgroundColor: choosenTheme.colors.retard }} >
<Card style={{ marginTop: 16, marginBottom: 16, backgroundColor: choosenTheme.colors.retard }} >
<Card.Title title={item.class} subtitle={"Professeur : " + item.prof} />
<Card.Content>
<Text>Date : {item.date}</Text>
Expand All @@ -1957,7 +1971,7 @@ function ShowAbsences({ navigation }) {
<Text>Justifié : {item.justified ? 'Oui' : 'Non'}</Text>
</Card.Content>
</Card>
<Divider style={{ marginBottom: 16 }} />
<Divider/>
</View>
)))
}
Expand All @@ -1967,7 +1981,7 @@ function ShowAbsences({ navigation }) {
if (exclusions.length > 0) {
return (exclusions.map((item) => (
<View>
<Card style={{ marginBottom: 16, backgroundColor: choosenTheme.colors.errorContainer }} >
<Card style={{ marginTop: 16, marginBottom: 16, backgroundColor: choosenTheme.colors.errorContainer }} >
<Card.Title title={item.class} subtitle={"Professeur : " + item.prof} />
<Card.Content>
<Text>Date : {item.date}</Text>
Expand All @@ -1978,7 +1992,7 @@ function ShowAbsences({ navigation }) {
<Text>Justifié : {item.justified ? 'Oui' : 'Non'}</Text>
</Card.Content>
</Card>
<Divider style={{ marginBottom: 16 }} />
<Divider/>
</View>
)))
}
Expand All @@ -1999,20 +2013,20 @@ function ShowAbsences({ navigation }) {
<Text style={{ textAlign: 'left' }} variant="titleMedium">Non justifiées : {totalHoursNonJustified}h</Text>
<Text style={{ textAlign: 'left' }} variant="titleMedium">Justifiées : {totalHoursJustified}h</Text>

<List.Accordion style={{ marginTop: 16 }}
title={absences.length + " absence(s)"}
<List.Accordion style={{ marginTop: 16, backgroundColor: choosenTheme.colors.primaryContainer, borderRadius: 16 }}
title={absences.length > 1 ? absences.length + " absences" : absences.length + " absence"}
left={props => <List.Icon {...props} icon="account-question" />}>
{showAbsences()}
</List.Accordion>

<List.Accordion
title={retards.length + " retard(s)"}
<List.Accordion style={{ marginTop: 8, backgroundColor: choosenTheme.colors.retard, borderRadius: 16 }}
title={retards.length > 1 ? retards.length + " retards" : retards.length + " retard"}
left={props => <List.Icon {...props} icon="camera-timer" />}>
{showRetards()}
</List.Accordion>

<List.Accordion
title={exclusions.length + " exclusion(s)"}
<List.Accordion style={{ marginTop: 8, backgroundColor: choosenTheme.colors.errorContainer, borderRadius: 16 }}
title={exclusions.length > 1 ? exclusions.length + " exclusions" : exclusions.length + " exclusion"}
left={props => <List.Icon {...props} icon="skull-crossbones" />}>
{showExclusions()}
</List.Accordion>
Expand Down Expand Up @@ -2171,7 +2185,6 @@ function ShowENT({ navigation }) {
<Chip style={{ height: 48, justifyContent: 'center', borderTopLeftRadius: 0, borderTopRightRadius: 0, borderBottomLeftRadius: 0, borderBottomRightRadius: 0, marginTop: 1 }} icon={"account"} onPress={ () => handleURL("https://link.univ-cotedazur.fr/fr/authentication/index/caslogin?1") }> Link UCA </Chip>
<Chip style={{ height: 48, justifyContent: 'center', borderTopLeftRadius: 0, borderTopRightRadius: 0, marginTop: 1 }} avatar={<Image size={24} source={require('./assets/ent/izly.png')}/>} onPress={ () => handleURL("https://mon-espace.izly.fr") }> Mon Espace Izly </Chip>
<Text style={{ marginTop: 16, textAlign: 'left' }} variant="titleMedium">Les applications ne sont pas compatibles avec UniceNotes et seront ouvertes avec un navigateur externe.</Text>
<Text style={{ marginTop: 16, textAlign: 'left' }} variant="titleSmall">La connexion automatique aux services aura lieu dans une prochaine mise à jour.</Text>
</ScrollView>
</View>
);
Expand Down Expand Up @@ -2211,6 +2224,11 @@ function ShowSettings({ navigation }) {
throw new Error('This is a crash');
} else if(mode == "deletephoto") {
FileSystem.deleteAsync(FileSystem.documentDirectory + 'profile.png');
} else if(mode == "deleteprofile") {
deleteData(false);
AsyncStorage.clear();
haptics("success");
throw new Error('Data deletion forced');
}
}

Expand Down Expand Up @@ -2278,9 +2296,9 @@ function ShowSettings({ navigation }) {
</Text>
<Text style={{ textAlign: 'left' }} variant="titleSmall">🛠️ Hash local du commit Git : {hash}</Text>

<Text style={{ marginTop: 16, textAlign: 'left' }} variant="titleSmall">UniceNotes n'est lié d'aucune forme à l'Université Côte d'Azur ou à l'I.U.T. de Nice Côte d'Azur.</Text>
<Text style={{ marginTop: 16, textAlign: 'left' }} variant="titleSmall">UniceNotes n'est lié d'aucune forme à l'Université Côte d'Azur ou à l'I.U.T. de Nice Côte d'Azur. Tout usage de cette application implique la seule responsabilité de l'utilisateur.</Text>

<Text style={{ marginTop: 8, textAlign: 'left' }} variant="titleSmall">🤝 Remerciements : Corentin B., Nathan J., Marius D., Eliott F., Bobi, Matthieu H., Lorik H., Romain H., Valentin D. et vous, merci pour votre soutien :)</Text>
<Text style={{ marginTop: 8, textAlign: 'left' }} variant="titleSmall">Merci d'avoir téléchargé UniceNotes :)</Text>

<Button style={{ marginTop: 16 }} icon="license" onPress={ () => handleURL("https://notes.metrixmedia.fr/credits") }> Mentions légales </Button>
<Button style={{ marginTop: 4 }} icon="account-child-circle" onPress={ () => handleURL("https://notes.metrixmedia.fr/privacy") }> Clause de confidentialité </Button>
Expand All @@ -2290,7 +2308,8 @@ function ShowSettings({ navigation }) {
isBeta ? (
<>
<Button style={{ marginTop: 4 }} icon="bug" onPress={ () => betaToolbox("crash") }> crash_app </Button>
<Button style={{ marginTop: 4 }} icon="account-remove" onPress={ () => betaToolbox("deletephoto") }> del_pprofile </Button>
<Button style={{ marginTop: 4 }} icon="account-box-multiple" onPress={ () => betaToolbox("deletephoto") }> del_photoprofile </Button>
<Button style={{ marginTop: 4 }} icon="account-remove" onPress={ () => betaToolbox("deleteprofile") }> forcedel_profile </Button>
</>
) : null
}
Expand Down Expand Up @@ -2662,8 +2681,8 @@ function ServerConfig({ navigation }) {
setStatusUniceNotes("close");
});

await fetch("https://intracursus.unice.fr").then((res) => {
if(res.status == 200) {
await fetch("https://intracursus.unice.fr/").then((res) => {
if(res.status == 200 || res.status == 302 || res.status == 301) {
setStatusIntracursus("check");
} else {
setStatusIntracursus("close");
Expand Down Expand Up @@ -2708,11 +2727,11 @@ function ServerConfig({ navigation }) {
<Card style={{ marginBottom:16 }}>
<Card.Title
title="Changer le serveur UniceNotes"
subtitle="⚠️ Zone sensible ⚠️"
subtitle="⚠️ - Attention, risque de sécurité"
left={(props) => <Avatar.Icon {...props} icon="server-network" />}
/>
<Card.Actions>
<Button mode={ whatSelectedServer("C") } onPress={ () => setSelectedServer("C") }>Custom</Button>
<Button mode={ whatSelectedServer("C") } onPress={ () => setSelectedServer("C") }>Personnalisé</Button>
<Button mode={ whatSelectedServer("P") } onPress={ () => setSelectedServer("P") }>Par défaut</Button>
</Card.Actions>
{
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ The Google Play Store logo® and the Google Play Store® are trademarks of Googl

UniceNotes n'est aucunement affilié à l'Université Côte d'Azur ou à l'I.U.T. Nice Côte d'Azur.

Toute utilisation de l'application UniceNotes est sous la seule responsabilité de l'utilisateur.

Toute ressemblance avec le nom de l'application, le logo et l'interface ne saurait être que fortuite.

L'application UniceNotes utilise Expo, un framework basé sur React Native.
Expand Down
38 changes: 17 additions & 21 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
Expand All @@ -11,11 +12,11 @@ react {
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()

// Use Expo CLI to bundle the app, this ensures the Metro config
// works correctly with Expo projects.
cliFile = new File(["node", "--print", "require.resolve('@expo/cli')"].execute(null, rootDir).text.trim())
cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
bundleCommand = "export:embed"

/* Folders */
Expand Down Expand Up @@ -79,15 +80,16 @@ def jscFlavor = 'org.webkit:android-jsc:+'
android {
ndkVersion rootProject.ext.ndkVersion

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion

namespace 'fr.hugofnm.unicenotes'
defaultConfig {
applicationId 'fr.hugofnm.unicenotes'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 21
versionName "1.5.2"
versionCode 22
versionName "1.5.3"

buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
}
Expand All @@ -112,6 +114,11 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
packagingOptions {
jniLibs {
useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
}
}
}

// Apply static values from `gradle.properties` to the `android.packagingOptions`
Expand Down Expand Up @@ -141,33 +148,22 @@ dependencies {
def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
def frescoVersion = rootProject.ext.frescoVersion

// If your app supports Android versions before Ice Cream Sandwich (API level 14)
if (isGifEnabled || isWebpEnabled) {
implementation("com.facebook.fresco:fresco:${frescoVersion}")
implementation("com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}")
}

if (isGifEnabled) {
// For animated gif support
implementation("com.facebook.fresco:animated-gif:${frescoVersion}")
implementation("com.facebook.fresco:animated-gif:${reactAndroidLibs.versions.fresco.get()}")
}

if (isWebpEnabled) {
// For webp support
implementation("com.facebook.fresco:webpsupport:${frescoVersion}")
implementation("com.facebook.fresco:webpsupport:${reactAndroidLibs.versions.fresco.get()}")
if (isWebpAnimatedEnabled) {
// Animated webp support
implementation("com.facebook.fresco:animated-webp:${frescoVersion}")
implementation("com.facebook.fresco:animated-webp:${reactAndroidLibs.versions.fresco.get()}")
}
}

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
implementation("com.facebook.react:flipper-integration")

if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
Expand All @@ -176,5 +172,5 @@ dependencies {
}
}

apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
applyNativeModulesAppBuildGradle(project)
Loading

0 comments on commit 13744c8

Please sign in to comment.