From 9118ac457ea5424a1a6b85cc228ae380e518d500 Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Wed, 12 Apr 2017 17:55:58 +0200 Subject: [PATCH] [enh] HTTP request: group response processing on device [enh] HTTP request: force JSOn response (for security reason) [fix] better UI on email subscription --- www/js/app.js | 6 ++++++ www/js/services/http-services.js | 3 ++- .../es/js/controllers/subscription-controllers.js | 2 +- .../es/templates/subscription/modal_email.html | 4 ++-- www/templates/wallet/transfer_form.html | 13 +++++++++---- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/www/js/app.js b/www/js/app.js index 1c85fa22f..27c490db9 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -261,6 +261,7 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht .config(function($httpProvider, csConfig) { 'ngInject'; + // Set default timeout $httpProvider.defaults.timeout = !!csConfig.TIMEOUT ? csConfig.TIMEOUT : 4000 /* default timeout */; @@ -269,6 +270,11 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht //Remove the header used to identify ajax call that would prevent CORS from working delete $httpProvider.defaults.headers.common['X-Requested-With']; + + // removeIf(no-device) + // Group http request response processing (better performance when many request) + $httpProvider.useApplyAsync(true); + // endRemoveIf(no-device) }) .config(function($compileProvider, csConfig) { diff --git a/www/js/services/http-services.js b/www/js/services/http-services.js index 1edcf835b..2332aac78 100644 --- a/www/js/services/http-services.js +++ b/www/js/services/http-services.js @@ -67,7 +67,8 @@ angular.module('cesium.http.services', ['ngResource', 'cesium.cache.services']) return function(params) { return $q(function(resolve, reject) { var config = { - timeout: timeout + timeout: timeout, + responseType: 'json' }; prepare(url, params, config, function(url, config) { diff --git a/www/plugins/es/js/controllers/subscription-controllers.js b/www/plugins/es/js/controllers/subscription-controllers.js index 49a00fc11..72a93fe7e 100644 --- a/www/plugins/es/js/controllers/subscription-controllers.js +++ b/www/plugins/es/js/controllers/subscription-controllers.js @@ -21,7 +21,7 @@ angular.module('cesium.es.subscription.controllers', ['cesium.es.services']) ; -function ViewSubscriptionsController($scope, $rootScope, csWot, UIUtils, ModalUtils, esSubscription) { +function ViewSubscriptionsController($scope, $rootScope, $q, csWot, UIUtils, ModalUtils, esSubscription) { 'ngInject'; $scope.popupData = {}; // need for the node popup diff --git a/www/plugins/es/templates/subscription/modal_email.html b/www/plugins/es/templates/subscription/modal_email.html index b674ac04a..1f942a54f 100644 --- a/www/plugins/es/templates/subscription/modal_email.html +++ b/www/plugins/es/templates/subscription/modal_email.html @@ -64,8 +64,8 @@ ng-click="showNetworkLookup()" style="height: 67px;"> <span class="input-label" translate>SUBSCRIPTION.MODAL_EMAIL.PROVIDER</span> - <span class="badge badge-positive animate-fade-in animate-show-hide ng-hide" ng-show="recipient && (recipient.name||recipient.uid)"> - {{recipient.name||recipient.uid}} + <span class="badge badge-royal animate-fade-in animate-show-hide ng-hide" ng-show="recipient && recipient.uid"> + <i class="ion-person"></i> {{recipient.name||recipient.uid}} </span> <span class="badge badge-secondary animate-fade-in animate-show-hide ng-hide" ng-show="formData.recipient"> <i class="ion-key"></i> {{formData.recipient | formatPubkey}} diff --git a/www/templates/wallet/transfer_form.html b/www/templates/wallet/transfer_form.html index f6f270520..8d000c25c 100644 --- a/www/templates/wallet/transfer_form.html +++ b/www/templates/wallet/transfer_form.html @@ -7,8 +7,13 @@ ng-class="{'item-input-error': form.$submitted && !formData.destPub}" ng-click="showWotLookupModal()"> <span class="gray" translate>TRANSFER.TO</span> - <span class="badge badge-royal">{{destUid}}{{destPub | formatPubkey}}</span> - <i class="gray icon ion-ios-arrow-right"></i> + <span class="badge badge-royal animate-fade-in animate-show-hide ng-hide" ng-show="destUid" > + <i class="ion-person"></i> {{destUid}} + </span> + <span class="badge badge-royal " ng-show="!destUid && formData.destPub"> + <i class="ion-key"></i> {{formData.destPub | formatPubkey}} + </span> + <i class="gray icon ion-ios-arrow-right"></i> </a> <div class="form-errors" ng-if="form.$submitted && !formData.destPub"> @@ -23,10 +28,10 @@ ng-class="{'badge-assertive': (convertedBalance <= 0 || (formData.amount && convertedBalance < formData.amount)), 'badge-balanced': (convertedBalance > 0 && (!formData.amount || convertedBalance >= formData.amount)) }"> <ion-spinner icon="android" ng-if="!$root.walletData.pubkey"></ion-spinner> <span ng-if="$root.walletData.pubkey && !$root.walletData.isMember"> - {{$root.walletData.pubkey| formatPubkey}} + <i class="ion-key"></i> {{$root.walletData.pubkey| formatPubkey}} </span> <span ng-if="$root.walletData.isMember"> - {{$root.walletData.name||$root.walletData.uid}} + <i class="ion-person"></i> {{$root.walletData.name||$root.walletData.uid}} </span> <span ng-bind-html="$root.walletData.balance|formatAmount:{useRelative: formData.useRelative, currency:currency}"></span> </span> -- GitLab