Skip to content

Commit

Permalink
Merge branch 'main' into feat/background
Browse files Browse the repository at this point in the history
  • Loading branch information
Kgeek33 committed Jan 7, 2025
2 parents 6bd5f6c + c97163f commit bde7f7b
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 56 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ android {
applicationId 'xyz.getpapillon.app'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 7700
versionCode 7701
versionName "7.7.0"
}
signingConfigs {
Expand Down
19 changes: 19 additions & 0 deletions android/react-settings-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.24"
id("java-gradle-plugin")
}

repositories {
mavenCentral()
}

gradlePlugin {
plugins {
create("reactSettingsPlugin") {
id = "com.facebook.react.settings"
implementationClass = "expo.plugins.ReactSettingsPlugin"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package expo.plugins

import org.gradle.api.Plugin
import org.gradle.api.initialization.Settings

class ReactSettingsPlugin : Plugin<Settings> {
override fun apply(settings: Settings) {
// Do nothing, just register the plugin.
}
}
3 changes: 1 addition & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
},
"assetBundlePatterns": ["**/*"],
"ios": {
"buildNumber": "7501",
"supportsTablet": true,
"appStoreUrl": "https://apps.apple.com/us/app/papillon-lappli-scolaire/id6477761165",
"bundleIdentifier": "xyz.getpapillon.ios",
Expand All @@ -42,7 +41,7 @@
}
},
"android": {
"versionCode": 7700,
"versionCode": 7701,
"playStoreUrl": "https://play.google.com/store/apps/details?id=xyz.getpapillon.app",
"adaptiveIcon": {
"foregroundImage": "./assets/launch/adaptive-icon-foreground.png",
Expand Down
20 changes: 7 additions & 13 deletions ios/Papillon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Papillon/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Papillon/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Papillon/main.m; sourceTree = "<group>"; };
222162480574474F81E8B151 /* FixelText-Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "FixelText-Regular.ttf"; path = "../assets/fonts/FixelText-Regular.ttf"; sourceTree = "<group>"; };
2CA436545607494ABF55D4A0 /* FixelText-Light.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "FixelText-Light.ttf"; path = "../assets/fonts/FixelText-Light.ttf"; sourceTree = "<group>"; };
222162480574474F81E8B151 /* FixelText-Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "FixelText-Regular.ttf"; path = "../assets/fonts/FixelText-Regular.ttf"; sourceTree = "<group>"; };
2CA436545607494ABF55D4A0 /* FixelText-Light.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "FixelText-Light.ttf"; path = "../assets/fonts/FixelText-Light.ttf"; sourceTree = "<group>"; };
34052B33E0B6329F11EBC220 /* Pods-Papillon.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Papillon.release.xcconfig"; path = "Target Support Files/Pods-Papillon/Pods-Papillon.release.xcconfig"; sourceTree = "<group>"; };
472EB33B2C45E06600503877 /* Messages.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Messages.framework; path = System/Library/Frameworks/Messages.framework; sourceTree = SDKROOT; };
472EB34F2C45E0EC00503877 /* Autocollants Papillon.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Autocollants Papillon.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
472EB3512C45E0ED00503877 /* Stickers.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Stickers.xcassets; sourceTree = "<group>"; };
472EB3532C45E0ED00503877 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
523BD2EA68B24DC59000E016 /* FixelText-Medium.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "FixelText-Medium.ttf"; path = "../assets/fonts/FixelText-Medium.ttf"; sourceTree = "<group>"; };
52806640827D4D76AC6BD305 /* FixelText-Bold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "FixelText-Bold.ttf"; path = "../assets/fonts/FixelText-Bold.ttf"; sourceTree = "<group>"; };
54DA555BF32B482E8C5E646E /* FixelText-SemiBold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "FixelText-SemiBold.ttf"; path = "../assets/fonts/FixelText-SemiBold.ttf"; sourceTree = "<group>"; };
523BD2EA68B24DC59000E016 /* FixelText-Medium.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "FixelText-Medium.ttf"; path = "../assets/fonts/FixelText-Medium.ttf"; sourceTree = "<group>"; };
52806640827D4D76AC6BD305 /* FixelText-Bold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "FixelText-Bold.ttf"; path = "../assets/fonts/FixelText-Bold.ttf"; sourceTree = "<group>"; };
54DA555BF32B482E8C5E646E /* FixelText-SemiBold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "FixelText-SemiBold.ttf"; path = "../assets/fonts/FixelText-SemiBold.ttf"; sourceTree = "<group>"; };
8609E53447C1AEB25F30038A /* Pods-Papillon.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Papillon.debug.xcconfig"; path = "Target Support Files/Pods-Papillon/Pods-Papillon.debug.xcconfig"; sourceTree = "<group>"; };
AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = Papillon/SplashScreen.storyboard; sourceTree = "<group>"; };
BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -629,10 +629,7 @@
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
OTHER_LDFLAGS = "$(inherited) ";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down Expand Up @@ -690,10 +687,7 @@
);
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift\"$(inherited)\"";
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
OTHER_LDFLAGS = "$(inherited) ";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down
3 changes: 1 addition & 2 deletions ios/Papillon/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>7501</string>
<string>1</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down Expand Up @@ -72,7 +72,6 @@
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>processing</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
Expand Down
6 changes: 3 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ PODS:
- React-Core
- RNDateTimePicker (8.0.1):
- React-Core
- RNGestureHandler (2.20.2):
- RNGestureHandler (2.21.2):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1981,7 +1981,7 @@ SPEC CHECKSUMS:
RNCAsyncStorage: 826b603ae9c0f88b5ac4e956801f755109fa4d5c
RNCMaskedView: 090213d32d8b3bb83a4dcb7d12c18f0152591906
RNDateTimePicker: b6a9b35a785ecbe12b4e7d6de5439d0aa4614146
RNGestureHandler: a8e61b93b4c5c44e6cd797cdaba43126ec36acaa
RNGestureHandler: 6fee3422fd8c81c5ee756fa72e3d1780e9943d9d
RNNotifee: 935f3ea8c134c88cbf8b13ea0c97c72c09ad2116
RNReanimated: 35f9ac9c3ac42d0497ebd1cce5c39d7687a8493e
RNScreens: b32a9ff15bea7fcdbe5dff6477bc503f792b1208
Expand All @@ -1993,4 +1993,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 7f0387b1ee3dbf846a6b743dd3d86d401c33d8c2

COCOAPODS: 1.16.2
COCOAPODS: 1.15.2
12 changes: 5 additions & 7 deletions src/components/Global/NativeComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,6 @@ export const NativeItem: React.FC<NativeItemProps> = ({
entering={entering && entering}
exiting={exiting && exiting}
pointerEvents={pointerEvents}
style={[
item_styles.item,
style,
disabled && {
opacity: 0.5,
},
]}
>
<NativePressable
onPress={!disabled ? onPress : () => {}}
Expand All @@ -245,9 +238,14 @@ export const NativeItem: React.FC<NativeItemProps> = ({
onTouchEnd={onTouchEnd}
androidStyle={androidStyle}
style={({ pressed }) => [
item_styles.item,
onPress && {
backgroundColor: pressed && !disabled ? colors.text + "12" : "transparent",
},
style,
disabled && {
opacity: 0.5,
},
]}
>
<View style={[item_styles.part, item_styles.leading]}>
Expand Down
44 changes: 37 additions & 7 deletions src/components/Settings/ReelGallery.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useCallback, useState } from "react";
import {
ScrollView,
View,
Expand Down Expand Up @@ -36,6 +36,26 @@ const SubjectBadge = ({ emoji, color }: { emoji: string; color: string }) => (
const ReelThumbnail = ({ reel, onPress, width }: { reel: Reel; onPress: () => void; width: number }) => {
const { colors } = useTheme();

// Vérification de sécurité pour l'image
const imageSource = reel.imagewithouteffect
? { uri: `data:image/jpeg;base64,${reel.imagewithouteffect}` }
: null; // Vous pouvez aussi mettre une image par défaut ici

if (!imageSource) {
return (
<View style={[styles.item, {
backgroundColor: colors.card,
width: width,
height: width * 1.5,
margin: 4,
justifyContent: "center",
alignItems: "center"
}]}>
<Text style={{color: colors.text}}>Image non disponible</Text>
</View>
);
}

return (
<TouchableOpacity
style={[
Expand All @@ -50,9 +70,10 @@ const ReelThumbnail = ({ reel, onPress, width }: { reel: Reel; onPress: () => vo
onPress={onPress}
>
<Image
source={{ uri: `data:image/jpeg;base64,${reel.imagewithouteffect}` }}
source={imageSource}
style={styles.thumbnail}
resizeMode="cover"
defaultSource={require("@/../assets/images/service_unknown.png")} // Ajoutez une image par défaut
/>
<View style={[styles.infoContainer, { backgroundColor: colors.card }]}>
<SubjectBadge
Expand All @@ -73,29 +94,38 @@ interface ReelGalleryProps {
reels: Reel[];
}

// Sécurisation du composant principal
const ReelGallery = ({ reels }: ReelGalleryProps) => {
const [selectedReel, setSelectedReel] = useState<Reel | null>(null);
const windowWidth = Dimensions.get("window").width;
const padding = 40;
const gap = 8;
const numColumns = 2;

// Vérification des reels valides
const validReels = reels.filter(reel =>
reel &&
typeof reel.id === "string" &&
reel.grade &&
reel.subjectdata
);

const itemWidth = (Math.min(500, windowWidth) - (padding * 2) - (gap * (numColumns - 1))) / numColumns;

const deleteReel = (reelId: string) => {
const deleteReel = useCallback((reelId: string) => {
useGradesStore.setState((store) => {
const updatedReels = { ...store.reels };
delete updatedReels[reelId];
return { reels: updatedReels };
});
setSelectedReel(null);
};
}, []);

return (
<ScrollView showsVerticalScrollIndicator={false}>
<View style={styles.container}>
<View style={[styles.galleryContent, { gap }]}>
{reels.map((reel) => (
{validReels.map((reel) => (
<ReelThumbnail
key={reel.id}
reel={reel}
Expand All @@ -109,9 +139,9 @@ const ReelGallery = ({ reels }: ReelGalleryProps) => {
{selectedReel && (
<GradeModal
isVisible={!!selectedReel}
imageBase64={selectedReel.image}
imageBase64={selectedReel.image || ""}
onClose={() => setSelectedReel(null)}
DeleteGrade={() => deleteReel(selectedReel.id)}
DeleteGrade={() => selectedReel.id && deleteReel(selectedReel.id)}
/>
)}
</ScrollView>
Expand Down
4 changes: 2 additions & 2 deletions src/utils/chat/themes/GetAvailableThemes.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {ThemesMeta} from "@/utils/chat/themes/Themes.types";

async function GetAvailableThemes (): Promise<ThemesMeta[]> {
let f = await fetch("https://raw.githubusercontent.com/PapillonApp/datasets/themes/refs/heads/main/themes.json");
let f = await fetch("https://raw.githubusercontent.com/PapillonApp/datasets/refs/heads/main/themes/themes.json");
let r = await f.json();
return r.map((theme: ThemesMeta) => {
return {
name: theme.name,
author: theme.author,
path: theme.path,
icon: { uri: "https://raw.githubusercontent.com/PapillonApp/datasets/themes/refs/heads/main/" + theme.path + "/" + theme.icon },
icon: { uri: "https://raw.githubusercontent.com/PapillonApp/datasets/refs/heads/main/themes/" + theme.path + "/" + theme.icon },
darkIcon: theme.darkIcon
};
});
Expand Down
4 changes: 2 additions & 2 deletions src/utils/chat/themes/SetThemeForChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ThemesMeta } from "@/utils/chat/themes/Themes.types";
import AsyncStorage from "@react-native-async-storage/async-storage";

async function DownloadTheme (meta: ThemesMeta): Promise<boolean> {
let f_theme = await fetch("https://raw.githubusercontent.com/PapillonApp/datasets/themes/main/" + meta.path + "/theme.json");
let f_theme = await fetch("https://raw.githubusercontent.com/PapillonApp/datasets/refs/heads/main/themes/" + meta.path + "/theme.json");
let r_theme = await f_theme.json();

let to_download: string[] = [];
Expand All @@ -13,7 +13,7 @@ async function DownloadTheme (meta: ThemesMeta): Promise<boolean> {
to_download.push(r_theme.lightModifier.chatBackgroundImage);
}
for (let i = 0; i < to_download.length; i++) {
let f = await fetch("https://raw.githubusercontent.com/PapillonApp/datasets/themes/refs/heads/main/" + meta.path + "/" + to_download[i]);
let f = await fetch("https://raw.githubusercontent.com/PapillonApp/datasets/refs/heads/main/themes/" + meta.path + "/" + to_download[i]);
let r = await f.blob();
let reader = new FileReader();
reader.readAsDataURL(r);
Expand Down
10 changes: 6 additions & 4 deletions src/views/account/Attendance/Atoms/AttendanceItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface AttendanceItemProps {
missed?: { hours: number, minutes: number }
}

const NO_JUSTICATION = "Sans justification";
const NO_JUSTICATION = "Aucune description";

const AttendanceItem: React.FC<AttendanceItemProps> = ({
title,
Expand Down Expand Up @@ -74,14 +74,16 @@ const AttendanceItem: React.FC<AttendanceItemProps> = ({
let totalTime = "";
if ("hours" in item) {
const [hours, minutes] = item.hours.split("h").map(Number);
totalTime = hours + "h " + leadingZero(minutes) + "min";
if (hours === 0) {
totalTime = `${leadingZero(minutes)} min`;
} else {
totalTime = `${hours}h ${leadingZero(minutes)}min`;
}
}
else if ("duration" in item) {
totalTime = item.duration + " min";
}

totalTime = totalTime.replace("0h ", "");

const timestamp = "fromTimestamp" in item ? item.fromTimestamp : item.timestamp;
const not_justified = "justified" in item && !item.justified;
const justification = "reasons" in item ? item.reasons || NO_JUSTICATION : "reason" in item ? item.reason.text : NO_JUSTICATION;
Expand Down
8 changes: 4 additions & 4 deletions src/views/account/Grades/Document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ const GradeDocument: Screen<"GradeDocument"> = ({ route, navigation }) => {
<TouchableOpacity
style={{
position: "absolute",
bottom: 20,
right: 20,
paddingHorizontal: 10,
paddingVertical: 8,
bottom: 12,
right: 12,
paddingHorizontal: 12,
paddingVertical: 6,
borderRadius: 100,
backgroundColor: "#00000043",
zIndex: 50,
Expand Down
4 changes: 2 additions & 2 deletions src/views/account/Lessons/Document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
Hourglass,
Info,
LinkIcon,
PersonStanding,
User2,
Users,
} from "lucide-react-native";

Expand Down Expand Up @@ -173,7 +173,7 @@ const LessonDocument: Screen<"LessonDocument"> = ({ route, navigation }) => {
enabled: Boolean(lesson.room?.trim()), // Check if lesson.room exists, is not null, and not empty
},
{
icon: <PersonStanding />,
icon: <User2 />,
text: lesson.teacher?.includes(",") ? "Professeurs" : "Professeur",
value: lesson.teacher || "Aucun",
enabled: Boolean(lesson.teacher?.trim()), // Check if lesson.teacher exists, is not null, and not empty.
Expand Down
4 changes: 2 additions & 2 deletions src/views/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import {
Route,
Scroll,
Settings as SettingsLucide,
Sparkles,
SunMoon,
Sparkles,
SunMoon,
Smile,
SwatchBook,
WandSparkles,
Expand Down
8 changes: 3 additions & 5 deletions src/views/settings/SettingsAbout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,9 @@ const SettingsAbout: Screen<"SettingsAbout"> = ({ navigation }) => {
<NativeText variant="title">
Version des dépendances
</NativeText>
{PackageJSON.dependencies["react-native"] &&
<NativeText variant="subtitle">
RN : {PackageJSON.dependencies["react-native"].split("^")[1]} | Expo : {(PackageJSON.devDependencies.expo || PackageJSON.dependencies.expo).split("^")[1]}
</NativeText>
}
<NativeText variant="subtitle">
RN : {PackageJSON.dependencies["react-native"].split("^")[1]} | Expo : {(PackageJSON.devDependencies["expo"] || PackageJSON.dependencies["expo"]).split(/[~^]/)[1] || (PackageJSON.devDependencies["expo"] || PackageJSON.dependencies["expo"])}
</NativeText>
</NativeItem>
</NativeList>

Expand Down

0 comments on commit bde7f7b

Please sign in to comment.