Merge branch 'ref/design' of https://github.com/bitpay/bitpay-wallet into feature/onboarding_last_steps

This commit is contained in:
Jamal Jackson 2016-09-08 10:33:21 -04:00
commit 57c1942740
33 changed files with 566 additions and 591 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $timeout, $log, lodash, bitpayCardService, configService, profileService, walletService, ongoingProcess, pbkdf2Service, moment, popupService) {
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $timeout, $log, lodash, bitpayCardService, configService, profileService, walletService, ongoingProcess, pbkdf2Service, moment, popupService, gettextCatalog, bwcError) {
var self = this;
var wallet;
@ -168,6 +168,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
};
walletService.createTx(wallet, txp, function(err, createdTxp) {
ongoingProcess.set('Processing Transaction...', false);
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
return;

View file

@ -17,6 +17,11 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$scope.showDescriptionPopup = function() {
$scope.data = {
comment: null
};
var commentPopup = $ionicPopup.show({
templateUrl: "views/includes/note.html",
title: gettextCatalog.getString('Set description'),
@ -25,9 +30,9 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$scope.commentPopupClose = function() {
commentPopup.close();
};
$scope.commentPopupSave = function(description) {
$log.debug('Saving description: ' + description);
$scope.description = description;
$scope.commentPopupSave = function() {
$log.debug('Saving description: ' + $scope.data.comment);
$scope.description = $scope.data.comment;
commentPopup.close();
};
};

View file

@ -1,20 +1,15 @@
'use strict';
angular.module('copayApp.controllers').controller('exportController',
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;
function($scope, $timeout, $log, $ionicHistory, backupService, walletService, storageService, profileService, platformInfo, gettextCatalog, $state, $stateParams, popupService) {
var wallet = profileService.getWallet($stateParams.walletId);
$scope.isEncrypted = wallet.isPrivKeyEncrypted();
$scope.isCordova = platformInfo.isCordova;
$scope.isSafari = platformInfo.isSafari;
$scope.init = function() {
$scope.supported = true;
$scope.exportQR = false;
$scope.noSignEnabled = false;
$scope.formData = {};
$scope.isEncrypted = wallet.isPrivKeyEncrypted();
$scope.isCordova = platformInfo.isCordova;
$scope.isSafari = platformInfo.isSafari;
$scope.formData.noSignEnabled = false;
$scope.showAdvanced = false;
$scope.wallet = wallet;
$scope.canSign = wallet.canSign();
@ -22,13 +17,15 @@ angular.module('copayApp.controllers').controller('exportController',
walletService.getEncodedWalletInfo(wallet, function(err, code) {
if (err || !code) {
$log.warn(err);
return $state.go('wallet.preferencesAdvanced')
return $ionicHistory.goBack();
}
if (!code)
$scope.supported = false;
else
$scope.exportWalletInfo = code;
$scope.formData.supported = false;
else {
$scope.formData.supported = true;
$scope.formData.exportWalletInfo = code;
}
$timeout(function() {
$scope.$apply();
@ -38,14 +35,25 @@ angular.module('copayApp.controllers').controller('exportController',
/*
EXPORT WITHOUT PRIVATE KEY - PENDING
*/
$scope.noSignEnabledChange = function() {
$scope.exportWalletInfo = encodeWalletInfo();
$timeout(function() {
$scope.$apply();
}, 1);
if (!$scope.formData.supported) return;
walletService.getEncodedWalletInfo(wallet, function(err, code) {
if (err) {
$log.error(err);
$scope.formData.supported = false;
$scope.formData.exportWalletInfo = null;
} else {
$scope.formData.supported = true;
$scope.formData.exportWalletInfo = code;
}
$timeout(function() {
$scope.$apply();
}, 1);
});
};
*/
$scope.downloadWalletBackup = function() {
$scope.getAddressbook(function(err, localAddressBook) {
@ -54,11 +62,11 @@ angular.module('copayApp.controllers').controller('exportController',
return;
}
var opts = {
noSign: $scope.noSignEnabled,
noSign: $scope.formData.noSignEnabled,
addressBook: localAddressBook
};
backupService.walletDownload($scope.password, opts, function(err) {
backupService.walletDownload($scope.formData.password, opts, function(err) {
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
return;
@ -91,11 +99,11 @@ angular.module('copayApp.controllers').controller('exportController',
return cb(null);
}
var opts = {
noSign: $scope.noSignEnabled,
noSign: $scope.formData.noSignEnabled,
addressBook: localAddressBook
};
var ew = backupService.walletExport($scope.password, opts);
var ew = backupService.walletExport($scope.formData.password, opts);
if (!ew) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
}
@ -132,7 +140,7 @@ angular.module('copayApp.controllers').controller('exportController',
var ew = backup;
if (!ew) return;
if ($scope.noSignEnabled)
if ($scope.formData.noSignEnabled)
name = name + '(No Private Key)';
var subject = 'Copay Wallet Backup: ' + name;

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, uxLanguage, profileService, externalLinkService) {
angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, $window, uxLanguage, profileService, externalLinkService) {
$scope.lang = uxLanguage.currentLanguage;
$scope.disclaimerUrl = $window.appConfig.disclaimerUrl;

View file

@ -1,15 +1,20 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesBitpayCardController',
function($scope, $ionicModal, bitpayCardService) {
function($scope, $state, $timeout, bitpayCardService, popupService) {
this.logout = function() {
$ionicModal.fromTemplateUrl('views/modals/bitpay-card-confirmation.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.bitpayCardConfirmationModal = modal;
$scope.bitpayCardConfirmationModal.show();
$scope.logout = function() {
var title = 'Are you sure you would like to log out of your Bitpay Card account?';
popupService.showConfirm(title, null, function(res) {
if (res) logout();
});
};
var logout = function() {
bitpayCardService.logout(function() {
$timeout(function() {
$state.go('bitpayCard.main');
}, 100);
});
};

View file

@ -144,7 +144,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
};
$scope.updateTxHistory = function(cb) {
if (!cb) cb = function() {};
if ($scope.updatingTxHistory) return;
$scope.updatingTxHistory = true;

View file

@ -434,7 +434,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
.state('tabs.preferences.export', {
abstract: true,
url: '/export',
views: {
'preferences': {
@ -442,24 +441,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
}
})
.state('tabs.preferences.export.file', {
url: '/tab-export-file',
needProfile: true,
views: {
'tab-export-file': {
templateUrl: 'views/tab-export-file.html',
},
}
})
.state('tabs.preferences.export.qrCode', {
url: '/tab-export-qrCode',
needProfile: true,
views: {
'tab-export-qrCode': {
templateUrl: 'views/tab-export-qrCode.html',
},
}
})
.state('tabs.preferences.preferencesBwsUrl', {
url: '/preferencesBwsUrl',
views: {

View file

@ -30,7 +30,7 @@ angular.module('copayApp.services')
root.updateWalletSettings = function(wallet) {
var defaults = configService.getDefaults();
configService.whenAvailable(function(config){
configService.whenAvailable(function(config) {
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';
@ -77,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;
}
@ -762,7 +762,7 @@ angular.module('copayApp.services')
var TIME_STAMP = 60 * 60 * 24 * 7;
var MAX = 100;
var ignored = {
var typeFilter1 = {
'NewBlock': 1,
'BalanceUpdated': 1,
'NewOutgoingTxByThirdParty': 1,
@ -771,6 +771,12 @@ angular.module('copayApp.services')
'TxProposalFinallyRejected': 1,
};
var typeFilter2 = {
'TxProposalAcceptedBy': 1,
'TxProposalRejectedBy': 1,
'NewTxProposal': 1,
}
var w = root.getWallets();
if (lodash.isEmpty(w)) return cb();
@ -868,9 +874,15 @@ angular.module('copayApp.services')
$log.warn('Error updating notifications:' + err);
} else {
var n = lodash.filter(wallet.cachedActivity.n, function(x) {
return !ignored[x.type];
return !typeFilter1[x.type];
});
if (wallet.n == 1) {
var n = lodash.filter(n, function(x) {
return !typeFilter2[x.type];
});
}
var idToName = {};
if (wallet.cachedStatus) {
lodash.each(wallet.cachedStatus.wallet.copayers, function(c) {
@ -911,7 +923,7 @@ angular.module('copayApp.services')
txps = txps.concat(x.pendingTxps);
});
txps = lodash.sortBy(txps, 'pendingForUs', 'createdOn');
txps = lodash.compact(lodash.flatten(txps)).slice(0,MAX);
txps = lodash.compact(lodash.flatten(txps)).slice(0, MAX);
var n = txps.length;
return cb(null, txps, n);
};

View file

@ -8,6 +8,10 @@
font-weight: bold;
}
.item.item-footer {
font-weight: lighter;
}
.icon.list-add-button {
color: #666;
font-size: 38px;

View file

@ -343,7 +343,7 @@ ul.wallet-selection.wallets {
position: absolute;
top: inherit;
left: 10px;
bottom: 26px;
bottom: 15px;
font-size: 20px;
color: #fff;
}
@ -996,5 +996,6 @@ input[type=number] {
@import "views/add";
@import "views/tab-home";
@import "views/walletDetails";
@import "views/bitpayCard";
@import 'views/onboarding/onboarding';
@import "views/includes/walletActivity";

View file

@ -0,0 +1,16 @@
#bitpayCard {
.amount {
width: 100%;
text-align: center;
padding: 2rem 1rem 1.5rem 1rem;
min-height: 115px;
margin-bottom: 25px;
border-color: #172565;
background-color: #1e3186;
background-image: linear-gradient(0deg, #172565, #172565 0%, transparent 0%);
color: #fff;
}
strong {
line-height: 100%;
}
}

View file

@ -14,14 +14,14 @@
opacity: 1;
background: #fff;
color: rgb(108, 108, 108);
height: 13rem;
height: 14rem;
animation-name: topBottom;
animation-iteration-count: 1;
animation-timing-function: ease-in;
animation-duration: 1s;
animation-delay: 2s;
position: absolute;
bottom: -13rem;
bottom: -14rem;
animation-fill-mode: forwards;
z-index: 5;
margin-top: 0;

View file

@ -1,6 +1,7 @@
#walletDetails {
.bar-header {
border: 0;
background: none;
.title, .button {
color: #fff;
}
@ -12,13 +13,17 @@
.amount {
width: 100%;
text-align: center;
padding: 2.5rem 1rem 1.5rem 1rem;
padding: 2rem 1rem 1.5rem 1rem;
color: #fff;
height: 150px;
margin-bottom: 25px;
min-height: 115px;
margin-bottom: 10px;
&-alternative {
line-height: 48px;
line-height: 36px;
}
strong {
line-height: 100%;
}
}
}