diff --git a/www/js/app.js b/www/js/app.js index f15edef444de4a372a63af8221d4331925f06e14..4a59bf3594fe7eafa9ab5338f850d6ef7ad066dc 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -18,23 +18,26 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngAnimate', }) .filter('formatDecimal', function() { - return function(input) { - if (input === undefined) return '0'; - //if (input === Infinity || input === -Infinity) { - // return '∞'; - //} - if (Math.abs(input) < 0.0001) return '~ 0'; - return numeral(input-0.00005).format('0,0.0000').replace(',', ' '); - }; - }) + return function(input) { + if (input === undefined) return '0'; + //if (input === Infinity || input === -Infinity) { + // return '∞'; + //} + if (Math.abs(input) < 0.0001) return '~ 0'; + return numeral(input-0.00005).format('0,0.0000').replace(',', ' '); + }; + }) .filter('formatNumeral', function() { - return function(input, pattern) { - if (input === undefined) return '0'; - if (Math.abs(input) < 0.0001) return '~ 0'; - return numeral(input).format(pattern).replace(',', ' '); - }; - }) + return function(input, pattern) { + if (input === undefined) return '0'; + //if (isNaN(input)) { + // return 'NaN'; + //} + if (Math.abs(input) < 0.0001) return '~ 0'; + return numeral(input).format(pattern).replace(',', ' '); + }; + }) .filter('formatDate', function() { return function(input) { @@ -140,7 +143,8 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngAnimate', .config(function($ionicNativeTransitionsProvider){ 'ngInject'; // Use native transition - var enableNativeTransitions = ionic.Platform.isAndroid() || ionic.Platform.isIOS(); + var enableNativeTransitions = (ionic.Platform.isAndroid() || ionic.Platform.isIOS()) && + ionic.Platform.grade.toLowerCase()=='a'; $ionicNativeTransitionsProvider.enable(enableNativeTransitions); }) // endRemoveIf(no-device) @@ -230,7 +234,8 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngAnimate', }; }) -.run(function($rootScope, amMoment, $translate, Device) { +.run(function($rootScope, amMoment, $translate, Device, UIUtils, $ionicConfig +) { 'ngInject'; // We use 'Device.ready()' instead of '$ionicPlatform.ready()', because it could be call many times @@ -255,6 +260,13 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngAnimate', // org.apache.cordova.statusbar required StatusBar.styleDefault(); } + + // Ionic Platform Grade is not A, disabling views transitions + if (ionic.Platform.grade.toLowerCase()!='a') { + console.log('Disable visual effects because plateform grade is not [a] but [' + ionic.Platform.grade + ']'); + $ionicConfig.views.transition('none'); + UIUtils.disableEffects(); + } }); $rootScope.onLanguageChange = function() { diff --git a/www/js/controllers/currency-controllers.js b/www/js/controllers/currency-controllers.js index 84496d6901de60569e569f3c9a38fa72c91aee0c..f0a9aafe1768287a763df6f6dbad18ae341483d1 100644 --- a/www/js/controllers/currency-controllers.js +++ b/www/js/controllers/currency-controllers.js @@ -95,13 +95,7 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i PeersController.call(this, $scope, $rootScope, BMA, UIUtils, $q, $interval, $timeout); - $scope.search = { - text: '', - results: {}, - options: { - listInset: true - } - }; + $scope.search = {}; $scope.formData = { useRelative: Wallet.data.settings.useRelative }; @@ -109,6 +103,18 @@ function CurrencyViewController($scope, $rootScope, $state, BMA, $q, UIUtils, $i $scope.node = null; $scope.loading = true; + $scope.currency = ''; + $scope.M = 0; + $scope.MoverN = 0; + $scope.UD = 0; + $scope.cactual = 0; + $scope.c = 0; + $scope.dt = 0; + $scope.sigQty = 0; + $scope.time = 0; + $scope.difficulty = 0; + $scope.Nprev = 0; + $scope.$on('$ionicView.enter', function(e, $state) { $scope.closeNode(); diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index fd003ee9b4e38aa2d2704364f9b510cb8a037728..3b5756a3269908fc9bd5537af1fccf1e270f43d7 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -90,9 +90,7 @@ function WalletController($scope, $rootScope, $state, $q, $ionicPopup, $ionicAct $scope.refreshConvertedBalance(); // Set Motion $timeout(function() { - UIUtils.motion.fadeSlideInRight({ - startVelocity: 3000 - }); + UIUtils.motion.fadeSlideInRight(); // Set Ink UIUtils.ink({selector: '.item'}); }, 10); @@ -121,7 +119,6 @@ function WalletController($scope, $rootScope, $state, $q, $ionicPopup, $ionicAct // Set Motion $timeout(function() { UIUtils.motion.fadeSlideInRight({ - startVelocity: 3000, selector: '.item-pending' }); // Set Ink @@ -353,9 +350,7 @@ function WalletTxErrorController($scope, $rootScope, $ionicPopup, $timeout, UIUt $scope.walletData = wallet; // Set Motion $timeout(function() { - UIUtils.motion.fadeSlideInRight({ - startVelocity: 3000 - }); + UIUtils.motion.fadeSlideInRight(); // Set Ink UIUtils.ink({selector: '.item'}); }, 10); diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index 47157e658ad755f82449fe94fa8dd979a7b14055..411c57f892472a0843db9327730519bb13906b61 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -161,11 +161,8 @@ function WotIdentityViewController($scope, $state, BMA, Wallet, UIUtils, $q, $ti $scope.loaded = true; $timeout(function() { - UIUtils.motion.fadeSlideInRight({ - selector: '.animate-fade-slide-in .item', - startVelocity: 3000 - }); - }, 100); + UIUtils.motion.fadeSlideInRight(); + }, 10); UIUtils.ink(); }; BMA.wot.lookup({ search: pub }) @@ -285,10 +282,7 @@ function WotCertificationsViewController($scope, $state, BMA, Wallet, UIUtils, $ $scope.loaded = true; // Set Motion $timeout(function() { - UIUtils.motion.fadeSlideInRight({ - selector: '.animate-fade-slide-in-right .item', - startVelocity: 3000 - }); + UIUtils.motion.fadeSlideInRight(); }, 10); if ($scope.canCertify) { $scope.showFab('fab-certify'); diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js index 6390c5d6dafd40051d07c74a298e5bfddcfeecd6..5e8824583ad34fe2d12563418403dd545ade3424 100644 --- a/www/js/services/utils-services.js +++ b/www/js/services/utils-services.js @@ -167,51 +167,81 @@ angular.module('cesium.utils.services', ['ngResource']) } function resizeImageFromFile(file) { - return $q(function(resolve, reject) { + return $q(function(resolve, reject) { - var reader = new FileReader(); + var reader = new FileReader(); - reader.onload = function(event){ - var img = document.createElement("img"); + reader.onload = function(event){ + var img = document.createElement("img"); - img.onload = function(event) { - var width = event.target.width; - var height = event.target.height; + img.onload = function(event) { + var width = event.target.width; + var height = event.target.height; - if (width > height) { - if (width > CONST.MAX_WIDTH) { - height *= CONST.MAX_WIDTH / width; - width = CONST.MAX_WIDTH; - } - } else { - if (height > CONST.MAX_HEIGHT) { - width *= CONST.MAX_HEIGHT / height; - height = CONST.MAX_HEIGHT; - } + if (width > height) { + if (width > CONST.MAX_WIDTH) { + height *= CONST.MAX_WIDTH / width; + width = CONST.MAX_WIDTH; } - var canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - var ctx = canvas.getContext("2d"); - ctx.drawImage(event.target, 0, 0, canvas.width, canvas.height); - - var dataurl = canvas.toDataURL(); + } else { + if (height > CONST.MAX_HEIGHT) { + width *= CONST.MAX_HEIGHT / height; + height = CONST.MAX_HEIGHT; + } + } + var canvas = document.createElement("canvas"); + canvas.width = width; + canvas.height = height; + var ctx = canvas.getContext("2d"); + ctx.drawImage(event.target, 0, 0, canvas.width, canvas.height); - resolve(dataurl); - }; + var dataurl = canvas.toDataURL(); - img.src = event.target.result; + resolve(dataurl); }; - if (file) { - reader.readAsDataURL(file); + img.src = event.target.result; + }; + + if (file) { + reader.readAsDataURL(file); + } + else { + //reject("Not a file"); + } + }); + } + + function disableEffects() { + this.ink = function(){}; + + function disableMotion(baseSelector) { + return function(options) { + if (!options || !options.selector) { + options = { + selector: (baseSelector + ' .item') + }; } - else { - //reject("Not a file"); + var parentsInDom = document.querySelectorAll(baseSelector); + for (var i = 0; i < parentsInDom.length; i++) { + var parent = parentsInDom[i]; + parent.className = parent.className.replace(/\banimate-[a-z- ]+\b/,''); } - }); + + var itemsInDom = document.querySelectorAll(options.selector); + for (var j = 0; j < itemsInDom.length; j++) { + var child = itemsInDom[j]; + child.style.webkitTransitionDelay = "0s"; + child.style.transitionDelay = "0s"; + child.className += ' in done'; + } + }; } + this.motion.fadeSlideIn= disableMotion('.animate-fade-slide-in'); + this.motion.fadeSlideInRight = disableMotion('.animate-fade-slide-in-right'); + } + return { alert: { error: alertError, @@ -228,6 +258,7 @@ angular.module('cesium.utils.services', ['ngResource']) onError: onError, ink: ionicMaterialInk.displayEffect, motion: ionicMaterialMotion, + disableEffects: disableEffects, selection: { select: selectElementText, get: getSelectionText diff --git a/www/templates/wot/view_identity.html b/www/templates/wot/view_identity.html index 87b1911e1d0f68a3a37275ce19774bf3d3b3cb4b..ecb57b4299c03b330e8358e8d98bcea561d32462 100644 --- a/www/templates/wot/view_identity.html +++ b/www/templates/wot/view_identity.html @@ -30,7 +30,7 @@ <div class="col col-20 hidden-xs hidden-sm"> </div> - <div class="col list animate-fade-slide-in"> + <div class="col list animate-fade-slide-in-right"> <!-- Certifications count --> <a class="item item-icon-left item-text-wrap item-icon-right ink" ng-if="hasSelf"