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

Style + added links + auto https #185

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ab365a7
URL in const
Slysoks Sep 2, 2024
588b9de
Too long text messages
Slysoks Sep 2, 2024
fe7254e
Formule de tutoiement
Slysoks Sep 2, 2024
3d3fa4b
Number of lines fix
Slysoks Sep 2, 2024
89f754a
Add https:// in front of URL if missing
Slysoks Sep 2, 2024
9fc6903
Displayed os type & version
Slysoks Sep 2, 2024
71f100e
Variable number of rows if the name exists or not
Slysoks Sep 2, 2024
0aec6ed
Removed useless imports
Slysoks Sep 2, 2024
2d2645a
Switched the two ToS & CGU links
Slysoks Sep 2, 2024
eceb451
style
Slysoks Sep 2, 2024
0fc2f10
refactor: Update background color and elevation of alert in Settings …
Slysoks Sep 2, 2024
c9bda1d
Merge branch 'main' of https://github.com/Slysoks/Papillon-1
Slysoks Sep 2, 2024
9228e42
Removed console.log()
Slysoks Sep 2, 2024
18c5d79
style: Added rows in bubble
Slysoks Sep 3, 2024
a19da89
Update Settings.tsx
Slysoks Sep 3, 2024
8b0efea
Update Settings.tsx
Slysoks Sep 3, 2024
77f4a17
Update Settings.tsx
Slysoks Sep 3, 2024
9c5524b
Update Settings.tsx
Slysoks Sep 3, 2024
a82de6f
Update Settings.tsx
Slysoks Sep 3, 2024
9b1d417
Update Settings.tsx
Slysoks Sep 3, 2024
a928a94
refactor: Update Settings.tsx with platform version and team message
Slysoks Sep 3, 2024
b52a5dd
feat: Open the donation url
Slysoks Sep 3, 2024
4bbea10
chore: Add beta description for Papillon Magic feature
Slysoks Sep 3, 2024
50cddbe
If average is NaN, the widget will not be displayed
Slysoks Sep 4, 2024
9e17fdc
feat: Go to Lessons page if press on widget
Slysoks Sep 4, 2024
035e909
Merge branch 'main' into main
Slysoks Sep 4, 2024
98d3f1b
Merge branch 'main' of https://github.com/Slysoks/Papillon-1
Slysoks Sep 8, 2024
f016fe1
style: trailing spaces
Slysoks Sep 8, 2024
3dc4242
refactor: Update "fabriqué avec" message in Settings.tsx
Slysoks Sep 8, 2024
a919823
refactor: Remove unused variable in AccountCreated.tsx
Slysoks Sep 8, 2024
1820e6e
refactor: Update donation URL in Settings.tsx
Slysoks Sep 9, 2024
8ea94bb
refactor: Change alert style ONLY FOR ANDROID
Slysoks Sep 9, 2024
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
2 changes: 1 addition & 1 deletion src/components/Home/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ const HeaderButton: React.FC<{
onPress: () => void
}> = ({icon, index, text, scrolled, onPress}) => {
const theme = useTheme();
const {colors} = theme;
const { colors } = theme;

const newIcon = React.cloneElement(icon, {
size: 24,
Expand Down
5 changes: 4 additions & 1 deletion src/services/pronote/determinate-authentication-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ const determinateAuthenticationView = async <ScreenName extends keyof RouteParam
showAlert: any // TODO: type
): Promise<void> => {
let instance: pronote.Instance | undefined;
pronoteURL = pronote.cleanURL(pronoteURL);
if (!pronoteURL.startsWith("https://") && !pronoteURL.startsWith("http://")) {
pronoteURL = `https://${pronoteURL}`;
pronoteURL = pronote.cleanURL(pronoteURL);
}

try {
instance = await pronote.instance(pronoteURL);
Expand Down
4 changes: 2 additions & 2 deletions src/views/login/pronote/PronoteAuthenticationSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ const PronoteAuthenticationSelector: Screen<"PronoteAuthenticationSelector"> = (
<MaskStars />

<PapillonShineBubble
message="Pour trouver ton établissement, préfères-tu utiliser ta position ou faire autrement ?"
numberOfLines={3}
message="Que préfères-tu utiliser pour te connecter à Pronote ?"
numberOfLines={2}
width={260}
offsetTop={"16%"}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/views/login/pronote/PronoteGeolocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const PronoteGeolocation: Screen<"PronoteGeolocation"> = ({ navigation }) => {

<PapillonShineBubble
message={PapillonMessage}
numberOfLines={permission?.granted ? 1 : 3}
numberOfLines={permission?.granted ? 1 : 4}
width={250}
/>
{!permission?.granted && (
Expand Down
2 changes: 1 addition & 1 deletion src/views/login/pronote/PronoteManualLocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const PronoteManualLocation: Screen<"PronoteManualLocation"> = ({ navigation })
layout={LinearTransition}
>
<PapillonShineBubble
message={"Dans quelle ville se trouve votre établissement ?"}
message={"Dans quelle ville se trouve ton établissement ?"}
numberOfLines={2}
width={250}
noFlex
Expand Down
2 changes: 1 addition & 1 deletion src/views/login/pronote/PronoteManualURL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const PronoteManualURL: Screen<"PronoteManualURL"> = ({ route, navigation }) =>
"Indique moi l'adresse URL Pronote de ton établissement"
: "J'ai trouvé cette adresse dans ton presse-papier !"
}
numberOfLines={2}
numberOfLines={3}
width={250}
noFlex
/>
Expand Down
4 changes: 2 additions & 2 deletions src/views/login/skolengo/SkolengoAuthenticationSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ const SkolengoAuthenticationSelector: Screen<"SkolengoAuthenticationSelector"> =
<MaskStars />

<PapillonShineBubble
message="Pour trouver ton établissement, préfères-tu utiliser ta position ou faire autrement ?"
numberOfLines={3}
message="Que préfères-tu pour te connecter à Skolengo ?"
numberOfLines={2}
width={260}
offsetTop={"16%"}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/views/login/skolengo/SkolengoGeolocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const SkolengoGeolocation: Screen<"SkolengoGeolocation"> = ({ navigation }) => {

<PapillonShineBubble
message={PapillonMessage}
numberOfLines={permission?.granted ? 1 : 3}
numberOfLines={permission?.granted ? 1 : 4}
width={250}
/>
{!permission?.granted && (
Expand Down
86 changes: 64 additions & 22 deletions src/views/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { useEffect, useLayoutEffect, useState } from "react";
import { Alert, Image, Platform, Text, View } from "react-native";
import { useAccounts, useCurrentAccount } from "@/stores/account";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import * as WebBrowser from "expo-web-browser";
import AppJSON from "../../../app.json";

import Reanimated, {
Expand All @@ -28,7 +29,8 @@ import {
Settings as SettingsLucide,
Sparkles,
SwatchBook,
WandSparkles
WandSparkles,
X
} from "lucide-react-native";

import { NativeIcon, NativeItem, NativeList, NativeListHeader, NativeText } from "@/components/Global/NativeComponents";
Expand All @@ -39,6 +41,7 @@ import {get_settings_widgets} from "@/addons/addons";
import AsyncStorage from "@react-native-async-storage/async-storage";
import {AddonPlacementManifest} from "@/addons/types";
import { useFlagsStore } from "@/stores/flags";
import { useAlert } from "@/providers/AlertProvider";

const Settings: Screen<"Settings"> = ({ route, navigation }) => {
const theme = useTheme();
Expand All @@ -51,6 +54,13 @@ const Settings: Screen<"Settings"> = ({ route, navigation }) => {

const removeAccount = useAccounts((store) => store.remove);

const openUrl = async (url: string) => {
await WebBrowser.openBrowserAsync(url, {
controlsColor: colors.primary,
presentationStyle: WebBrowser.WebBrowserPresentationStyle.PAGE_SHEET,
});
};

useEffect(() => {
AsyncStorage.getItem("devmode")
.then((res) => {
Expand Down Expand Up @@ -80,6 +90,8 @@ const Settings: Screen<"Settings"> = ({ route, navigation }) => {
return unsubscribe;
}, []);

const { showAlert } = useAlert();

const tabs = [
{
icon: <SettingsLucide />,
Expand Down Expand Up @@ -164,6 +176,7 @@ const Settings: Screen<"Settings"> = ({ route, navigation }) => {
icon: <WandSparkles />,
color: "#58A3C3",
label: "Papillon Magic",
description: "Beta",
onPress: () => navigation.navigate("SettingsMagic"),
},
],
Expand All @@ -176,9 +189,9 @@ const Settings: Screen<"Settings"> = ({ route, navigation }) => {
icon: <HandCoins />,
color: "#CBA024",
label: "Soutenir Papillon",
description: "Disponible prochainement",
onPress: () => {},
disabled: true,
onPress: () => {
Platform.OS === "android" ? openUrl("https://papillon.bzh/donate") : undefined;
},
},
{
icon: <Info />,
Expand All @@ -195,23 +208,51 @@ const Settings: Screen<"Settings"> = ({ route, navigation }) => {
color: "#CF0029",
label: "Se déconnecter",
onPress: () => {
Alert.alert("Se déconnecter", "Êtes-vous sûr de vouloir vous déconnecter ?", [
{
text: "Annuler",
style: "cancel",
},
{
text: "Se déconnecter",
style: "destructive",
onPress: () => {
removeAccount(account.localID);
navigation.reset({
index: 0,
routes: [{ name: "AccountSelector" }],
});
if (Platform.OS === "ios") {
Alert.alert("Se déconnecter", "Êtes-vous sûr de vouloir vous déconnecter ?", [
{
text: "Annuler",
style: "cancel",
},
},
]);
{
text: "Se déconnecter",
style: "destructive",
onPress: () => {
removeAccount(account.localID);
navigation.reset({
index: 0,
routes: [{ name: "AccountSelector" }],
});
},
},
]);
} else {
showAlert({
title: "Se déconnecter",
message: "Êtes-vous sûr de vouloir vous déconnecter ?",
actions: [
{
title: "Annuler",
onPress: () => {},
backgroundColor: colors.card,
icon: <X color={colors.text} />,
},
{
title: "Se déconnecter",
onPress: () => {
removeAccount(account.localID);
navigation.reset({
index: 0,
routes: [{ name: "AccountSelector" }],
});
},
primary: true,
backgroundColor: "#CF0029",
icon: <LogOut color="#FFFFFF" />,
},
],
});
}
},
},
]
Expand Down Expand Up @@ -366,11 +407,12 @@ const Settings: Screen<"Settings"> = ({ route, navigation }) => {
}}
>
version {AppJSON.expo.version} {"\n"}
fabriqué avec ❤️ par les contributeurs de Papillon
{Platform.OS} {Platform.Version} {"\n"}
fabriqué avec ❤️ par les contributeurs Papillon
</Text>
</Reanimated.ScrollView>
</>
);
};

export default Settings;
export default Settings;
2 changes: 1 addition & 1 deletion src/views/welcome/AccountCreated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const AccountCreated: Screen<"AccountCreated"> = ({ navigation }) => {

<PapillonShineBubble
message={name ? `Enchanté, ${name} ! On va personnaliser ton expérience !` : "Bienvenue sur Papillon !"}
numberOfLines={2}
numberOfLines={name ? 3 : 1}
width={260}
style={{
zIndex: 10,
Expand Down
5 changes: 3 additions & 2 deletions src/views/welcome/FirstInstallation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import * as WebBrowser from "expo-web-browser";
import { Audio } from "expo-av";

const PRIVACY_POLICY_URL = "https://safety.getpapillon.xyz/documents/privacy-policy";
const TERMS_OF_SERVICE_URL = "https://safety.getpapillon.xyz/documents/terms-of-service";

const FirstInstallation: Screen<"FirstInstallation"> = ({ navigation }) => {
const theme = useTheme();
Expand Down Expand Up @@ -97,14 +98,14 @@ const FirstInstallation: Screen<"FirstInstallation"> = ({ navigation }) => {
En continuant, vous acceptez les&nbsp;
<Text
style={{ textDecorationLine: "underline" }}
onPress={() => openUrl("https://safety.getpapillon.xyz/documents/terms-of-service")}
onPress={() => openUrl(TERMS_OF_SERVICE_URL)}
>
conditions d'utilisation
</Text>
&nbsp;et la&nbsp;
<Text
style={{ textDecorationLine: "underline" }}
onPress={() => openUrl("https://safety.getpapillon.xyz/documents/privacy-policy")}
onPress={() => openUrl(PRIVACY_POLICY_URL)}
>
politique de confidentialité
</Text>.
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/Components/GeneralAverage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const GeneralAverageWidget = forwardRef(({
}, [defaultPeriod]);

useEffect(() => {
setHidden(typeof average !== "number" || average < 0);
setHidden(typeof average !== "number" || average < 0 || average + "" === "NaN");
Slysoks marked this conversation as resolved.
Show resolved Hide resolved
}, [average]);

if (isNaN(average ?? 0)) {
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/Components/NextCourse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const NextCourseWidget = forwardRef(({ hidden, setHidden, loading, setLoading }:

setLoading(false);
}();
}, [account.instance, timetables]);
}, [account.instance, timetables]);

return !hidden && (
<View
Expand Down