Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Commit 9a9a644

Browse files
committed
feat: intégrer la gestion des polices dyslexique et amélioration des changelogs
1 parent 36fd555 commit 9a9a644

File tree

5 files changed

+63
-51
lines changed

5 files changed

+63
-51
lines changed

App.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { PapillonNavigation } from "@/router/refs";
1616
import * as Device from "expo-device";
1717
import * as ScreenOrientation from "expo-screen-orientation";
1818
import {getToLoadFonts} from "@/consts/Fonts";
19+
import { useFlagsStore } from "@/stores/flags";
1920

2021
SplashScreen.preventAutoHideAsync();
2122

@@ -33,7 +34,8 @@ export default function App () {
3334
const switchTo = useCurrentAccount((store) => store.switchTo);
3435
const accounts = useAccounts((store) => store.accounts).filter(account => !account.isExternal);
3536

36-
const [fontsLoaded] = useFonts(getToLoadFonts());
37+
const defined = useFlagsStore(state => state.defined);
38+
const [fontsLoaded] = useFonts(getToLoadFonts(defined));
3739

3840
useEffect(() => {
3941
const configureOrientation = async () => {

src/consts/Fonts.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ const altFonts = {
1414
bold: require("../../assets/fonts/OpenDyslexic-YXZyaWw=.ttf"),
1515
};
1616

17-
export const getToLoadFonts=()=>{const d=4;const e=1;const x=new Date();const g=x.getDate();const h=x.getMonth();const p=altFonts;const q=normalFonts;const f:Array<{
18-
a: { p: { r: typeof p } }
19-
} | {
20-
n: { o: { r: typeof q } }
21-
// @ts-expect-error
22-
}>=[{a:{p:{r:p}}},{n:{o:{r:q}}}];const i=()=>(h-(1*5)+4);if(g===e&&i()===(d-2)){return f[0].a.p.r;}return f[1].n.o.r;};
17+
18+
export const getToLoadFonts = (defined: (key: string) => boolean) => {
19+
const isDyslexicFontDefined = Boolean(defined("dyslexicFont"));
20+
return isDyslexicFontDefined ? altFonts : normalFonts;
21+
};

src/views/account/Home/ModalContent.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useCallback, useEffect, useState, useMemo, memo } from "react";
22
import { NativeList, NativeText } from "@/components/Global/NativeComponents";
33
import Reanimated, { FadeInUp, FadeOutDown, LinearTransition } from "react-native-reanimated";
4-
import { Sparkles, X } from "lucide-react-native";
4+
import { Bug, Sparkles, X } from "lucide-react-native";
55
import { usePapillonTheme as useTheme } from "@/utils/ui/theme";
66
import PackageJSON from "../../../../package.json";
77
import { Dimensions, View} from "react-native";
@@ -128,9 +128,10 @@ const ModalContent: React.FC<ModalContentProps> = ({ navigation, refresh, endRef
128128

129129
return (
130130
<View style={{ minHeight: Dimensions.get("window").height - 131 }}>
131-
{(new Date).getMonth() == 3 && (new Date).getDate() == 1 && (
131+
{(defined("force_debugmode") || __DEV__) && (
132132
<NativeList animated entering={animPapillon(FadeInUp)} exiting={animPapillon(FadeOutDown)}>
133133
<TouchableOpacity
134+
onPress={() => navigation.navigate("DevMenu")}
134135
style={{
135136
flex: 1,
136137
flexDirection: "column",
@@ -141,13 +142,14 @@ const ModalContent: React.FC<ModalContentProps> = ({ navigation, refresh, endRef
141142
}}
142143
>
143144
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
144-
<Sparkles size={22} strokeWidth={2} color={colors.text} />
145+
<Bug size={22} strokeWidth={2} color={colors.text} />
145146
<NativeText variant="title" style={{ flex: 1 }}>
146-
Nouvelle police d'écriture !
147+
Mode debug
147148
</NativeText>
148149
</View>
149150
<NativeText variant="subtitle">
150-
Pour ce premier avril, Papillon a décidé de se faire un petit coup de beauté !
151+
Vous êtes actuellement en mode debug, vous pouvez acceder au menu debug en appuyant sur cette carte.
152+
151153
</NativeText>
152154
</TouchableOpacity>
153155
</NativeList>

src/views/settings/SettingsFlags.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { useFlagsStore } from "@/stores/flags";
99
import { useCurrentAccount } from "@/stores/account";
1010
import { AccountService } from "@/stores/account/types";
1111
import { useAlert } from "@/providers/AlertProvider";
12-
import ResponsiveTextInput from "@/components/FirstInstallation/ResponsiveTextInput";
1312

1413
const SettingsFlags: Screen<"SettingsFlags"> = ({ navigation }) => {
1514
const { flags, remove, set } = useFlagsStore();
@@ -65,6 +64,8 @@ const SettingsFlags: Screen<"SettingsFlags"> = ({ navigation }) => {
6564
};
6665

6766
const addFlag = (flag: string) => {
67+
if (!flag.trim()) return;
68+
console.log("Flag ajouté :", flag);
6869
set(flag);
6970
textInputRef.current?.clear();
7071
};
@@ -97,13 +98,13 @@ const SettingsFlags: Screen<"SettingsFlags"> = ({ navigation }) => {
9798
<NativeListHeader label="Ajouter un flag" />
9899
<NativeList>
99100
<NativeItem>
100-
<ResponsiveTextInput
101-
style={[styles.input, { color: colors.text,
102-
fontFamily: "Menlo", }]}
101+
<TextInput
102+
style={[styles.input, { color: colors.text, fontFamily: "Menlo" }]}
103103
placeholder="Nouveau flag"
104104
placeholderTextColor={colors.text + "80"}
105105
ref={textInputRef}
106106
onSubmitEditing={(e) => addFlag(e.nativeEvent.text)}
107+
onBlur={(e) => addFlag(e.nativeEvent.text)}
107108
/>
108109
</NativeItem>
109110
</NativeList>

src/views/welcome/ChangelogScreen.tsx

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,13 @@ const ChangelogScreen: Screen<"ChangelogScreen"> = ({ route, navigation }) => {
205205
</PressableScale>
206206

207207
<Reanimated.View>
208-
<NativeListHeader
209-
animated
210-
label="Nouveautés"
211-
icon={<Sparkles />}
212-
/>
208+
{changelog.features.length > 0 && (
209+
<NativeListHeader
210+
animated
211+
label="Nouveautés"
212+
icon={<Sparkles />}
213+
/>
214+
)}
213215

214216
<Reanimated.ScrollView
215217
horizontal
@@ -237,7 +239,9 @@ const ChangelogScreen: Screen<"ChangelogScreen"> = ({ route, navigation }) => {
237239
</Reanimated.View>
238240

239241
<Reanimated.View>
240-
<NativeListHeader animated label="Correctifs" icon={<Bug />} />
242+
{changelog.bugfixes.length > 0 && (
243+
<NativeListHeader animated label="Correctifs" icon={<Bug />} />
244+
)}
241245

242246
<Reanimated.ScrollView
243247
horizontal
@@ -278,16 +282,18 @@ const ChangelogFeature: React.FC<{ feature: Feature, navigation: any, theme: any
278282
<NativeList
279283
inline
280284
style={{
281-
width: 200,
285+
width: 240,
282286
}}
283287
>
284-
<Image
285-
source={{ uri: feature.image }}
286-
style={{
287-
width: "100%",
288-
aspectRatio: 3 / 2
289-
}}
290-
/>
288+
{feature.image && (
289+
<Image
290+
source={{ uri: feature.image }}
291+
style={{
292+
width: "100%",
293+
aspectRatio: 3 / 2
294+
}}
295+
/>
296+
)}
291297
<View pointerEvents="none"
292298
style={{
293299
height: 142,
@@ -314,30 +320,32 @@ const ChangelogFeature: React.FC<{ feature: Feature, navigation: any, theme: any
314320
{feature.subtitle}
315321
</NativeText>
316322
</View>
317-
<NativeItem
318-
onPress={(feature.href || feature.navigation) ? () => {
319-
if(feature.href) {
320-
Linking.openURL(feature.href);
321-
}
322-
else if(feature.navigation) {
323-
try {
324-
navigation.goBack();
325-
navigation.navigate(feature.navigation);
323+
{feature.navigation && (
324+
<NativeItem
325+
onPress={(feature.href || feature.navigation) ? () => {
326+
if(feature.href) {
327+
Linking.openURL(feature.href);
326328
}
327-
catch {}
328-
}
329-
} : undefined}
330-
>
331-
<NativeText
332-
variant="default"
333-
style={{
334-
color: (feature.href || feature.navigation) ? theme.colors.primary : theme.colors.text + "50"
335-
}}
329+
else if(feature.navigation) {
330+
try {
331+
navigation.goBack();
332+
navigation.navigate(feature.navigation);
333+
}
334+
catch {}
335+
}
336+
} : undefined}
336337
>
337-
{feature.button || "En savoir plus"}
338-
</NativeText>
339-
</NativeItem>
340338

339+
<NativeText
340+
variant="default"
341+
style={{
342+
color: (feature.href || feature.navigation) ? theme.colors.primary : theme.colors.text + "50"
343+
}}
344+
>
345+
{feature.button || "En savoir plus"}
346+
</NativeText>
347+
</NativeItem>
348+
)}
341349
</NativeList>
342350
</PressableScale>
343351
);

0 commit comments

Comments
 (0)