diff --git a/scss/ionic.app.scss b/scss/ionic.app.scss index fba9deb1811e3566aa054eb53a91ac5bdead6aa5..0f87ffadf1912322302ede774f374c8771db26af 100644 --- a/scss/ionic.app.scss +++ b/scss/ionic.app.scss @@ -491,7 +491,7 @@ $screen-menu: $screen-sm; } .bar-header { - background-color: $positive-900-bg; + background-color: $positive; color: #fff; height: 150px; padding-right: 0 !important; @@ -938,13 +938,20 @@ html, body { display: inline-block !important; vertical-align: bottom; } +.loader { + zoom: unset; + top: 49px; + width: 100%; +} + +.loader .logo, #home .logo { margin-top: 15px; width: 100%; background-position: center center; background-repeat: no-repeat; } - +.loader .center, #home .center { float: none; text-align: center; @@ -955,7 +962,8 @@ html, body { display: inline-block; } -@media screen and (max-width: $screen-xs-max) { +@media screen and (max-width: $screen-xxs-max) { + .loader .logo, #home .logo { height: 96px; background-image: url('../img/logo_96px.png'); @@ -966,7 +974,9 @@ html, body { } } -@media screen and (min-width: $screen-sm) and (max-width: $screen-sm-max) { + +@media screen and (min-width: $screen-xs) and (max-width: $screen-sm-max) { + .loader .logo, #home .logo { height: 144px; background-image: url('../img/logo_144px.png'); @@ -979,6 +989,7 @@ html, body { } @media screen and (min-width: $screen-md) { + .loader .logo, #home .logo { height: 200px; background-image: url('../img/logo_200px.png'); @@ -991,16 +1002,23 @@ html, body { } } +.circle-bg-dark { + background-image: url('../../resources/logo/svg/white/logo.large.empty.transparent.svg'); + background-repeat: no-repeat; + background-position: -725px -145px; + background-size: 1024px 1024px; +} -@media screen and (min-width: $screen-md) { - +@media screen and (max-width: $screen-sm-max) { .circle-bg-dark { - background-image: url('../../resources/logo/svg/white/logo.large.empty.transparent.svg'); - background-repeat: no-repeat; - background-position: -725px -145px; - background-size: 1024px 1024px; + background-blend-mode: soft-light; } +} +@media screen and (min-width: $screen-md) { + .circle-bg-dark { + background-blend-mode: hard-light; + } } .gray { diff --git a/www/js/controllers/transfer-controllers.js b/www/js/controllers/transfer-controllers.js index 746e245ae844a0c654e7db8effe4d444f3ab607d..03d370e771c66b843269ccaf04e9f52df19e01f0 100644 --- a/www/js/controllers/transfer-controllers.js +++ b/www/js/controllers/transfer-controllers.js @@ -129,8 +129,9 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc $scope.destPub = parameters.pubkey; } if (parameters.amount) { - var amount = parseInt(parameters.amount); // Parse as integer - see issue #1001) - $scope.formData.amount = !isNaN(amount) ? amount : null; + var amount = Number(parameters.amount) + // Trunc at 2 decimals + $scope.formData.amount = !isNaN(amount) ? Math.trunc(parseFloat(parameters.amount) * 100) / 100 : null; $scope.formData.useRelative=false; } else if (parameters.udAmount) { @@ -139,8 +140,13 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc $scope.formData.useRelative=true; } if (parameters.comment) { - $scope.formData.useComment=true; - $scope.formData.comment = parameters.comment; + var cleanComment = parameters.comment.trim() + .replaceAll(new RegExp(BMA.constants.regexp.INVALID_COMMENT_CHARS, 'g'), ' ') + .replaceAll(/\s+/g, ' '); + if (cleanComment.length > 0) { + $scope.formData.useComment = true; + $scope.formData.comment = cleanComment; + } } if (parameters.restPub || parameters.all) { $scope.restUid = ''; @@ -158,6 +164,7 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc $scope.formData.walletId = parameters.wallet; } }; + // Read default parameters $scope.setParameters(parameters); @@ -166,7 +173,7 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc wallet = $scope.enableSelectWallet && ($scope.formData.walletId ? csWallet.children.get($scope.formData.walletId) : csWallet) || csWallet; if (!wallet.isDefault()) { - console.debug("[transfer] Using wallet {" + wallet.id + "}"); + console.debug("[transfer] Using wallet {{0}}".format(wallet.id)); } // Make to sure to load full wallet data (balance) return wallet.login({sources: true, silent: true}) @@ -325,7 +332,7 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc amount = amount.toFixed(2) * 100; // remove 2 decimals on quantitative mode } - // convert comment: trim, then null if empty + // Trim comment to null var comment = $scope.formData.comment && $scope.formData.comment.trim(); if (comment && !comment.length) { comment = null; diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index ce2ee21ff7fdb1d54ff0347450deb11a3050d857..6336b6df7878adf2a9dc3aa600475a8561a73fad 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -43,7 +43,7 @@ angular.module('cesium.wot.controllers', ['cesium.services']) }) .state('app.wot_identity', { - url: "/wot/:pubkey/:uid?action&block&amount&comment", + url: "/wot/:pubkey/:uid?action&block&amount&comment&udAmount&restPub&wallet", views: { 'menuContent': { templateUrl: "templates/wot/view_identity.html", @@ -1110,18 +1110,22 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, $s $scope.$on('$ionicView.enter', function(e, state) { - var onLoadSuccess = function() { - $scope.doMotion(); + var doAction = function() { if (state.stateParams && state.stateParams.action) { $timeout(function() { $scope.doAction(state.stateParams.action.trim(), state.stateParams); }, 100); + } - $scope.removeActionParamInLocationHref(state); + $scope.removeActionParamInLocationHref(state); + } + var onLoadSuccess = function() { + $scope.doMotion(); - // Need by like controller - $scope.likeData.id = $scope.formData.pubkey; - } + doAction(); + + // Need by like controller + $scope.likeData.id = $scope.formData.pubkey; $scope.showQRCode(); }; @@ -1133,12 +1137,17 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, $s if (state.stateParams && state.stateParams.pubkey && state.stateParams.pubkey.trim().length > 0) { - if ($scope.loading) { // load once + // First time: load identity data + if ($scope.loading) { return $scope.load(state.stateParams.pubkey.trim(), state.stateParams.uid, options) .then(onLoadSuccess) .catch(UIUtils.onError("ERROR.LOAD_IDENTITY_FAILED")); } + // Do action + else { + doAction(); + } } else if (state.stateParams && @@ -1148,6 +1157,9 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, $s return $scope.load(null, state.stateParams.uid, options) .then(onLoadSuccess); } + else { + doAction(); + } } // Redirect to home @@ -1310,7 +1322,7 @@ function WotIdentityTxViewController($scope, $timeout, $q, BMA, csSettings, csWo }) .catch(function(err) { // If http rest limitation: wait then retry - if (err.ucode == BMA.errorCodes.HTTP_LIMITATION) { + if (err.ucode === BMA.errorCodes.HTTP_LIMITATION) { $timeout(function() { return $scope.showMoreTx(fromTime); }, 2000); diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index a09fc57b42e0ff9976c2a2ecb6613f63d6e69d87..bf2936cbc117f5bc241b7b247536bd8098b68120 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -38,7 +38,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. PUBKEY: pubkey, PUBKEY_WITH_CHECKSUM: "(" + pubkey +"):([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{3})", COMMENT: "[ a-zA-Z0-9-_:/;*\\[\\]()?!^\\+=@&~#{}|\\\\<>%.]*", - INVALID_COMMENT_CHARS: "[^ a-zA-Z0-9-_:/;*\\[\\]()?!^\\+=@&~#{}|\\\\<>%.]*", + INVALID_COMMENT_CHARS: "[^ a-zA-Z0-9-_:/;*\\[\\]()?!^\\+=@&~#{}|\\\\<>%.]+", // duniter://[uid]:[pubkey]@[host]:[port] URI_WITH_AT: "duniter://(?:([A-Za-z0-9_-]+):)?("+pubkey+"@([a-zA-Z0-9-.]+.[ a-zA-Z0-9-_:/;*?!^\\+=@&~#|<>%.]+)", URI_WITH_PATH: "duniter://([a-zA-Z0-9-.]+.[a-zA-Z0-9-_:.]+)/("+pubkey+")(?:/([A-Za-z0-9_-]+))?", @@ -580,6 +580,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. regexp: { USER_ID: exact(regexp.USER_ID), COMMENT: exact(regexp.COMMENT), + INVALID_COMMENT_CHARS: test(regexp.INVALID_COMMENT_CHARS), PUBKEY: exact(regexp.PUBKEY), PUBKEY_WITH_CHECKSUM: exact(regexp.PUBKEY_WITH_CHECKSUM), CURRENCY: exact(regexp.CURRENCY), diff --git a/www/js/services/http-services.js b/www/js/services/http-services.js index a3ff1ea6f63ddedf8b870bf8761f22b4bbfc756d..e6505a934a8043688255e2e1944810ae77ee0f23 100644 --- a/www/js/services/http-services.js +++ b/www/js/services/http-services.js @@ -402,7 +402,12 @@ angular.module('cesium.http.services', ['cesium.cache.services']) if (searchParam.indexOf('=') !== -1) { var key = searchParam.substring(0, searchParam.indexOf('=')); var value = searchParam.substring(searchParam.indexOf('=') + 1); - res[key] = value; + try { + res[key] = decodeURIComponent(value); + } catch (e) { + // Ignore any invalid uri component. + res[key] = value; + } } else { res[searchParam] = true; // default value