diff --git a/www/js/controllers/app-controllers.js b/www/js/controllers/app-controllers.js index af866782f08eddabc857d0dbf322d13c86e524ef..52b45f23a8fbccff9e57ea4f72617525d4c205fd 100644 --- a/www/js/controllers/app-controllers.js +++ b/www/js/controllers/app-controllers.js @@ -504,7 +504,7 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $ var skip = $scope.fullscreen || !UIUtils.screen.isSmall() || !Device.isWeb(); if (skip) return; - return UIUtils.alert.confirm('CONFIRM.FULLSCREEN', null, { + return UIUtils.alert.confirm('CONFIRM.FULLSCREEN', undefined, { cancelText: 'COMMON.BTN_NO', okText: 'COMMON.BTN_YES' }) diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js index 7db0244dad3a2586540f93715ecaa251f265e09a..d81d7edb133c738534636a6922387ddb1b201064 100644 --- a/www/js/services/utils-services.js +++ b/www/js/services/utils-services.js @@ -70,12 +70,12 @@ angular.module('cesium.utils.services', ['angular-fullscreen-toggle']) function alertInfo(message, subtitle) { return $q(function(resolve) { - $translate([message, subtitle, 'INFO.POPUP_TITLE', 'COMMON.BTN_OK']) + $translate([message, 'INFO.POPUP_TITLE', 'COMMON.BTN_OK'].concat(subtitle ? [subtitle] : [])) .then(function (translations) { $ionicPopup.show({ template: '<p>' + translations[message] + '</p>', title: translations['INFO.POPUP_TITLE'], - subTitle: translations[subtitle], + subTitle: subtitle && translations[subtitle] ||Â undefined, buttons: [ { text: translations['COMMON.BTN_OK'], diff --git a/www/plugins/es/js/controllers/like-controllers.js b/www/plugins/es/js/controllers/like-controllers.js index 439f9a80fb3d18e71ea2a0d96473207a1ca062c1..c801c125843717e8b1f7cb42bdd8ade290cf632d 100644 --- a/www/plugins/es/js/controllers/like-controllers.js +++ b/www/plugins/es/js/controllers/like-controllers.js @@ -112,6 +112,15 @@ function ESLikesController($scope, $q, $timeout, $translate, $ionicPopup, UIUtil $scope.initLikes(); if (!$scope.likeData.id) throw new Error("Missing 'likeData.id' in scope. Cannot apply toggle"); + // Make sure tobe auth before continue + if (!csWallet.isLogin()) { + return csWallet.auth({minData: true}) + .then(function(){ + UIUtils.loading.hide(); + return $scope.reportAbuse(event, options); // loop + }); + } + options = options ||Â {}; options.kind = options.kind && options.kind.toUpperCase() || 'LIKE'; var key = options.kind.toLowerCase() + 's'; @@ -124,14 +133,19 @@ function ESLikesController($scope, $q, $timeout, $translate, $ionicPopup, UIUtil return $q.reject(); } - // Select the wallet, if many if (!options.pubkey) { - return (csWallet.children.count() ? Modals.showSelectWallet({displayBalance: false}) : $q.when(csWallet)) - .then(function(wallet) { - if (!wallet) throw 'CANCELLED'; - options.pubkey = wallet.data.pubkey; - return $scope.toggleLike(event, options); // Loop - }); + if (csWallet.children.count() === 0) { + options.pubkey = csWallet.data.pubkey + } + // Select the wallet, if many + else { + return Modals.showSelectWallet({displayBalance: false}) + .then(function (wallet) { + if (!wallet) throw 'CANCELLED'; + options.pubkey = wallet.data.pubkey; + return $scope.reportAbuse(event, options); // Loop + }); + } } var wallet = csWallet.getByPubkey(options.pubkey); @@ -225,19 +239,34 @@ function ESLikesController($scope, $q, $timeout, $translate, $ionicPopup, UIUtil }; $scope.reportAbuse = function(event, options) { + + // Make sure tobe auth before continue + if (!csWallet.isLogin()) { + return csWallet.auth({minData: true}) + .then(function(){ + UIUtils.loading.hide(); + return $scope.reportAbuse(event, options); // loop + }); + } + if (!$scope.likeData || !$scope.likeData.abuses || $scope.likeData.abuses.wasHitCount) return; // skip if ($scope.likeData.abuses.wasHitCount) return; // already report options = options ||Â {}; - // Select the wallet, if many if (!options.pubkey) { - return (csWallet.children.count() ? Modals.showSelectWallet({displayBalance: false}) : $q.when(csWallet)) - .then(function(wallet) { - if (!wallet) throw 'CANCELLED'; - options.pubkey = wallet.data.pubkey; - return $scope.reportAbuse(event, options); // Loop - }); + if (csWallet.children.count() === 0) { + options.pubkey = csWallet.data.pubkey + } + // Select the wallet, if many + else { + return Modals.showSelectWallet({displayBalance: false}) + .then(function (wallet) { + if (!wallet) throw 'CANCELLED'; + options.pubkey = wallet.data.pubkey; + return $scope.reportAbuse(event, options); // Loop + }); + } } var wallet = csWallet.getByPubkey(options.pubkey);