Skip to content

Commit 79da867

Browse files
committed
fix number transfer
1 parent 27649a0 commit 79da867

File tree

5 files changed

+4266
-3928
lines changed

5 files changed

+4266
-3928
lines changed

expo/app.config.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
1717
name: "Oz Ensemble",
1818
slug: "oz_ensemble",
1919
owner: "oz-ensemble",
20+
newArchEnabled: true,
2021
version: version.buildName,
2122
// orientation: "portrait",
2223
icon: "./assets/images/icon.png",
@@ -55,7 +56,11 @@ export default ({ config }: ConfigContext): ExpoConfig => {
5556
googleServicesFile: "./google-services.json",
5657
package: "com.addicto",
5758
versionCode: version.buildNumber,
58-
permissions: ["android.permission.SCHEDULE_EXACT_ALARM", "android.permission.WRITE_EXTERNAL_STORAGE"],
59+
permissions: [
60+
"android.permission.SCHEDULE_EXACT_ALARM",
61+
"android.permission.WRITE_EXTERNAL_STORAGE",
62+
"android.permission",
63+
],
5964
softwareKeyboardLayoutMode: "pan",
6065
intentFilters: [
6166
{
@@ -76,14 +81,11 @@ export default ({ config }: ConfigContext): ExpoConfig => {
7681
},
7782
plugins: [
7883
[
79-
"expo-build-properties",
84+
"react-native-share",
8085
{
81-
ios: {
82-
newArchEnabled: true,
83-
},
84-
android: {
85-
newArchEnabled: true,
86-
},
86+
ios: ["fb", "instagram", "twitter", "tiktoksharesdk"],
87+
android: ["com.facebook.katana", "com.instagram.android", "com.twitter.android", "com.zhiliaoapp.musically"],
88+
enableBase64ShareAndroid: true,
8789
},
8890
],
8991
[

expo/app.versions.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"buildNumber": 318,
3-
"buildName": "1.28.0"
2+
"buildNumber": 321,
3+
"buildName": "1.29.1"
44
}

expo/package.json

+37-37
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "oz-ensemble",
3-
"version": "1.27.0",
3+
"version": "1.29.1",
44
"scripts": {
55
"get-ip": "./get-ip.sh && echo \"this script updates the API IP to your own IP, because that's what Android Emulator needs to work. It's based on your wifi IP, if you need ethernet it won't work (needs en1 instead of en0)\"",
66
"start": "expo start --dev-client",
@@ -33,55 +33,55 @@
3333
"printWidth": 120
3434
},
3535
"dependencies": {
36-
"@react-native-community/datetimepicker": "8.0.1",
37-
"@react-native-community/netinfo": "11.3.1",
38-
"@react-native-masked-view/masked-view": "0.3.1",
36+
"@react-native-community/datetimepicker": "8.2.0",
37+
"@react-native-community/netinfo": "11.4.1",
38+
"@react-native-masked-view/masked-view": "0.3.2",
3939
"@react-navigation/bottom-tabs": "6.6.1",
4040
"@react-navigation/native": "^6.1.9",
4141
"@react-navigation/native-stack": "^6.11.0",
4242
"@react-navigation/stack": "^6.3.2",
43-
"@sentry/react-native": "5.31.1",
44-
"@shopify/flash-list": "1.7.1",
43+
"@sentry/react-native": "~6.3.0",
44+
"@shopify/flash-list": "1.7.3",
4545
"base-64": "^1.0.0",
4646
"dayjs": "^1.11.11",
47-
"expo": "51.0.31",
48-
"expo-application": "^5.9.1",
49-
"expo-build-properties": "^0.12.3",
50-
"expo-checkbox": "^3.0.0",
51-
"expo-constants": "^16.0.2",
52-
"expo-dev-client": "4.0.25",
53-
"expo-dev-menu": "5.0.21",
54-
"expo-document-picker": "12.0.2",
55-
"expo-file-system": "17.0.1",
56-
"expo-image": "1.12.15",
57-
"expo-linking": "^6.3.1",
58-
"expo-notifications": "0.28.16",
59-
"expo-splash-screen": "^0.27.5",
60-
"expo-status-bar": "^1.12.1",
61-
"expo-system-ui": "^3.0.7",
62-
"expo-web-browser": "^13.0.3",
47+
"expo": "^52.0.39",
48+
"expo-application": "~6.0.2",
49+
"expo-build-properties": "~0.13.2",
50+
"expo-checkbox": "~4.0.1",
51+
"expo-constants": "~17.0.8",
52+
"expo-dev-client": "~5.0.14",
53+
"expo-dev-menu": "6.0.21",
54+
"expo-document-picker": "~13.0.3",
55+
"expo-file-system": "~18.0.11",
56+
"expo-image": "~2.0.6",
57+
"expo-linking": "~7.0.5",
58+
"expo-notifications": "~0.29.14",
59+
"expo-splash-screen": "~0.29.22",
60+
"expo-status-bar": "~2.0.1",
61+
"expo-system-ui": "~4.0.8",
62+
"expo-web-browser": "~14.0.2",
6363
"nativewind": "^2.0.11",
64-
"react": "18.2.0",
65-
"react-dom": "18.2.0",
66-
"react-native": "0.75.2",
64+
"react": "18.3.1",
65+
"react-dom": "18.3.1",
66+
"react-native": "0.76.7",
6767
"react-native-awesome-slider": "^2.5.3",
6868
"react-native-device-info": "^11.1.0",
6969
"react-native-draggable-flatlist": "^4.0.1",
70-
"react-native-gesture-handler": "2.19.0",
70+
"react-native-gesture-handler": "~2.20.2",
7171
"react-native-get-random-values": "^1.11.0",
7272
"react-native-in-app-review": "^4.3.3",
7373
"react-native-localize": "^3.2.0",
7474
"react-native-mmkv": "3.0.2",
75-
"react-native-reanimated": "3.15.1",
75+
"react-native-reanimated": "~3.16.1",
7676
"react-native-restart": "0.0.27",
77-
"react-native-safe-area-context": "4.10.5",
78-
"react-native-screens": "3.34.0",
79-
"react-native-share": "10.2.1",
80-
"react-native-svg": "15.6.0",
77+
"react-native-safe-area-context": "4.12.0",
78+
"react-native-screens": "~4.4.0",
79+
"react-native-share": "^12.0.9",
80+
"react-native-svg": "15.8.0",
8181
"react-native-swipe-list-view": "^3.2.9",
8282
"react-native-swiper": "^1.6.0",
8383
"react-native-tab-view": "^3.5.2",
84-
"react-native-webview": "13.8.6",
84+
"react-native-webview": "13.12.5",
8585
"react-native-youtube-iframe": "^2.3.0",
8686
"recoil": "^0.7.7",
8787
"styled-components": "^5.3.11",
@@ -90,22 +90,22 @@
9090
"validator": "^13.12.0"
9191
},
9292
"devDependencies": {
93-
"@babel/core": "^7.24.8",
93+
"@babel/core": "^7.25.2",
9494
"@types/base-64": "^1",
9595
"@types/eslint": "^8",
9696
"@types/jest": "^29.5.12",
9797
"@types/node": "^20.14.11",
98-
"@types/react": "~18.2.79",
98+
"@types/react": "~18.3.12",
9999
"@types/react-native-get-random-values": "^1",
100100
"@types/semver": "^7",
101101
"@types/urijs": "^1",
102102
"@types/uuid": "^10",
103103
"@types/validator": "^13",
104-
"babel-preset-expo": "^11.0.12",
104+
"babel-preset-expo": "~12.0.0",
105105
"eslint": "^8.57.0",
106-
"eslint-config-expo": "^7.0.0",
106+
"eslint-config-expo": "~8.0.1",
107107
"jest": "^29.7.0",
108-
"jest-expo": "^51.0.3",
108+
"jest-expo": "~52.0.6",
109109
"knip": "^5.26.0",
110110
"semver": "^7.6.3",
111111
"tailwindcss": "3.3.2",

expo/src/scenes/Infos/Transfer.js

+48-26
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import WrapperContainer from "../../components/WrapperContainer.js";
44
import { storage } from "../../services/storage.js";
55
import API from "../../services/api.js";
66
import * as DocumentPicker from "expo-document-picker";
7-
import * as Expo from "expo";
87
import * as FileSystem from "expo-file-system";
98
import Share from "react-native-share";
109
import TipIcon from "../../components/illustrations/TipIcon.js";
@@ -16,6 +15,7 @@ import CloudIcon from "../../components/illustrations/icons/CloudIcon.js";
1615
import DownloadIcon from "../../components/illustrations/icons/DownloadIcon.js";
1716
import { logEvent } from "../../services/logEventsWithMatomo.js";
1817
import RNRestart from "react-native-restart";
18+
import { capture } from "../../services/sentry.js";
1919

2020
const Transfer = ({ navigation }) => {
2121
const exportData = async () => {
@@ -26,49 +26,62 @@ const Transfer = ({ navigation }) => {
2626
(key) => !key.startsWith("STORAGE_KEY_PUSH_NOTIFICATION") && key !== "@ExportedData"
2727
);
2828
const toExportData = {};
29-
filteredStorage.forEach((key) => {
29+
for (const key of filteredStorage) {
30+
const debug = key === "@Defi1_ValidatedDays";
3031
// On vérifie si la valeur est un objet ou un boolean
3132
// Si c'est un objet, on le parse en JSON
3233
// Si c'est un boolean, on le récupère en boolean
3334
// Sinon, on le récupère en string
3435
const stringValue = storage.getString(key);
3536
const booleanValue = storage.getBoolean(key);
37+
const numberValue = storage.getNumber(key);
38+
3639
let value;
3740
if (stringValue !== null && stringValue !== undefined) {
38-
try {
39-
value = JSON.parse(stringValue);
40-
} catch (e) {
41-
value = stringValue;
41+
if (stringValue === "" && numberValue > 0) {
42+
value = numberValue;
43+
} else {
44+
try {
45+
value = JSON.parse(stringValue);
46+
} catch (e) {
47+
value = stringValue;
48+
}
4249
}
4350
} else if (booleanValue !== null && booleanValue !== undefined) {
4451
value = booleanValue;
52+
} else if (numberValue !== null && numberValue !== undefined) {
53+
value = numberValue;
4554
} else {
4655
value = null;
4756
}
4857

4958
if (value !== null) toExportData[key] = value;
50-
});
59+
}
5160
const jsonExport = JSON.stringify(toExportData);
5261
const path = `${FileSystem.documentDirectory}oz-ensemble-export.json`;
5362

5463
await FileSystem.writeAsStringAsync(path, jsonExport, { encoding: FileSystem.EncodingType.UTF8 });
5564

56-
const shareOptions = {
57-
url: `file://${path}`,
58-
title: "Données exportées",
59-
message: "Voici vos données exportées depuis l'application Oz Ensemble",
60-
};
61-
6265
try {
63-
await Share.open(shareOptions).then((res) => {
64-
console.log(res);
65-
logEvent({ category: "TRANSFER", action: "EXPORT_DATA_SUCCESS" });
66-
Alert.alert("Vos données ont bien été sauvegardées.");
67-
storage.set("@ExportedData", true);
68-
});
66+
await Share.open({
67+
url: `file://${path}`,
68+
title: "Données exportées",
69+
message: "Voici vos données exportées depuis l'application Oz Ensemble",
70+
type: "application/json",
71+
}).then((res) => {
72+
console.log(res);
73+
logEvent({ category: "TRANSFER", action: "EXPORT_DATA_SUCCESS" });
74+
Alert.alert("Vos données ont bien été sauvegardées.");
75+
storage.set("@ExportedData", true);
76+
});
6977
} catch (error) {
7078
console.log("Error sharing:", error);
71-
Alert.alert("Erreur lors du partage des données.");
79+
if (error.message === "User did not share") {
80+
logEvent({ category: "TRANSFER", action: "EXPORT_DATA_SUCCESS", name: "SHARE_CANCEL" });
81+
} else {
82+
logEvent({ category: "TRANSFER", action: "EXPORT_DATA_FAILURE" });
83+
Alert.alert("Erreur lors du partage des données.");
84+
}
7285
}
7386
};
7487
const importData = async () => {
@@ -88,16 +101,20 @@ const Transfer = ({ navigation }) => {
88101
onPress: async () => {
89102
try {
90103
const result = await DocumentPicker.getDocumentAsync({ type: "application/json" });
91-
const fileUri = result.assets && result.assets.length > 0 ? result.assets[0].uri : undefined;
104+
if (result.canceled || !result.assets || result.assets.length === 0) {
105+
logEvent({ category: "TRANSFER", action: "CANCEL_IMPORT_DATA", name: "DOCUMENT_PICKER_CANCEL" });
106+
return;
107+
}
108+
const fileUri = result.assets[0].uri;
109+
if (!fileUri) {
110+
logEvent({ category: "TRANSFER", action: "CANCEL_IMPORT_DATA", name: "DOCUMENT_PICKER_CANCEL" });
111+
return;
112+
}
92113
const fileContents = await fetch(fileUri).then((response) => response.text());
93114
const pushNotifToken = storage.getString("STORAGE_KEY_PUSH_NOTIFICATION_TOKEN");
94115
await handleImportData(fileContents, pushNotifToken);
95116
} catch (err) {
96-
if (DocumentPicker.isCancel(err)) {
97-
logEvent({ category: "TRANSFER", action: "CANCEL_IMPORT_DATA", name: "DOCUMENT_PICKER_CANCEL" });
98-
} else {
99-
console.log(err);
100-
}
117+
console.log(err);
101118
}
102119
},
103120
},
@@ -167,6 +184,7 @@ const Transfer = ({ navigation }) => {
167184
RNRestart.restart();
168185
});
169186
} catch (error) {
187+
capture(error);
170188
Alert.alert("Une erreur est survenue lors de l'importation des données");
171189
logEvent({ category: "TRANSFER", action: "IMPORT_DATA_FAILURE" });
172190
}
@@ -206,6 +224,10 @@ const Transfer = ({ navigation }) => {
206224
Une fenêtre s’ouvre, sélectionnez une des méthodes proposées pour sauvegarder vos données Oz. Vous pouvez
207225
réaliser cette sauvegarde :
208226
</Text>
227+
<View className="flex flex-row space-x-2">
228+
<Text className="text-[#4030A5] font-bold">{"\u2022"}</Text>
229+
<Text className="text-[#4030A5] font-bold">sur votre téléphone,</Text>
230+
</View>
209231
<View className="flex flex-row space-x-2">
210232
<Text className="text-[#4030A5] font-bold">{"\u2022"}</Text>
211233
<Text className="text-[#4030A5] font-bold">via le cloud,</Text>

0 commit comments

Comments
 (0)