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

This commit is contained in:
Nick Cardin 2016-09-01 11:40:43 -04:00
commit 3a771e0e21
116 changed files with 1732 additions and 1371 deletions

View file

@ -1,27 +1,30 @@
@font-face {
font-family: 'Roboto';
font-family: 'roboto-regular';
font-style: normal;
font-weight: 400;
src: local('Roboto Regular'),
local('Roboto-Regular'),
url(../roboto-font/Roboto-Regular.ttf)
format('ttf');
url(../roboto-font/Roboto-Regular.ttf) format('truetype'),
url(../roboto-font/Roboto-Regular.woff) format('woff'),
url(../roboto-font/Roboto-Regular.woff2) format('woff2');
}
@font-face {
font-family: 'Roboto';
font-family: 'roboto-bold';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'),
local('Roboto-Bold'),
url(../roboto-font/Roboto-Bold.ttf)
format('ttf');
url(../roboto-font/Roboto-Bold.ttf) format('truetype'),
url(../roboto-font/Roboto-Bold.woff) format('woff'),
url(../roboto-font/Roboto-Bold.woff2) format('woff2');
}
@font-face {
font-family: 'Roboto';
font-family: 'roboto-italic';
font-style: italic;
font-weight: 400;
src: local('Roboto Italic'),
local('Roboto-Italic'),
url(../roboto-font/Roboto-Italic.ttf)
format('ttf');
url(../roboto-font/Roboto-Italic.ttf) format('truetype'),
url(../roboto-font/Roboto-Italic.woff) format('woff'),
url(../roboto-font/Roboto-Italic.woff2) format('woff2');
}

View file

@ -4,43 +4,19 @@ angular.module('copayApp.controllers').controller('activityController',
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) {
var self = this;
var setNotifications = function(notifications) {
var n = walletService.processNotifications(notifications);
$scope.notifications = n;
$timeout(function() {
$scope.$apply();
}, 1);
};
$scope.init = function() {
$scope.wallets = profileService.getWallets();
var i = $scope.wallets.length,
j = 0;
var timeSpan = 60 * 60 * 24 * 7;
var notifications = [];
$scope.fetchingNotifications = true;
lodash.each($scope.wallets, function(wallet) {
walletService.getNotifications(wallet, {
timeSpan: timeSpan
}, function(err, n) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
notifications.push(n);
if (++j == i) {
$scope.fetchingNotifications = false;
setNotifications(lodash.compact(lodash.flatten(notifications)));
};
});
profileService.getNotifications(50, function(err, n) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
$scope.fetchingNotifications = false;
$scope.notifications = n;
$timeout(function() {
$scope.$apply();
}, 1);
});
}
});

View file

@ -8,7 +8,7 @@ angular.module('copayApp.controllers').controller('backController', function($sc
$scope.importGoBack = function() {
if ($stateParams.fromOnboarding) $state.go('onboarding.welcome');
else $state.go('add.main');
else $state.go('tabs.add');
};
$scope.onboardingMailSkip = function() {

View file

@ -1,14 +1,10 @@
'use strict';
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $rootScope, $timeout, $log, $ionicModal, lodash, bitpayCardService, configService, profileService, walletService, ongoingProcess, pbkdf2Service, moment, platformInfo) {
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $timeout, $log, lodash, bitpayCardService, configService, profileService, walletService, ongoingProcess, pbkdf2Service, moment, popupService) {
var self = this;
var wallet;
if (platformInfo.isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#293C92");
}
$scope.$on('Wallet/Changed', function(event, w) {
if (lodash.isEmpty(w)) {
$log.debug('No wallet provided');
@ -87,7 +83,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.transactionHistory(dateRange, function(err, history) {
$scope.loadingHistory = false;
if (err) {
self.error = 'Error getting transactions';
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get transactions'));
return;
}
@ -120,13 +116,11 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
};
this.sendFunds = function() {
self.error = null;
if (lodash.isEmpty(wallet)) return;
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
$log.info('No signing proposal: No private key');
self.error = bwcError.msg('MISSING_PRIVATE_KEY');
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg('MISSING_PRIVATE_KEY'));
return;
}
@ -146,10 +140,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.topUp(dataSrc, function(err, invoiceId) {
if (err) {
ongoingProcess.set('Processing Transaction...', false);
self.error = bwcError.msg(err);
$timeout(function() {
$scope.$digest();
});
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
return;
}
@ -178,18 +169,12 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
walletService.createTx(wallet, txp, function(err, createdTxp) {
if (err) {
self.error = bwcError.msg(err);
$timeout(function() {
$scope.$digest();
});
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
return;
}
walletService.publishAndSign(wallet, createdTxp, function(err, tx) {
if (err) {
self.error = err;
$timeout(function() {
$scope.$digest();
});
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
return;
}
self.update();
@ -205,7 +190,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
};
this.authenticate = function() {
self.error = null;
var data = {
emailAddress : $scope.email,
@ -219,7 +203,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.authenticate(data, function(err, auth) {
self.authenticating = false;
if (err && err.data && err.data.error && !err.data.error.twoFactorPending) {
self.error = err.statusText || err.data.error || 'Authentiation error';
popupService.showAlert(gettextCatalog.getString('Error'), err.statusText || err.data.error || 'Authentiation error');
return;
}
@ -231,7 +215,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
};
this.authenticate2FA = function() {
self.error = null;
var data = {
twoFactorCode : $scope.twoFactorCode
@ -241,7 +224,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.authenticate2FA(data, function(err, auth) {
self.authenticating = false;
if (err) {
self.error = 'Authentiation error';
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Authentiation error'));
return;
}

View file

@ -39,7 +39,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
$log.info('No signing proposal: No private key');
popupService.showAler(gettextCatalog.getString('Error'), bwcError.msg('MISSING_PRIVATE_KEY'));
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg('MISSING_PRIVATE_KEY'));
return;
}
@ -59,7 +59,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
amazonService.createBitPayInvoice(dataSrc, function(err, dataInvoice) {
if (err) {
ongoingProcess.set('Processing Transaction...', false);
popupService.showAler(gettextCatalog.getString('Error'), bwcError.msg(err));
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
return;
}

View file

@ -1,19 +1,26 @@
'use strict';
angular.module('copayApp.controllers').controller('buyGlideraController',
function($scope, $timeout, $log, $ionicModal, profileService, walletService, glideraService, bwcError, lodash, ongoingProcess) {
function($scope, $timeout, $log, profileService, walletService, glideraService, bwcError, lodash, ongoingProcess, popupService, gettextCatalog) {
var wallet;
var self = this;
this.show2faCodeInput = null;
this.error = null;
this.success = null;
$scope.$on('Wallet/Changed', function(event, w) {
if (lodash.isEmpty(w)) {
$log.debug('No wallet provided');
return;
}
wallet = w;
$log.debug('Wallet changed: ' + w.name);
});
$scope.init = function(accessToken) {
$scope.network = glideraService.getEnvironment();
$scope.token = accessToken;
$scope.error = null;
$scope.permissions = null;
$scope.email = null;
$scope.personalInfo = null;
@ -25,7 +32,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
glideraService.init($scope.token, function(err, glidera) {
ongoingProcess.set('connectingGlidera');
if (err || !glidera) {
$scope.error = err;
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
$scope.token = glidera.token;
@ -33,21 +40,11 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
$scope.update({fullUpdate: true});
});
self.allWallets = profileService.getWallets({
$scope.wallets = profileService.getWallets({
network: $scope.network,
n: 1,
onlyComplete: true
});
if (lodash.isEmpty(self.allWallets)) return;
wallet = self.allWallets[0];
if (wallet) {
$timeout(function() {
self.selectedWalletId = wallet.credentials.walletId;
self.selectedWalletName = wallet.credentials.walletName;
$scope.$apply();
}, 100);
}
};
$scope.update = function(opts) {
@ -84,33 +81,6 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
}
};
$scope.openWalletsModal = function(wallets) {
self.error = null;
$scope.type = 'BUY';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.self = self;
$ionicModal.fromTemplateUrl('views/modals/wallets.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.walletsModal = modal;
$scope.walletsModal.show();
});
$scope.$on('walletSelected', function(ev, walletId) {
$timeout(function() {
wallet = profileService.getClient(walletId);
self.selectedWalletId = walletId;
self.selectedWalletName = wallet.credentials.walletName;
$scope.$apply();
}, 100);
$scope.walletsModal.hide();
});
};
this.getBuyPrice = function(token, price) {
var self = this;
this.error = null;
@ -122,7 +92,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
glideraService.buyPrice(token, price, function(err, buyPrice) {
self.gettingBuyPrice = false;
if (err) {
self.error = 'Could not get exchange information. Please, try again.';
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get exchange information. Please, try again'));
return;
}
self.buyPrice = buyPrice;
@ -131,13 +101,12 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
this.get2faCode = function(token) {
var self = this;
self.error = null;
ongoingProcess.set('Sending 2FA code...', true);
$timeout(function() {
glideraService.get2faCode(token, function(err, sent) {
ongoingProcess.set('Sending 2FA code...', false);
if (err) {
self.error = 'Could not send confirmation code to your phone';
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not send confirmation code to your phone'));
return;
}
self.show2faCodeInput = sent;
@ -147,13 +116,12 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
this.sendRequest = function(token, permissions, twoFaCode) {
var self = this;
self.error = null;
ongoingProcess.set('Buying Bitcoin...', true);
$timeout(function() {
walletService.getAddress(wallet, false, function(err, walletAddr) {
if (err) {
ongoingProcess.set('Buying Bitcoin...', false);
self.error = bwcError.cb(err, 'Could not create address');
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.cb(err, 'Could not create address'));
return;
}
var data = {
@ -166,11 +134,13 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
glideraService.buy(token, twoFaCode, data, function(err, data) {
ongoingProcess.set('Buying Bitcoin...', false);
if (err) {
self.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
self.success = data;
$scope.$emit('Local/GlideraTx');
$timeout(function() {
$scope.$digest();
});
});
});
}, 100);

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('createController',
function($scope, $rootScope, $timeout, $log, lodash, $state, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService) {
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService) {
var isChromeApp = platformInfo.isChromeApp;
var isCordova = platformInfo.isCordova;
@ -37,6 +37,10 @@ angular.module('copayApp.controllers').controller('createController',
return new Array(num);
}
$scope.showAdvChange = function() {
$ionicScrollDelegate.resize();
};
var updateRCSelect = function(n) {
$scope.totalCopayers = n;
var maxReq = COPAYER_PAIR_LIMITS[n];

View file

@ -1,11 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraController',
function($rootScope, $scope, $timeout, $ionicModal, $log, profileService, storageService, glideraService, lodash, ongoingProcess, platformInfo, nodeWebkit) {
if (platformInfo.isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#4B6178");
}
function($scope, $timeout, $ionicModal, $log, storageService, glideraService, ongoingProcess, platformInfo, nodeWebkit, popupService, gettextCatalog) {
$scope.openExternalLink = function(url, target) {
if (platformInfo.isNW) {
@ -20,7 +16,6 @@ angular.module('copayApp.controllers').controller('glideraController',
$scope.network = glideraService.getEnvironment();
$scope.token = null;
$scope.error = null;
$scope.permissions = null;
$scope.email = null;
$scope.personalInfo = null;
@ -32,7 +27,7 @@ angular.module('copayApp.controllers').controller('glideraController',
glideraService.init($scope.token, function(err, glidera) {
ongoingProcess.set('connectingGlidera');
if (err || !glidera) {
$scope.error = err;
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
$scope.token = glidera.token;
@ -81,15 +76,11 @@ angular.module('copayApp.controllers').controller('glideraController',
this.submitOauthCode = function(code) {
ongoingProcess.set('connectingGlidera', true);
$scope.error = null;
$timeout(function() {
glideraService.getToken(code, function(err, data) {
ongoingProcess.set('connectingGlidera', false);
if (err) {
$scope.error = err;
$timeout(function() {
$scope.$apply();
}, 100);
popupService.showAlert(gettextCatalog.getString('Error'), err);
} else if (data && data.access_token) {
storageService.setGlideraToken($scope.network, data.access_token, function() {
$scope.init(data.access_token);
@ -108,7 +99,11 @@ angular.module('copayApp.controllers').controller('glideraController',
$scope.self = self;
$scope.tx = tx;
glideraService.getTransaction(token, tx.transactionUuid, function(error, tx) {
glideraService.getTransaction(token, tx.transactionUuid, function(err, tx) {
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get transactions'));
return;
}
$scope.tx = tx;
});

View file

@ -1,41 +1,34 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraUriController',
function($scope, $log, $stateParams, $timeout, profileService, configService, glideraService, storageService, $state, ongoingProcess) {
function($scope, $log, $stateParams, $timeout, glideraService, storageService, $state, ongoingProcess, popupService, gettextCatalog) {
this.submitOauthCode = function(code) {
var submitOauthCode = function(code) {
$log.debug('Glidera Oauth Code:' + code);
var self = this;
var glideraTestnet = configService.getSync().glidera.testnet;
var network = glideraTestnet ? 'testnet' : 'livenet';
$scope.network = glideraService.getEnvironment();
ongoingProcess.set('connectingGlidera', true);
this.error = null;
$timeout(function() {
glideraService.getToken(code, function(err, data) {
ongoingProcess.set('connectingGlidera', false);
if (err) {
self.error = err;
$timeout(function() {
$scope.$apply();
}, 100);
popupService.showAlert(gettextCatalog.getString('Error'), err);
} else if (data && data.access_token) {
storageService.setGlideraToken(network, data.access_token, function() {
$scope.$emit('Local/GlideraUpdated', data.access_token);
storageService.setGlideraToken($scope.network, data.access_token, function() {
$timeout(function() {
$state.go('glidera');
$state.go('glidera.main');
$scope.$apply();
}, 100);
}, 500);
});
}
});
}, 100);
};
this.checkCode = function() {
$scope.checkCode = function() {
if ($stateParams.url) {
var match = $stateParams.url.match(/code=(.+)/);
if (match && match[1]) {
this.code = match[1];
return this.submitOauthCode(this.code);
submitOauthCode(match[1]);
return;
}
}
$log.error('Bad state: ' + JSON.stringify($stateParams));

View file

@ -1,13 +1,13 @@
'use strict';
angular.module('copayApp.controllers').controller('amazonCardDetailsController', function($scope, $log, $timeout, bwcError, amazonService, lodash, ongoingProcess) {
angular.module('copayApp.controllers').controller('amazonCardDetailsController', function($scope, $log, $timeout, bwcError, amazonService, lodash, ongoingProcess, popupService, gettextCatalog) {
$scope.cancelGiftCard = function() {
ongoingProcess.set('Canceling gift card...', true);
amazonService.cancelGiftCard($scope.card, function(err, data) {
ongoingProcess.set('Canceling gift card...', false);
if (err) {
$scope.error = bwcError.msg(err);
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
return;
}
$scope.card.cardStatus = data.cardStatus;
@ -29,7 +29,7 @@ angular.module('copayApp.controllers').controller('amazonCardDetailsController',
$scope.refreshGiftCard = function() {
amazonService.getPendingGiftCards(function(err, gcds) {
if (err) {
self.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
lodash.forEach(gcds, function(dataFromStorage) {
@ -37,8 +37,7 @@ angular.module('copayApp.controllers').controller('amazonCardDetailsController',
$log.debug("creating gift card");
amazonService.createGiftCard(dataFromStorage, function(err, giftCard) {
if (err) {
self.error = bwcError.msg(err);
$log.debug(bwcError.msg(err));
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
return;
}
if (!lodash.isEmpty(giftCard)) {

View file

@ -2,12 +2,6 @@
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $log, $ionicPopup, profileService) {
$scope.goImport = function() {
$state.go('add.import.phrase', {
fromOnboarding: true
});
};
$scope.createProfile = function() {
$log.debug('Creating profile');
profileService.createProfile(function(err) {

View file

@ -1,13 +1,12 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesGlideraController',
function($scope, $log, $ionicModal, ongoingProcess, glideraService) {
function($scope, $log, $timeout, $state, ongoingProcess, glideraService, popupService, gettextCatalog) {
$scope.init = function(accessToken) {
$scope.network = glideraService.getEnvironment();
$scope.token = accessToken;
$scope.error = null;
$scope.permissions = null;
$scope.email = null;
$scope.personalInfo = null;
@ -19,7 +18,7 @@ angular.module('copayApp.controllers').controller('preferencesGlideraController'
glideraService.init($scope.token, function(err, glidera) {
ongoingProcess.set('connectingGlidera');
if (err || !glidera) {
$scope.error = err;
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
$scope.token = glidera.token;
@ -63,11 +62,14 @@ angular.module('copayApp.controllers').controller('preferencesGlideraController'
};
$scope.revokeToken = function() {
$ionicModal.fromTemplateUrl('views/modals/glidera-confirmation.html', {
scope: $scope
}).then(function(modal) {
$scope.glideraConfirmationModal = modal;
$scope.glideraConfirmationModal.show();
popupService.showConfirm('Glidera', 'Are you sure you would like to log out of your Glidera account?', function(res) {
if (res) {
glideraService.removeToken(function() {
$timeout(function() {
$state.go('glidera.main');
}, 100);
});
}
});
};

View file

@ -1,28 +1,27 @@
'use strict';
angular.module('copayApp.controllers').controller('sellGlideraController',
function($rootScope, $scope, $timeout, $ionicModal, $log, profileService, glideraService, bwcError, lodash, walletService, fingerprintService, configService, ongoingProcess) {
function($scope, $timeout, $log, profileService, glideraService, bwcError, lodash, walletService, configService, ongoingProcess, popupService, gettextCatalog) {
var self = this;
this.data = {};
this.show2faCodeInput = null;
this.success = null;
this.error = null;
var wallet;
var handleEncryptedWallet = function(wallet, cb) {
if (!walletService.isEncrypted(wallet)) return cb();
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
if (err) return cb(err);
return cb(walletService.unlock(wallet, password));
});
};
$scope.$on('Wallet/Changed', function(event, w) {
if (lodash.isEmpty(w)) {
$log.debug('No wallet provided');
return;
}
wallet = w;
$log.debug('Wallet changed: ' + w.name);
});
$scope.init = function(accessToken) {
$scope.network = glideraService.getEnvironment();
$scope.token = accessToken;
$scope.error = null;
$scope.permissions = null;
$scope.email = null;
$scope.personalInfo = null;
@ -34,7 +33,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
glideraService.init($scope.token, function(err, glidera) {
ongoingProcess.set('connectingGlidera');
if (err || !glidera) {
$scope.error = err;
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
$scope.token = glidera.token;
@ -42,21 +41,11 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
$scope.update({fullUpdate: true});
});
self.allWallets = profileService.getWallets({
$scope.wallets = profileService.getWallets({
network: $scope.network,
n: 1,
onlyComplete: true
});
if (lodash.isEmpty(self.allWallets)) return;
wallet = self.allWallets[0];
if (wallet) {
$timeout(function() {
self.selectedWalletId = wallet.credentials.walletId;
self.selectedWalletName = wallet.credentials.walletName;
$scope.$apply();
}, 100);
}
};
$scope.update = function(opts) {
@ -93,36 +82,8 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
}
};
$scope.openWalletsModal = function(wallets) {
self.error = null;
$scope.type = 'SELL';
$scope.wallets = wallets;
$scope.noColor = true;
$scope.self = self;
$ionicModal.fromTemplateUrl('views/modals/wallets.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.walletsModal = modal;
$scope.walletsModal.show();
});
$scope.$on('walletSelected', function(ev, walletId) {
$timeout(function() {
wallet = profileService.getClient(walletId);
self.selectedWalletId = walletId;
self.selectedWalletName = wallet.credentials.walletName;
$scope.$apply();
}, 100);
$scope.walletsModal.hide();
});
};
this.getSellPrice = function(token, price) {
var self = this;
self.error = null;
if (!price || (price && !price.qty && !price.fiat)) {
self.sellPrice = null;
return;
@ -131,7 +92,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
glideraService.sellPrice(token, price, function(err, sellPrice) {
self.gettingSellPrice = false;
if (err) {
self.error = 'Could not get exchange information. Please, try again.';
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get exchange information. Please, try again'));
return;
}
self.sellPrice = sellPrice;
@ -145,7 +106,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
glideraService.get2faCode(token, function(err, sent) {
ongoingProcess.set('Sending 2FA code...', false);
if (err) {
self.error = 'Could not send confirmation code to your phone';
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not send confirmation code to your phone'));
} else {
self.show2faCodeInput = sent;
}
@ -155,29 +116,27 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
this.createTx = function(token, permissions, twoFaCode) {
var self = this;
self.error = null;
var outputs = [];
var config = configService.getSync();
var configWallet = config.wallet;
var walletSettings = configWallet.settings;
if (!wallet) {
self.error = 'No wallet selected';
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('No wallet selected'));
return;
}
ongoingProcess.set('creatingTx', true);
walletService.getAddress(wallet, null, function(err, refundAddress) {
if (!refundAddress) {
ongoingProcess.clear();
self.error = bwcError.msg(err, 'Could not create address');
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, 'Could not create address'));
return;
}
glideraService.getSellAddress(token, function(error, sellAddress) {
if (!sellAddress) {
glideraService.getSellAddress(token, function(err, sellAddress) {
if (!sellAddress || err) {
ongoingProcess.clear();
self.error = 'Could not get the destination bitcoin address';
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get the destination bitcoin address'));
return;
}
var amount = parseInt((self.sellPrice.qty * 100000000).toFixed(0));
@ -205,28 +164,30 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
walletService.createTx(wallet, txp, function(err, createdTxp) {
ongoingProcess.clear();
if (err) {
self.error = err.message ||  bwcError.msg(err);
popupService.showAlert(gettextCatalog.getString('Error'), err.message || bwcError.msg(err));
return;
}
walletService.prepare(wallet, txp, function(err, password) {
walletService.prepare(wallet, function(err, password) {
if (err) {
self.error = err.message ||  bwcError.msg(err);
ongoingProcess.clear();
popupService.showAlert(gettextCatalog.getString('Error'), err.message || bwcError.msg(err));
return;
}
ongoingProcess.set('signingTx', true);
walletService.publishTx(wallet, createdTxp, function(err, publishedTxp) {
if (err) {
ongoingProcess.clear();
self.error = err.message ||  bwcError.msg(err);
popupService.showAlert(gettextCatalog.getString('Error'), err.message || bwcError.msg(err));
return;
}
walletService.signTx(wallet, publishedTxp, function(err, password, signedTxp) {
walletService.removeTx(wallet, signedTxp, function(err) {
if (err) $log.debug(err);
});
ongoingProcess.clear();
walletService.signTx(wallet, publishedTxp, password, function(err, signedTxp) {
if (err) {
self.error = err.message ||  bwcError.msg(err);
ongoingProcess.clear();
popupService.showAlert(gettextCatalog.getString('Error'), err.message || bwcError.msg(err));
walletService.removeTx(wallet, signedTxp, function(err) {
if (err) $log.debug(err);
});
return;
}
var rawTx = signedTxp.raw;
@ -237,15 +198,17 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
useCurrentPrice: self.sellPrice.priceUuid ? false : true,
ip: null
};
ongoingProcess.set('Seling Bitcoin', true);
ongoingProcess.set('Selling Bitcoin', true);
glideraService.sell(token, twoFaCode, data, function(err, data) {
ongoingProcess.clear();
if (err) {
self.error = err.message ||  bwcError.msg(err);
popupService.showAlert(gettextCatalog.getString('Error'), err.message || bwcError.msg(err));
return;
}
self.success = data;
$scope.update();
$timeout(function() {
$scope.$digest();
});
});
});
});

View file

@ -1,12 +1,13 @@
'use strict';
angular.module('copayApp.controllers').controller('tabHomeController',
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo, storageService) {
function($rootScope, $timeout, $scope, $state, $ionicScrollDelegate, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo, storageService) {
$scope.externalServices = {};
$scope.bitpayCardEnabled = true; // TODO
var setNotifications = function(notifications) {
var n = walletService.processNotifications(notifications, 5);
$scope.notifications = n;
$scope.notificationsMore = notifications.length > 5 ? notifications.length - 5 : null;
$scope.notifications = notifications;
$timeout(function() {
$scope.$apply();
}, 1);
@ -16,41 +17,33 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.wallets = profileService.getWallets();
if (lodash.isEmpty($scope.wallets)) return;
$timeout(function() {
var i = $scope.wallets.length;
var j = 0;
var timeSpan = 60 * 60 * 24 * 7;
var notifications = [];
$scope.fetchingNotifications = true;
lodash.each($scope.wallets, function(wallet) {
walletService.getStatus(wallet, {}, function(err, status) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
wallet.status = status;
});
walletService.getNotifications(wallet, {
timeSpan: timeSpan
}, function(err, n) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
notifications.push(n);
if (++j == i) {
$scope.fetchingNotifications = false;
setNotifications(lodash.compact(lodash.flatten(notifications)));
};
});
var i = $scope.wallets.length;
var j = 0;
var timeSpan = 60 * 60 * 24 * 7;
var notifications = [];
lodash.each($scope.wallets, function(wallet) {
walletService.getStatus(wallet, {}, function(err, status) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
wallet.status = status;
});
$scope.$digest();
}, 100);
});
$scope.fetchingNotifications = true;
profileService.getNotifications({
limit: 3
}, function(err, n) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
$scope.fetchingNotifications = false;
setNotifications(n);
$ionicScrollDelegate.resize();
})
};
$scope.updateWallet = function(wallet) {
@ -61,23 +54,30 @@ angular.module('copayApp.controllers').controller('tabHomeController',
return;
}
wallet.status = status;
$timeout(function() {
$scope.$apply();
}, 1);
profileService.getNotifications({
limit: 3
}, function(err, n) {
console.log('[tab-home.js.57]', n); //TODO
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
setNotifications(n);
$ionicScrollDelegate.resize();
})
});
};
$scope.externalServices = {};
$scope.nextStep = function() {
lodash.each(['AmazonGiftCards', 'BitpayCard', 'BuyAndSell'], function(service) {
storageService.getNextStep(service, function(err, value) {
$scope.externalServices[service] = value ? true : false;
$ionicScrollDelegate.resize();
});
});
};
$scope.bitpayCardEnabled = true; // TODO
var listeners = [
$rootScope.$on('bwsEvent', function(e, walletId, type, n) {
var wallet = profileService.getWallet(walletId);

View file

@ -36,6 +36,7 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
$scope.otherWallets = lodash.filter(profileService.getWallets(self.network), function(w) {
return w.id != self.walletId;
});
$scope.wallets = profileService.getWallets();
};
$scope.openAddressbookModal = function() {

View file

@ -30,7 +30,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$ionicConfigProvider.navBar.positionSecondaryButtons('right');
// NAV BACK-BUTTON TEXT/ICON
$ionicConfigProvider.backButton.icon('ion-chevron-left');
$ionicConfigProvider.backButton.icon('ion-arrow-left-c').text('');
$ionicConfigProvider.backButton.previousTitleText(false);
$logProvider.debugEnabled(true);
@ -155,156 +155,18 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
*
*/
.state('wallet', {
url: '/wallet/{walletId}/{fromOnboarding}',
abstract: true,
template: '<ion-nav-view name="wallet"></ion-nav-view>'
})
.state('wallet.details', {
url: '/details',
views: {
'wallet': {
templateUrl: 'views/walletDetails.html'
}
},
params: {
txid: null,
txpId: null,
},
})
.state('wallet.preferences', {
url: '/preferences',
views: {
'wallet': {
templateUrl: 'views/preferences.html'
}
.state('tabs.details', {
url: '/details/{walletId}/{fromOnboarding}',
views: {
'tab-home': {
templateUrl: 'views/walletDetails.html'
}
})
.state('wallet.preferencesAlias', {
url: '/preferencesAlias',
views: {
'wallet': {
templateUrl: 'views/preferencesAlias.html'
}
}
})
.state('wallet.preferencesColor', {
url: '/preferencesColor',
views: {
'wallet': {
templateUrl: 'views/preferencesColor.html'
}
}
})
.state('wallet.preferencesEmail', {
url: '/preferencesEmail',
views: {
'wallet': {
templateUrl: 'views/preferencesEmail.html'
}
}
})
.state('wallet.backup', {
url: '/backup',
views: {
'wallet': {
templateUrl: 'views/backup.html'
}
}
})
.state('wallet.preferencesAdvanced', {
url: '/preferencesAdvanced',
views: {
'wallet': {
templateUrl: 'views/preferencesAdvanced.html'
}
}
})
.state('wallet.information', {
url: '/information',
views: {
'wallet': {
templateUrl: 'views/preferencesInformation.html'
}
}
})
.state('wallet.export', {
abstract: true,
url: '/export',
views: {
'wallet': {
templateUrl: 'views/export.html'
}
}
})
.state('wallet.export.file', {
url: '/tab-export-file',
needProfile: true,
views: {
'tab-export-file': {
templateUrl: 'views/tab-export-file.html',
},
}
})
.state('wallet.export.qrCode', {
url: '/tab-export-qrCode',
needProfile: true,
views: {
'tab-export-qrCode': {
templateUrl: 'views/tab-export-qrCode.html',
},
}
})
.state('wallet.preferencesBwsUrl', {
url: '/preferencesBwsUrl',
views: {
'wallet': {
templateUrl: 'views/preferencesBwsUrl.html'
}
}
})
.state('wallet.preferencesHistory', {
url: '/preferencesHistory',
views: {
'wallet': {
templateUrl: 'views/preferencesHistory.html'
}
}
})
.state('wallet.deleteWords', {
url: '/deleteWords',
views: {
'wallet': {
templateUrl: 'views/preferencesDeleteWords.html'
}
}
})
.state('wallet.delete', {
url: '/delete',
views: {
'wallet': {
templateUrl: 'views/preferencesDeleteWallet.html'
}
}
})
.state('wallet.copayers', {
url: '/copayers',
views: {
'wallet': {
templateUrl: 'views/copayers.html'
}
}
})
.state('wallet.paperWallet', {
url: '/paperWallet',
views: {
'wallet': {
templateUrl: 'views/paperWallet.html'
}
}
})
},
params: {
txid: null,
txpId: null,
},
})
/*
*
@ -385,15 +247,10 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
*
*/
.state('add', {
.state('tabs.add', {
url: '/add',
abstract: true,
template: '<ion-nav-view name="add"></ion-nav-view>'
})
.state('add.main', {
url: '/main',
views: {
'add': {
'tab-home': {
templateUrl: 'views/add.html',
controller: function(platformInfo) {
if (platformInfo.isCordova && StatusBar.isVisible) {
@ -403,24 +260,24 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
}
})
.state('add.join', {
.state('tabs.join', {
url: '/join/:url',
views: {
'add': {
'tab-home': {
templateUrl: 'views/join.html'
},
}
})
.state('add.import', {
.state('tabs.import', {
url: '/import/:fromOnboarding',
abstract: true,
// abstract: true,
views: {
'add': {
'tab-home': {
templateUrl: 'views/import.html'
},
}
})
.state('add.import.phrase', {
.state('tabs.import.phrase', {
url: '/tab-import-phrase',
views: {
'tab-import-phrase': {
@ -428,7 +285,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
},
}
})
.state('add.import.file', {
.state('tabs.import.file', {
url: '/tab-import-file',
views: {
'tab-import-file': {
@ -436,7 +293,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
},
}
})
.state('add.import.hardware', {
.state('tabs.import.hardware', {
url: '/tab-import-hardware',
views: {
'tab-import-hardware': {
@ -444,17 +301,17 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
},
}
})
.state('add.create', {
.state('tabs.create', {
url: '/create',
abstract: true,
templateUrl: 'views/create.html',
views: {
'add': {
'tab-home': {
templateUrl: 'views/create.html'
},
}
})
.state('add.create.personal', {
.state('tabs.create.personal', {
url: '/tab-create-personal',
views: {
'tab-create-personal': {
@ -462,7 +319,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
},
}
})
.state('add.create.shared', {
.state('tabs.create.shared', {
url: '/tab-create-shared',
views: {
'tab-create-shared': {
@ -477,76 +334,225 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
*
*/
.state('settings', {
url: '/settings',
abstract: true,
template: '<ion-nav-view name="settings"></ion-nav-view>'
})
.state('settings.language', {
.state('tabs.language', {
url: '/language',
views: {
'settings': {
'tab-settings': {
templateUrl: 'views/preferencesLanguage.html'
}
}
})
.state('settings.unit', {
.state('tabs.unit', {
url: '/unit',
views: {
'settings': {
'tab-settings': {
templateUrl: 'views/preferencesUnit.html'
}
}
})
.state('settings.fee', {
.state('tabs.fee', {
url: '/fee',
views: {
'settings': {
'tab-settings': {
templateUrl: 'views/preferencesFee.html'
}
}
})
.state('settings.altCurrency', {
.state('tabs.altCurrency', {
url: '/altCurrency',
views: {
'settings': {
'tab-settings': {
templateUrl: 'views/preferencesAltCurrency.html'
}
}
})
.state('settings.about', {
.state('tabs.about', {
url: '/about',
views: {
'settings': {
'tab-settings': {
templateUrl: 'views/preferencesAbout.html'
}
}
})
.state('settings.logs', {
.state('tabs.logs', {
url: '/logs',
views: {
'settings': {
'tab-settings': {
templateUrl: 'views/preferencesLogs.html'
}
}
})
.state('settings.termsOfUse', {
.state('tabs.termsOfUse', {
url: '/termsOfUse',
views: {
'settings': {
'tab-settings': {
templateUrl: 'views/termsOfUse.html',
}
}
})
.state('settings.translators', {
.state('tabs.translators', {
url: '/translators',
views: {
'settings': {
'tab-settings': {
templateUrl: 'views/translators.html'
}
}
})
/*
*
* Wallet preferences
*
*/
.state('tabs.preferences', {
url: '/preferences/:walletId',
abstract: true,
views: {
'tab-settings': {
template: '<ion-nav-view name="preferences"></ion-nav-view>'
},
}
})
.state('tabs.preferences.main', {
url: '/main',
views: {
'preferences': {
templateUrl: 'views/preferences.html'
}
}
})
.state('tabs.preferences.preferencesAlias', {
url: '/preferencesAlias',
views: {
'preferences': {
templateUrl: 'views/preferencesAlias.html'
}
}
})
.state('tabs.preferences.preferencesColor', {
url: '/preferencesColor',
views: {
'preferences': {
templateUrl: 'views/preferencesColor.html'
}
}
})
.state('tabs.preferences.preferencesEmail', {
url: '/preferencesEmail',
views: {
'preferences': {
templateUrl: 'views/preferencesEmail.html'
}
}
})
.state('tabs.preferences.backup', {
url: '/backup',
views: {
'preferences': {
templateUrl: 'views/backup.html'
}
}
})
.state('tabs.preferences.preferencesAdvanced', {
url: '/preferencesAdvanced',
views: {
'preferences': {
templateUrl: 'views/preferencesAdvanced.html'
}
}
})
.state('tabs.preferences.information', {
url: '/information',
views: {
'preferences': {
templateUrl: 'views/preferencesInformation.html'
}
}
})
.state('tabs.preferences.export', {
abstract: true,
url: '/export',
views: {
'preferences': {
templateUrl: 'views/export.html'
}
}
})
.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: {
'preferences': {
templateUrl: 'views/preferencesBwsUrl.html'
}
}
})
.state('tabs.preferences.preferencesHistory', {
url: '/preferencesHistory',
views: {
'preferences': {
templateUrl: 'views/preferencesHistory.html'
}
}
})
.state('tabs.preferences.deleteWords', {
url: '/deleteWords',
views: {
'preferences': {
templateUrl: 'views/preferencesDeleteWords.html'
}
}
})
.state('tabs.preferences.delete', {
url: '/delete',
views: {
'preferences': {
templateUrl: 'views/preferencesDeleteWallet.html'
}
}
})
.state('tabs.preferences.paperWallet', {
url: '/paperWallet',
views: {
'preferences': {
templateUrl: 'views/paperWallet.html'
}
}
})
/*
*
*TO DO
*
*/
.state('tabs.copayers', {
url: '/copayers',
views: {
'wallet': {
templateUrl: 'views/copayers.html'
}
}
})
/*
*
* Onboarding
@ -824,7 +830,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
});
$ionicPlatform.on('resume', function() {
$rootScope.$emit('Local/Resume');
// Nothing tot do
});
$ionicPlatform.on('menubutton', function() {
@ -853,6 +859,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
} else {
profileService.storeProfileIfDirty();
$log.debug('Profile loaded ... Starting UX.');
$state.transitionTo('tabs.home');
}
});

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.services').factory('incomingData', function($log, $ionicModal, $state, bitcore) {
var root = {};
root.redir = function(data) {
@ -32,7 +32,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
data = sanitizeUri(data);
// BIP21
// BIP21
if (bitcore.URI.isValid(data)) {
var parsed = new bitcore.URI(data);
@ -52,7 +52,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
}
return true;
// Plain URL
// Plain URL
} else if (/^https?:\/\//.test(data)) {
return $state.go('send.confirm', {paypro: data})
@ -64,10 +64,10 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
// copay: protocol
} else if (data.indexOf('copay:glidera')==0) {
return $state.go('send.uriglidera', {url: data})
} else if (data.indexOf('copay:coinbase')==0) {
return $state.go('send.uricoinbase', {url: data})
} else if (data.indexOf('copay://glidera')==0) {
return $state.go('uriglidera', {url: data})
} else if (data.indexOf('copay://coinbase')==0) {
return $state.go('uricoinbase', {url: data})
// Join
} else if (data.match(/^copay:[0-9A-HJ-NP-Za-km-z]{70,80}$/)) {

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services')
.factory('profileService', function profileServiceFactory($rootScope, $timeout, $filter, $log, sjcl, lodash, storageService, bwcService, configService, pushNotificationsService, gettext, gettextCatalog, bwcError, uxLanguage, bitcore, platformInfo, $ionicHistory) {
.factory('profileService', function profileServiceFactory($rootScope, $timeout, $filter, $log, sjcl, lodash, storageService, bwcService, configService, pushNotificationsService, gettext, gettextCatalog, bwcError, uxLanguage, platformInfo, $ionicHistory, txFormatService, $state) {
var isChromeApp = platformInfo.isChromeApp;
@ -119,6 +119,9 @@ angular.module('copayApp.services')
if (wallet.completeHistory)
wallet.completeHistory.isValid = false;
if (wallet.cachedActivity)
wallet.cachedActivity.isValid = false;
$rootScope.$emit('bwsEvent', wallet.id, n.type, n);
});
@ -130,7 +133,9 @@ angular.module('copayApp.services')
});
});
wallet.initialize({}, function(err) {
wallet.initialize({
notificationIncludeOwn: true,
}, function(err) {
if (err) {
$log.error('Could not init notifications err:', err);
return;
@ -426,8 +431,8 @@ angular.module('copayApp.services')
// check if exist
if (lodash.find(root.profile.credentials, {
'walletId': walletData.walletId
})) {
'walletId': walletData.walletId
})) {
return cb(gettext('Cannot join the same wallet more that once'));
}
} catch (ex) {
@ -733,15 +738,155 @@ angular.module('copayApp.services')
});
} else {}
return lodash.sortBy(ret, [function(x) {
return x.isComplete();
}, 'createdOn']);
return lodash.sortBy(ret, [
function(x) {
return x.isComplete();
}, 'createdOn'
]);
};
root.toggleHideBalanceFlag = function(walletId, cb) {
root.wallet[walletId].balanceHidden = !root.wallet[walletId].balanceHidden;
storageService.setHideBalanceFlag(walletId, root.wallet[walletId].balanceHidden.toString(), cb);
}
};
root.getNotifications = function(opts, cb) {
opts = opts || {};
var TIME_STAMP = 60 * 60 * 24 * 7;
var MAX = 100;
var ignored = {
'NewBlock': 1,
'BalanceUpdated': 1,
'NewOutgoingTxByThirdParty': 1,
'NewAddress': 1,
'TxProposalFinallyAccepted': 1,
'TxProposalFinallyRejected': 1,
};
var w = root.getWallets();
if (lodash.isEmpty(w)) return cb();
var l = w.length,
j = 0,
notifications = [];
function isActivityCached(wallet) {
return wallet.cachedActivity && wallet.cachedActivity.isValid;
};
function getNotifications(wallet, cb2) {
if (isActivityCached(wallet) && !opts.force) return cb2();
wallet.getNotifications({
timeSpan: TIME_STAMP,
includeOwn: true,
}, function(err, n) {
if (err) return cb2(err);
wallet.cachedActivity = {
n: n.slice(-MAX),
isValid: true,
};
return cb2();
});
};
function process(notifications) {
if (!notifications) return [];
var shown = lodash.sortBy(notifications, 'createdOn').reverse();
shown = shown.splice(0, opts.limit || MAX);
lodash.each(shown, function(x) {
x.txpId = x.data ? x.data.txProposalId : null;
x.txid = x.data ? x.data.txid : null;
x.types = [x.type];
if (x.data && x.data.amount)
x.amountStr = txFormatService.formatAmountStr(x.data.amount);
x.action = function() {
// TODO?
$state.go('tabs.details', {
walletId: x.walletId,
txpId: x.txpId,
txid: x.txid,
});
};
});
// condense
var finale = [],
prev;
lodash.each(shown, function(x) {
if (prev && prev.walletId === x.walletId && prev.txpId && prev.txpId === x.txpId && prev.creatorId && prev.creatorId === x.creatorId) {
prev.types.push(x.type);
prev.data = lodash.assign(prev.data, x.data);
prev.txid = prev.txid || x.txid;
prev.amountStr = prev.amountStr || x.amountStr;
prev.creatorName = prev.creatorName || x.creatorName;
} else {
finale.push(x);
prev = x;
}
});
// messages...
var u = bwcService.getUtils();
lodash.each(finale, function(x) {
if (x.data && x.data.message && x.wallet && x.wallet.credentials.sharedEncryptingKey) {
// TODO TODO TODO => BWC
x.message = u.decryptMessage(x.data.message, x.wallet.credentials.sharedEncryptingKey);
}
});
return finale;
};
lodash.each(w, function(wallet) {
getNotifications(wallet, function(err) {
j++;
if (err) {
$log.warn('Error updating notifications:' + err);
} else {
var n = lodash.filter(wallet.cachedActivity.n, function(x) {
return !ignored[x.type];
});
var idToName = {};
if (wallet.cachedStatus) {
lodash.each(wallet.cachedStatus.wallet.copayers, function(c) {
idToName[c.id] = c.name;
});
}
lodash.each(n, function(x) {
x.wallet = wallet;
if (x.creatorId && wallet.cachedStatus) {
x.creatorName = idToName[x.creatorId];
};
});
notifications.push(n);
}
if (j == l) {
notifications = lodash.sortBy(notifications, 'createdOn');
notifications = lodash.compact(lodash.flatten(notifications)).slice(0,MAX);
return cb(null, process(notifications));
};
});
});
};
return root;
});

View file

@ -976,33 +976,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
});
};
root.getNotifications = function(wallet, opts, cb) {
wallet.getNotifications(opts, function(err, notifications) {
if (err) return cb(err);
notifications = lodash.filter(notifications, function(x) {
return x.type != 'NewBlock' && x.type != 'BalanceUpdated' && x.type != 'NewOutgoingTxByThirdParty';
});
var idToName = {};
if (wallet.cachedStatus) {
lodash.each(wallet.cachedStatus.wallet.copayers, function(c) {
idToName[c.id] = c.name;
});
}
lodash.each(notifications, function(x) {
x.wallet = wallet;
if (x.creatorId && wallet.cachedStatus) {
x.creatorName = idToName[x.creatorId];
};
});
return cb(null, notifications);
});
};
root.getEncodedWalletInfo = function(wallet, cb) {
var derivationPath = wallet.credentials.getBaseAddressDerivationPath();
@ -1036,64 +1009,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
});
};
root.processNotifications = function(notifications, limit) {
if (!notifications) return [];
var shown = lodash.sortBy(notifications, 'createdOn').reverse();
if (limit)
shown = shown.splice(0, limit);
lodash.each(shown, function(x) {
x.txpId = x.data ? x.data.txProposalId : null;
x.txid = x.data ? x.data.txid : null;
x.types = [x.type];
if (x.data && x.data.amount)
x.amountStr = txFormatService.formatAmountStr(x.data.amount);
x.action = function() {
// TODO?
$state.go('wallet.details', {
walletId: x.walletId,
txpId: x.txpId,
txid: x.txid,
});
};
});
// condense
var finale = [],
prev;
lodash.each(shown, function(x) {
if (prev && prev.walletId === x.walletId && prev.txpId && prev.txpId === x.txpId && prev.creatorId && prev.creatorId === x.creatorId) {
prev.types.push(x.type);
prev.data = lodash.assign(prev.data, x.data);
prev.txid = prev.txid || x.txid;
prev.amountStr = prev.amountStr || x.amountStr;
prev.creatorName = prev.creatorName || x.creatorName;
} else {
finale.push(x);
prev = x;
}
});
// messages...
var u = bwcService.getUtils();
lodash.each(finale, function(x) {
if (x.data && x.data.message && x.wallet && x.wallet.credentials.sharedEncryptingKey) {
// TODO TODO TODO => BWC
x.message = u.decryptMessage(x.data.message, x.wallet.credentials.sharedEncryptingKey);
}
});
return finale;
};
root.setTouchId = function(wallet, enabled, cb) {
fingerprintService.check(wallet, function(err) {
if (err) return cb(err); {

View file

@ -4,9 +4,7 @@
*
*/
body {
font-family: Roboto;
font-style : normal;
font-weight: 400;
font-family: 'roboto-regular';
}
h3.title {
@ -887,6 +885,14 @@ input[type=file] {
text-align: left;
}
.right {
float: right;
}
.left {
float: left;
}
.input-label {
max-width: none;
width: inherit;
@ -999,6 +1005,8 @@ input[type=number] {
@import "ionic";
@import "common";
@import 'mixins/mixins';
@import "views/add";
@import "views/tab-home";
@import 'views/onboarding/onboarding';
@import "views/includes/walletActivity";

View file

@ -0,0 +1,4 @@
@mixin center-block($topBottom: 0) {
float:none;
margin: $topBottom auto;
}

View file

@ -0,0 +1 @@
@import "layout";

View file

@ -0,0 +1,22 @@
#onboard-tour {
&-secure {
#cta {
background-image: url(../img/onboarding-tour-phone.svg);
}
}
&-currency {
#cta {
background-image: url(../img/onboarding-tour-currency-bg.svg);
}
.next-slide {
margin-top: 3rem;
}
}
&-control {
#cta {
background-image: url(../img/onboarding-tour-control.svg);
background-size: 70%;
background-position: top;
}
}
}

View file

@ -0,0 +1,33 @@
#onboard-welcome {
ion-content {
background: url(../img/onboarding-welcome-bg.png);
background-position: top center;
background-size: contain;
background-repeat-y: no-repeat;
#shopping-24 {
position: absolute;
top: 2%;
right: 5%;
width: 35px;
height: auto;
}
.logo,
p {
@include center-block();
}
.logo {
margin-top: 15rem;
}
button {
@include center-block(1rem);
color: #fff;
&.get-started {
background: rgb(100, 124, 232);
margin-top: 4rem;
}
&.restore {
background: none;
}
}
}
}

View file

@ -0,0 +1,67 @@
.onboarding {
background: rgba(30, 49, 134, 1);
background: -moz-linear-gradient(top, rgba(30, 49, 134, 1) 0%, rgba(17, 27, 73, 1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(30, 49, 134, 1)), color-stop(100%, rgba(17, 27, 73, 1)));
background: -webkit-linear-gradient(top, rgba(30, 49, 134, 1) 0%, rgba(17, 27, 73, 1) 100%);
background: -o-linear-gradient(top, rgba(30, 49, 134, 1) 0%, rgba(17, 27, 73, 1) 100%);
background: -ms-linear-gradient(top, rgba(30, 49, 134, 1) 0%, rgba(17, 27, 73, 1) 100%);
background: linear-gradient(to bottom, rgba(30, 49, 134, 1) 0%, rgba(17, 27, 73, 1) 100%);
color: #fff;
.bar.bar-header {
background: rgb(30, 49, 134);
color: #fff;
button {
color: #fff;
}
.secondary-buttons {
button {
color: rgba(255, 255, 255, .5);
}
}
}
ion-content {
color: #fff;
.scroll {}
h2 {
color: #fff;
font-size: 1.8rem;
}
p {
&.tagline {
color: rgba(255, 255, 255, .5);
}
}
.col {
@include center-block(.5rem);
}
#cta {
background-size: contain;
width: 100%;
clear: both;
height: 20rem;
margin-bottom: -3rem;
background-position: center;
background-repeat: no-repeat;
img {
height: 16rem;
}
}
button {
&.next-slide {
background: rgba(215, 215, 215, 0.10);
}
}
}
.swiper-pagination {
&-bullet {
background: rgb(100, 124, 232);
&-active {
background: rgb(100, 124, 232);
}
}
}
}
@import "terms-of-use";
@import "onboard-welcome";
@import "onboard-tour";

View file

@ -0,0 +1,17 @@
#terms-of-use{
ion-header-bar{
background: #fff;
box-shadow: 0px 3px 3px 0px rgba(50, 50, 50, 0.2);
}
ion-content{
margin-top:1.5rem;
color: rgba(86, 86, 86, 0.77);
p{
padding:0 2.5%;
margin:2rem auto;
&:first-child{
margin-top:0;
}
}
}
}

View file

@ -19,4 +19,8 @@
background-repeat: no-repeat;
background-position: -5px -6px;
}
a.item {
color: #444;
}
}