From 6eedcd01a6c5d068d972610cc5f0aa5d267aebc0 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 23 May 2017 15:58:25 -0300 Subject: [PATCH 1/6] Ref tab-receive. Fix UI standar alignment --- src/js/controllers/tab-receive.js | 8 +++++--- src/js/directives/copyToClipboard.js | 14 +++++++------- src/sass/views/tab-receive.scss | 24 +++++++++++++++++++++--- www/views/tab-receive.html | 18 ++++++++++++++---- 4 files changed, 47 insertions(+), 17 deletions(-) diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js index c51b4133d..4a56d565b 100644 --- a/src/js/controllers/tab-receive.js +++ b/src/js/controllers/tab-receive.js @@ -98,6 +98,8 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi var selectedWallet = checkSelectedWallet($scope.wallet, $scope.wallets); $scope.onWalletSelect(selectedWallet); + $scope.showShareButton = platformInfo.isCordova ? (platformInfo.isIOS ? 'iOS' : 'Android') : null; + listeners = [ $rootScope.$on('bwsEvent', function(e, walletId, type, n) { // Update current address @@ -132,8 +134,8 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi $scope.showWallets = true; }; - $scope.copyToClipboard = function() { - if ($scope.isCordova) return 'bitcoin:' + $scope.addr; - else return $scope.addr; + $scope.shareAddress = function() { + if (!$scope.isCordova) return; + window.plugins.socialsharing.share('bitcoin:' + $scope.addr, null, null, null); } }); diff --git a/src/js/directives/copyToClipboard.js b/src/js/directives/copyToClipboard.js index a06b2743d..5de40f23e 100644 --- a/src/js/directives/copyToClipboard.js +++ b/src/js/directives/copyToClipboard.js @@ -21,18 +21,18 @@ angular.module('copayApp.directives') if (!data) return; if (isCordova) { - window.plugins.socialsharing.share(data, null, null, null); + cordova.plugins.clipboard.copy(data); } else if (isNW) { nodeWebkitService.writeToClipboard(data); - scope.$apply(function() { - ionicToast.show(msg, 'bottom', false, 1000); - }); } else if (clipboard.supported) { clipboard.copyText(data); - scope.$apply(function() { - ionicToast.show(msg, 'bottom', false, 1000); - }); + } else { + // No supported + return; } + scope.$apply(function() { + ionicToast.show(msg, 'bottom', false, 1000); + }); }); } } diff --git a/src/sass/views/tab-receive.scss b/src/sass/views/tab-receive.scss index f573744ee..4757e3cc2 100644 --- a/src/sass/views/tab-receive.scss +++ b/src/sass/views/tab-receive.scss @@ -1,5 +1,26 @@ #tab-receive { @extend .deflash-blue; + .button-share { + color: #fff; + box-shadow: none; + border-color: transparent; + background: transparent; + padding: 0 10px; + .icon:before { + font-size: 26px; + } + } + .button-request { + margin-top: 15px; + background: transparent; + border: none; + font-size: 12px; + color: $v-text-accent-color; + i.icon { + vertical-align: middle; + padding-left: 5px; + } + } .address { background: #fff; overflow: auto; @@ -21,9 +42,6 @@ margin-top: 5%; font-size: 13px; } - .request-button { - padding-top: 20px; - } } .incomplete { .title { diff --git a/www/views/tab-receive.html b/www/views/tab-receive.html index 3612ec51c..3da92d152 100644 --- a/www/views/tab-receive.html +++ b/www/views/tab-receive.html @@ -1,6 +1,15 @@ {{'Receive' | translate}} + + +
@@ -19,7 +28,7 @@
-
+
-
- -
+
From e98ce470f7695bdbb38ae239cf76fef0c001a710 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 24 May 2017 09:44:04 -0300 Subject: [PATCH 2/6] Fix UI from copayers view. Fix redirect to home --- src/js/controllers/copayers.js | 23 +++++++++++----- src/sass/variables.scss | 1 + src/sass/views/copayers.scss | 48 +++++++++++++++++++++++++--------- www/views/copayers.html | 19 +++++++------- 4 files changed, 64 insertions(+), 27 deletions(-) diff --git a/src/js/controllers/copayers.js b/src/js/controllers/copayers.js index bbcf069c2..b022b9fe9 100644 --- a/src/js/controllers/copayers.js +++ b/src/js/controllers/copayers.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('copayersController', - function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, appConfigService, lodash, profileService, walletService, popupService, bwcError, platformInfo, gettextCatalog, ongoingProcess) { + function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, appConfigService, lodash, profileService, walletService, popupService, bwcError, platformInfo, gettextCatalog, ongoingProcess, pushNotificationsService) { var appName = appConfigService.userVisibleName; var appUrl = appConfigService.url; @@ -10,6 +10,7 @@ angular.module('copayApp.controllers').controller('copayersController', $scope.$on("$ionicView.beforeEnter", function(event, data) { $scope.wallet = profileService.getWallet(data.stateParams.walletId); updateWallet(); + $scope.shareIcon = platformInfo.isIOS ? 'iOS' : 'Android'; }); var listener = $rootScope.$on('bwsEvent', function() { @@ -35,7 +36,12 @@ angular.module('copayApp.controllers').controller('copayersController', if (status.wallet.status == 'complete') { $scope.wallet.openWallet(function(err, status) { if (err) $log.error(err); - $scope.goHome(); + $scope.clearNextView(); + $state.go('tabs.home').then(function() { + $state.transitionTo('tabs.wallet', { + walletId: $scope.wallet.credentials.walletId + }); + }); }); } }); @@ -56,7 +62,9 @@ angular.module('copayApp.controllers').controller('copayersController', if (err) { popupService.showAlert(gettextCatalog.getString('Error'), err.message || err); } else { - $scope.goHome(); + pushNotificationsService.unsubscribe($scope.wallet); + $scope.clearNextView(); + $state.go('tabs.home'); } }); }; @@ -81,9 +89,12 @@ angular.module('copayApp.controllers').controller('copayersController', } }; - $scope.goHome = function() { - $state.go('tabs.home'); - $ionicHistory.clearHistory(); + $scope.clearNextView = function() { + $ionicHistory.nextViewOptions({ + disableAnimate: true, + historyRoot: true + }); + $ionicHistory.clearHistory(); }; }); diff --git a/src/sass/variables.scss b/src/sass/variables.scss index d91baa647..5481aace9 100644 --- a/src/sass/variables.scss +++ b/src/sass/variables.scss @@ -24,6 +24,7 @@ $v-text-accent-color: #647ce8 !default; $v-success-color: #13e5b6 !default; $v-warning-color: #ffa500 !default; +$v-error-color: #ef473a !default; $v-wallet-color-map: ( 0: (color: #dd4b39, name: 'Cinnabar'), diff --git a/src/sass/views/copayers.scss b/src/sass/views/copayers.scss index 2f3458a4e..6dabb8758 100644 --- a/src/sass/views/copayers.scss +++ b/src/sass/views/copayers.scss @@ -1,13 +1,37 @@ -.copayers-secret { - text-align: center; - font-size: 12px; - margin: 10px; - white-space: -moz-pre-wrap !important; - white-space: -pre-wrap; - white-space: -o-pre-wrap; - white-space: pre-wrap; - word-wrap: break-word; - white-space: -webkit-pre-wrap; - word-break: break-all; - white-space: normal; +#copayers-invitation { + @extend .deflash-blue; + .button-share { + color: #fff; + box-shadow: none; + border-color: transparent; + background: transparent; + padding: 0 10px; + .icon:before { + font-size: 26px; + } + } + .button-cancel { + margin-top: 15px; + background: transparent; + border: none; + font-size: 12px; + color: $v-error-color; + i.icon { + vertical-align: middle; + padding-left: 5px; + } + } + .copayers-secret { + text-align: center; + font-size: 12px; + margin: 10px; + white-space: -moz-pre-wrap !important; + white-space: -pre-wrap; + white-space: -o-pre-wrap; + white-space: pre-wrap; + word-wrap: break-word; + white-space: -webkit-pre-wrap; + word-break: break-all; + white-space: normal; + } } diff --git a/www/views/copayers.html b/www/views/copayers.html index a3b4ff52c..c575d0e0b 100644 --- a/www/views/copayers.html +++ b/www/views/copayers.html @@ -1,19 +1,23 @@ - + {{wallet.name}} -
-
+
Share this invitation with your copayers
@@ -29,11 +33,8 @@ {{secret || ('Loading...'|translate)}}
-
From c21ff0c0776a5fa8ab4ce77171ae6f2decfba37f Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 24 May 2017 12:42:22 -0300 Subject: [PATCH 3/6] Fix event for newCopayers --- src/js/controllers/copayers.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/js/controllers/copayers.js b/src/js/controllers/copayers.js index b022b9fe9..4e74a3862 100644 --- a/src/js/controllers/copayers.js +++ b/src/js/controllers/copayers.js @@ -3,6 +3,7 @@ angular.module('copayApp.controllers').controller('copayersController', function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, appConfigService, lodash, profileService, walletService, popupService, bwcError, platformInfo, gettextCatalog, ongoingProcess, pushNotificationsService) { + var listener; var appName = appConfigService.userVisibleName; var appUrl = appConfigService.url; @@ -11,13 +12,14 @@ angular.module('copayApp.controllers').controller('copayersController', $scope.wallet = profileService.getWallet(data.stateParams.walletId); updateWallet(); $scope.shareIcon = platformInfo.isIOS ? 'iOS' : 'Android'; - }); + + listener = $rootScope.$on('bwsEvent', function(e, walletId, type, n) { + if ($scope.wallet && walletId == $scope.wallet.id && type == ('NewCopayer' || 'WalletComplete')) + updateWalletDebounced(); + }); + }); - var listener = $rootScope.$on('bwsEvent', function() { - updateWallet(); - }); - - $scope.$on('$destroy', function() { + $scope.$on("$ionicView.leave", function(event, data) { listener(); }); @@ -47,6 +49,8 @@ angular.module('copayApp.controllers').controller('copayersController', }); }; + var updateWalletDebounced = lodash.debounce(updateWallet, 5000, true); + $scope.showDeletePopup = function() { var title = gettextCatalog.getString('Confirm'); var msg = gettextCatalog.getString('Are you sure you want to cancel and delete this wallet?'); @@ -90,6 +94,7 @@ angular.module('copayApp.controllers').controller('copayersController', }; $scope.clearNextView = function() { + listener(); // remove listener $ionicHistory.nextViewOptions({ disableAnimate: true, historyRoot: true From 1c006988534506e1fd066ff929946085cf408d67 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 24 May 2017 12:51:58 -0300 Subject: [PATCH 4/6] Adds generate new address button --- src/sass/views/tab-receive.scss | 7 +++++++ www/views/tab-receive.html | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/sass/views/tab-receive.scss b/src/sass/views/tab-receive.scss index 4757e3cc2..de9cab61c 100644 --- a/src/sass/views/tab-receive.scss +++ b/src/sass/views/tab-receive.scss @@ -21,6 +21,13 @@ padding-left: 5px; } } + .button-address { + margin-top: 5px; + background: transparent; + border: none; + font-size: 12px; + color: $v-text-accent-color; + } .address { background: #fff; overflow: auto; diff --git a/www/views/tab-receive.html b/www/views/tab-receive.html index 3da92d152..fb335c420 100644 --- a/www/views/tab-receive.html +++ b/www/views/tab-receive.html @@ -40,10 +40,17 @@ - +
+ +
+
+ +
From aae4b41619f256f9f880269eb2f5325775f6d58d Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 24 May 2017 14:30:52 -0300 Subject: [PATCH 5/6] Fix margin --- src/sass/views/tab-receive.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sass/views/tab-receive.scss b/src/sass/views/tab-receive.scss index de9cab61c..c013ef4f5 100644 --- a/src/sass/views/tab-receive.scss +++ b/src/sass/views/tab-receive.scss @@ -11,7 +11,7 @@ } } .button-request { - margin-top: 15px; + margin-top: 10px; background: transparent; border: none; font-size: 12px; @@ -22,7 +22,7 @@ } } .button-address { - margin-top: 5px; + margin-top: 10px; background: transparent; border: none; font-size: 12px; From acbfb87f457f49c98795f1d554c746de057d8901 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 24 May 2017 16:24:52 -0300 Subject: [PATCH 6/6] Share a custom amount --- src/js/controllers/customAmount.js | 10 +++++++++- src/sass/views/custom-amount.scss | 15 +++++++++++++++ www/views/customAmount.html | 15 ++++++++++++--- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/js/controllers/customAmount.js b/src/js/controllers/customAmount.js index b3040977e..9a2b46f6c 100644 --- a/src/js/controllers/customAmount.js +++ b/src/js/controllers/customAmount.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('customAmountController', function($rootScope, $scope, $stateParams, $ionicHistory, txFormatService, platformInfo, configService, profileService, walletService, popupService) { +angular.module('copayApp.controllers').controller('customAmountController', function($scope, $ionicHistory, txFormatService, platformInfo, configService, profileService, walletService, popupService) { var showErrorAndBack = function(title, msg) { popupService.showAlert(title, msg, function() { @@ -15,6 +15,8 @@ angular.module('copayApp.controllers').controller('customAmountController', func showErrorAndBack('Error', 'No wallet selected'); return; } + + $scope.showShareButton = platformInfo.isCordova ? (platformInfo.isIOS ? 'iOS' : 'Android') : null; $scope.wallet = profileService.getWallet(walletId); @@ -57,6 +59,12 @@ angular.module('copayApp.controllers').controller('customAmountController', func $ionicHistory.goBack(-2); }; + $scope.shareAddress = function() { + if (!platformInfo.isCordova) return; + var data = 'bitcoin:' + $scope.address + '?amount=' + $scope.amountBtc; + window.plugins.socialsharing.share(data, null, null, null); + } + $scope.copyToClipboard = function() { return 'bitcoin:' + $scope.address + '?amount=' + $scope.amountBtc; }; diff --git a/src/sass/views/custom-amount.scss b/src/sass/views/custom-amount.scss index 245734a09..3576e56a0 100644 --- a/src/sass/views/custom-amount.scss +++ b/src/sass/views/custom-amount.scss @@ -3,6 +3,16 @@ $item-lateral-padding: 20px; $item-vertical-padding: 10px; $item-label-color: #6C6C6E; + .button-share { + color: #fff; + box-shadow: none; + border-color: transparent; + background: transparent; + padding: 0 10px; + .icon:before { + font-size: 26px; + } + } .address { background: #fff; overflow: auto; @@ -39,6 +49,11 @@ padding-right: $item-lateral-padding; } + .item-note { + width: 75%; + text-align: right; + } + .label { font-size: 14px; color: $item-label-color; diff --git a/www/views/customAmount.html b/www/views/customAmount.html index 3aead822c..902671d63 100644 --- a/www/views/customAmount.html +++ b/www/views/customAmount.html @@ -1,11 +1,20 @@ + + + {{'Custom Amount' | translate}} - @@ -15,7 +24,7 @@
-
+
Address {{address}}