diff --git a/.github/workflows/web-deploy.yml b/.github/workflows/web-deploy.yml index 2502d5b3..5667d557 100644 --- a/.github/workflows/web-deploy.yml +++ b/.github/workflows/web-deploy.yml @@ -13,4 +13,4 @@ jobs: - name: Send curl to trigger build run: | curl -X POST --fail -F token=${{ secrets.CI_token }} -F "ref=main" -F "variables[RUN_NIGHTLY_BUILD]=true" https://gitlab.gpf-tech.ign.fr/api/v4/projects/1292/trigger/pipeline - + \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 2d16b62a..67e6040a 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "fr.ign.geoportail" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 30002 - versionName "3.0.2" + versionCode 30003 + versionName "3.0.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index d1e75dc4..81a67af0 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -346,11 +346,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3.0.2; + CURRENT_PROJECT_VERSION = 3.0.3; INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 3.0.2; + MARKETING_VERSION = 3.0.3; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = fr.ign.geoportail; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -366,11 +366,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3.0.2; + CURRENT_PROJECT_VERSION = 3.0.3; INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 3.0.2; + MARKETING_VERSION = 3.0.3; PRODUCT_BUNDLE_IDENTIFIER = fr.ign.geoportail; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; diff --git a/package-lock.json b/package-lock.json index 375c4649..33b22732 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "geoportail-app", - "version": "3.0.2", + "version": "3.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "geoportail-app", - "version": "3.0.2", + "version": "3.0.3", "license": "GPLv3", "dependencies": { "@aashu-dubey/capacitor-statusbar-safe-area": "^3.0.0", diff --git a/package.json b/package.json index 454cb594..76c14485 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "geoportail-app", "displayName": "Géoportail", - "version": "3.0.2", + "version": "3.0.3", "description": "Application Géoportail", "main": "index.js", "engines": { diff --git a/src/css/position.css b/src/css/position.css index 8c6a8753..5eb2d93e 100644 --- a/src/css/position.css +++ b/src/css/position.css @@ -183,6 +183,7 @@ */ #interactivityPopup, +#editoPopup, #onlinePopup, #locationPopup, #routeDrawHelpPopup { @@ -191,15 +192,17 @@ font-family: "Open Sans"; font-size: 13px; } + #interactivityPopup .divPositionTitle, +#editoPopup .divPositionTitle, #onlinePopup .divPositionTitle, #locationPopup .divPositionTitle, #routeDrawHelpPopup .divPositionTitle { margin-right: 30px; } - .interactivityPopup, +.editoPopup, .onlinePopup, .locationPopup, .routeDrawHelpPopup { @@ -218,6 +221,7 @@ } .routeDrawHelpPopup>.maplibregl-popup-content, +.editoPopup>.maplibregl-popup-content, .interactivityPopup>.maplibregl-popup-content, .onlinePopup>.maplibregl-popup-content, .locationPopup>.maplibregl-popup-content { @@ -227,6 +231,7 @@ } .routeDrawHelpPopup>.maplibregl-popup-tip, +.editoPopup>.maplibregl-popup-tip, .onlinePopup>.maplibregl-popup-tip, .interactivityPopup>.maplibregl-popup-tip, .locationPopup>.maplibregl-popup-tip { diff --git a/src/js/index.js b/src/js/index.js index 1110181b..255c8f3c 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -17,7 +17,7 @@ import Controls from "./controls"; import RecentSearch from "./search-recent"; import MenuNavigation from "./nav"; import InteractivityIndicator from "./map-interactivity/interactivity-indicator"; -import PopupUtils from "./utils/popup-utils"; +import StatusPopups from "./status-popups"; import { Capacitor } from "@capacitor/core"; import { ScreenOrientation } from "@capacitor/screen-orientation"; @@ -25,7 +25,6 @@ import { SplashScreen } from "@capacitor/splash-screen"; import { StatusBar, Style } from "@capacitor/status-bar"; import { SafeArea, SafeAreaController } from "@aashu-dubey/capacitor-statusbar-safe-area"; import { TextZoom } from "@capacitor/text-zoom"; -import { Network } from "@capacitor/network"; import { Device } from "@capacitor/device"; // import CSS @@ -219,19 +218,8 @@ function app() { map.setCenter([localStorage.getItem("lastMapLng"), localStorage.getItem("lastMapLat")]); map.setZoom(localStorage.getItem("lastMapZoom") || map.getZoom()); map.once("moveend", () => { - Network.getStatus().then((status) => { - if (!status.connected) { - PopupUtils.showOnlinePopup(` -
-
Vous êtes hors ligne
-
-
- La plupart des fonctionnalités de l'application sont indisponibles. Vous pouvez consulter les cartes et données déjà chargées, ainsi que les données enregistrées, et visualiser votre position sur la carte. -
-
- `, map); - } - }); + StatusPopups.getNetworkPopup(map); + StatusPopups.getEditoPopup(map); }); } @@ -256,21 +244,15 @@ function app() { if (!Globals.mapLoaded) { map.flyTo(map.getCenter()); map.once("moveend", () => { - Network.getStatus().then((status) => { - if (!status.connected) { - PopupUtils.showOnlinePopup(` -
-
Vous êtes hors ligne
-
-
- La plupart des fonctionnalités de l'application sont indisponibles. Vous pouvez consulter les cartes et données déjà chargées, ainsi que les données enregistrées, et visualiser votre position sur la carte. -
-
- `, map); - } - }); + StatusPopups.getNetworkPopup(map); }); } + setTimeout(() => { + if (!Globals.mapLoaded) { + SplashScreen.hide(); + StatusPopups.getEditoPopup(map); + } + }, 2000); }, 4000); } diff --git a/src/js/status-popups.js b/src/js/status-popups.js new file mode 100644 index 00000000..d4a65a41 --- /dev/null +++ b/src/js/status-popups.js @@ -0,0 +1,79 @@ +/** + * Copyright (c) Institut national de l'information géographique et forestière + * + * This program and the accompanying materials are made available under the terms of the GPL License, Version 3.0. + */ + +import { Network } from "@capacitor/network"; + +import PopupUtils from "./utils/popup-utils"; + +function getNetworkPopup(map) { + Network.getStatus().then((status) => { + if (!status.connected) { + PopupUtils.showOnlinePopup(` +
+
Vous êtes hors ligne
+
+
+ La plupart des fonctionnalités de l'application sont indisponibles. Vous pouvez consulter les cartes et données déjà chargées, ainsi que les données enregistrées, et visualiser votre position sur la carte. +
+
+ `, map); + } + }); +} + +function getEditoPopup (map) { + fetch("https://ignf.github.io/cartes-ign-services-uptime/edito.json?v=0").then(res => res.json()).then( (res) => { + if ( + localStorage.getItem("lastEditoPopupId") !== null && localStorage.getItem("lastEditoPopupId") === `${res.id}` + && localStorage.getItem("dontShowEditoAgain") === "true" + && !res.force + ) { + return; + } + if (res.message === "") { + return; + } + let dontShowCheckBox = ""; + if (!res.force) { + window.onChkEditoChange = (event) => { + if (event.target.checked) { + localStorage.setItem("dontShowEditoAgain", "true"); + } else { + localStorage.setItem("dontShowEditoAgain", "false"); + } + }; + dontShowCheckBox = ` +

+ `; + + } + PopupUtils.showEditoPopup(` +
+
+ ${res.message} + ${dontShowCheckBox} +
+ ` + , map); + localStorage.setItem("lastEditoPopupId", res.id); + }).catch((err) => { + console.warn("Could not load edito message"); + console.warn(err); + }); +} + +export default { + getNetworkPopup, + getEditoPopup, +}; diff --git a/src/js/utils/popup-utils.js b/src/js/utils/popup-utils.js index ef6bcab7..96e2cdf2 100644 --- a/src/js/utils/popup-utils.js +++ b/src/js/utils/popup-utils.js @@ -42,6 +42,36 @@ function showOnlinePopup(content, map) { document.body.appendChild(popupEl); } +function showEditoPopup(content, map) { + let editoPopup; + window.onCloseeditoPopup = () => { + editoPopup.remove(); + }; + + // centre de la carte + var center = map.getCenter(); + // position de la popup + var popupOffsets = { + "bottom": [0, 100], + }; + // ouverture d'une popup + editoPopup = new MapLibreGL.Popup({ + offset: popupOffsets, + className: "editoPopup", + closeOnClick: true, + closeOnMove: true, + closeButton: false + }) + .setLngLat(center) + .setHTML(content) + .setMaxWidth("300px") + .addTo(map); + // HACK: déplacement de la popup à la racine du body pour qu'elle puisse d'afficher au dessus de tout + var popupEl = document.querySelectorAll(".editoPopup")[0]; + document.body.appendChild(popupEl); +} + export default { showOnlinePopup, + showEditoPopup, };