From 68d30fa14362ff788a5aa9623075d4c6faab2d03 Mon Sep 17 00:00:00 2001 From: Javier Date: Thu, 6 Oct 2016 15:50:51 -0300 Subject: [PATCH 01/23] fix spending password require on mobile --- src/js/controllers/preferences.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/preferences.js b/src/js/controllers/preferences.js index 3ab7cf1de..bed1da88f 100644 --- a/src/js/controllers/preferences.js +++ b/src/js/controllers/preferences.js @@ -6,6 +6,11 @@ angular.module('copayApp.controllers').controller('preferencesController', var walletId = wallet.credentials.walletId; $scope.wallet = wallet; + $scope.encryptEnabled = { + value: walletService.isEncrypted(wallet) + }; + + $scope.encryptChange = function() { if (!wallet) return; var val = $scope.encryptEnabled.value; @@ -18,6 +23,9 @@ angular.module('copayApp.controllers').controller('preferencesController', // ToDo show error? $scope.encryptEnabled.value = false; + $timeout(function() { + $scope.$apply(); + }); return; } profileService.updateCredentials(JSON.parse(wallet.export()), function() { @@ -32,6 +40,9 @@ angular.module('copayApp.controllers').controller('preferencesController', // ToDo show error? $scope.encryptEnabled.value = true; + $timeout(function() { + $scope.$apply(); + }); return; } profileService.updateCredentials(JSON.parse(wallet.export()), function() { @@ -64,9 +75,7 @@ angular.module('copayApp.controllers').controller('preferencesController', var config = configService.getSync(); - $scope.encryptEnabled = { - value: walletService.isEncrypted(wallet) - }; + if (wallet.isPrivKeyExternal) $scope.externalSource = wallet.getPrivKeyExternalSourceName() == 'ledger' ? 'Ledger' : 'Trezor'; From 1ab4504824dcc893e28f6becebda5d66b5ff206a Mon Sep 17 00:00:00 2001 From: Javier Date: Fri, 7 Oct 2016 15:39:03 -0300 Subject: [PATCH 02/23] ref password and andvanced options oncreate personal view --- src/js/controllers/create.js | 26 +++++++++++++---- www/views/tab-create-personal.html | 47 ++++++++++++++++++------------ 2 files changed, 49 insertions(+), 24 deletions(-) diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index 6b91db34d..fcfefd653 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -37,9 +37,24 @@ angular.module('copayApp.controllers').controller('createController', }; $scope.showAdvChange = function() { + $scope.showAdv = !$scope.showAdv; + $scope.resizeView(); + }; + + $scope.resizeView = function() { $timeout(function() { $ionicScrollDelegate.resize(); - }, 10); + }); + checkPasswordFields(); + }; + + function checkPasswordFields() { + if (!$scope.encrypt) { + $scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = null; + $timeout(function() { + $scope.$apply(); + }); + } }; function updateRCSelect(n) { @@ -160,7 +175,8 @@ angular.module('copayApp.controllers').controller('createController', function _create(opts) { ongoingProcess.set('creatingWallet', true); $timeout(function() { - + console.log(opts); + return; profileService.createWallet(opts, function(err, client) { ongoingProcess.set('creatingWallet', false); if (err) { @@ -173,11 +189,12 @@ angular.module('copayApp.controllers').controller('createController', $log.debug('Remote preferences saved for:' + client.credentials.walletId) }); - if ($scope.seedSource.id == 'set') { profileService.setBackupFlag(client.credentials.walletId); } + $ionicHistory.removeBackView(); + if (!client.isComplete()) { $ionicHistory.nextViewOptions({ disableAnimate: true @@ -188,8 +205,7 @@ angular.module('copayApp.controllers').controller('createController', walletId: client.credentials.walletId }); }, 100); - } - else $state.go('tabs.home') + } else $state.go('tabs.home'); }); }, 100); } diff --git a/www/views/tab-create-personal.html b/www/views/tab-create-personal.html index 506709f63..81623a180 100644 --- a/www/views/tab-create-personal.html +++ b/www/views/tab-create-personal.html @@ -18,10 +18,12 @@ ng-blur="formFocus(false)"> - +
+ + Show advanced options Hide advanced options -
+
-
-
- WARNING: The password cannot be recovered. Be sure to write it down. The wallet can not be restored without the password. -
-
- - - -
- From 8e5ac09aa4ac684318abaff21826c3c6bd8699f5 Mon Sep 17 00:00:00 2001 From: Javier Date: Fri, 7 Oct 2016 15:54:14 -0300 Subject: [PATCH 03/23] ref password and andvanced options oncreate shared view --- www/views/tab-create-shared.html | 47 +++++++++++++++++++------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/www/views/tab-create-shared.html b/www/views/tab-create-shared.html index 914976dc2..fd3472bb0 100644 --- a/www/views/tab-create-shared.html +++ b/www/views/tab-create-shared.html @@ -48,10 +48,12 @@ - +
+ + Show advanced options Hide advanced options -
+
-
-
- WARNING: The password cannot be recovered. Be sure to write it down. The wallet can not be restored without the password. -
-
- - - -
- From 45c6cd9736b0cdd4d2e69e1a6b801191e7e2ffb9 Mon Sep 17 00:00:00 2001 From: Javier Date: Fri, 7 Oct 2016 16:23:08 -0300 Subject: [PATCH 04/23] ref password and andvanced options on join and export file view --- src/js/controllers/create.js | 2 -- src/js/controllers/export.js | 13 ++++++++- src/js/controllers/join.js | 29 +++++++++++++++---- www/views/join.html | 53 +++++++++++++++++++--------------- www/views/tab-export-file.html | 12 ++++---- 5 files changed, 72 insertions(+), 37 deletions(-) diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index fcfefd653..bad361d93 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -175,8 +175,6 @@ angular.module('copayApp.controllers').controller('createController', function _create(opts) { ongoingProcess.set('creatingWallet', true); $timeout(function() { - console.log(opts); - return; profileService.createWallet(opts, function(err, client) { ongoingProcess.set('creatingWallet', false); if (err) { diff --git a/src/js/controllers/export.js b/src/js/controllers/export.js index 4d7aed6c0..a5a90766b 100644 --- a/src/js/controllers/export.js +++ b/src/js/controllers/export.js @@ -1,9 +1,20 @@ 'use strict'; angular.module('copayApp.controllers').controller('exportController', - function($scope, $timeout, $log, $ionicHistory, backupService, walletService, storageService, profileService, platformInfo, gettextCatalog, $state, $stateParams, popupService) { + function($scope, $timeout, $log, $ionicHistory, $ionicScrollDelegate, backupService, walletService, storageService, profileService, platformInfo, gettextCatalog, $state, $stateParams, popupService) { var wallet = profileService.getWallet($stateParams.walletId); + $scope.showAdvChange = function() { + $scope.showAdv = !$scope.showAdv; + $scope.resizeView(); + }; + + $scope.resizeView = function() { + $timeout(function() { + $ionicScrollDelegate.resize(); + }); + }; + var init = function() { $scope.formData = {}; $scope.isEncrypted = wallet.isPrivKeyEncrypted(); diff --git a/src/js/controllers/join.js b/src/js/controllers/join.js index 83150713a..c358b7fc9 100644 --- a/src/js/controllers/join.js +++ b/src/js/controllers/join.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('joinController', - function($scope, $rootScope, $timeout, $state, $ionicHistory, profileService, configService, storageService, applicationService, gettext, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService) { + function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettext, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService) { var isChromeApp = platformInfo.isChromeApp; var isDevel = platformInfo.isDevel; @@ -12,6 +12,26 @@ angular.module('copayApp.controllers').controller('joinController', $scope.derivationPath = derivationPathHelper.default; $scope.account = 1; + $scope.showAdvChange = function() { + $scope.showAdv = !$scope.showAdv; + $scope.resizeView(); + }; + + $scope.resizeView = function() { + $timeout(function() { + $ionicScrollDelegate.resize(); + }); + checkPasswordFields(); + }; + + function checkPasswordFields() { + if (!$scope.encrypt) { + $scope.passphrase = $scope.createPassphrase = $scope.passwordSaved = null; + $timeout(function() { + $scope.$apply(); + }); + } + }; this.onQrCodeScanned = function(data) { $scope.secret = data; @@ -156,11 +176,10 @@ angular.module('copayApp.controllers').controller('joinController', $state.transitionTo('tabs.copayers', { walletId: client.credentials.walletId }); - }, 100); - } - else $state.go('tabs.home') + }); + } else $state.go('tabs.home'); }); - }, 100); + }); }; updateSeedSourceSelect(); diff --git a/www/views/join.html b/www/views/join.html index f21080820..c1e559383 100644 --- a/www/views/join.html +++ b/www/views/join.html @@ -40,10 +40,12 @@ - +
+ + Show advanced options Hide advanced options -
+
@@ -69,23 +71,6 @@ -
-
- - WARNING: The password cannot be recovered. Be sure to write it down. The wallet can not be restored without the password. - -
-
- - - -
- diff --git a/www/views/tab-export-file.html b/www/views/tab-export-file.html index 31eb7d51a..552ab6d9f 100644 --- a/www/views/tab-export-file.html +++ b/www/views/tab-export-file.html @@ -18,13 +18,13 @@ - - Show advanced options - Hide advanced options - +
+ + Show advanced options + Hide advanced options + -
- + Do not include private key
From 12835ddb7eb08f5a527ba8e572ee48f28d602e17 Mon Sep 17 00:00:00 2001 From: Javier Date: Fri, 7 Oct 2016 17:32:52 -0300 Subject: [PATCH 05/23] reset words only --- src/js/controllers/backup.js | 12 ++++++------ www/views/backup.html | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/js/controllers/backup.js b/src/js/controllers/backup.js index 486667e2f..f40af13d8 100644 --- a/src/js/controllers/backup.js +++ b/src/js/controllers/backup.js @@ -27,7 +27,7 @@ angular.module('copayApp.controllers').controller('backupController', }); }; - $scope.initFlow = function() { + $scope.setFlow = function(step) { if (!keys) return; var words = keys.mnemonic; @@ -39,7 +39,7 @@ angular.module('copayApp.controllers').controller('backupController', $scope.useIdeograms = words.indexOf("\u3000") >= 0; $scope.data.passphrase = null; $scope.customWords = []; - $scope.step = 1; + $scope.step = step || 1; $scope.selectComplete = false; $scope.backupError = false; @@ -72,10 +72,10 @@ angular.module('copayApp.controllers').controller('backupController', var showBackupResult = function() { if ($scope.backupError) { - var title = gettextCatalog.getString('Uh oh...'); + var title = 'Uh oh...'; var message = gettextCatalog.getString("It's important that you write your backup phrase down correctly. If something happens to your wallet, you'll need this backup to recover your money. Please review your backup and try again."); popupService.showAlert(title, message, function() { - $scope.goToStep(1); + $scope.setFlow(2); }) } else { openConfirmBackupModal(); @@ -151,7 +151,7 @@ angular.module('copayApp.controllers').controller('backupController', $scope.goToStep = function(n) { if (n == 1) - $scope.initFlow(); + $scope.setFlow(); if (n == 2) $scope.step = 2; if (n == 3) { @@ -203,7 +203,7 @@ angular.module('copayApp.controllers').controller('backupController', } $scope.credentialsEncrypted = false; keys = k; - $scope.initFlow(); + $scope.setFlow(); }); }); diff --git a/www/views/backup.html b/www/views/backup.html index fe43000d2..de649acc2 100644 --- a/www/views/backup.html +++ b/www/views/backup.html @@ -51,7 +51,7 @@ - +
From 7f2dae69603974e3a9399ad5ce56238d33a5b9a3 Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Fri, 7 Oct 2016 16:42:05 -0400 Subject: [PATCH 06/23] killed receive tips --- src/js/controllers/tab-receive.js | 16 ---------------- www/views/modals/receive-tips.html | 15 --------------- 2 files changed, 31 deletions(-) delete mode 100644 www/views/modals/receive-tips.html diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js index 70bd07e4b..f2cd4472a 100644 --- a/src/js/controllers/tab-receive.js +++ b/src/js/controllers/tab-receive.js @@ -5,21 +5,6 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi $scope.isCordova = platformInfo.isCordova; $scope.isNW = platformInfo.isNW; - $scope.checkTips = function(force) { - storageService.getReceiveTipsAccepted(function(err, accepted) { - if (err) $log.warn(err); - if (accepted && !force) return; - - $timeout(function() { - $ionicModal.fromTemplateUrl('views/modals/receive-tips.html', { - scope: $scope - }).then(function(modal) { - $scope.receiveTipsModal = modal; - $scope.receiveTipsModal.show(); - }); - }, force ? 1 : 1000); - }); - }; $scope.shareAddress = function(addr) { if ($scope.generatingAddress) return; @@ -84,7 +69,6 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi }); }; - if (!$scope.isCordova) $scope.checkTips(); $scope.$on('Wallet/Changed', function(event, wallet) { if (!wallet) { $log.debug('No wallet provided'); diff --git a/www/views/modals/receive-tips.html b/www/views/modals/receive-tips.html deleted file mode 100644 index b148acd35..000000000 --- a/www/views/modals/receive-tips.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - -
-

Receive bitcoin by sharing your address

-

Other bitcoin users can scan this code to send you money

-
-
-
From 93625092c5ebcf74442630eaaf9f1090dcedeb7c Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Fri, 7 Oct 2016 16:42:51 -0400 Subject: [PATCH 07/23] removed scanner tip --- src/js/controllers/modals/scanner.js | 23 +---------------------- www/views/modals/scan-tips.html | 15 --------------- 2 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 www/views/modals/scan-tips.html diff --git a/src/js/controllers/modals/scanner.js b/src/js/controllers/modals/scanner.js index 6616d505a..4412dad9b 100644 --- a/src/js/controllers/modals/scanner.js +++ b/src/js/controllers/modals/scanner.js @@ -73,28 +73,7 @@ angular.module('copayApp.controllers').controller('scannerController', function( }; $scope.init = function() { - if (platformInfo.isCordova) scannerInit(); - else checkTips(); - }; - - function checkTips() { - //TODO addapt tips to the new QR plugin (mobile) - storageService.getScanTipsAccepted(function(err, accepted) { - if (err) $log.warn(err); - if (accepted) { - scannerInit(); - return; - } - - $timeout(function() { - $ionicModal.fromTemplateUrl('views/modals/scan-tips.html', { - scope: $scope - }).then(function(modal) { - $scope.scanTipsModal = modal; - $scope.scanTipsModal.show(); - }); - }, 1000); - }); + scannerInit(); }; $scope.$on('TipsModalClosed', function(event) { diff --git a/www/views/modals/scan-tips.html b/www/views/modals/scan-tips.html deleted file mode 100644 index 512b60327..000000000 --- a/www/views/modals/scan-tips.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - -
-

Scan the code to pay with bitcoin

-

QR codes could also contain a bitcoin wallet invitation, or an URL

-
-
-
From ed118c6eecdd650b6f265e3c5f33a39ba68505a0 Mon Sep 17 00:00:00 2001 From: Jason Dreyzehner Date: Fri, 7 Oct 2016 17:09:09 -0400 Subject: [PATCH 08/23] design(onboarding): polish font-sizes on very thin screens --- src/sass/views/onboarding/onboarding.scss | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/sass/views/onboarding/onboarding.scss b/src/sass/views/onboarding/onboarding.scss index 635ba7ad7..550f8de32 100644 --- a/src/sass/views/onboarding/onboarding.scss +++ b/src/sass/views/onboarding/onboarding.scss @@ -22,18 +22,27 @@ font-size: 24px; margin-top: .5rem; line-height: 1.3; + @media(max-width: 350px) { + font-size: 20px; + } } .onboarding-description { margin-top: 1rem; font-size: 16px; color: rgba(255,255,255,0.5); line-height: 1.5; + @media(max-width: 350px) { + line-height: 1.3; + } } .onboarding-tldr { font-size: 18px; margin-top: 1rem; margin-bottom: 1em; line-height: 1.3; + @media(max-width: 350px) { + font-size: 16px; + } } } @@ -55,7 +64,7 @@ %onboarding-illustration { position: absolute; width: 100%; - height: 40%; + height: 45%; margin-top: 25vh; top: 0; background-position: center; From d76dd3764518b1652bb9bc5c6eab0ebe608d63e9 Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Fri, 7 Oct 2016 17:32:10 -0400 Subject: [PATCH 09/23] removed storage service methods for tip value set/get --- src/js/services/storageService.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/js/services/storageService.js b/src/js/services/storageService.js index 3e07547ac..fc21e4059 100644 --- a/src/js/services/storageService.js +++ b/src/js/services/storageService.js @@ -361,21 +361,6 @@ angular.module('copayApp.services') }); }; - root.setScanTipsAccepted = function(val, cb) { - storage.set('scanTips', val, cb); - }; - - root.getScanTipsAccepted = function(cb) { - storage.get('scanTips', cb); - }; - - root.setReceiveTipsAccepted = function(val, cb) { - storage.set('receiveTips', val, cb); - }; - - root.getReceiveTipsAccepted = function(cb) { - storage.get('receiveTips', cb); - }; root.setBackupNeededModalFlag = function(walletId, val, cb) { storage.set('showBackupNeededModal-' + walletId, val, cb); From bdead7bd83949bc1bf4738881282e58e580dc0d7 Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Fri, 7 Oct 2016 17:35:45 -0400 Subject: [PATCH 10/23] removed modal controllers --- src/js/controllers/modals/receiveTips.js | 10 ---------- src/js/controllers/modals/scanTips.js | 11 ----------- 2 files changed, 21 deletions(-) delete mode 100644 src/js/controllers/modals/receiveTips.js delete mode 100644 src/js/controllers/modals/scanTips.js diff --git a/src/js/controllers/modals/receiveTips.js b/src/js/controllers/modals/receiveTips.js deleted file mode 100644 index 2297be7a4..000000000 --- a/src/js/controllers/modals/receiveTips.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -angular.module('copayApp.controllers').controller('receiveTipsController', function($scope, $log, storageService) { - $scope.close = function() { - $log.debug('Receive tips accepted'); - storageService.setReceiveTipsAccepted(true, function(err) { - $scope.receiveTipsModal.hide(); - }); - } -}); diff --git a/src/js/controllers/modals/scanTips.js b/src/js/controllers/modals/scanTips.js deleted file mode 100644 index a82f70554..000000000 --- a/src/js/controllers/modals/scanTips.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -angular.module('copayApp.controllers').controller('scanTipsController', function($scope, $log, storageService) { - $scope.close = function() { - $log.debug('Scan tips accepted'); - storageService.setScanTipsAccepted(true, function(err) { - $scope.$emit('TipsModalClosed', function() {}); - $scope.scanTipsModal.hide(); - }); - } -}); From a4b2575f6865d9c9f36b50dabf53338b9713d379 Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Mon, 10 Oct 2016 12:08:21 -0400 Subject: [PATCH 11/23] limits one decimal in amount value, stops user from going past 2 decimal places with alternate currency --- src/js/controllers/amount.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index baa1cfdc4..dd8623cfa 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -92,6 +92,8 @@ angular.module('copayApp.controllers').controller('amountController', function($ $scope.pushDigit = function(digit) { if ($scope.amount && $scope.amount.length >= LENGTH_EXPRESSION_LIMIT) return; + if ($scope.amount.indexOf('.') > -1 && digit == '.') return; + if($scope.showAlternativeAmount && $scope.amount.indexOf('.') > -1 && $scope.amount[$scope.amount.indexOf('.') + 2]) return; $scope.amount = ($scope.amount + digit).replace('..', '.'); checkFontSize(); From 3320510d3563d735260d5d365370379e55720a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Sat, 8 Oct 2016 20:19:55 -0300 Subject: [PATCH 12/23] fix push notifications and remove onboarding email --- app-template/bitpay/appConfig.json | 1 + app-template/copay/appConfig.json | 1 + .../controllers/onboarding/notifications.js | 25 +++++- src/js/controllers/onboarding/tour.js | 83 ++++++++++--------- .../controllers/preferencesNotifications.js | 4 +- src/js/services/profileService.js | 3 +- src/js/services/pushNotificationsService.js | 3 +- www/views/onboarding/notifications.html | 2 +- www/views/onboarding/tour.html | 5 +- 9 files changed, 74 insertions(+), 53 deletions(-) diff --git a/app-template/bitpay/appConfig.json b/app-template/bitpay/appConfig.json index 44be954ac..3c0ee862b 100644 --- a/app-template/bitpay/appConfig.json +++ b/app-template/bitpay/appConfig.json @@ -17,6 +17,7 @@ "winAppName": "BitPayWallet", "wpPublisherId": "{}", "wpProductId": "{}", + "pushSenderId": "1036948132229", "description": "Secure Bitcoin Storage", "version": "0.14.0", "androidVersion": "1", diff --git a/app-template/copay/appConfig.json b/app-template/copay/appConfig.json index 66bb79585..7a6ee7ef3 100644 --- a/app-template/copay/appConfig.json +++ b/app-template/copay/appConfig.json @@ -17,6 +17,7 @@ "winAppName": "CopayWallet", "wpPublisherId": "{31cdd08b-457c-413d-b440-f6665eec847d}", "wpProductId": "{5381aa50-9069-11e4-84cc-293caf9cbdc8}", + "pushSenderId": "1036948132229", "description": "A Secure Bitcoin Wallet", "version": "2.5.0", "androidVersion": "115", diff --git a/src/js/controllers/onboarding/notifications.js b/src/js/controllers/onboarding/notifications.js index a2444abf0..a2c8346e5 100644 --- a/src/js/controllers/onboarding/notifications.js +++ b/src/js/controllers/onboarding/notifications.js @@ -1,13 +1,32 @@ 'use strict'; -angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $stateParams, profileService) { +angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $timeout, $stateParams, profileService, configService) { + + $scope.$on("$ionicView.enter", function(event, data) { + $scope.walletId = data.stateParams.walletId; + }); - $scope.walletId = $stateParams.walletId; $scope.allowNotif = function() { - profileService.pushNotificationsInit(); + $timeout(function() { + profileService.pushNotificationsInit(); + }); $state.go('onboarding.backupRequest', { walletId: $scope.walletId }); } + $scope.disableNotif = function() { + var opts = { + pushNotifications: { + enabled: false + } + }; + configService.set(opts, function(err) { + if (err) $log.warn(err); + $state.go('onboarding.backupRequest', { + walletId: $scope.walletId + }); + }); + }; + }); diff --git a/src/js/controllers/onboarding/tour.js b/src/js/controllers/onboarding/tour.js index aa2cdd92e..568d2771b 100644 --- a/src/js/controllers/onboarding/tour.js +++ b/src/js/controllers/onboarding/tour.js @@ -1,28 +1,40 @@ 'use strict'; angular.module('copayApp.controllers').controller('tourController', - function($scope, $state, $log, $timeout, $filter, ongoingProcess, profileService, rateService) { + function($scope, $state, $log, $timeout, $filter, ongoingProcess, platformInfo, profileService, rateService) { - var tries = 0; + var isCordova = platformInfo.isCordova; + var isWP = platformInfo.isWP; + var usePushNotifications = isCordova && !isWP; - $scope.init = function() { - $scope.data = { - index: 0 - }; - - $scope.options = { - loop: false, - effect: 'flip', - speed: 500, - spaceBetween: 100 - } + $scope.data = { + index: 0 }; - rateService.whenAvailable(function() { - var localCurrency = 'USD'; - var btcAmount = 1; - var rate = rateService.toFiat(btcAmount * 1e8, localCurrency); - $scope.localCurrencySymbol = '$'; - $scope.localCurrencyPerBtc = $filter('formatFiatAmount')(parseFloat(rate.toFixed(2), 10)); + $scope.options = { + loop: false, + effect: 'flip', + speed: 500, + spaceBetween: 100 + } + + $scope.$on("$ionicSlides.sliderInitialized", function(event, data) { + $scope.slider = data.slider; + }); + + $scope.$on("$ionicSlides.slideChangeStart", function(event, data) { + $scope.data.index = data.slider.activeIndex; + }); + + $scope.$on("$ionicSlides.slideChangeEnd", function(event, data) {}); + + $scope.$on("$ionicView.enter", function(event, data) { + rateService.whenAvailable(function() { + var localCurrency = 'USD'; + var btcAmount = 1; + var rate = rateService.toFiat(btcAmount * 1e8, localCurrency); + $scope.localCurrencySymbol = '$'; + $scope.localCurrencyPerBtc = $filter('formatFiatAmount')(parseFloat(rate.toFixed(2), 10)); + }); }); $scope.createDefaultWallet = function() { @@ -33,21 +45,22 @@ angular.module('copayApp.controllers').controller('tourController', return $timeout(function() { $log.warn('Retrying to create default wallet......'); - if (tries == 3) { - tries == 0; - return $scope.createDefaultWallet(); - } else { - tries += 1; - return $scope.createDefaultWallet(); - } + return $scope.createDefaultWallet(); }, 3000); }; ongoingProcess.set('creatingWallet', false); var wallet = walletClient; - $state.go('onboarding.collectEmail', { - fromOnboarding: true, - walletId: wallet.credentials.walletId - }); + var walletId = wallet.credentials.walletId; + if (!usePushNotifications) { + $state.go('onboarding.backupRequest', { + walletId: walletId + }); + } + else { + $state.go('onboarding.notifications', { + walletId: walletId + }); + } }); }; @@ -60,14 +73,4 @@ angular.module('copayApp.controllers').controller('tourController', if ($scope.data.index != 2) $scope.slider.slideNext(); else $state.go('onboarding.welcome'); } - - $scope.$on("$ionicSlides.sliderInitialized", function(event, data) { - $scope.slider = data.slider; - }); - - $scope.$on("$ionicSlides.slideChangeStart", function(event, data) { - $scope.data.index = data.slider.activeIndex; - }); - - $scope.$on("$ionicSlides.slideChangeEnd", function(event, data) {}); }); diff --git a/src/js/controllers/preferencesNotifications.js b/src/js/controllers/preferencesNotifications.js index 8d947dde8..10ce21a4f 100644 --- a/src/js/controllers/preferencesNotifications.js +++ b/src/js/controllers/preferencesNotifications.js @@ -39,9 +39,9 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr }; configService.set(opts, function(err) { if (opts.pushNotifications.enabled) - pushNotificationsService.enableNotifications(profileService.walletClients); + profileService.pushNotificationsInit(); else - pushNotificationsService.disableNotifications(profileService.walletClients); + pushNotificationsService.disableNotifications(profileService.getWallets()); if (err) $log.debug(err); }); }; diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 30563208b..5a6cfc88e 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -296,7 +296,8 @@ angular.module('copayApp.services') if (!val) { return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer')); } - if (usePushNotifications) + var config = configService.getSync(); + if (config.pushNotifications.enabled && usePushNotifications) root.pushNotificationsInit(); return cb(); }); diff --git a/src/js/services/pushNotificationsService.js b/src/js/services/pushNotificationsService.js index f6c621415..57d9d5ddd 100644 --- a/src/js/services/pushNotificationsService.js +++ b/src/js/services/pushNotificationsService.js @@ -14,7 +14,6 @@ angular.module('copayApp.services') var push = PushNotification.init(defaults.pushNotifications.config); push.on('registration', function(data) { - if (root.token) return; $log.debug('Starting push notification registration'); root.token = data.registrationId; var config = configService.getSync(); @@ -31,7 +30,7 @@ angular.module('copayApp.services') if (!config.pushNotifications.enabled) return; if (!root.token) { - $log.warn('No token available for this device. Cannot set push notifications'); + $log.warn('No token available for this device. Cannot set push notifications. Needs registration.'); return; } diff --git a/www/views/onboarding/notifications.html b/www/views/onboarding/notifications.html index 8d03866ca..dac81fdf9 100644 --- a/www/views/onboarding/notifications.html +++ b/www/views/onboarding/notifications.html @@ -5,7 +5,7 @@
- +
diff --git a/www/views/onboarding/tour.html b/www/views/onboarding/tour.html index 9135e5217..de836e0c9 100644 --- a/www/views/onboarding/tour.html +++ b/www/views/onboarding/tour.html @@ -1,4 +1,4 @@ - + @@ -6,9 +6,6 @@ - - - From b29fab9ae2a7a9682619d2575c748f8b2434a61d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Sat, 8 Oct 2016 21:12:30 -0300 Subject: [PATCH 13/23] ios fixes --- app-template/config-template.xml | 1 - src/js/controllers/preferencesNotifications.js | 14 +++----------- www/views/preferencesNotifications.html | 5 +---- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/app-template/config-template.xml b/app-template/config-template.xml index 3596fc947..e2fc4058f 100644 --- a/app-template/config-template.xml +++ b/app-template/config-template.xml @@ -32,7 +32,6 @@ - diff --git a/src/js/controllers/preferencesNotifications.js b/src/js/controllers/preferencesNotifications.js index 10ce21a4f..cf8c5a979 100644 --- a/src/js/controllers/preferencesNotifications.js +++ b/src/js/controllers/preferencesNotifications.js @@ -9,12 +9,12 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr var isCordova = platformInfo.isCordova; var isIOS = platformInfo.isIOS; + $scope.appName = $window.appConfig.nameCase; $scope.PNEnabledByUser = true; $scope.isIOSApp = isIOS && isCordova; if ($scope.isIOSApp) { - cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(isEnabled) { - $scope.PNEnabledByUser = isEnabled; - $scope.$digest(); + PushNotification.hasPermission(function(data) { + $scope.PNEnabledByUser = data.isEnabled; }); } @@ -23,14 +23,6 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr }; }; - $scope.openSettings = function() { - cordova.plugins.diagnostic.switchToSettings(function() { - $log.debug('switched to settings'); - }, function(err) { - $log.debug(err); - }); - }; - $scope.pushNotificationsChange = function() { var opts = { pushNotifications: { diff --git a/www/views/preferencesNotifications.html b/www/views/preferencesNotifications.html index 8b54a93e2..7385fd380 100644 --- a/www/views/preferencesNotifications.html +++ b/www/views/preferencesNotifications.html @@ -18,11 +18,8 @@
Notifications
- Push notifications for Copay are currently disabled. Enable them in the Settings app. + Push notifications for {{appName}} are currently disabled. Enable them in the Settings app.
- - Open Settings app -
From ee5b2817d7b06d3980229870be47d28ab7d31fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 10 Oct 2016 13:13:30 -0300 Subject: [PATCH 14/23] fix --- app-template/config-template.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app-template/config-template.xml b/app-template/config-template.xml index e2fc4058f..5a72f4560 100644 --- a/app-template/config-template.xml +++ b/app-template/config-template.xml @@ -56,7 +56,9 @@ - + + + From fce9c2357fe17f10908cb7ea893771c4bcdf7fbd Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 10 Oct 2016 13:25:40 -0300 Subject: [PATCH 15/23] rm language selection --- www/views/tab-settings.html | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/www/views/tab-settings.html b/www/views/tab-settings.html index 87633a712..c22662e72 100644 --- a/www/views/tab-settings.html +++ b/www/views/tab-settings.html @@ -37,18 +37,18 @@ Notifications - - - - - - Language - - {{currentLanguageName|translate}} - - - - + + + + + + + + + + + + From cd0e5df44751353afa082fb5fc9a8d1d954432cb Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 10 Oct 2016 13:45:43 -0300 Subject: [PATCH 16/23] Fix if push is not available --- src/js/controllers/preferencesNotifications.js | 11 ++++++++--- src/js/services/profileService.js | 2 ++ src/js/services/pushNotificationsService.js | 7 ++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/js/controllers/preferencesNotifications.js b/src/js/controllers/preferencesNotifications.js index cf8c5a979..5cf80a4af 100644 --- a/src/js/controllers/preferencesNotifications.js +++ b/src/js/controllers/preferencesNotifications.js @@ -13,9 +13,13 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr $scope.PNEnabledByUser = true; $scope.isIOSApp = isIOS && isCordova; if ($scope.isIOSApp) { - PushNotification.hasPermission(function(data) { - $scope.PNEnabledByUser = data.isEnabled; - }); + try { + PushNotification.hasPermission(function(data) { + $scope.PNEnabledByUser = data.isEnabled; + }); + } catch(e) { + $log.error(e); + }; } $scope.pushNotifications = { @@ -24,6 +28,7 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr }; $scope.pushNotificationsChange = function() { + if (!$scope.pushNotifications) return; var opts = { pushNotifications: { enabled: $scope.pushNotifications.value diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 5a6cfc88e..659f9dd8f 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -318,6 +318,8 @@ angular.module('copayApp.services') var defaults = configService.getDefaults(); var push = pushNotificationsService.init(root.wallet); + if (!push) return; + push.on('notification', function(data) { if (!data.additionalData.foreground) { $log.debug('Push notification event: ', data.message); diff --git a/src/js/services/pushNotificationsService.js b/src/js/services/pushNotificationsService.js index 57d9d5ddd..904ae4246 100644 --- a/src/js/services/pushNotificationsService.js +++ b/src/js/services/pushNotificationsService.js @@ -11,7 +11,12 @@ angular.module('copayApp.services') root.init = function(walletsClients) { var defaults = configService.getDefaults(); - var push = PushNotification.init(defaults.pushNotifications.config); + try { + var push = PushNotification.init(defaults.pushNotifications.config); + } catch(e) { + $log.error(e); + return; + }; push.on('registration', function(data) { $log.debug('Starting push notification registration'); From 1af5d6dd5f9469d7b2ae4d61af61e342a76e677a Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 10 Oct 2016 13:57:25 -0300 Subject: [PATCH 17/23] better message for "no enough funds" --- src/js/controllers/confirm.js | 21 ++++++++++++++++----- www/views/confirm.html | 14 ++++++++++---- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 868a45856..870febb2d 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -41,14 +41,20 @@ angular.module('copayApp.controllers').controller('confirmController', function( var networkName = (new bitcore.Address($scope.toAddress)).network.name; $scope.network = networkName; - $scope.notAvailable = false; + $scope.insuffientFunds = false; + $scope.noMatchingWallet = false; + var wallets = profileService.getWallets({ onlyComplete: true, network: networkName, }); + if (!wallets || !wallets.length) { + $scope.noMatchingWallet = true; + } + var filteredWallets = []; - var index = 0; + var index = 0, enoughFunds = false; lodash.each(wallets, function(w) { walletService.getStatus(w, {}, function(err, status) { @@ -56,15 +62,20 @@ angular.module('copayApp.controllers').controller('confirmController', function( $log.error(err); } else { if (!status.availableBalanceSat) $log.debug('No balance available in: ' + w.name); - if (status.availableBalanceSat > $scope.toAmount) filteredWallets.push(w); + if (status.availableBalanceSat > $scope.toAmount) { + filteredWallets.push(w); + enoughFunds = true; + } } if (++index == wallets.length) { if (!lodash.isEmpty(filteredWallets)) { $scope.wallets = lodash.clone(filteredWallets); - $scope.notAvailable = false; } else { - $scope.notAvailable = true; + + if (!enoughFunds) + $scope.insuffientFunds = true; + $log.warn('No wallet available to make the payment'); } } diff --git a/www/views/confirm.html b/www/views/confirm.html index aa039f4b4..0577b8ab6 100644 --- a/www/views/confirm.html +++ b/www/views/confirm.html @@ -45,13 +45,19 @@ -
- No wallet with enough funds +
+ No appropiate wallet to make this payment +
+ + + +
+ Insufficient funds
-
+
Add description @@ -59,7 +65,7 @@
- + From b23da0aa1134acee801b11c1917e04411f255351 Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Mon, 10 Oct 2016 13:06:29 -0400 Subject: [PATCH 18/23] made home tip persistent until user closes --- src/js/controllers/tab-home.js | 18 +++++++++++++----- src/js/services/storageService.js | 8 ++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index e13111622..a2bd85811 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -12,6 +12,12 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.name = $window.appConfig.nameCase; $scope.homeTip = $stateParams.fromOnboarding; + if(!$scope.homeTip){ + storageService.getHomeTipAccepted(function(error, value){ + $scope.homeTip = (value == 'false') ? false : true; + }); + } + $scope.openNotificationModal = function(n) { wallet = profileService.getWallet(n.walletId); @@ -164,11 +170,13 @@ angular.module('copayApp.controllers').controller('tabHomeController', }; $scope.hideHomeTip = function() { - $scope.homeTip = null; - $state.transitionTo($state.current, null, { - reload: true, - inherit: false, - notify: false + storageService.setHomeTipAccepted(false, function(error, value){ + $scope.homeTip = false; + $state.transitionTo($state.current, null, { + reload: true, + inherit: false, + notify: false + }); }); }; diff --git a/src/js/services/storageService.js b/src/js/services/storageService.js index fc21e4059..f9f14fdf7 100644 --- a/src/js/services/storageService.js +++ b/src/js/services/storageService.js @@ -195,6 +195,14 @@ angular.module('copayApp.services') storage.remove('config', cb); }; + root.getHomeTipAccepted = function(cb) { + storage.get('homeTip', cb); + }; + + root.setHomeTipAccepted = function(val, cb) { + storage.set('homeTip', val, cb); + }; + root.setHideBalanceFlag = function(walletId, val, cb) { storage.set('hideBalance-' + walletId, val, cb); }; From 52f8888a949627e98c91262e43279cc0e56940e1 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 10 Oct 2016 14:12:25 -0300 Subject: [PATCH 19/23] fix arrow direction --- www/views/tab-home.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/views/tab-home.html b/www/views/tab-home.html index b43869c56..35b92c244 100644 --- a/www/views/tab-home.html +++ b/www/views/tab-home.html @@ -126,8 +126,8 @@ ng-show="nextStepEnabled && wallets[0]">
Next steps - - + +
From c04ab7a469b9ed64b1aa0c63b4783b64cf0f0700 Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Mon, 10 Oct 2016 13:20:05 -0400 Subject: [PATCH 20/23] removed unneeded state transition --- src/js/controllers/tab-home.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index a2bd85811..937e1bab6 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -172,11 +172,6 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.hideHomeTip = function() { storageService.setHomeTipAccepted(false, function(error, value){ $scope.homeTip = false; - $state.transitionTo($state.current, null, { - reload: true, - inherit: false, - notify: false - }); }); }; From 2da5d82a8a5de2b7852a1639bc9c9edf437a77ca Mon Sep 17 00:00:00 2001 From: Jamal Jackson Date: Mon, 10 Oct 2016 13:42:29 -0400 Subject: [PATCH 21/23] sending user directly to gliders view --- www/views/tab-home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/views/tab-home.html b/www/views/tab-home.html index b43869c56..b09ac4d2b 100644 --- a/www/views/tab-home.html +++ b/www/views/tab-home.html @@ -137,7 +137,7 @@ Add BitPay Visa® Card - +
From 183dde73c4e199e449fe09c74318bb3434811da1 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 10 Oct 2016 14:56:14 -0300 Subject: [PATCH 22/23] fix font on tx-send --- www/views/modals/tx-status.html | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/www/views/modals/tx-status.html b/www/views/modals/tx-status.html index 426c762af..1c930de0d 100644 --- a/www/views/modals/tx-status.html +++ b/www/views/modals/tx-status.html @@ -1,15 +1,17 @@ -