Skip to content

Commit

Permalink
fix: version
Browse files Browse the repository at this point in the history
  • Loading branch information
YoanRos committed Aug 2, 2024
1 parent fa63144 commit 6460f26
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
2 changes: 1 addition & 1 deletion expo/app.versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"buildNumber": 302,
"buildNumber": 303,
"buildName": "1.26.1"
}
50 changes: 29 additions & 21 deletions expo/src/scenes/Infos/Transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,28 +139,36 @@ const Transfer = ({ navigation }) => {
};

const overwriteData = async (dataImported, pushNotifToken) => {
storage.clearAll();
storage.set("STORAGE_KEY_PUSH_NOTIFICATION_TOKEN", pushNotifToken);
Object.keys(dataImported).forEach((key) => {
const value = dataImported[key];
if (typeof value === "object") {
storage.set(key, JSON.stringify(value));
} else {
storage.set(key, value);
}
});
const matomoId = storage.getString("@UserIdv2");
await API.put({ path: `/user`, body: { matomoId, pushNotifToken } }).then((res) => {
if (res.ok) {
Alert.alert("Félicitations, vos données ont bien été importées 🥳");
logEvent({ category: "TRANSFER", action: "IMPORT_DATA_SUCCESS" });
Expo.reloadAppAsync();
} else {
Alert.alert("Félicitations, vos données ont bien été importées 🥳");
logEvent({ category: "TRANSFER", action: "IMPORT_DATA_SUCCESS", name: "PUSH_NOTIF_TOKEN_NOT_SYNC" });
Expo.reloadAppAsync();
try {
if (Object.keys(dataImported).length === 0) {
throw new Error("Imported data is empty");
}
});
storage.clearAll();
storage.set("STORAGE_KEY_PUSH_NOTIFICATION_TOKEN", pushNotifToken);
Object.keys(dataImported).forEach((key) => {
const value = dataImported[key];
if (typeof value === "object") {
storage.set(key, JSON.stringify(value));
} else {
storage.set(key, value);
}
});
const matomoId = storage.getString("@UserIdv2");
await API.put({ path: `/user`, body: { matomoId, pushNotifToken } }).then((res) => {
if (res.ok) {
Alert.alert("Félicitations, vos données ont bien été importées 🥳");
logEvent({ category: "TRANSFER", action: "IMPORT_DATA_SUCCESS" });
Expo.reloadAppAsync();
} else {
Alert.alert("Félicitations, vos données ont bien été importées 🥳");
logEvent({ category: "TRANSFER", action: "IMPORT_DATA_SUCCESS", name: "PUSH_NOTIF_TOKEN_NOT_SYNC" });
Expo.reloadAppAsync();
}
});
} catch (error) {
Alert.alert("Une erreur est survenue lors de l'importation des données: " + error.message);
logEvent({ category: "TRANSFER", action: "IMPORT_DATA_FAILURE", label: error.message });
}
};

return (
Expand Down

0 comments on commit 6460f26

Please sign in to comment.