From f8fddd2431820a95cdc2b77aa165375cbe13697e Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Fri, 2 Sep 2016 13:00:38 -0300 Subject: [PATCH 01/24] Fix topbar for mobile --- app-template/config.xml | 5 +- public/index.html | 1 - public/views/onboarding/backupRequest.html | 2 +- public/views/onboarding/backupWarning.html | 2 +- public/views/onboarding/collectEmail.html | 2 +- public/views/onboarding/notifications.html | 2 +- public/views/onboarding/tour.html | 4 +- public/views/onboarding/welcome.html | 2 +- src/js/controllers/onboarding/collectEmail.js | 4 ++ src/js/controllers/tab-settings.js | 3 -- src/js/routes.js | 50 ++----------------- .../views/onboarding/onboard-welcome.scss | 4 +- 12 files changed, 18 insertions(+), 63 deletions(-) diff --git a/app-template/config.xml b/app-template/config.xml index 635456255..84952a749 100644 --- a/app-template/config.xml +++ b/app-template/config.xml @@ -21,9 +21,8 @@ - - - + + diff --git a/public/index.html b/public/index.html index cef1fb09e..fe0611bae 100644 --- a/public/index.html +++ b/public/index.html @@ -6,7 +6,6 @@ - {{appConfig.nameCase}} - {{appConfig.description}} diff --git a/public/views/onboarding/backupRequest.html b/public/views/onboarding/backupRequest.html index 3802772fd..6044406d5 100644 --- a/public/views/onboarding/backupRequest.html +++ b/public/views/onboarding/backupRequest.html @@ -1,7 +1,7 @@
- +

diff --git a/public/views/onboarding/backupWarning.html b/public/views/onboarding/backupWarning.html index 7b5e173af..a6f0bafee 100644 --- a/public/views/onboarding/backupWarning.html +++ b/public/views/onboarding/backupWarning.html @@ -18,7 +18,7 @@

- +

diff --git a/public/views/onboarding/collectEmail.html b/public/views/onboarding/collectEmail.html index ca3afbd94..edcc2c96e 100644 --- a/public/views/onboarding/collectEmail.html +++ b/public/views/onboarding/collectEmail.html @@ -8,7 +8,7 @@

- +

Wallet Created

diff --git a/public/views/onboarding/notifications.html b/public/views/onboarding/notifications.html index 555a06d08..3d5b3f6f9 100644 --- a/public/views/onboarding/notifications.html +++ b/public/views/onboarding/notifications.html @@ -10,7 +10,7 @@ - +
diff --git a/public/views/onboarding/tour.html b/public/views/onboarding/tour.html index 3524f8231..8df77f256 100644 --- a/public/views/onboarding/tour.html +++ b/public/views/onboarding/tour.html @@ -2,12 +2,12 @@ - - diff --git a/public/views/onboarding/welcome.html b/public/views/onboarding/welcome.html index 05459b33d..1c97d5274 100644 --- a/public/views/onboarding/welcome.html +++ b/public/views/onboarding/welcome.html @@ -3,7 +3,7 @@
- +

diff --git a/src/js/controllers/onboarding/collectEmail.js b/src/js/controllers/onboarding/collectEmail.js index b5dbfc739..58122bd74 100644 --- a/src/js/controllers/onboarding/collectEmail.js +++ b/src/js/controllers/onboarding/collectEmail.js @@ -30,4 +30,8 @@ angular.module('copayApp.controllers').controller('collectEmailController', func }); }); }; + + $scope.onboardingMailSkip = function() { + $state.go('onboarding.backupRequest'); + }; }); diff --git a/src/js/controllers/tab-settings.js b/src/js/controllers/tab-settings.js index e4edb47d4..ca45e1411 100644 --- a/src/js/controllers/tab-settings.js +++ b/src/js/controllers/tab-settings.js @@ -30,9 +30,6 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct $scope.glideraEnabled = config.glidera.enabled; $scope.coinbaseEnabled = config.coinbase.enabled; $scope.pushNotifications = config.pushNotifications.enabled; - if (isCordova && StatusBar.isVisible) { - StatusBar.backgroundColorByHexString("#4B6178"); - } $scope.otherWallets = lodash.filter(profileService.getWallets(self.network), function(w) { return w.id != self.walletId; }); diff --git a/src/js/routes.js b/src/js/routes.js index 501d46f26..b3878fce1 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -254,12 +254,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr url: '/add', views: { 'tab-home': { - templateUrl: 'views/add.html', - controller: function(platformInfo) { - if (platformInfo.isCordova && StatusBar.isVisible) { - StatusBar.backgroundColorByHexString("#4B6178"); - } - } + templateUrl: 'views/add.html' } } }) @@ -807,54 +802,16 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }) .run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService) { - if (platformInfo.isCordova) { - if (screen.width < 768) { - screen.lockOrientation('portrait'); - } else { - window.addEventListener("orientationchange", function() { - var leftMenuWidth = document.querySelector("ion-side-menu[side='left']").clientWidth; - if (screen.orientation.includes('portrait')) { - // Portrait - document.querySelector("ion-side-menu-content").style.width = (screen.width - leftMenuWidth) + "px"; - } else { - // Landscape - document.querySelector("ion-side-menu-content").style.width = (screen.height - leftMenuWidth) + "px"; - } - }); - } - } else { - if (screen.width >= 768) { - window.addEventListener('resize', lodash.throttle(function() { - $rootScope.$emit('Local/WindowResize'); - }, 100)); - } - } - uxLanguage.init(); openURLService.init(); $ionicPlatform.ready(function() { if (platformInfo.isCordova) { - window.addEventListener('native.keyboardhide', function() { - $timeout(function() { - $rootScope.shouldHideMenuBar = false; //show menu bar when keyboard is hidden with back button action on send screen - }, 100); - }); - - window.addEventListener('native.keyboardshow', function() { - $timeout(function() { - $rootScope.shouldHideMenuBar = true; //hide menu bar when keyboard opens with back button action on send screen - }, 300); - }); - if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) { cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); cordova.plugins.Keyboard.disableScroll(true); } - if (window.StatusBar) { - StatusBar.styleLightContent(); - } $ionicPlatform.registerBackButtonAction(function(e) { @@ -873,8 +830,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }, 5000); } e.preventDefault(); - }, - 101); + }, 101); $ionicPlatform.on('pause', function() { // Nothing to do @@ -890,7 +846,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr setTimeout(function() { navigator.splashscreen.hide(); - }, 1000); + }, 500); } diff --git a/src/sass/views/onboarding/onboard-welcome.scss b/src/sass/views/onboarding/onboard-welcome.scss index 8e40facd9..84d206d20 100644 --- a/src/sass/views/onboarding/onboard-welcome.scss +++ b/src/sass/views/onboarding/onboard-welcome.scss @@ -7,7 +7,7 @@ #shopping-24 { content: url("../img/onboarding-welcome-shopping24.png"); position: absolute; - top: 2%; + top: 5%; right: 5%; width: 35px; height: auto; @@ -17,7 +17,7 @@ @include center-block(); } .logo { - margin-top: 15rem; + margin-top: 13rem; } button { @include center-block(1rem); From 0ed46f1f655b82d6a8385aecc7bb094c0fe30507 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 2 Sep 2016 14:04:19 -0300 Subject: [PATCH 02/24] fix About --- public/views/preferencesAbout.html | 6 +++--- src/js/controllers/preferencesAbout.js | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/public/views/preferencesAbout.html b/public/views/preferencesAbout.html index e768ddc8b..550cd2d9b 100644 --- a/public/views/preferencesAbout.html +++ b/public/views/preferencesAbout.html @@ -14,14 +14,14 @@ Version - v{{v.version}} + v{{version}}

-
+
Commit hash - #{{v.commitHash}} + #{{commitHash}}
diff --git a/src/js/controllers/preferencesAbout.js b/src/js/controllers/preferencesAbout.js index d410eec64..8cff3cb27 100644 --- a/src/js/controllers/preferencesAbout.js +++ b/src/js/controllers/preferencesAbout.js @@ -1,6 +1,9 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesAbout', - function($ionicNavBarDelegate, gettextCatalog) { + function($scope, $version, $ionicNavBarDelegate, gettextCatalog) { $ionicNavBarDelegate.title(gettextCatalog.getString('About Copay')); + + $scope.version = $window.version; + $scope.commit = $window.commitHash; }); From d7e025c2d0431473d13a77a2819b7f234a3470c2 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 2 Sep 2016 14:17:47 -0300 Subject: [PATCH 03/24] better tx create at confirm --- public/views/confirm.html | 2 +- public/views/tab-home.html | 6 +++++- src/js/controllers/confirm.js | 25 +++++++++---------------- src/js/controllers/modals/txpDetails.js | 16 ++++++++-------- src/js/controllers/preferencesAbout.js | 4 ++-- src/js/controllers/tab-home.js | 8 +++++++- src/js/services/walletService.js | 2 ++ 7 files changed, 34 insertions(+), 29 deletions(-) diff --git a/public/views/confirm.html b/public/views/confirm.html index 2d45e16b1..a36da1bc9 100644 --- a/public/views/confirm.html +++ b/public/views/confirm.html @@ -49,7 +49,7 @@
- diff --git a/public/views/tab-home.html b/public/views/tab-home.html index e22dcf09a..204fee2ed 100644 --- a/public/views/tab-home.html +++ b/public/views/tab-home.html @@ -28,7 +28,7 @@
Updating activity. Please stand by
- +
@@ -118,5 +118,9 @@
+

+{{name}} v{{version}} +

+
diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 9fd24fa7a..0ecd5b01e 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -17,13 +17,6 @@ angular.module('copayApp.controllers').controller('confirmController', function( $scope.commentPopupSave = function(description) { $log.debug('Saving description: ' + description); $scope.description = description; - $scope.txp = null; - - createTx($scope.wallet, function(err, txp) { - if (err) return; - cachedTxp[$scope.wallet.id] = txp; - apply(txp); - }); commentPopup.close(); }; }; @@ -165,7 +158,7 @@ angular.module('copayApp.controllers').controller('confirmController', function( apply(cachedTxp[wallet.id]); } else { stop = $timeout(function() { - createTx(wallet, function(err, txp) { + createTx(wallet, true, function(err, txp) { if (err) return; cachedTxp[wallet.id] = txp; apply(txp); @@ -184,7 +177,7 @@ angular.module('copayApp.controllers').controller('confirmController', function( $scope.$apply(); }; - var createTx = function(wallet, cb) { + var createTx = function(wallet, dryRun, cb) { var config = configService.getSync().wallet; var currentSpendUnconfirmed = config.spendUnconfirmed; var outputs = []; @@ -227,6 +220,7 @@ angular.module('copayApp.controllers').controller('confirmController', function( txp.payProUrl = paypro; txp.excludeUnconfirmedUtxos = config.spendUnconfirmed ? false : true; txp.feeLevel = config.settings.feeLevel || 'normal'; + txp.dryRun = dryRun; walletService.createTx(wallet, txp, function(err, ctxp) { if (err) { @@ -247,14 +241,10 @@ angular.module('copayApp.controllers').controller('confirmController', function( $scope.approve = function() { var wallet = $scope.wallet; - var txp = $scope.txp; if (!wallet) { return setSendError(gettextCatalog.getString('No wallet selected')); }; - if (!txp) { - return setSendError(gettextCatalog.getString('No transaction')); - }; if (!wallet.canSign() && !wallet.isPrivKeyExternal()) { $log.info('No signing proposal: No private key'); @@ -265,9 +255,12 @@ angular.module('copayApp.controllers').controller('confirmController', function( }); } - walletService.publishAndSign(wallet, txp, function(err, txp) { - if (err) return setSendError(err); - $state.transitionTo('tabs.home'); + createTx(wallet, false, function(err, txp) { + if (err) return; + walletService.publishAndSign(wallet, txp, function(err, txp) { + if (err) return setSendError(err); + $state.transitionTo('tabs.home'); + }); }); }; diff --git a/src/js/controllers/modals/txpDetails.js b/src/js/controllers/modals/txpDetails.js index dadc6309e..3804cd830 100644 --- a/src/js/controllers/modals/txpDetails.js +++ b/src/js/controllers/modals/txpDetails.js @@ -32,12 +32,9 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi $scope.sign = function() { $scope.loading = true; walletService.publishAndSign($scope.wallet, $scope.tx, function(err, txp) { - -console.log('[txpDetails.js.35] AFTER publush'); //TODO - $scope.$emit('UpdateTx'); if (err) return setSendError(err); - $scope.close(txp); + $scope.close(true); }); }; @@ -53,7 +50,7 @@ console.log('[txpDetails.js.35] AFTER publush'); //TODO if (err) return setError(err, gettextCatalog.getString('Could not reject payment')); - $scope.close(txpr); + $scope.close(true); }); @@ -73,7 +70,7 @@ console.log('[txpDetails.js.35] AFTER publush'); //TODO return setError(err, gettextCatalog.getString('Could not delete payment proposal')); } - $scope.close(); + $scope.close(true); }); }, 10); }; @@ -90,7 +87,7 @@ console.log('[txpDetails.js.35] AFTER publush'); //TODO return setError(err, gettextCatalog.getString('Could not broadcast payment')); } - $scope.close(txpb); + $scope.close(true); }); }, 10); }; @@ -175,7 +172,10 @@ console.log('[txpDetails.js.35] AFTER publush'); //TODO }); }; - $scope.close = function(txp) { + $scope.close = function(shouldEmit) { + if (shouldEmit) + $rootScope.$emit('Local/TxAction', $scope.wallet.id); + $scope.loading = null; $scope.txpDetailsModal.hide(); }; diff --git a/src/js/controllers/preferencesAbout.js b/src/js/controllers/preferencesAbout.js index 8cff3cb27..002c399b4 100644 --- a/src/js/controllers/preferencesAbout.js +++ b/src/js/controllers/preferencesAbout.js @@ -1,9 +1,9 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesAbout', - function($scope, $version, $ionicNavBarDelegate, gettextCatalog) { + function($scope, $window, $ionicNavBarDelegate, gettextCatalog) { $ionicNavBarDelegate.title(gettextCatalog.getString('About Copay')); $scope.version = $window.version; - $scope.commit = $window.commitHash; + $scope.commitHash = $window.commitHash; }); diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 20d85c7d6..3fcccd64d 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('tabHomeController', - function($rootScope, $timeout, $scope, $state, $ionicScrollDelegate, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo, storageService, txpModalService) { + function($rootScope, $timeout, $scope, $state, $ionicScrollDelegate, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo, storageService, txpModalService, $window) { $scope.externalServices = {}; $scope.bitpayCardEnabled = true; // TODO @@ -81,9 +81,11 @@ angular.module('copayApp.controllers').controller('tabHomeController', } wallet.status = status; + $scope.fetchingNotifications = true; profileService.getNotifications({ limit: 3 }, function(err, notifications) { + $scope.fetchingNotifications = false; if (err) { console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO return; @@ -143,5 +145,9 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.openTxpModal = txpModalService.open; + $scope.version = $window.version; + $scope.name = $window.appConfig.nameCase; + + }); diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index 6293c31c3..bd447f7ff 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -852,6 +852,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim askPassword(wallet.name, gettext('Enter Spending Password'), function(password) { if (!password) return cb('no password'); + if (!wallet.checkPassword(password)) return cb('wrong password'); + return cb(null, password); }); From 8c43f55756685ee37603795ddbcc889e4a14d9f5 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 2 Sep 2016 14:33:18 -0300 Subject: [PATCH 04/24] add notpending in proposals --- public/views/includes/txp.html | 52 ++++++++++++--------- public/views/proposals.html | 2 +- public/views/tab-home.html | 2 +- src/js/controllers/tab-home.js | 51 +++++++------------- src/js/services/profileService.js | 12 +---- src/sass/views/includes/walletActivity.scss | 4 ++ 6 files changed, 54 insertions(+), 69 deletions(-) diff --git a/public/views/includes/txp.html b/public/views/includes/txp.html index 0749fd310..183c49f90 100644 --- a/public/views/includes/txp.html +++ b/public/views/includes/txp.html @@ -1,23 +1,31 @@ - - - - {{addressbook[tx.toAddress]}} - - - {{tx.message}} - - - Sending - - - - {{tx.merchant.domain}} - {{tx.merchant.domain}} - - - - {{tx.amountStr}} - -
- {{tx.wallet.name}} · -
+
+ + + {{addressbook[tx.toAddress]}} + + + {{tx.message}} + + + Sending + + + + {{tx.merchant.domain}} + {{tx.merchant.domain}} + + + + +
+ {{tx.amountStr}} +
+ + +

+ + {{tx.wallet.name}} + +

+
diff --git a/public/views/proposals.html b/public/views/proposals.html index 515d8e050..0f3306ddc 100644 --- a/public/views/proposals.html +++ b/public/views/proposals.html @@ -11,7 +11,7 @@
- + diff --git a/public/views/tab-home.html b/public/views/tab-home.html index 204fee2ed..2c65004c2 100644 --- a/public/views/tab-home.html +++ b/public/views/tab-home.html @@ -14,7 +14,7 @@ {{txpsN}} - +
diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 3fcccd64d..ac8ef2750 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -7,17 +7,24 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.bitpayCardEnabled = true; // TODO + function updateTxps() { + profileService.getTxps({ + limit: 3 + }, function(err, txps, n) { + if (err) { + console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO + } + $scope.txps = txps; + $scope.txpsN = n; + $ionicScrollDelegate.resize(); - var setPendingTxps = function(txps) { - if (!txps) { - $scope.txps = []; - return; - } - $scope.txps = lodash.sortBy(txps, 'createdOn').reverse(); + $timeout(function() { + $scope.$apply(); + }, 1); + }) }; - $scope.updateAllWallets = function() { $scope.wallets = profileService.getWallets(); if (lodash.isEmpty($scope.wallets)) return; @@ -35,20 +42,7 @@ angular.module('copayApp.controllers').controller('tabHomeController', wallet.status = status; } if (++j==i) { - profileService.getTxps({ - limit: 3 - }, function(err, txps, n) { - if (err) { - console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO - } - $scope.txps = txps; - $scope.txpsN = n; - $ionicScrollDelegate.resize(); - - $timeout(function() { - $scope.$apply(); - }, 1); - }); + updateTxps(); } }); }); @@ -92,20 +86,7 @@ angular.module('copayApp.controllers').controller('tabHomeController', } $scope.notifications = notifications; - profileService.getTxps({ - limit: 3 - }, function(err, txps, n) { - if (err) { - console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO - } - $scope.txps = txps; - $scope.txpsN = n; - $ionicScrollDelegate.resize(); - - $timeout(function() { - $scope.$apply(); - }, 1); - }) + updateTxps(); }) }); }; diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 8fb2df403..dbad76e34 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -908,22 +908,14 @@ angular.module('copayApp.services') var txps = []; - function process(notifications) { - if (!notifications) return []; - - var shown = lodash.sortBy(notifications, 'createdOn').reverse(); - shown = shown.splice(0, opts.limit || MAX); - return shown; - }; - lodash.each(w, function(x) { if (x.pendingTxps) txps = txps.concat(x.pendingTxps); }); - txps = lodash.sortBy(txps, 'createdOn'); + txps = lodash.sortBy(txps, 'pendingForUs', 'createdOn'); txps = lodash.compact(lodash.flatten(txps)).slice(0,MAX); var n = txps.length; - return cb(null, process(txps), n); + return cb(null, txps, n); }; return root; diff --git a/src/sass/views/includes/walletActivity.scss b/src/sass/views/includes/walletActivity.scss index d5f723582..af7ff4c65 100644 --- a/src/sass/views/includes/walletActivity.scss +++ b/src/sass/views/includes/walletActivity.scss @@ -1,5 +1,9 @@ .wallet-activity { + &-not-pending { + background-color:#eee; + } + &-amount { float: right; font-size: 18px; From 6388a97eb51b1306fc270771d5e8ed0dc01584ea Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 2 Sep 2016 14:55:18 -0300 Subject: [PATCH 05/24] fix refresh after delete --- app-template/package.json | 2 +- package.json | 2 +- src/js/controllers/confirm.js | 22 +++++++++++++--------- src/js/controllers/modals/txpDetails.js | 13 +++++-------- src/js/controllers/tab-home.js | 1 + src/js/services/profileService.js | 1 - src/js/services/walletService.js | 25 +++++++++++++++++-------- 7 files changed, 38 insertions(+), 28 deletions(-) diff --git a/app-template/package.json b/app-template/package.json index 0d396c2af..3e19f4248 100644 --- a/app-template/package.json +++ b/app-template/package.json @@ -42,7 +42,7 @@ "url": "https://github.com/bitpay/copay/issues" }, "dependencies": { - "bitcore-wallet-client": "4.1.0", + "bitcore-wallet-client": "4.2.0", "coveralls": "^2.11.9", "express": "^4.11.2", "fs": "0.0.2", diff --git a/package.json b/package.json index abfa18eb5..b4086fa2f 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "url": "https://github.com/bitpay/copay/issues" }, "dependencies": { - "bitcore-wallet-client": "4.1.0", + "bitcore-wallet-client": "4.2.0", "coveralls": "^2.11.9", "express": "^4.11.2", "fs": "0.0.2", diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 0ecd5b01e..4c701775c 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -5,6 +5,17 @@ angular.module('copayApp.controllers').controller('confirmController', function( var cachedTxp = {}; var isChromeApp = platformInfo.isChromeApp; + + $scope.$on('Wallet/Changed', function(event, wallet) { + if (lodash.isEmpty(wallet)) { + $log.debug('No wallet provided'); + return; + } + $log.debug('Wallet changed: ' + wallet.name); + setWallet(wallet, true); + }); + + $scope.showDescriptionPopup = function() { var commentPopup = $ionicPopup.show({ templateUrl: "views/includes/note.html", @@ -130,15 +141,6 @@ angular.module('copayApp.controllers').controller('confirmController', function( }); }; - $scope.$on('Wallet/Changed', function(event, wallet) { - if (lodash.isEmpty(wallet)) { - $log.debug('No wallet provided'); - return; - } - $log.debug('Wallet changed: ' + wallet.name); - setWallet(wallet, true); - }); - function setWallet(wallet, delayed) { var stop; $scope.wallet = wallet; @@ -255,7 +257,9 @@ angular.module('copayApp.controllers').controller('confirmController', function( }); } + ongoingProcess.set('creatingTx', true); createTx(wallet, false, function(err, txp) { + ongoingProcess.set('creatingTx', false); if (err) return; walletService.publishAndSign(wallet, txp, function(err, txp) { if (err) return setSendError(err); diff --git a/src/js/controllers/modals/txpDetails.js b/src/js/controllers/modals/txpDetails.js index 3804cd830..a9fd5656c 100644 --- a/src/js/controllers/modals/txpDetails.js +++ b/src/js/controllers/modals/txpDetails.js @@ -34,7 +34,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi walletService.publishAndSign($scope.wallet, $scope.tx, function(err, txp) { $scope.$emit('UpdateTx'); if (err) return setSendError(err); - $scope.close(true); + $scope.close(); }); }; @@ -50,7 +50,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi if (err) return setError(err, gettextCatalog.getString('Could not reject payment')); - $scope.close(true); + $scope.close(); }); @@ -70,7 +70,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi return setError(err, gettextCatalog.getString('Could not delete payment proposal')); } - $scope.close(true); + $scope.close(); }); }, 10); }; @@ -87,7 +87,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi return setError(err, gettextCatalog.getString('Could not broadcast payment')); } - $scope.close(true); + $scope.close(); }); }, 10); }; @@ -172,10 +172,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi }); }; - $scope.close = function(shouldEmit) { - if (shouldEmit) - $rootScope.$emit('Local/TxAction', $scope.wallet.id); - + $scope.close = function() { $scope.loading = null; $scope.txpDetailsModal.hide(); }; diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index ac8ef2750..3abf9f157 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -106,6 +106,7 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.updateWallet(wallet); }), $rootScope.$on('Local/TxAction', function(e, walletId) { + $log.debug('Got action for wallet '+ walletId); var wallet = profileService.getWallet(walletId); $scope.updateWallet(wallet); }), diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index dbad76e34..2e11c97d4 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -123,7 +123,6 @@ angular.module('copayApp.services') if (wallet.cachedActivity) wallet.cachedActivity.isValid = false; - if (wallet.cachedTxps) wallet.cachedTxps.isValid = false; diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index bd447f7ff..f5bf2e45d 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -92,13 +92,17 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim root.invalidateCache = function(wallet) { - if (wallet.cachedStatus) { + if (wallet.cachedStatus) wallet.cachedStatus.isValid = false; - } - if (wallet.completeHistory) { + if (wallet.completeHistory) wallet.completeHistory.isValid = false; - } + + if (wallet.cachedActivity) + wallet.cachedActivity.isValid = false; + + if (wallet.cachedTxps) + wallet.cachedTxps.isValid = false; }; root.getStatus = function(wallet, opts, cb) { @@ -623,6 +627,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim wallet.removeTxProposal(txp, function(err) { $log.debug('Transaction removed'); + + root.invalidateCache(wallet); + $rootScope.$emit('Local/TxAction', wallet.id); + return cb(err); }); }; @@ -864,8 +872,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim ongoingProcess.set('rejectTx', true); root.rejectTx(wallet, txp, function(err, txpr) { root.invalidateCache(wallet); - ongoingProcess.set('rejectTx', false); + if (err) return cb(err); $rootScope.$emit('Local/TxAction', wallet.id); @@ -935,6 +943,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim var msg = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen'); + $rootScope.$emit('Local/TxAction', wallet.id); return cb(msg); } @@ -945,18 +954,18 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim ongoingProcess.set('broadcastingTx', false); if (err) return cb('sign error' + err); + $rootScope.$emit('Local/TxAction', wallet.id); var type = root.getViewStatus(wallet, broadcastedTxp); root.openStatusModal(type, broadcastedTxp, function() { - $rootScope.$emit('Local/TxAction', wallet.id); }); return cb(null, broadcastedTxp) }); } else { + $rootScope.$emit('Local/TxAction', wallet.id); + var type = root.getViewStatus(wallet, signedTxp); root.openStatusModal(type, signedTxp, function() { - root.invalidateCache(wallet); - $rootScope.$emit('Local/TxAction', wallet.id); }); return cb(null, signedTxp); } From 2fccd89c3ab108408880df09ee8f9bcccb55ed46 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Fri, 2 Sep 2016 15:42:45 -0300 Subject: [PATCH 06/24] Fix onboarding params, buttons, states --- public/views/includes/backupWarningPopup.html | 2 +- public/views/onboarding/backupRequest.html | 3 ++- public/views/onboarding/backupWarning.html | 8 ++++---- public/views/onboarding/collectEmail.html | 12 +++++------- public/views/onboarding/notifications.html | 2 +- .../controllers/onboarding/backupRequest.js | 3 ++- .../controllers/onboarding/backupWarning.js | 5 +++-- src/js/controllers/onboarding/collectEmail.js | 8 ++++---- .../controllers/onboarding/notifications.js | 4 +++- src/js/routes.js | 19 ++++++++----------- .../onboarding/onboard-collect-email.scss | 3 ++- src/sass/views/onboarding/onboarding.scss | 2 +- 12 files changed, 36 insertions(+), 35 deletions(-) diff --git a/public/views/includes/backupWarningPopup.html b/public/views/includes/backupWarningPopup.html index fbe1b79fd..b5cfecee9 100644 --- a/public/views/includes/backupWarningPopup.html +++ b/public/views/includes/backupWarningPopup.html @@ -1,7 +1,7 @@

Screenshots are not secure

if you take a screenshot, your backup may be viewed by others apps. You can make a safe backup with paper and a pen. -
diff --git a/public/views/onboarding/backupRequest.html b/public/views/onboarding/backupRequest.html index 6044406d5..f7099033f 100644 --- a/public/views/onboarding/backupRequest.html +++ b/public/views/onboarding/backupRequest.html @@ -17,7 +17,8 @@
- +
diff --git a/public/views/onboarding/backupWarning.html b/public/views/onboarding/backupWarning.html index a6f0bafee..d3406fb13 100644 --- a/public/views/onboarding/backupWarning.html +++ b/public/views/onboarding/backupWarning.html @@ -1,12 +1,12 @@ - - + + - - +

Are you being watched? diff --git a/public/views/onboarding/collectEmail.html b/public/views/onboarding/collectEmail.html index edcc2c96e..5f01e1e53 100644 --- a/public/views/onboarding/collectEmail.html +++ b/public/views/onboarding/collectEmail.html @@ -1,11 +1,4 @@ - - - - -
@@ -24,6 +17,11 @@ +
+ +
diff --git a/public/views/onboarding/notifications.html b/public/views/onboarding/notifications.html index 3d5b3f6f9..d086b1355 100644 --- a/public/views/onboarding/notifications.html +++ b/public/views/onboarding/notifications.html @@ -10,7 +10,7 @@ - +

diff --git a/src/js/controllers/onboarding/backupRequest.js b/src/js/controllers/onboarding/backupRequest.js index 60ae381f2..8284baafb 100644 --- a/src/js/controllers/onboarding/backupRequest.js +++ b/src/js/controllers/onboarding/backupRequest.js @@ -1,7 +1,8 @@ 'use strict'; -angular.module('copayApp.controllers').controller('backupRequestController', function($scope, $state, $ionicPopup) { +angular.module('copayApp.controllers').controller('backupRequestController', function($scope, $state, $stateParams, $ionicPopup) { + $scope.walletId = $stateParams.walletId; $scope.openPopup = function() { var backupLaterPopup = $ionicPopup.show({ templateUrl: "views/includes/backupLaterPopup.html", diff --git a/src/js/controllers/onboarding/backupWarning.js b/src/js/controllers/onboarding/backupWarning.js index cb4aa4934..b7099ed8a 100644 --- a/src/js/controllers/onboarding/backupWarning.js +++ b/src/js/controllers/onboarding/backupWarning.js @@ -1,7 +1,8 @@ 'use strict'; -angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $ionicPopup, $stateParams, profileService) { +angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $stateParams, $ionicPopup, profileService) { + $scope.walletId = $stateParams.walletId; $scope.openPopup = function() { var backupWarningPopup = $ionicPopup.show({ templateUrl: "views/includes/backupWarningPopup.html", @@ -10,7 +11,7 @@ angular.module('copayApp.controllers').controller('backupWarningController', fun $scope.close = function() { backupWarningPopup.close(); - $state.go('onboarding.backup'); + $state.go('onboarding.backup', {walletId: $stateParams.walletId, fromOnboarding: true}); }; } }); diff --git a/src/js/controllers/onboarding/collectEmail.js b/src/js/controllers/onboarding/collectEmail.js index 58122bd74..a383a78b3 100644 --- a/src/js/controllers/onboarding/collectEmail.js +++ b/src/js/controllers/onboarding/collectEmail.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $stateParams, profileService, configService, walletService, platformInfo) { +angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $stateParams, $ionicScrollDelegate, profileService, configService, walletService, platformInfo) { var isCordova = platformInfo.isCordova; var isWP = platformInfo.isWP; @@ -25,13 +25,13 @@ angular.module('copayApp.controllers').controller('collectEmailController', func if (err) $log.warn(err); configService.set(opts, function(err) { if (err) $log.warn(err); - if (!usePushNotifications) $state.go('onboarding.backupRequest'); - else $state.go('onboarding.notifications'); + if (!usePushNotifications) $state.go('onboarding.backupRequest', {walletId: walletId}); + else $state.go('onboarding.notifications', {walletId: walletId}); }); }); }; $scope.onboardingMailSkip = function() { - $state.go('onboarding.backupRequest'); + $state.go('onboarding.backupRequest', {walletId: walletId}); }; }); diff --git a/src/js/controllers/onboarding/notifications.js b/src/js/controllers/onboarding/notifications.js index 2b40cd65a..6252a77e7 100644 --- a/src/js/controllers/onboarding/notifications.js +++ b/src/js/controllers/onboarding/notifications.js @@ -1,7 +1,9 @@ 'use strict'; -angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, profileService) { +angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $stateParams, profileService) { +console.log('[notifications.js:3]',$stateParams); //TODO + $scope.walletId = $stateParams.walletId; $scope.allowNotif = function() { profileService.pushNotificationsInit(); $state.go('onboarding.backupRequest'); diff --git a/src/js/routes.js b/src/js/routes.js index b3878fce1..7660ebf31 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -560,11 +560,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr .state('onboarding', { url: '/onboarding', abstract: true, - template: '', - params: { - walletId: null, - fromOnboarding: null, - }, + template: '' }) .state('onboarding.welcome', { url: '/welcome', @@ -583,7 +579,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }) .state('onboarding.collectEmail', { - url: '/collectEmail', + url: '/collectEmail/:walletId', views: { 'onboarding': { templateUrl: 'views/onboarding/collectEmail.html' @@ -591,7 +587,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }) .state('onboarding.notifications', { - url: '/notifications', + url: '/notifications/:walletId', views: { 'onboarding': { templateUrl: 'views/onboarding/notifications.html' @@ -599,7 +595,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }) .state('onboarding.backupRequest', { - url: '/backupRequest', + url: '/backupRequest/:walletId', views: { 'onboarding': { templateUrl: 'views/onboarding/backupRequest.html' @@ -607,7 +603,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }) .state('onboarding.backupWarning', { - url: '/backupWarning', + url: '/backupWarning/:walletId', views: { 'onboarding': { templateUrl: 'views/onboarding/backupWarning.html' @@ -615,7 +611,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr } }) .state('onboarding.backup', { - url: '/backup', + url: '/backup/:walletId/:fromOnboarding', views: { 'onboarding': { templateUrl: 'views/backup.html' @@ -647,7 +643,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }, }, params: { - code: null + code: null, + fromOnboarding: null }, }) .state('onboarding.import.phrase', { diff --git a/src/sass/views/onboarding/onboard-collect-email.scss b/src/sass/views/onboarding/onboard-collect-email.scss index 427ab466f..7ffd453bb 100644 --- a/src/sass/views/onboarding/onboard-collect-email.scss +++ b/src/sass/views/onboarding/onboard-collect-email.scss @@ -11,7 +11,7 @@ opacity: 1; background: #fff; color: rgb(108, 108, 108); - height: 11rem; + height: 13rem; animation-name: topBottom; animation-iteration-count: 1; animation-timing-function: ease-in; @@ -22,6 +22,7 @@ animation-fill-mode: forwards; z-index: 5; margin-top: 0; + width: 100%; label { background: rgba(200, 200, 200, 0.20); height: 3rem; diff --git a/src/sass/views/onboarding/onboarding.scss b/src/sass/views/onboarding/onboarding.scss index ac2d1d698..55846f08d 100644 --- a/src/sass/views/onboarding/onboarding.scss +++ b/src/sass/views/onboarding/onboarding.scss @@ -34,7 +34,7 @@ background-size: contain; width: 100%; clear: both; - height: 20rem; + height: 23rem; margin-bottom: -3rem; background-position: center; background-repeat: no-repeat; From e19d5dc254dbf1bc65681d396744915480aeaf0c Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Fri, 2 Sep 2016 15:55:43 -0300 Subject: [PATCH 07/24] onboarding email: fix scrolling when focus input --- Gruntfile.js | 2 +- public/views/onboarding/collectEmail.html | 34 +++++++++---------- .../onboarding/onboard-collect-email.scss | 5 ++- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ad4a457a5..1ef8ef2cf 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -69,7 +69,7 @@ module.exports = function(grunt) { tasks: ['concat:css'] }, sass: { - files: ['src/sass/**/*.scss'], + files: ['src/sass/**/**/*.scss'], tasks: ['sass', 'concat:css'] }, main: { diff --git a/public/views/onboarding/collectEmail.html b/public/views/onboarding/collectEmail.html index 5f01e1e53..5145b53e7 100644 --- a/public/views/onboarding/collectEmail.html +++ b/public/views/onboarding/collectEmail.html @@ -6,22 +6,22 @@

Wallet Created

+
+
+

Where would you like to receive email notifications about payments

+
+
+ +
+
+ +
+
+
-
-
-

Where would you like to receive email notifications about payments

-
-
- -
-
- -
-
-
diff --git a/src/sass/views/onboarding/onboard-collect-email.scss b/src/sass/views/onboarding/onboard-collect-email.scss index 7ffd453bb..ea71241ee 100644 --- a/src/sass/views/onboarding/onboard-collect-email.scss +++ b/src/sass/views/onboarding/onboard-collect-email.scss @@ -1,5 +1,8 @@ #onboarding-collect-email { background: rgb(17, 209, 166); + .scroll { + height: 100%; + } #success-image { margin-top: 4rem; } @@ -18,7 +21,7 @@ animation-duration: 1s; animation-delay: 2s; position: absolute; - bottom: -100%; + bottom: -13rem; animation-fill-mode: forwards; z-index: 5; margin-top: 0; From 3e8ce8854ff4c973efd8c60ef5ed12c9c41acf98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Fri, 2 Sep 2016 16:05:25 -0300 Subject: [PATCH 08/24] clear history on settings --- src/js/controllers/export.js | 3 ++- src/js/controllers/paperWallet.js | 3 ++- src/js/controllers/paymentUri.js | 3 ++- src/js/controllers/preferencesDelete.js | 3 ++- src/js/controllers/preferencesHistory.js | 3 ++- src/js/controllers/preferencesInformation.js | 4 +++- src/js/services/applicationService.js | 3 ++- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/js/controllers/export.js b/src/js/controllers/export.js index 0a0690e85..1e4d78e47 100644 --- a/src/js/controllers/export.js +++ b/src/js/controllers/export.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('exportController', - function($rootScope, $scope, $timeout, $log, lodash, backupService, walletService, storageService, profileService, platformInfo, gettext, gettextCatalog, $state, $stateParams, popupService) { + function($rootScope, $scope, $timeout, $log, $ionicHistory, lodash, backupService, walletService, storageService, profileService, platformInfo, gettext, gettextCatalog, $state, $stateParams, popupService) { var prevState; var isWP = platformInfo.isWP; var isAndroid = platformInfo.isAndroid; @@ -63,6 +63,7 @@ angular.module('copayApp.controllers').controller('exportController', popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export')); return; } + $ionicHistory.clearHistory(); $state.go('tabs.home'); }); }); diff --git a/src/js/controllers/paperWallet.js b/src/js/controllers/paperWallet.js index db0d21bca..6393fdc3f 100644 --- a/src/js/controllers/paperWallet.js +++ b/src/js/controllers/paperWallet.js @@ -1,5 +1,5 @@ angular.module('copayApp.controllers').controller('paperWalletController', - function($scope, $timeout, $log, $ionicModal, configService, profileService, $state, addressService, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) { + function($scope, $timeout, $log, $ionicModal, $ionicHistory, configService, profileService, $state, addressService, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) { var wallet = profileService.getWallet($stateParams.walletId); var rawTx; @@ -102,6 +102,7 @@ angular.module('copayApp.controllers').controller('paperWalletController', } else { var type = walletService.getViewStatus(wallet, txp); $scope.openStatusModal(type, txp, function() { + $ionicHistory.clearHistory(); $state.go('tabs.home'); }); } diff --git a/src/js/controllers/paymentUri.js b/src/js/controllers/paymentUri.js index 79628814c..70cf15d51 100644 --- a/src/js/controllers/paymentUri.js +++ b/src/js/controllers/paymentUri.js @@ -1,6 +1,6 @@ 'use strict'; angular.module('copayApp.controllers').controller('paymentUriController', - function($rootScope, $scope, $stateParams, $location, $timeout, profileService, configService, lodash, bitcore, $state) { + function($rootScope, $scope, $stateParams, $location, $timeout, $ionicHistory, profileService, configService, lodash, bitcore, $state) { function strip(number) { return (parseFloat(number.toPrecision(12))); }; @@ -47,6 +47,7 @@ angular.module('copayApp.controllers').controller('paymentUriController', this.selectWallet = function(wid) { var self = this; profileService.setAndStoreFocus(wid, function() {}); + $ionicHistory.clearHistory(); $state.go('tabs.home'); $timeout(function() { $rootScope.$emit('paymentUri', self.bitcoinURI); diff --git a/src/js/controllers/preferencesDelete.js b/src/js/controllers/preferencesDelete.js index c66e2c165..19cdccb1e 100644 --- a/src/js/controllers/preferencesDelete.js +++ b/src/js/controllers/preferencesDelete.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesDeleteWalletController', - function($scope, $ionicPopup, $stateParams, $ionicNavBarDelegate, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) { + function($scope, $ionicPopup, $stateParams, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) { $ionicNavBarDelegate.title(gettextCatalog.getString('Delete Wallet')); var wallet = profileService.getWallet($stateParams.walletId); $scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' '; @@ -37,6 +37,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro if (err) { popupService.showAlert(gettextCatalog.getString('Error'), err.message || err); } else { + $ionicHistory.clearHistory(); $state.go('tabs.home'); } }); diff --git a/src/js/controllers/preferencesHistory.js b/src/js/controllers/preferencesHistory.js index 721f3723e..2d478ae04 100644 --- a/src/js/controllers/preferencesHistory.js +++ b/src/js/controllers/preferencesHistory.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesHistory', - function($scope, $log, $stateParams, $timeout, $ionicNavBarDelegate, gettextCatalog, storageService, $state, profileService, lodash) { + function($scope, $log, $stateParams, $timeout, $ionicNavBarDelegate, gettextCatalog, storageService, $state, $ionicHistory, profileService, lodash) { $ionicNavBarDelegate.title(gettextCatalog.getString('Transaction History')); var wallet = profileService.getWallet($stateParams.walletId); var c = wallet.credentials; @@ -126,6 +126,7 @@ angular.module('copayApp.controllers').controller('preferencesHistory', $scope.$emit('Local/ClearHistory'); $timeout(function() { + $ionicHistory.clearHistory(); $state.go('tabs.home'); }, 100); }); diff --git a/src/js/controllers/preferencesInformation.js b/src/js/controllers/preferencesInformation.js index 2848d95ce..fd8d9f99c 100644 --- a/src/js/controllers/preferencesInformation.js +++ b/src/js/controllers/preferencesInformation.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesInformation', - function($scope, $log, $timeout, $ionicNavBarDelegate, platformInfo, gettextCatalog, lodash, profileService, configService, $stateParams, walletService, $state) { + function($scope, $log, $timeout, $ionicNavBarDelegate, $ionicHistory, platformInfo, gettextCatalog, lodash, profileService, configService, $stateParams, walletService, $state) { $ionicNavBarDelegate.title(gettextCatalog.getString('Wallet Information')); var base = 'xpub'; var wallet = profileService.getWallet($stateParams.walletId); @@ -105,6 +105,7 @@ angular.module('copayApp.controllers').controller('preferencesInformation', opts.colorFor[walletId] = color; configService.set(opts, function(err) { + $ionicHistory.clearHistory(); $state.go('tabs.home'); if (err) $log.warn(err); }); @@ -116,6 +117,7 @@ angular.module('copayApp.controllers').controller('preferencesInformation', $scope.scan = function() { walletService.startScan(wallet); + $ionicHistory.clearHistory(); $state.go('tabs.home'); }; diff --git a/src/js/services/applicationService.js b/src/js/services/applicationService.js index b5e80e4ea..6c7de2954 100644 --- a/src/js/services/applicationService.js +++ b/src/js/services/applicationService.js @@ -1,6 +1,6 @@ 'use strict'; angular.module('copayApp.services') - .factory('applicationService', function($rootScope, $timeout, platformInfo, $state) { + .factory('applicationService', function($rootScope, $timeout, $ionicHistory, platformInfo, $state) { var root = {}; var isChromeApp = platformInfo.isChromeApp; @@ -19,6 +19,7 @@ angular.module('copayApp.services') if (isChromeApp) { chrome.runtime.reload(); } else if (isNW) { + $ionicHistory.clearHistory(); $state.go('tabs.home'); $timeout(function() { var win = require('nw.gui').Window.get(); From d7da13e46ce8315a8fb6abc24d9348f202a08e97 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Fri, 2 Sep 2016 16:29:14 -0300 Subject: [PATCH 09/24] Removes ionicscrolldelegate --- src/js/controllers/onboarding/collectEmail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/controllers/onboarding/collectEmail.js b/src/js/controllers/onboarding/collectEmail.js index a383a78b3..8fcda40f5 100644 --- a/src/js/controllers/onboarding/collectEmail.js +++ b/src/js/controllers/onboarding/collectEmail.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $stateParams, $ionicScrollDelegate, profileService, configService, walletService, platformInfo) { +angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $stateParams, profileService, configService, walletService, platformInfo) { var isCordova = platformInfo.isCordova; var isWP = platformInfo.isWP; From 1ad2df0714a6fcefb51411ad90da4bf455b58e8f Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 2 Sep 2016 16:36:18 -0300 Subject: [PATCH 10/24] fix init wallet view model --- src/js/services/profileService.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 2e11c97d4..9a3ae09fa 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -30,13 +30,12 @@ angular.module('copayApp.services') root.updateWalletSettings = function(wallet) { var defaults = configService.getDefaults(); - var config = configService.getSync(); - - wallet.usingCustomBWS = config.bwsFor && config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url); - - wallet.name = config.aliasFor && (config.aliasFor[wallet.id] || wallet.credentials.walletName); - wallet.color = config.colorFor && (config.colorFor[wallet.id] || '#4A90E2'); - wallet.email = config.emailFor && config.emailFor[wallet.id]; + configService.whenAvailable(function(config){ + wallet.usingCustomBWS = config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url); + wallet.name = config.aliasFor[wallet.id] || wallet.credentials.walletName; + wallet.color = config.colorFor[wallet.id] || '#4A90E2'; + wallet.email = config.emailFor && config.emailFor[wallet.id]; + }); } root.setBackupFlag = function(walletId) { @@ -78,7 +77,7 @@ angular.module('copayApp.services') var opts = opts || {}; var walletId = wallet.credentials.walletId; - if ((root.wallet[walletId] && root.wallet[walletId].started) || opts.force) { + if ((root.wallet[walletId] && root.wallet[walletId].started) && !opts.force) { return false; } From 4b2e72a28ff29e37e47c9af6923854da0624fefc Mon Sep 17 00:00:00 2001 From: Javier Date: Fri, 2 Sep 2016 16:42:14 -0300 Subject: [PATCH 11/24] fix empty object - navigate to home --- public/views/preferencesInformation.html | 2 +- src/js/controllers/preferencesHistory.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/views/preferencesInformation.html b/public/views/preferencesInformation.html index 7e5ee438e..e527bdf63 100644 --- a/public/views/preferencesInformation.html +++ b/public/views/preferencesInformation.html @@ -101,7 +101,7 @@
Only Main (not change) addresses are shown. The addresses on this list were not verified locally at this time.
- - - {{'Create new wallet' | translate}} - +
- +
+ - + + Show advanced options + Hide advanced options + -
- +
+ - - 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. +
+
- - - - -
-
- WARNING: The password cannot be recovered. Be sure to write it down. The wallet can not be restored without the password. -
-
- - + - + - + - + - - Testnet - + + + Testnet + - - Single Address Wallet - For audit purposes - + + Single Address Wallet + For audit purposes + -
-
+
+
- + - + - -
- + diff --git a/public/views/tab-create-shared.html b/public/views/tab-create-shared.html index 2d5dc1ccf..9b1fc4409 100644 --- a/public/views/tab-create-shared.html +++ b/public/views/tab-create-shared.html @@ -1,159 +1,145 @@ - - - - - - {{'Create new wallet' | translate}} - +
- +
+ - + -
- + - + - + + Show advanced options + Hide advanced options + - +
- - 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. +
+
- - -
-
- WARNING: The password cannot be recovered. Be sure to write it down. The wallet can not be restored without the password. -
-
- - + - + - + - + - - Testnet - + + Testnet + - - Single Address Wallet - For audit purposes - + + Single Address Wallet + For audit purposes + -
-
+
+
- + - + - -
-
+ diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index 1faf089f7..17716d589 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -190,27 +190,6 @@ angular.module('copayApp.controllers').controller('createController', }, 100); } - this.formFocus = function(what) { - if (!this.isWindowsPhoneApp) return - - if (what && what == 'my-name') { - this.hideWalletName = true; - this.hideTabs = true; - } else if (what && what == 'wallet-name') { - this.hideTabs = true; - } else { - this.hideWalletName = false; - this.hideTabs = false; - } - $timeout(function() { - $rootScope.$digest(); - }, 1); - }; - - $scope.$on("$destroy", function() { - $rootScope.hideWalletNavigation = false; - }); - updateSeedSourceSelect(1); self.setSeedSource(); }); diff --git a/src/js/routes.js b/src/js/routes.js index 7660ebf31..f7857c67a 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -301,7 +301,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }) .state('tabs.create', { url: '/create', - abstract: true, + // abstract: true, templateUrl: 'views/create.html', views: { 'tab-home': { @@ -309,22 +309,22 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }, } }) - .state('tabs.create.personal', { - url: '/tab-create-personal', - views: { - 'tab-create-personal': { - templateUrl: 'views/tab-create-personal.html', - }, - } - }) - .state('tabs.create.shared', { - url: '/tab-create-shared', - views: { - 'tab-create-shared': { - templateUrl: 'views/tab-create-shared.html', - }, - } - }) + // .state('tabs.create.personal', { + // url: '/tab-create-personal', + // views: { + // 'tab-create-personal': { + // templateUrl: 'views/tab-create-personal.html', + // }, + // } + // }) + // .state('tabs.create.shared', { + // url: '/tab-create-shared', + // views: { + // 'tab-create-shared': { + // templateUrl: 'views/tab-create-shared.html', + // }, + // } + // }) /* * @@ -812,21 +812,21 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr $ionicPlatform.registerBackButtonAction(function(e) { - var fromDisclaimer = $ionicHistory.currentStateName().match(/disclaimer/) ? 'true' : ''; - var fromTabs = $ionicHistory.currentStateName().match(/tabs/) ? 'true' : ''; + var fromDisclaimer = $ionicHistory.currentStateName().match(/disclaimer/) ? 'true' : ''; + var fromTabs = $ionicHistory.currentStateName().match(/tabs/) ? 'true' : ''; - if ($rootScope.backButtonPressedOnceToExit || fromDisclaimer) { - ionic.Platform.exitApp(); - } else if ($ionicHistory.backView() && !fromTabs) { - $ionicHistory.goBack(); - } else { - $rootScope.backButtonPressedOnceToExit = true; - window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit')); - setInterval(function() { - $rootScope.backButtonPressedOnceToExit = false; - }, 5000); - } - e.preventDefault(); + if ($rootScope.backButtonPressedOnceToExit || fromDisclaimer) { + ionic.Platform.exitApp(); + } else if ($ionicHistory.backView() && !fromTabs) { + $ionicHistory.goBack(); + } else { + $rootScope.backButtonPressedOnceToExit = true; + window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit')); + setInterval(function() { + $rootScope.backButtonPressedOnceToExit = false; + }, 5000); + } + e.preventDefault(); }, 101); $ionicPlatform.on('pause', function() { From a200d42bcd4024b6c037232afbc16531fec31647 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 5 Sep 2016 14:59:11 -0300 Subject: [PATCH 21/24] Ref About --- app-template/copay/appConfig.json | 4 +- public/views/onboarding/terms.html | 2 +- public/views/preferencesAbout.html | 65 ++++++++++++----------- public/views/preferencesLanguage.html | 12 +++-- public/views/preferencesLogs.html | 29 ++++++---- public/views/tab-settings.html | 26 +++++---- public/views/termsOfUse.html | 18 +++---- public/views/translators.html | 46 ++++++++-------- public/views/walletDetails.html | 2 +- src/js/controllers/amazon.js | 9 +--- src/js/controllers/buyAmazon.js | 9 +--- src/js/controllers/glidera.js | 9 +--- src/js/controllers/modals/txDetails.js | 9 +--- src/js/controllers/onboarding/terms.js | 6 ++- src/js/controllers/preferencesAbout.js | 9 +++- src/js/controllers/preferencesLanguage.js | 6 ++- src/js/controllers/preferencesLogs.js | 14 +++-- src/js/controllers/tab-settings.js | 4 +- src/js/controllers/termOfUse.js | 9 +++- src/js/controllers/translators.js | 8 +++ src/js/controllers/walletDetails.js | 5 +- src/js/directives/copyToClipboard.js | 4 +- src/js/services/externalLinkService.js | 14 +++++ src/js/services/nodeWebkit.js | 38 ------------- src/js/services/nodeWebkitService.js | 22 ++++++++ 25 files changed, 208 insertions(+), 171 deletions(-) create mode 100644 src/js/controllers/translators.js create mode 100644 src/js/services/externalLinkService.js delete mode 100644 src/js/services/nodeWebkit.js create mode 100644 src/js/services/nodeWebkitService.js diff --git a/app-template/copay/appConfig.json b/app-template/copay/appConfig.json index 60afe4b6b..4bc581559 100644 --- a/app-template/copay/appConfig.json +++ b/app-template/copay/appConfig.json @@ -5,6 +5,8 @@ "nameCase": "Copay", "nameCaseNoSpace": "Copay", "bundleName": "copay", + "gitHubRepoName": "copay", + "disclaimerUrl": "https://copay.io/disclaimer", "url": "https://copay.io", "appDescription": "Copay Bitcoin Wallet", "winAppName": "CopayWallet", @@ -18,5 +20,5 @@ "coinbase": true, "glidera": true, "amazon": true - } + } } diff --git a/public/views/onboarding/terms.html b/public/views/onboarding/terms.html index 775c14fdb..c2b380fad 100644 --- a/public/views/onboarding/terms.html +++ b/public/views/onboarding/terms.html @@ -10,7 +10,7 @@
I have read, understood, and agree with the Terms of Use diff --git a/public/views/preferencesAbout.html b/public/views/preferencesAbout.html index 550cd2d9b..1604fe98e 100644 --- a/public/views/preferencesAbout.html +++ b/public/views/preferencesAbout.html @@ -7,36 +7,41 @@ -
- Release information -
-
- - Version - - v{{version}} - -
-
- - Commit hash - - #{{commitHash}} - -
-
-
-
- - Terms of Use -
-
- - Translators -
-
- - Session log +
+
+ Release information +
+
+ + Version + + v{{version}} + +
+
+ + Commit hash + + #{{commitHash}} + +
+
+
+
+ + Terms of Use + +
+
+ + Translators + +
+
+ + Session log + +
diff --git a/public/views/preferencesLanguage.html b/public/views/preferencesLanguage.html index 3adb8a34a..df04e0160 100644 --- a/public/views/preferencesLanguage.html +++ b/public/views/preferencesLanguage.html @@ -8,10 +8,12 @@ {{lang.name}} - All contributions to Copay's translation are welcome. Sign up at crowdin.com and join the Copay project at - https://crowdin.com/project/copay. - - Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language. - +
+ All contributions to Copay's translation are welcome. Sign up at crowdin.com and join the Copay project at + https://crowdin.com/project/copay. + + Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language. + +
diff --git a/public/views/preferencesLogs.html b/public/views/preferencesLogs.html index dcd0add3e..8d2d1311b 100644 --- a/public/views/preferencesLogs.html +++ b/public/views/preferencesLogs.html @@ -4,16 +4,25 @@ - - + -
    -
  • - - {{l.msg}} - -
  • -
diff --git a/public/views/tab-settings.html b/public/views/tab-settings.html index d0f99acc0..3f0ec2605 100644 --- a/public/views/tab-settings.html +++ b/public/views/tab-settings.html @@ -6,7 +6,6 @@
-
Address Book @@ -14,36 +13,40 @@
Preferences
-
+
Language {{currentLanguageName|translate}} +
-
+
Unit {{unitName}} +
-
+
Alternative Currency {{selectedAlternative.name}} +
-
- +
+ Bitcoin Network Fee Policy {{feeOpts[currentFeeLevel]|translate}} +
@@ -81,7 +84,7 @@
Wallets Settings
-
@@ -92,14 +95,15 @@ Incomplete +
-
- - About Bitpay Wallet +
+ + About {{appName}} +
-
diff --git a/public/views/termsOfUse.html b/public/views/termsOfUse.html index 788b1b4b0..7fd05725a 100644 --- a/public/views/termsOfUse.html +++ b/public/views/termsOfUse.html @@ -5,14 +5,14 @@ - -

-

-

- + +
+
+
+
diff --git a/public/views/translators.html b/public/views/translators.html index 7163e1e45..cb865e3eb 100644 --- a/public/views/translators.html +++ b/public/views/translators.html @@ -5,29 +5,29 @@ - -

Translation Credits

-
    -
  • kinoshitajonaJapanese
  • -
  • KirvxFrench
  • -
  • saschadGerman
  • -
  • cmgustavo83Spanish
  • -
  • RussianNeuroMancerRussian
  • -
  • HostFatItalian
  • -
  • xm2hiChinese
  • -
  • Pirx1618Polish
  • -
  • mareksipCzech
  • -
-
-
-

- All contributions to Copay's translation are welcome. Sign up at crowdin.com and join the Copay project at - https://crowdin.com/project/copay. -

- - Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language. - -
+ +
+
+ Translation Credits
+
kinoshitajonaJapanese
+
KirvxFrench
+
saschadGerman
+
cmgustavo83Spanish
+
RussianNeuroMancerRussian
+
HostFatItalian
+
xm2hiChinese
+
Pirx1618Polish
+
mareksipCzech
+
+
+

+ All contributions to Copay's translation are welcome. Sign up at crowdin.com and join the Copay project at + https://crowdin.com/project/copay. +

+ + Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language. + +
diff --git a/public/views/walletDetails.html b/public/views/walletDetails.html index 6e586caee..78cd5ce10 100644 --- a/public/views/walletDetails.html +++ b/public/views/walletDetails.html @@ -94,7 +94,7 @@
-
+
{{newRelease}}
diff --git a/src/js/controllers/amazon.js b/src/js/controllers/amazon.js index 353c73600..302bd2a24 100644 --- a/src/js/controllers/amazon.js +++ b/src/js/controllers/amazon.js @@ -1,15 +1,10 @@ 'use strict'; angular.module('copayApp.controllers').controller('amazonController', - function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo, nodeWebkit, popupService) { + function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo, externalLinkService, popupService) { $scope.openExternalLink = function(url, target) { - if (platformInfo.isNW) { - nodeWebkit.openExternalLink(url); - } else { - target = target || '_blank'; - var ref = window.open(url, target, 'location=no'); - } + externalLinkService.open(url, target); }; this.init = function() { diff --git a/src/js/controllers/buyAmazon.js b/src/js/controllers/buyAmazon.js index 61409d6ef..b0b2d948d 100644 --- a/src/js/controllers/buyAmazon.js +++ b/src/js/controllers/buyAmazon.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('buyAmazonController', - function($scope, $log, $timeout, $state, lodash, profileService, bwcError, gettextCatalog, configService, walletService, amazonService, ongoingProcess, platformInfo, nodeWebkit, popupService) { + function($scope, $log, $timeout, $state, lodash, profileService, bwcError, gettextCatalog, configService, walletService, amazonService, ongoingProcess, platformInfo, externalLinkService, popupService) { var self = this; var wallet; @@ -16,12 +16,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController', }); $scope.openExternalLink = function(url, target) { - if (platformInfo.isNW) { - nodeWebkit.openExternalLink(url); - } else { - target = target || '_blank'; - var ref = window.open(url, target, 'location=no'); - } + externalLinkService.open(url, target); }; this.init = function() { diff --git a/src/js/controllers/glidera.js b/src/js/controllers/glidera.js index 8eaac6558..e1703411a 100644 --- a/src/js/controllers/glidera.js +++ b/src/js/controllers/glidera.js @@ -1,15 +1,10 @@ 'use strict'; angular.module('copayApp.controllers').controller('glideraController', - function($scope, $timeout, $ionicModal, $log, storageService, glideraService, ongoingProcess, platformInfo, nodeWebkit, popupService, gettextCatalog) { + function($scope, $timeout, $ionicModal, $log, storageService, glideraService, ongoingProcess, platformInfo, externalLinkService, popupService, gettextCatalog) { $scope.openExternalLink = function(url, target) { - if (platformInfo.isNW) { - nodeWebkit.openExternalLink(url); - } else { - target = target || '_blank'; - var ref = window.open(url, target, 'location=no'); - } + externalLinkService.open(url, target); }; $scope.init = function(accessToken) { diff --git a/src/js/controllers/modals/txDetails.js b/src/js/controllers/modals/txDetails.js index 2db8bb8b1..3de9cda31 100644 --- a/src/js/controllers/modals/txDetails.js +++ b/src/js/controllers/modals/txDetails.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $stateParams, $ionicPopup, gettextCatalog, profileService, configService, lodash, txFormatService, platformInfo) { +angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $stateParams, $ionicPopup, gettextCatalog, profileService, configService, lodash, txFormatService, platformInfo, externalLinkService) { var self = $scope.self; var wallet = profileService.getWallet($stateParams.walletId); @@ -81,12 +81,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio }; $scope.openExternalLink = function(url, target) { - if (platformInfo.isNW) { - nodeWebkit.openExternalLink(url); - } else { - target = target || '_blank'; - var ref = window.open(url, target, 'location=no'); - } + externalLinkService.open(url, target); }; $scope.getShortNetworkName = function() { diff --git a/src/js/controllers/onboarding/terms.js b/src/js/controllers/onboarding/terms.js index e3f30c321..a76d52b96 100644 --- a/src/js/controllers/onboarding/terms.js +++ b/src/js/controllers/onboarding/terms.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, uxLanguage, profileService) { +angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, uxLanguage, profileService, externalLinkService) { $scope.lang = uxLanguage.currentLanguage; $scope.confirm = function() { @@ -12,4 +12,8 @@ angular.module('copayApp.controllers').controller('termsController', function($s }); }; + $scope.openExternalLink = function(url, target) { + externalLinkService.open(url, target); + }; + }); diff --git a/src/js/controllers/preferencesAbout.js b/src/js/controllers/preferencesAbout.js index 002c399b4..55ae224d9 100644 --- a/src/js/controllers/preferencesAbout.js +++ b/src/js/controllers/preferencesAbout.js @@ -1,9 +1,14 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesAbout', - function($scope, $window, $ionicNavBarDelegate, gettextCatalog) { - $ionicNavBarDelegate.title(gettextCatalog.getString('About Copay')); + function($scope, $window, $ionicNavBarDelegate, gettextCatalog, externalLinkService) { + $ionicNavBarDelegate.title(gettextCatalog.getString('About') + ' ' + $window.appConfig.nameCase); $scope.version = $window.version; $scope.commitHash = $window.commitHash; + $scope.name = $window.appConfig.gitHubRepoName; + + $scope.openExternalLink = function(url, target) { + externalLinkService.open(url, target); + }; }); diff --git a/src/js/controllers/preferencesLanguage.js b/src/js/controllers/preferencesLanguage.js index 0406d3542..7690eb6b6 100644 --- a/src/js/controllers/preferencesLanguage.js +++ b/src/js/controllers/preferencesLanguage.js @@ -1,9 +1,13 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesLanguageController', - function($scope, $log, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, configService, profileService, uxLanguage, walletService) { + function($scope, $log, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, configService, profileService, uxLanguage, walletService, externalLinkService) { $ionicNavBarDelegate.title(gettextCatalog.getString('Language')); + $scope.openExternalLink = function(url, target) { + externalLinkService.open(url, target); + }; + $scope.init = function() { $scope.availableLanguages = uxLanguage.getLanguages(); $scope.currentLanguage = uxLanguage.getCurrentLanguage(); diff --git a/src/js/controllers/preferencesLogs.js b/src/js/controllers/preferencesLogs.js index 153a279aa..6c9a8c16d 100644 --- a/src/js/controllers/preferencesLogs.js +++ b/src/js/controllers/preferencesLogs.js @@ -8,13 +8,19 @@ angular.module('copayApp.controllers').controller('preferencesLogs', $scope.logs = historicLog.get(); } - $scope.sendLogs = function() { - var body = 'Copay Session Logs\n Be careful, this could contain sensitive private data\n\n'; - body += '\n\n'; - body += $scope.logs.map(function(v) { + $scope.prepare = function() { + var log = 'Copay Session Logs\n Be careful, this could contain sensitive private data\n\n'; + log += '\n\n'; + log += $scope.logs.map(function(v) { return v.msg; }).join('\n'); + return log; + }; + + $scope.sendLogs = function() { + var body = $scope.prepare(); + window.plugins.socialsharing.shareViaEmail( body, 'Copay Logs', diff --git a/src/js/controllers/tab-settings.js b/src/js/controllers/tab-settings.js index ca45e1411..e4ce0e833 100644 --- a/src/js/controllers/tab-settings.js +++ b/src/js/controllers/tab-settings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) { +angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $ionicModal, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) { $scope.init = function() { @@ -9,6 +9,8 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct var isWP = platformInfo.isWP; var isIOS = platformInfo.isIOS; + $scope.appName = $window.appConfig.nameCase; + $scope.unitName = config.wallet.settings.unitName; $scope.currentLanguageName = uxLanguage.getCurrentLanguageName(); $scope.selectedAlternative = { diff --git a/src/js/controllers/termOfUse.js b/src/js/controllers/termOfUse.js index c66f55b8c..7632e187a 100644 --- a/src/js/controllers/termOfUse.js +++ b/src/js/controllers/termOfUse.js @@ -1,7 +1,12 @@ 'use strict'; angular.module('copayApp.controllers').controller('termOfUseController', - function($scope, uxLanguage, $ionicNavBarDelegate, gettextCatalog) { - $ionicNavBarDelegate.title(gettextCatalog.getString('About Copay')); + function($scope, $window, uxLanguage, $ionicNavBarDelegate, gettextCatalog, externalLinkService) { + $ionicNavBarDelegate.title(gettextCatalog.getString('Terms Of Use')); $scope.lang = uxLanguage.currentLanguage; + $scope.disclaimerUrl = $window.appConfig.disclaimerUrl; + + $scope.openExternalLink = function(url, target) { + externalLinkService.open(url, target); + }; }); diff --git a/src/js/controllers/translators.js b/src/js/controllers/translators.js new file mode 100644 index 000000000..7f09f58d5 --- /dev/null +++ b/src/js/controllers/translators.js @@ -0,0 +1,8 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('translatorsController', + function($scope, externalLinkService) { + $scope.openExternalLink = function(url, target) { + externalLinkService.open(url, target); + }; + }); diff --git a/src/js/controllers/walletDetails.js b/src/js/controllers/walletDetails.js index 349e57bf2..6e8f7b078 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, $ionicNavBarDelegate, $state, $stateParams, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, $ionicPopup, txpModalService) { +angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, $ionicPopup, txpModalService, externalLinkService) { var isCordova = platformInfo.isCordova; var isWP = platformInfo.isWP; @@ -12,6 +12,9 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun var HISTORY_SHOW_LIMIT = 10; $scope.txps = []; + $scope.openExternalLink = function(url, target) { + externalLinkService.open(url, target); + }; var setPendingTxps = function(txps) { if (!txps) { diff --git a/src/js/directives/copyToClipboard.js b/src/js/directives/copyToClipboard.js index 1e9cbfe92..b6523b6f1 100644 --- a/src/js/directives/copyToClipboard.js +++ b/src/js/directives/copyToClipboard.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.directives') - .directive('copyToClipboard', function(platformInfo, nodeWebkit, gettextCatalog, ionicToast, clipboard) { + .directive('copyToClipboard', function(platformInfo, nodeWebkitService, gettextCatalog, ionicToast, clipboard) { return { restrict: 'A', scope: { @@ -22,7 +22,7 @@ angular.module('copayApp.directives') window.cordova.plugins.clipboard.copy(data); window.plugins.toast.showShortCenter(msg); } else if (isNW) { - nodeWebkit.writeToClipboard(data); + nodeWebkitService.writeToClipboard(data); scope.$apply(function() { ionicToast.show(msg, 'bottom', false, 1000); }); diff --git a/src/js/services/externalLinkService.js b/src/js/services/externalLinkService.js new file mode 100644 index 000000000..aa1951fd6 --- /dev/null +++ b/src/js/services/externalLinkService.js @@ -0,0 +1,14 @@ +'use strict'; + +angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService) { + + this.open = function(url, target) { + if (platformInfo.isNW) { + nodeWebkitService.openExternalLink(url); + } else { + target = target || '_blank'; + var ref = window.open(url, target, 'location=no'); + } + }; + +}); diff --git a/src/js/services/nodeWebkit.js b/src/js/services/nodeWebkit.js deleted file mode 100644 index c1e13d84b..000000000 --- a/src/js/services/nodeWebkit.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -angular.module('copayApp.services').factory('nodeWebkit', function nodeWebkitFactory() { - var root = {}; - - var isNodeWebkit = function() { - var isNode = (typeof process !== "undefined" && typeof require !== "undefined"); - if(isNode) { - try { - return (typeof require('nw.gui') !== "undefined"); - } catch(e) { - return false; - } - } - }; - - root.readFromClipboard = function() { - if (!isNodeWebkit()) return; - var gui = require('nw.gui'); - var clipboard = gui.Clipboard.get(); - return clipboard.get(); - }; - - root.writeToClipboard = function(text) { - if (!isNodeWebkit()) return; - var gui = require('nw.gui'); - var clipboard = gui.Clipboard.get(); - return clipboard.set(text); - }; - - root.openExternalLink = function(url) { - if (!isNodeWebkit()) return; - var gui = require('nw.gui'); - return gui.Shell.openExternal(url); - }; - - return root; -}); diff --git a/src/js/services/nodeWebkitService.js b/src/js/services/nodeWebkitService.js new file mode 100644 index 000000000..a2b836ca5 --- /dev/null +++ b/src/js/services/nodeWebkitService.js @@ -0,0 +1,22 @@ +'use strict'; + +angular.module('copayApp.services').service('nodeWebkitService', function() { + + this.readFromClipboard = function() { + var gui = require('nw.gui'); + var clipboard = gui.Clipboard.get(); + return clipboard.get(); + }; + + this.writeToClipboard = function(text) { + var gui = require('nw.gui'); + var clipboard = gui.Clipboard.get(); + return clipboard.set(text); + }; + + this.openExternalLink = function(url) { + var gui = require('nw.gui'); + return gui.Shell.openExternal(url); + }; + +}); From 6ba7b7c6558401febb05ccddfdb58bd28e317a94 Mon Sep 17 00:00:00 2001 From: Javier Date: Mon, 5 Sep 2016 17:14:41 -0300 Subject: [PATCH 22/24] complete scope data for create wallets --- public/views/create.html | 6 +- public/views/tab-create-personal.html | 65 +++++---------- public/views/tab-create-shared.html | 96 ++++++++-------------- src/js/controllers/create.js | 113 ++++++++++++-------------- src/js/routes.js | 17 ---- 5 files changed, 110 insertions(+), 187 deletions(-) diff --git a/public/views/create.html b/public/views/create.html index 66a67492c..49a483906 100644 --- a/public/views/create.html +++ b/public/views/create.html @@ -6,12 +6,12 @@ - +
-
+
Personal Wallet
-
+
Shared Wallet
diff --git a/public/views/tab-create-personal.html b/public/views/tab-create-personal.html index 5d3295c00..94887a3ba 100644 --- a/public/views/tab-create-personal.html +++ b/public/views/tab-create-personal.html @@ -1,14 +1,13 @@ -
- +
@@ -19,74 +18,63 @@
-
- - - - diff --git a/public/views/tab-create-shared.html b/public/views/tab-create-shared.html index 9b1fc4409..a40c1df8b 100644 --- a/public/views/tab-create-shared.html +++ b/public/views/tab-create-shared.html @@ -1,48 +1,42 @@ -
- +
-