From de4b614e6fba0162a3a8da4b19d7b444e1f36ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Fri, 7 Jul 2017 17:58:24 -0300 Subject: [PATCH] fix statusbar color when leaving history view --- src/js/controllers/walletDetails.js | 19 ++++++++++++------- src/sass/variables.scss | 4 ++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/js/controllers/walletDetails.js b/src/js/controllers/walletDetails.js index a41c32c2c..13698f0cd 100644 --- a/src/js/controllers/walletDetails.js +++ b/src/js/controllers/walletDetails.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicHistory, profileService, lodash, configService, platformInfo, walletService, txpModalService, externalLinkService, popupService, addressbookService, storageService, $ionicScrollDelegate, $window, bwcError, gettextCatalog, timeService, feeService) { +angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $state, $stateParams, $ionicHistory, profileService, lodash, configService, platformInfo, walletService, txpModalService, externalLinkService, popupService, addressbookService, storageService, $ionicScrollDelegate, $window, bwcError, gettextCatalog, timeService, feeService, appConfigService) { var HISTORY_SHOW_LIMIT = 10; var currentTxHistoryPage = 0; @@ -52,9 +52,9 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun var analyzeUtxos = function() { if (analyzeUtxosDone) return; - feeService.getFeeLevels(function(err, levels){ + feeService.getFeeLevels(function(err, levels) { if (err) return; - walletService.getLowUtxos($scope.wallet, levels, function(err, resp){ + walletService.getLowUtxos($scope.wallet, levels, function(err, resp) { if (err || !resp) return; analyzeUtxosDone = true; $scope.lowUtxosWarning = resp.warning; @@ -171,7 +171,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun }); }; - feeService.getFeeLevels(function(err, levels){ + feeService.getFeeLevels(function(err, levels) { walletService.getTxHistory($scope.wallet, { progressFn: progressFn, feeLevels: levels, @@ -378,9 +378,11 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun refreshAmountSection(); }); - $scope.$on("$ionicView.beforeLeave", function(event, data) { + $scope.$on("$ionicView.afterLeave", function(event, data) { + if ($window.StatusBar) { - $window.StatusBar.backgroundColorByHexString('#1e3186'); + var statusBarColor = appConfigService.name == 'copay' ? '#192c3a' : '#1e3186'; + $window.StatusBar.backgroundColorByHexString(statusBarColor); } }); @@ -392,7 +394,10 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun function setAndroidStatusBarColor() { var SUBTRACT_AMOUNT = 15; - var rgb = hexToRgb($scope.wallet.color); + var walletColor; + if (!$scope.wallet.color) walletColor = appConfigService.name == 'copay' ? '#019477' : '#4a90e2'; + else walletColor = $scope.wallet.color; + var rgb = hexToRgb(walletColor); var keys = Object.keys(rgb); keys.forEach(function(k) { if (rgb[k] - SUBTRACT_AMOUNT < 0) { diff --git a/src/sass/variables.scss b/src/sass/variables.scss index 5481aace9..302dac511 100644 --- a/src/sass/variables.scss +++ b/src/sass/variables.scss @@ -43,8 +43,8 @@ $v-wallet-color-map: ( 13: (color: #7a8c9e, name: 'Light Slate Grey') ) !default; -/* Theme */ -$v-default-wallet-color-index: 6 !default; // See $v-wallet-color-map +/* Theme */ +$v-default-wallet-color-index: 8 !default; // See $v-wallet-color-map $v-subtle-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) !default; $v-hovering-box-shadow: 0px 6px 12px 0px rgba(0, 0, 0, 0.3) !default; $v-subtle-radius: 3px !default;