From 9982bef8df9f4f15bac32487260478f31242d239 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 10 Aug 2016 12:08:39 -0300 Subject: [PATCH 1/2] Fix UI calculator. Set default status bar color if no wallet selected --- public/views/walletHome.html | 2 -- src/js/controllers/amazon.js | 6 +++++- src/js/controllers/coinbase.js | 4 ++++ src/js/controllers/glidera.js | 6 +++++- src/js/controllers/modals/inputAmount.js | 2 +- src/js/controllers/preferencesGlobal.js | 4 ++++ src/js/controllers/walletHome.js | 10 ++++++++++ src/js/routes.js | 18 ++++++++++++++---- src/sass/main.scss | 12 ++++++++++++ 9 files changed, 55 insertions(+), 9 deletions(-) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index 1ba4ba392..b76a8a8dd 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -425,7 +425,6 @@ readonly="true" ng-show="!showAlternative" id="amount" - ng-disabled="home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount in'|translate}} {{home.unitName}}" ng-model="_amount" @@ -439,7 +438,6 @@ readonly="true" ng-show="showAlternative" id="alternative" - ng-disabled="!home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount in'|translate}} {{ home.alternativeName }}" ng-model="_alternative" diff --git a/src/js/controllers/amazon.js b/src/js/controllers/amazon.js index 8c8271223..bf908a702 100644 --- a/src/js/controllers/amazon.js +++ b/src/js/controllers/amazon.js @@ -1,7 +1,11 @@ 'use strict'; angular.module('copayApp.controllers').controller('amazonController', - function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService) { + function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo) { + + if (platformInfo.isCordova && StatusBar.isVisible) { + StatusBar.backgroundColorByHexString("#4B6178"); + } this.init = function() { var self = this; diff --git a/src/js/controllers/coinbase.js b/src/js/controllers/coinbase.js index dc1c094c7..76b93c9c7 100644 --- a/src/js/controllers/coinbase.js +++ b/src/js/controllers/coinbase.js @@ -5,6 +5,10 @@ angular.module('copayApp.controllers').controller('coinbaseController', var isNW = platformInfo.isNW; + if (platformInfo.isCordova && StatusBar.isVisible) { + StatusBar.backgroundColorByHexString("#4B6178"); + } + this.openAuthenticateWindow = function() { var oauthUrl = this.getAuthenticateUrl(); if (!isNW) { diff --git a/src/js/controllers/glidera.js b/src/js/controllers/glidera.js index e21b20e57..f72a6c5f6 100644 --- a/src/js/controllers/glidera.js +++ b/src/js/controllers/glidera.js @@ -1,7 +1,11 @@ 'use strict'; angular.module('copayApp.controllers').controller('glideraController', - function($rootScope, $scope, $timeout, $ionicModal, profileService, configService, storageService, glideraService, lodash, ongoingProcess) { + function($rootScope, $scope, $timeout, $ionicModal, profileService, configService, storageService, glideraService, lodash, ongoingProcess, platformInfo) { + + if (platformInfo.isCordova && StatusBar.isVisible) { + StatusBar.backgroundColorByHexString("#4B6178"); + } this.getAuthenticateUrl = function() { return glideraService.getOauthCodeUrl(); diff --git a/src/js/controllers/modals/inputAmount.js b/src/js/controllers/modals/inputAmount.js index ceafa36b0..e85b71399 100644 --- a/src/js/controllers/modals/inputAmount.js +++ b/src/js/controllers/modals/inputAmount.js @@ -19,7 +19,7 @@ angular.module('copayApp.controllers').controller('inputAmountController', funct satToUnit = 1 / unitToSatoshi; satToBtc = 1 / 100000000; unitDecimals = config.unitDecimals; - $scope.resetAmount(); + processAmount($scope.amount); $timeout(function() { $ionicScrollDelegate.resize(); }, 100); diff --git a/src/js/controllers/preferencesGlobal.js b/src/js/controllers/preferencesGlobal.js index 194494a11..4fee4d878 100644 --- a/src/js/controllers/preferencesGlobal.js +++ b/src/js/controllers/preferencesGlobal.js @@ -5,6 +5,10 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController', var isCordova = platformInfo.isCordova; + if (isCordova && StatusBar.isVisible) { + StatusBar.backgroundColorByHexString("#4B6178"); + } + $scope.init = function() { var config = configService.getSync(); $scope.unitName = config.wallet.settings.unitName; diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 2a315605b..3c01f6bf1 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -106,6 +106,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi $rootScope.shouldHideMenuBar = false; }); + if (platformInfo.isCordova && StatusBar.isVisible) { + var fc = profileService.focusedClient; + StatusBar.backgroundColorByHexString(fc.backgroundColor); + } + this.onQrCodeScanned = function(data) { if (data) go.send(); $rootScope.$emit('dataScanned', data); @@ -586,6 +591,11 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi var fc = profileService.focusedClient; $scope.color = fc.backgroundColor; $scope.showAlternativeAmount = $scope.showAlternative || null; + if ($scope.showAlternativeAmount) { + $scope.amount = $scope.sendForm.alternative.$viewValue || null; + } else { + $scope.amount = $scope.sendForm.amount.$viewValue || null; + } $scope.self = self; $scope.addr = addr; diff --git a/src/js/routes.js b/src/js/routes.js index 61db44513..0d3879998 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -311,8 +311,13 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr needProfile: true, views: { 'main': { - templateUrl: 'views/buyAndSell.html' - }, + templateUrl: 'views/buyAndSell.html', + controller: function(platformInfo) { + if (platformInfo.isCordova && StatusBar.isVisible) { + StatusBar.backgroundColorByHexString("#4B6178"); + } + } + } } }) .state('amazon', { @@ -523,8 +528,13 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr needProfile: true, views: { 'main': { - templateUrl: 'views/add.html' - }, + templateUrl: 'views/add.html', + controller: function(platformInfo) { + if (platformInfo.isCordova && StatusBar.isVisible) { + StatusBar.backgroundColorByHexString("#4B6178"); + } + } + } } }); }) diff --git a/src/sass/main.scss b/src/sass/main.scss index 4549c7a04..c64c17736 100644 --- a/src/sass/main.scss +++ b/src/sass/main.scss @@ -2128,6 +2128,10 @@ body.modal-open { } } +/* + * Calculator + */ + .calculator .header-calc { position: absolute; width: 100%; @@ -2162,6 +2166,14 @@ body.modal-open { background-color: #f8f8f8; } +// No looks likes locked +input[type="number"] { + &[readonly] { + background-color: #F6F7F9; + padding-left: 0; + } +} + @media all and (max-height: 480px) { .calculator .button-calc .columns { padding: 10px; } .calculator .header-calc { top: 11%; } From 23596b749f18ecdb9ae9a514ff86c3521dfb6a7a Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 10 Aug 2016 12:14:35 -0300 Subject: [PATCH 2/2] Statusbar: If do not have any wallet --- src/js/controllers/walletHome.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 3c01f6bf1..1035acebd 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -106,9 +106,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi $rootScope.shouldHideMenuBar = false; }); - if (platformInfo.isCordova && StatusBar.isVisible) { - var fc = profileService.focusedClient; - StatusBar.backgroundColorByHexString(fc.backgroundColor); + if (isCordova && StatusBar.isVisible) { + var backgroundColor = profileService.focusedClient ? profileService.focusedClient.backgroundColor : "#4B6178"; + StatusBar.backgroundColorByHexString(backgroundColor); } this.onQrCodeScanned = function(data) {