From efa36915e1e9d9c34cd5636bbd95431e8db9cdac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Fri, 13 May 2016 15:05:43 -0300 Subject: [PATCH] tap to lock balance --- public/views/walletHome.html | 10 ++++++++-- src/js/controllers/index.js | 14 ++++++++++++++ src/js/services/storageService.js | 8 ++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index 021edbb5e..0643f38b5 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -85,7 +85,7 @@
Tap to retry -
+
{{index.totalBalanceStr}}
@@ -98,6 +98,12 @@
+
+ [Balance Hidden] +
+ Tap and hold to show +
+
@@ -396,7 +402,7 @@

- + Send Max diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 31db70abb..81269de57 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -69,6 +69,18 @@ angular.module('copayApp.controllers').controller('indexController', function($r go.walletHome(); }; + self.hideBalance = function() { + storageService.getHideBalanceFlag(self.walletId, function(err, shouldHideBalance) { + if (err) self.shouldHideBalance = false; + else self.shouldHideBalance = (shouldHideBalance == 'true') ? true : false; + }); + } + + self.onHold = function(){ + self.shouldHideBalance = !self.shouldHideBalance; + storageService.setHideBalanceFlag(self.walletId, self.shouldHideBalance, function() {}); + } + self.setOngoingProcess = function(processName, isOn) { $log.debug('onGoingProcess', processName, isOn); self[processName] = isOn; @@ -153,6 +165,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.initGlidera(); self.initCoinbase(); + self.hideBalance(); + self.setCustomBWSFlag(); if (!self.isComplete) { diff --git a/src/js/services/storageService.js b/src/js/services/storageService.js index d80a0f78d..faf7e14e9 100644 --- a/src/js/services/storageService.js +++ b/src/js/services/storageService.js @@ -200,6 +200,14 @@ angular.module('copayApp.services') storage.remove('config', cb); }; + root.setHideBalanceFlag = function(walletId, val, cb) { + storage.set('hideBalance-' + walletId, val, cb); + }; + + root.getHideBalanceFlag = function(walletId, cb) { + storage.get('hideBalance-' + walletId, cb); + }; + //for compatibility root.getCopayDisclaimerFlag = function(cb) { storage.get('agreeDisclaimer', cb);