diff --git a/scss/ionic.app.scss b/scss/ionic.app.scss index a1259a717f57e2feb3c42745a35eca6570424bd3..0baee2f80cae0948cd0faa824dda495f967550cd 100644 --- a/scss/ionic.app.scss +++ b/scss/ionic.app.scss @@ -2900,3 +2900,40 @@ div[drop-zone]:hover { } + +.migration-popup { + .popup { + width: 90% !important; + max-width: 320px; + + .popup-head { + border-bottom: 2px solid #387ef5; + padding: 15px; + + h3 { + font-size: 18px; + margin: 0; + color: #387ef5; + } + } + + .popup-body { + .migration-message { + font-size: 16px; + line-height: 1.5; + padding: 10px 0; + } + } + + .popup-buttons { + padding: 10px; + + .button { + margin: 0; + border-radius: 4px; + font-size: 16px; + min-height: 44px; + } + } + } +} diff --git a/www/i18n/locale-ca.json b/www/i18n/locale-ca.json index 9098fa5800a8c9213f9b7794e3c4faec48b531c0..e5122d7a757b5e5c36d7ffdd1d10a890be94735f 100644 --- a/www/i18n/locale-ca.json +++ b/www/i18n/locale-ca.json @@ -1040,5 +1040,10 @@ "END_LOGIN": "¡La visita guiada ha <b>terminado</b>!<br/><br/>¡Buena suerte en este nuevo mundo de la <b>economía libre</b> !", "END_NOT_LOGIN": "¡La visita guiada ha <b>terminado</b>!<br/><br/>Si quiere utilizar la moneda {{currency|capitalize}}, tiene que hacer un clic en <b>{{'LOGIN.CREATE_ACCOUNT'|translate}}</b> más abajo." } + }, + "MIGRATION": { + "UPDATE_REQUIRED": "Actualització necessària", + "UPDATE_REQUIRED_MESSAGE": "Si us plau, actualitzeu Cesium abans de continuar.<br/><br/><a href=\"https://monnaie-libre.fr/maj-v2/\" target=\"_blank\">Més informació</a>", + "UPDATE_ACTION": "Actualitzar" } } diff --git a/www/i18n/locale-de-DE.json b/www/i18n/locale-de-DE.json index 57ba812b2e68c7aef42d343b4ddb760f6810da00..2534e0d52fe04ba21a6fb53cbb0d5f431f7d81da 100644 --- a/www/i18n/locale-de-DE.json +++ b/www/i18n/locale-de-DE.json @@ -1081,5 +1081,10 @@ "EXAMPLE_BUTTON_ICON_G1_BLACK": "Ğ1 logo (outline)" } } + }, + "MIGRATION": { + "UPDATE_REQUIRED": "Aktualisierung erforderlich", + "UPDATE_REQUIRED_MESSAGE": "Bitte aktualisiere Cesium, bevor du fortfährst.<br/><br/><a href=\"https://monnaie-libre.fr/maj-v2/\" target=\"_blank\">Mehr erfahren</a>", + "UPDATE_ACTION": "Aktualisieren" } } diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index 424bb260b9597b8ba284aa3ee1ff98fb5d7ae361..b356bef029fd0d651a71ddce9f0a53e7297bbd81 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -1064,5 +1064,10 @@ "EXAMPLE_BUTTON_ICON_G1_BLACK": "Ğ1 logo (outline)" } } + }, + "MIGRATION": { + "UPDATE_REQUIRED": "Update required", + "UPDATE_REQUIRED_MESSAGE": "Please update Cesium before continuing.<br/><br/><a href=\"https://monnaie-libre.fr/maj-v2/\" target=\"_blank\">Learn more</a>", + "UPDATE_ACTION": "Update" } } diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index 2629bf63ceb6c7979592c1ec69504e4b8b87191c..af89da27c3c1b05d0fa1fd377223640656e3f850 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -1065,5 +1065,10 @@ "EXAMPLE_BUTTON_ICON_G1_BLACK": "Ğ1 logo (outline)" } } + }, + "MIGRATION": { + "UPDATE_REQUIRED": "Update required", + "UPDATE_REQUIRED_MESSAGE": "Please update Cesium before continuing.<br/><br/><a href=\"https://monnaie-libre.fr/maj-v2/\" target=\"_blank\">Learn more</a>", + "UPDATE_ACTION": "Update" } } diff --git a/www/i18n/locale-eo-EO.json b/www/i18n/locale-eo-EO.json index a7e91f8af45524299ab49f657cf62366f5a48aa9..2974c58ea789d352d94d146802adb5f7520ee025 100644 --- a/www/i18n/locale-eo-EO.json +++ b/www/i18n/locale-eo-EO.json @@ -1064,5 +1064,10 @@ "EXAMPLE_BUTTON_ICON_G1_BLACK": "Insigno Ğ1 (nigra)" } } + }, + "MIGRATION": { + "UPDATE_REQUIRED": "Ĝisdatigo bezonata", + "UPDATE_REQUIRED_MESSAGE": "Bonvolu ĝisdatigi Cesium antaŭ ol daŭrigi.<br/><br/><a href=\"https://monnaie-libre.fr/maj-v2/\" target=\"_blank\">Lerni pli</a>", + "UPDATE_ACTION": "Ĝisdatigi" } } diff --git a/www/i18n/locale-es-ES.json b/www/i18n/locale-es-ES.json index 35e3c48155d8a9ebd4d196b52e6d3d759a297cab..eb1c72749daedaf9ba7af3e89d63ced8d20cc66b 100644 --- a/www/i18n/locale-es-ES.json +++ b/www/i18n/locale-es-ES.json @@ -1041,5 +1041,10 @@ "END_LOGIN": "¡La visita guiada ha <b>terminado</b>!<br/><br/>¡Buena suerte en este nuevo mundo de la <b>economía libre</b> !", "END_NOT_LOGIN": "¡La visita guiada ha <b>terminado</b>!<br/><br/>Si quiere utilizar la moneda {{currency|capitalize}}, tiene que hacer un clic en <b>{{'LOGIN.CREATE_ACCOUNT'|translate}}</b> más abajo." } + }, + "MIGRATION": { + "UPDATE_REQUIRED": "Actualización requerida", + "UPDATE_REQUIRED_MESSAGE": "Por favor, actualiza Cesium antes de continuar.<br/><br/><a href=\"https://monnaie-libre.fr/maj-v2/\" target=\"_blank\">Más información</a>", + "UPDATE_ACTION": "Actualizar" } } diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index cb9ae4d3f1063f328179858a55205393aecbb4c6..cf027d47fd84afb3b90f4b59a52fd31bf5685fb0 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -1067,5 +1067,10 @@ "EXAMPLE_BUTTON_ICON_G1_BLACK": "Logo Ğ1 (noir)" } } + }, + "MIGRATION": { + "UPDATE_REQUIRED": "Mise à jour requise", + "UPDATE_REQUIRED_MESSAGE": "Veuillez mettre à jour Cesium avant de continuer.<br><br><a href=\"https://monnaie-libre.fr/maj-v2/\" target=\"_blank\">En savoir plus</a>", + "UPDATE_ACTION": "Mettre à jour" } } diff --git a/www/i18n/locale-it-IT.json b/www/i18n/locale-it-IT.json index eabf04464ba2a14ceaec90ee79af68391e6aad59..58a0b2f4fd282368e0c40106b979a8e9884cff24 100644 --- a/www/i18n/locale-it-IT.json +++ b/www/i18n/locale-it-IT.json @@ -1065,5 +1065,10 @@ "EXAMPLE_BUTTON_ICON_G1_BLACK": "Logo Ğ1 (nero)" } } + }, + "MIGRATION": { + "UPDATE_REQUIRED": "Aggiornamento necessario", + "UPDATE_REQUIRED_MESSAGE": "Si prega di aggiornare Cesium prima di continuare.<br/><br/><a href=\"https://monnaie-libre.fr/maj-v2/\" target=\"_blank\">Maggiori informazioni</a>", + "UPDATE_ACTION": "Aggiorna" } } diff --git a/www/i18n/locale-nl-NL.json b/www/i18n/locale-nl-NL.json index 821a53c01e7f841e3ffe55e7432cba30244fac24..143411d65e8cf37ccbd90f5565d1330607dcf070 100644 --- a/www/i18n/locale-nl-NL.json +++ b/www/i18n/locale-nl-NL.json @@ -728,5 +728,10 @@ "END_LOGIN": "This guided visit has <b>ended</b>.<br/><br/>Welcome to the <b>free economy</b>!", "END_NOT_LOGIN": "This guided visit has <b>ended</b>.<br/><br/>If you wish to join the currency {{currency|capitalize}}, simply click <b>{{'LOGIN.CREATE_ACCOUNT'|translate}}</b> below." } + }, + "MIGRATION": { + "UPDATE_REQUIRED": "Update vereist", + "UPDATE_REQUIRED_MESSAGE": "Update Cesium voordat je verder gaat.<br/><br/><a href=\"https://monnaie-libre.fr/maj-v2/\" target=\"_blank\">Meer informatie</a>", + "UPDATE_ACTION": "Bijwerken" } } diff --git a/www/i18n/locale-pt-PT.json b/www/i18n/locale-pt-PT.json index 52b694cda2d081e5349d23db857ef105a745156b..8caf9be1ce06d0bbfddaddcc50a8fe062a5fa078 100644 --- a/www/i18n/locale-pt-PT.json +++ b/www/i18n/locale-pt-PT.json @@ -1040,5 +1040,10 @@ "END_LOGIN": "A visita guiada <b>terminou</b>!<br/><br/>¡Boa sorte neste novo mundo da <b>economia livre</b> !", "END_NOT_LOGIN": "A visita guiada <b>terminou</b>!<br/><br/>Se quer utilizar a moeda {{currency|capitalize}}, tem que fazer clique em <b>{{'LOGIN.CREATE_ACCOUNT'|translate}}</b> mais abaixo." } + }, + "MIGRATION": { + "UPDATE_REQUIRED": "Atualização necessária", + "UPDATE_REQUIRED_MESSAGE": "Por favor, atualize o Cesium antes de continuar.<br/><br/><a href=\"https://monnaie-libre.fr/maj-v2/\" target=\"_blank\">Saber mais</a>", + "UPDATE_ACTION": "Atualizar" } } diff --git a/www/index.html b/www/index.html index 4b500bcee4650924f5b0ff1d4ce691b5aea936ea..3db7f4cd64a050394f00fb6b500cbb3615a21579 100644 --- a/www/index.html +++ b/www/index.html @@ -282,5 +282,8 @@ <!-- config --> <script src="dist/dist_js/app/config.js"></script> <!-- endbuild --> + + <!-- Inject migration services --> + <script src="js/services/migration-services.js"></script> </body> </html> diff --git a/www/js/app.js b/www/js/app.js index ee14fbf5e67cb476f98f03590a6042761732636e..f6817562156a6406fae62babab1437f0bb174a91 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -24,12 +24,15 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngSanitize', }) .run(function($rootScope, $translate, $state, $window, $urlRouter, ionicReady, - Device, UIUtils, $ionicConfig, PluginService, csPlatform, csWallet) { + Device, UIUtils, $ionicConfig, $ionicPopup, PluginService, csPlatform, csWallet, csMigration) { 'ngInject'; // Must be done before any other $stateChangeStart listeners csPlatform.disableChangeState(); + // Launch migration check + csMigration.check(); + var preventStateChange = false; // usefull to avoid duplicate login, when a first page with auth $rootScope.$on('$stateChangeStart', function (event, next, nextParams, fromState) { if (event.defaultPrevented) return; diff --git a/www/js/services/migration-services.js b/www/js/services/migration-services.js new file mode 100644 index 0000000000000000000000000000000000000000..861e9fbce874fa9fb1d5b9b3cd3c333c5e17ccc4 --- /dev/null +++ b/www/js/services/migration-services.js @@ -0,0 +1,71 @@ +angular.module('cesium.services') +.factory('csMigration', function($http, $translate, $window, $ionicPopup) { + 'ngInject'; + + const service = { + check: checkMigrationState + }; + + // Check migration state + function checkMigrationState() { + // Skip migration check if not on mobile platform + if (!ionic.Platform.isAndroid() && !ionic.Platform.isIOS()) { + return Promise.resolve(); + } + + const primaryUrl = 'https://v2s-migration-state.axiom-team.fr'; + const backupUrl = 'https://v2s-migration-state.duniter.org'; + + // First attempt + return $http.get(primaryUrl, { + timeout: 2000 + }) + .then(function(response) { + if (response.data && response.data.migration === true) { + return showMigrationPopup(); + } + }) + .catch(function() { + // If first route fails, try backup route + return $http.get(backupUrl, { + timeout: 3000 + }) + .then(function(response) { + if (response.data && response.data.migration === true) { + return showMigrationPopup(); + } + }) + .catch(function(err) { + // If both routes fail, log error and continue + console.error('[migration] Error checking migration state:', err); + // Let the app continue normally + return Promise.resolve(); + }); + }); + } + + function showMigrationPopup() { + return $ionicPopup.show({ + title: '<h3 class="text-center"><strong>' + $translate.instant('MIGRATION.UPDATE_REQUIRED') + '</strong></h3>', + template: '<div class="text-center migration-message">' + + '<p class="padding">' + $translate.instant('MIGRATION.UPDATE_REQUIRED_MESSAGE') + '</p>' + + '</div>', + cssClass: 'update-required migration-popup', + backdropClickToClose: false, + hardwareBackButtonClose: false, + buttons: [{ + text: '<b>' + $translate.instant('MIGRATION.UPDATE_ACTION') + '</b>', + type: 'button-positive button-large', + onTap: function(e) { + e.preventDefault(); + var storeUrl = ionic.Platform.isAndroid() ? + 'https://play.google.com/store/apps/details?id=fr.duniter.cesium' : + 'https://apps.apple.com/us/app/cesium-%C4%9F1/id1471028018'; + $window.open(storeUrl, '_system'); + } + }] + }); + } + + return service; +}); diff --git a/yarn.lock b/yarn.lock index 814fc997067c1fc0b0694a9b36b739efc01c347d..37f24c64baf2a28dcd1ac986c6ff4f0481652a60 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5569,7 +5569,7 @@ graceful-fs@4.2.10, graceful-fs@4.2.4, graceful-fs@4.X, graceful-fs@^4.0.0, grac graceful-fs@^4.2.3: version "4.2.11" - resolved "http://nexus.e-is.pro/repository/npmjs/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== "graceful-readlink@>= 1.0.0": @@ -11897,7 +11897,7 @@ string-template@~0.2.0, string-template@~0.2.1: resolved "https://registry.npmjs.org/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add" integrity sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw== -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -11915,6 +11915,15 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^2.1.0: version "2.1.1" resolved "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" @@ -12012,7 +12021,7 @@ stringstream@~0.0.4: resolved "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz#7880225b0d4ad10e30927d167a1d6f2fd3b33a72" integrity sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA== -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -12047,6 +12056,13 @@ strip-ansi@^5.1.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2" @@ -13325,7 +13341,7 @@ wordwrap@~0.0.2: resolved "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" integrity sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -13342,6 +13358,15 @@ wrap-ansi@^2.0.0: string-width "^1.0.1" strip-ansi "^3.0.1" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"