diff --git a/www/js/controllers/network-controllers.js b/www/js/controllers/network-controllers.js index 56f523449275fcd6b2286cb54fc3715f4748bdd0..afdda2b07f10c574d28f1affca0f816edb453345 100644 --- a/www/js/controllers/network-controllers.js +++ b/www/js/controllers/network-controllers.js @@ -6,8 +6,8 @@ angular.module('cesium.network.controllers', ['cesium.services']) $stateProvider - .state('app.network', { - url: "/network?type", + .state('app.network', { + url: "/network?type&expert", cache: false, views: { 'menuContent': { @@ -65,8 +65,13 @@ function NetworkLookupController($scope, $timeout, $state, $ionicHistory, $ionic if (currency) { $scope.node = !BMA.node.same(currency.peer.host, currency.peer.port) ? BMA.instance(currency.peer.host, currency.peer.port) : BMA; - if (state && state.stateParams && state.stateParams.type) { - $scope.search.type = state.stateParams.type; + if (state && state.stateParams) { + if (state.stateParams.type) { + $scope.search.type = state.stateParams.type; + } + if (state.stateParams.expert) { + $scope.expertMode = state.stateParams.expert; + } } $scope.load(); } diff --git a/www/plugins/es/i18n/locale-en-GB.json b/www/plugins/es/i18n/locale-en-GB.json index f16c0015e462d22c7cf57d16588abcbf27f52ad1..ec1f4eb896d08314d079beb7de1b9face32f9ee9 100644 --- a/www/plugins/es/i18n/locale-en-GB.json +++ b/www/plugins/es/i18n/locale-en-GB.json @@ -109,7 +109,8 @@ "MARK_AS_READ_FAILED": "Unable to mark the message as 'read'.", "LOAD_NOTIFICATIONS_FAILED": "Error while loading messages notifications.", "REMOVE_All_MESSAGES_FAILED": "Error while removing all messages.", - "MARK_ALL_AS_READ_FAILED": "Error while marking messages as read." + "MARK_ALL_AS_READ_FAILED": "Error while marking messages as read.", + "RECIPIENT_IS_MANDATORY": "Recipient is mandatory." } }, "MARKET": { diff --git a/www/plugins/es/i18n/locale-en.json b/www/plugins/es/i18n/locale-en.json index f16c0015e462d22c7cf57d16588abcbf27f52ad1..ec1f4eb896d08314d079beb7de1b9face32f9ee9 100644 --- a/www/plugins/es/i18n/locale-en.json +++ b/www/plugins/es/i18n/locale-en.json @@ -109,7 +109,8 @@ "MARK_AS_READ_FAILED": "Unable to mark the message as 'read'.", "LOAD_NOTIFICATIONS_FAILED": "Error while loading messages notifications.", "REMOVE_All_MESSAGES_FAILED": "Error while removing all messages.", - "MARK_ALL_AS_READ_FAILED": "Error while marking messages as read." + "MARK_ALL_AS_READ_FAILED": "Error while marking messages as read.", + "RECIPIENT_IS_MANDATORY": "Recipient is mandatory." } }, "MARKET": { diff --git a/www/plugins/es/i18n/locale-fr-FR.json b/www/plugins/es/i18n/locale-fr-FR.json index 7f4d9a72bb847ec62d5bd6565e968d5c89e84d56..a7de9b8d1b9365929497c5961d874f60d8660522 100644 --- a/www/plugins/es/i18n/locale-fr-FR.json +++ b/www/plugins/es/i18n/locale-fr-FR.json @@ -109,7 +109,8 @@ "MARK_AS_READ_FAILED": "Impossible de marquer le message comme 'lu'.", "LOAD_NOTIFICATIONS_FAILED": "Erreur lors de la récupération des notifications de messages.", "REMOVE_All_MESSAGES_FAILED": "Erreur lors de la suppression de tous les messages.", - "MARK_ALL_AS_READ_FAILED": "Erreur lors du marquage des message comme lu." + "MARK_ALL_AS_READ_FAILED": "Erreur lors du marquage des message comme lu.", + "RECIPIENT_IS_MANDATORY": "Le destinataire est obligatoire." } }, "MARKET": { diff --git a/www/plugins/es/js/controllers/message-controllers.js b/www/plugins/es/js/controllers/message-controllers.js index f5b7b25070ed50476a9784f8c7b8b3dac4ddcd60..6a48cecbdbcab7b3a573c1c410dfe2a9d652a079 100644 --- a/www/plugins/es/js/controllers/message-controllers.js +++ b/www/plugins/es/js/controllers/message-controllers.js @@ -264,22 +264,23 @@ function ESMessageComposeController($scope, $ionicHistory, Modals, UIUtils, Cry }) .catch(function(err){ if (err === 'CANCELLED') { - $ionicHistory.nextViewOptions({ - historyRoot: true - }); - $state.go('app.home'); + $scope.showHome(); } }); }); $scope.cancel = function() { - $ionicHistory.goBack(); + $scope.showHome(); }; $scope.setForm = function(form) { $scope.form = form; }; + $scope.clodeModal = function() { + $scope.showHome(); + }; + } function ESMessageComposeModalController($scope, Modals, UIUtils, CryptoUtils, csWallet, esHttp, esMessage, parameters) { @@ -296,7 +297,7 @@ function ESMessageComposeModalController($scope, Modals, UIUtils, CryptoUtils, c $scope.doSend = function(forceNoContent) { $scope.form.$submitted=true; - if(!$scope.form.$valid) { + if(!$scope.form.$valid /*|| !$scope.formData.destPub*/) { return; } diff --git a/www/plugins/es/js/services/message-services.js b/www/plugins/es/js/services/message-services.js index 49317da36e6c44f6575d2b929d7377169e8be36f..e5a76e98634fed1d92f188c3a2fd96b2574bde53 100644 --- a/www/plugins/es/js/services/message-services.js +++ b/www/plugins/es/js/services/message-services.js @@ -110,31 +110,31 @@ angular.module('cesium.es.message.services', ['ngResource', 'cesium.services', ' } function sendMessage(message, keypair) { - return $q(function(resolve, reject) { - doSendMessage(message, keypair) - .catch(function(err) { - reject(err); - }) - .then(function(res){ - resolve(res); - - var outbox = (csSettings.data.plugins.es.message && - angular.isDefined(csSettings.data.plugins.es.message.outbox)) ? - csSettings.data.plugins.es.message.outbox : true; - // Send to outbox (in a async way) - if (outbox) { - return doSendMessage(message, keypair, '/message/outbox', 'issuer') - .catch(function(err) { - console.error("Failed to store message to outbox: " + err); - }); - } - }); + return doSendMessage(message, keypair) + .then(function(sendResult){ + var outbox = (csSettings.data.plugins.es.message && + angular.isDefined(csSettings.data.plugins.es.message.outbox)) ? + csSettings.data.plugins.es.message.outbox : true; + + if (!outbox) return sendResult; + + // Send to outbox + return doSendMessage(message, keypair, '/message/outbox', 'issuer') + .catch(function(err) { + console.error("Failed to store message to outbox: " + err); + }) + .then(function() { + return sendResult; + }); }); } function doSendMessage(message, keypair, boxPath, recipientFieldName) { boxPath = boxPath || '/message/inbox'; recipientFieldName = recipientFieldName || 'recipient'; + if (!message[recipientFieldName]) { + return $q.reject({message:'MESSAGE.ERROR.RECIPIENT_IS_MANDATORY'}); + } var boxKeypair = getBoxKeypair(keypair);