diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index 4199a556c7b5cbfe20daba1dcb3159853a366039..25483f774b03c0390b99633fc6b589af1e15c7b7 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -453,6 +453,7 @@ "FIELD_ACCENT": "Commas and accent characters not allowed", "FIELD_NOT_NUMBER": "Value is not a number", "FIELD_NOT_INT": "Value is not an integer", + "FIELD_NOT_EMAIL": "Email adress not valid", "PASSWORD_NOT_CONFIRMED": "Must match previous password.", "SALT_NOT_CONFIRMED": "Must match previous identifier.", "SEND_IDENTITY_FAILED": "Error while trying to register.", diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index 398d6e101177d84acf8568703536961b60aa4c71..3b8c961a01c267c6fc232f7867c69494f99e7cc0 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -453,6 +453,7 @@ "FIELD_ACCENT": "Commas and accent characters not allowed", "FIELD_NOT_NUMBER": "Value is not a number", "FIELD_NOT_INT": "Value is not an integer", + "FIELD_NOT_EMAIL": "Email adress not valid", "PASSWORD_NOT_CONFIRMED": "Must match previous password.", "SALT_NOT_CONFIRMED": "Must match previous identifier.", "SEND_IDENTITY_FAILED": "Error while trying to register.", diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index d9cbe8d456e3a4528898b48c8b7e15c5d7124040..2ea90ed839205ed58575069c7656662e40eec858 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -72,6 +72,10 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, } }); } + else { + // update view (to refresh profile and subscriptions) + $scope.updateView(); + } }); $scope.updateView = function() { diff --git a/www/plugins/es/i18n/locale-en-GB.json b/www/plugins/es/i18n/locale-en-GB.json index 26ef99db3e928ccfc681b64cab9a68947bcea05f..ccfa81a25e535773944c7dbb3000120c9920afef 100644 --- a/www/plugins/es/i18n/locale-en-GB.json +++ b/www/plugins/es/i18n/locale-en-GB.json @@ -373,8 +373,14 @@ "EMAIL": "Receive email notifications" } }, + "CONFIRM": { + "DELETE_SUBSCRIPTION": "Are you sur you want to <b>delete this subscription</b>?" + }, "ERROR": { - "LOAD_SUBSCRIPTIONS_FAILED": "Error loading online services" + "LOAD_SUBSCRIPTIONS_FAILED": "Error while loading online services", + "ADD_SUBSCRIPTION_FAILED": "Error while adding subscription", + "UPDATE_SUBSCRIPTION_FAILED": "Error during subscription update", + "DELETE_SUBSCRIPTION_FAILED": "Error while deleting subscription" }, "MODAL_EMAIL": { "TITLE" : "Notification by email", diff --git a/www/plugins/es/i18n/locale-en.json b/www/plugins/es/i18n/locale-en.json index 26ef99db3e928ccfc681b64cab9a68947bcea05f..ccfa81a25e535773944c7dbb3000120c9920afef 100644 --- a/www/plugins/es/i18n/locale-en.json +++ b/www/plugins/es/i18n/locale-en.json @@ -373,8 +373,14 @@ "EMAIL": "Receive email notifications" } }, + "CONFIRM": { + "DELETE_SUBSCRIPTION": "Are you sur you want to <b>delete this subscription</b>?" + }, "ERROR": { - "LOAD_SUBSCRIPTIONS_FAILED": "Error loading online services" + "LOAD_SUBSCRIPTIONS_FAILED": "Error while loading online services", + "ADD_SUBSCRIPTION_FAILED": "Error while adding subscription", + "UPDATE_SUBSCRIPTION_FAILED": "Error during subscription update", + "DELETE_SUBSCRIPTION_FAILED": "Error while deleting subscription" }, "MODAL_EMAIL": { "TITLE" : "Notification by email", diff --git a/www/plugins/es/i18n/locale-fr-FR.json b/www/plugins/es/i18n/locale-fr-FR.json index 1ea7537de9ef90032b8af2ab63d41fb9249fa12c..932951262b4a97edb61415f99c763e8c54afad35 100644 --- a/www/plugins/es/i18n/locale-fr-FR.json +++ b/www/plugins/es/i18n/locale-fr-FR.json @@ -414,10 +414,14 @@ "EMAIL": "Recevoir les notifications par email" } }, + "CONFIRM": { + "DELETE_SUBSCRIPTION": "Etes-vous sûr de vouloir <b>supprimer cet abonnement</b> ?" + }, "ERROR": { "LOAD_SUBSCRIPTIONS_FAILED": "Erreur lors du chargement des services en ligne", "ADD_SUBSCRIPTION_FAILED": "Erreur de l'envoi de l'abonnement", - "UPDATE_SUBSCRIPTION_FAILED": "Erreur de la mise à jour de l'abonnement" + "UPDATE_SUBSCRIPTION_FAILED": "Erreur de la mise à jour de l'abonnement", + "DELETE_SUBSCRIPTION_FAILED": "Erreur lors de la suppression de l'abonnement" }, "MODAL_EMAIL": { "TITLE" : "Notification par email", diff --git a/www/plugins/es/js/controllers/subscription-controllers.js b/www/plugins/es/js/controllers/subscription-controllers.js index 72a93fe7e68220817536add2f8ff731500609c5e..f4bb17faca3d0d982f61ec4c521f237862b9897c 100644 --- a/www/plugins/es/js/controllers/subscription-controllers.js +++ b/www/plugins/es/js/controllers/subscription-controllers.js @@ -77,7 +77,7 @@ function ViewSubscriptionsController($scope, $rootScope, $q, csWot, UIUtils, Mod .catch(function(err){ UIUtils.loading.hide(10); if (err && err.ucode == 404) { - $scope.updateView({}); + $scope.updateView([]); $scope.existing = false; } else { @@ -122,7 +122,7 @@ function ViewSubscriptionsController($scope, $rootScope, $q, csWot, UIUtils, Mod UIUtils.loading.hide(); $scope.updateView(); }) - .catch(UIUtils.onError('SUBSCRIPTION.ERROR.FAILED_ADD_SUBSCRIPTION')); + .catch(UIUtils.onError('SUBSCRIPTION.ERROR.ADD_SUBSCRIPTION_FAILED')); }); }; @@ -153,15 +153,29 @@ function ViewSubscriptionsController($scope, $rootScope, $q, csWot, UIUtils, Mod UIUtils.loading.hide(); $scope.updateView(); }) - .catch(UIUtils.onError('SUBSCRIPTION.ERROR.FAILED_ADD_SUBSCRIPTION')); + .catch(UIUtils.onError('SUBSCRIPTION.ERROR.UPDATE_SUBSCRIPTION_FAILED')); }); }; - $scope.deleteSubscription = function(record) { + $scope.deleteSubscription = function(record, confirm) { if (!record || !record.id) return; - esSubscription.record.remove(record.id); - $scope.removeFromUI(record); + if (!confirm) { + return UIUtils.alert.confirm('SUBSCRIPTION.CONFIRM.DELETE_SUBSCRIPTION') + .then(function(confirm) { + if (confirm) return $scope.deleteSubscription(record, confirm); + }); + } + + UIUtils.loading.show(); + esSubscription.record.remove(record.id) + .then(function() { + $rootScope.walletData.subscriptions = $rootScope.walletData.subscriptions || {count: 1}; + $rootScope.walletData.subscriptions.count--; + $scope.removeFromUI(record); + UIUtils.loading.hide(); + }) + .catch(UIUtils.onError('SUBSCRIPTION.ERROR.DELETE_SUBSCRIPTION_FAILED')); }; $scope.removeFromUI = function(record) {