Skip to content

Commit e3e7bb7

Browse files
authored
feat(myaccount): saved data now uses phone storage instead of preferences (#174)
1 parent 510b596 commit e3e7bb7

File tree

10 files changed

+398
-131
lines changed

10 files changed

+398
-131
lines changed

src/js/compare-landmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class compareLandmark {
133133
*/
134134
#generateGeoJson() {
135135
let id = -1;
136-
if (this.compareLandmarkId !== null && this.compareLandmarkId >= 0) {
136+
if (this.compareLandmarkId !== null && (this.compareLandmarkId >= 0 || typeof this.compareLandmarkId === "string")) {
137137
id = this.compareLandmarkId;
138138
}
139139
return {

src/js/compare-poi/compare-poi.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class ComparePoi {
128128
setData(comparePoi) {
129129
this.dom.advancedBtn.classList.add("d-none");
130130
this.comparePoiId = -1;
131-
if (comparePoi.id !== null && comparePoi.id >= 0) {
131+
if (comparePoi.id !== null && (comparePoi.id >= 0 || typeof comparePoi.id === "string")) {
132132
this.comparePoiId = comparePoi.id;
133133
}
134134
this.compareConfig = {
@@ -207,6 +207,7 @@ class ComparePoi {
207207
const comparePoi = this.map.queryRenderedFeatures(e.point, {layers: layers})[0];
208208
comparePoi.properties.opacity = 0.6;
209209
comparePoi.properties.radiusRatio = 0;
210+
comparePoi.id = comparePoi.properties.id;
210211
const source = this.map.getSource("selected-compare-poi");
211212
source.setData({
212213
"type": "FeatureCollection",

src/js/index.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { SafeAreaController } from "@aashu-dubey/capacitor-statusbar-safe-area";
2727
import { TextZoom } from "@capacitor/text-zoom";
2828
import { Device } from "@capacitor/device";
2929
import { App } from "@capacitor/app";
30-
import { Preferences } from "@capacitor/preferences";
3130
import { Toast } from "@capacitor/toast";
3231

3332
import { Protocol } from "pmtiles";
@@ -46,35 +45,6 @@ defineCustomElements(window);
4645
* Fonction définissant l'application
4746
*/
4847
function app() {
49-
// REMOVEME : rétrocompatibilité des itinéraires / PR / PR comparer : migration du localStorage vers Preferences
50-
if (localStorage.getItem("savedRoutes")) {
51-
Preferences.set({
52-
key: "savedRoutes",
53-
value: localStorage.getItem("savedRoutes"),
54-
}).then( () => {
55-
localStorage.removeItem("savedRoutes");
56-
});
57-
}
58-
59-
if (localStorage.getItem("savedLandmarks")) {
60-
Preferences.set({
61-
key: "savedLandmarks",
62-
value: localStorage.getItem("savedLandmarks"),
63-
}).then( () => {
64-
localStorage.removeItem("savedLandmarks");
65-
});
66-
}
67-
68-
if (localStorage.getItem("savedCompareLandmarks")) {
69-
Preferences.set({
70-
key: "savedCompareLandmarks",
71-
value: localStorage.getItem("savedCompareLandmarks"),
72-
}).then( () => {
73-
localStorage.removeItem("savedCompareLandmarks");
74-
});
75-
}
76-
// END REMOVEME
77-
7848
// Ajout du protocole PM Tiles
7949
let protocol = new Protocol();
8050
maplibregl.addProtocol("pmtiles", protocol.tile);

src/js/landmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class Landmark {
130130
*/
131131
#generateGeoJson() {
132132
let id = -1;
133-
if (this.landmarkId !== null && this.landmarkId >= 0) {
133+
if (this.landmarkId !== null && (this.landmarkId >= 0 || typeof this.landmarkId === "string")) {
134134
id = this.landmarkId;
135135
}
136136
return {

0 commit comments

Comments
 (0)