fix merge conflicts
This commit is contained in:
commit
78bd523391
272 changed files with 8069 additions and 5496 deletions
|
|
@ -12,7 +12,7 @@ var modules = [
|
|||
'ngCsv',
|
||||
'angular-md5',
|
||||
'bwcModule',
|
||||
'pbkdf2Module',
|
||||
'bitauthModule',
|
||||
'copayApp.filters',
|
||||
'copayApp.services',
|
||||
'copayApp.controllers',
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ angular.module('copayApp.controllers').controller('activityController',
|
|||
$scope.openTxpModal = txpModalService.open;
|
||||
$scope.fetchingNotifications = true;
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
profileService.getNotifications(50, function(err, n) {
|
||||
if (err) {
|
||||
$log.error(err);
|
||||
|
|
@ -74,7 +74,7 @@ angular.module('copayApp.controllers').controller('activityController',
|
|||
});
|
||||
|
||||
walletService.getTxNote(wallet, n.txid, function(err, note) {
|
||||
if (err) $log.debug('Could not fetch transaction note');
|
||||
if (err) $log.warn('Could not fetch transaction note: ' + err);
|
||||
$scope.btx.note = note;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,33 +2,10 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('addressbookViewController', function($scope, $state, $timeout, $stateParams, lodash, addressbookService, popupService, $ionicHistory) {
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
var address = data.stateParams.address;
|
||||
|
||||
if (!address) {
|
||||
$ionicHistory.back();
|
||||
return;
|
||||
}
|
||||
|
||||
addressbookService.get(address, function(err, obj) {
|
||||
if (err) {
|
||||
popupService.showAlert(err);
|
||||
return;
|
||||
}
|
||||
if (!lodash.isObject(obj)) {
|
||||
var name = obj;
|
||||
obj = {
|
||||
'name': name,
|
||||
'address': address,
|
||||
'email': ''
|
||||
};
|
||||
}
|
||||
$scope.addressbookEntry = obj;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
});
|
||||
$scope.addressbookEntry = {};
|
||||
$scope.addressbookEntry.name = $stateParams.name;
|
||||
$scope.addressbookEntry.email = $stateParams.email;
|
||||
$scope.addressbookEntry.address = $stateParams.address;
|
||||
|
||||
$scope.sendTo = function() {
|
||||
$ionicHistory.removeBackView();
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
|
||||
$scope.network = amazonService.getEnvironment();
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
var initAmazon = function() {
|
||||
|
|
@ -83,7 +83,7 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
initAmazon();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,13 +17,14 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
|
||||
$scope.isWallet = data.stateParams.isWallet;
|
||||
$scope.isCard = data.stateParams.isCard;
|
||||
$scope.cardId = data.stateParams.cardId;
|
||||
$scope.toAddress = data.stateParams.toAddress;
|
||||
$scope.toName = data.stateParams.toName;
|
||||
$scope.toEmail = data.stateParams.toEmail;
|
||||
$scope.showAlternativeAmount = !!$scope.isCard;
|
||||
$scope.showAlternativeAmount = !!$scope.cardId;
|
||||
$scope.toColor = data.stateParams.toColor;
|
||||
|
||||
if (!$scope.isCard && !$stateParams.toAddress) {
|
||||
if (!$scope.cardId && !$stateParams.toAddress) {
|
||||
$log.error('Bad params at amount')
|
||||
throw ('bad params');
|
||||
}
|
||||
|
|
@ -93,7 +94,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
$scope.pushDigit = function(digit) {
|
||||
if ($scope.amount && $scope.amount.length >= LENGTH_EXPRESSION_LIMIT) return;
|
||||
if ($scope.amount.indexOf('.') > -1 && digit == '.') return;
|
||||
if($scope.showAlternativeAmount && $scope.amount.indexOf('.') > -1 && $scope.amount[$scope.amount.indexOf('.') + 2]) return;
|
||||
if ($scope.showAlternativeAmount && $scope.amount.indexOf('.') > -1 && $scope.amount[$scope.amount.indexOf('.') + 2]) return;
|
||||
|
||||
$scope.amount = ($scope.amount + digit).replace('..', '.');
|
||||
checkFontSize();
|
||||
|
|
@ -189,7 +190,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
$scope.finish = function() {
|
||||
var _amount = evaluate(format($scope.amount));
|
||||
|
||||
if ($scope.isCard) {
|
||||
if ($scope.cardId) {
|
||||
var amountUSD = $scope.showAlternativeAmount ? _amount : $filter('formatFiatAmount')(toFiat(_amount));
|
||||
|
||||
var dataSrc = {
|
||||
|
|
@ -199,7 +200,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
ongoingProcess.set('Processing Transaction...', true);
|
||||
$timeout(function() {
|
||||
|
||||
bitpayCardService.topUp(dataSrc, function(err, invoiceId) {
|
||||
bitpayCardService.topUp($scope.cardId, dataSrc, function(err, invoiceId) {
|
||||
if (err) {
|
||||
ongoingProcess.set('Processing Transaction...', false);
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
|
||||
|
|
@ -215,7 +216,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
var payProUrl = data.paymentUrls.BIP73;
|
||||
|
||||
$state.transitionTo('tabs.bitpayCard.confirm', {
|
||||
isCard: $scope.isCard,
|
||||
cardId: $scope.cardId,
|
||||
toName: $scope.toName,
|
||||
paypro: payProUrl
|
||||
});
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
}
|
||||
|
||||
profileService.setBackupFlag(wallet.credentials.walletId);
|
||||
profileService.setBackupNeededModalFlag(wallet.credentials.walletId);
|
||||
return cb();
|
||||
}, 1);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,39 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $timeout, $log, lodash, bitpayCardService, configService, profileService, walletService, ongoingProcess, pbkdf2Service, moment, popupService, gettextCatalog, bwcError) {
|
||||
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $timeout, $log, $state, lodash, bitpayCardService, moment, popupService, gettextCatalog, $ionicHistory) {
|
||||
|
||||
var self = this;
|
||||
$scope.dateRange = 'last30Days';
|
||||
$scope.dateRange = { value: 'last30Days'};
|
||||
$scope.network = bitpayCardService.getEnvironment();
|
||||
|
||||
bitpayCardService.getCacheData(function(err, data) {
|
||||
if (err || lodash.isEmpty(data)) return;
|
||||
$scope.bitpayCardCached = true;
|
||||
self.bitpayCardTransactionHistory = data.transactions;
|
||||
self.bitpayCardCurrentBalance = data.balance;
|
||||
});
|
||||
|
||||
var processTransactions = function(invoices, history) {
|
||||
for (var i = 0; i < invoices.length; i++) {
|
||||
var matched = false;
|
||||
for (var j = 0; j < history.length; j++) {
|
||||
if (history[j].description[0].indexOf(invoices[i].id) > -1) {
|
||||
matched = true;
|
||||
}
|
||||
}
|
||||
if (!matched && ['paid', 'confirmed', 'complete'].indexOf(invoices[i].status) > -1) {
|
||||
|
||||
history.unshift({
|
||||
timestamp: invoices[i].invoiceTime,
|
||||
description: invoices[i].itemDesc,
|
||||
amount: invoices[i].price,
|
||||
type: '00611 = Client Funded Deposit',
|
||||
pending: true,
|
||||
status: invoices[i].status
|
||||
});
|
||||
}
|
||||
}
|
||||
return history;
|
||||
var updateHistoryFromCache = function(cb) {
|
||||
bitpayCardService.getBitpayDebitCardsHistory($scope.cardId, function(err, data) {
|
||||
if (err || lodash.isEmpty(data)) return cb();
|
||||
$scope.historyCached = true;
|
||||
self.bitpayCardTransactionHistory = data.transactions;
|
||||
self.bitpayCardCurrentBalance = data.balance;
|
||||
return cb();
|
||||
});
|
||||
};
|
||||
|
||||
var setDateRange = function(preset) {
|
||||
|
|
@ -61,120 +41,96 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
};
|
||||
};
|
||||
|
||||
var setGetStarted = function(history, cb) {
|
||||
if (lodash.isEmpty(history.transactionList)) {
|
||||
var dateRange = setDateRange('all');
|
||||
bitpayCardService.getHistory($scope.cardId, dateRange, function(err, history) {
|
||||
if (lodash.isEmpty(history.transactionList)) return cb(true);
|
||||
return cb(false);
|
||||
});
|
||||
} else return cb(false);
|
||||
};
|
||||
|
||||
this.update = function() {
|
||||
var dateRange = setDateRange($scope.dateRange);
|
||||
self.loadingSession = true;
|
||||
bitpayCardService.isAuthenticated(function(err, bpSession) {
|
||||
self.loadingSession = false;
|
||||
var dateRange = setDateRange($scope.dateRange.value);
|
||||
|
||||
$scope.loadingHistory = true;
|
||||
bitpayCardService.getHistory($scope.cardId, dateRange, function(err, history) {
|
||||
$scope.loadingHistory = false;
|
||||
|
||||
if (err) {
|
||||
$log.error(err);
|
||||
$scope.error = gettextCatalog.getString('Could not get transactions');
|
||||
return;
|
||||
}
|
||||
|
||||
self.bitpayCardAuthenticated = bpSession.isAuthenticated;
|
||||
self.bitpayCardTwoFactorPending = bpSession.twoFactorPending ? true : false;
|
||||
setGetStarted(history, function(getStarted) {
|
||||
self.getStarted = getStarted;
|
||||
|
||||
if (self.bitpayCardTwoFactorPending) return;
|
||||
var txs = lodash.clone(history.txs);
|
||||
for (var i = 0; i < txs.length; i++) {
|
||||
txs[i] = _getMerchantInfo(txs[i]);
|
||||
txs[i].icon = _getIconName(txs[i]);
|
||||
txs[i].desc = _processDescription(txs[i]);
|
||||
}
|
||||
self.bitpayCardTransactionHistory = txs;
|
||||
self.bitpayCardCurrentBalance = history.currentCardBalance;
|
||||
|
||||
if (self.bitpayCardAuthenticated) {
|
||||
$scope.loadingHistory = true;
|
||||
bitpayCardService.invoiceHistory(function(err, invoices) {
|
||||
if (err) $log.error(err);
|
||||
bitpayCardService.transactionHistory(dateRange, function(err, history) {
|
||||
$scope.loadingHistory = false;
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get transactions'));
|
||||
return;
|
||||
}
|
||||
|
||||
self.bitpayCardTransactionHistory = processTransactions(invoices, history.transactionList);
|
||||
self.bitpayCardCurrentBalance = history.currentCardBalance;
|
||||
|
||||
var cacheData = {
|
||||
balance: self.bitpayCardCurrentBalance,
|
||||
transactions: self.bitpayCardTransactionHistory
|
||||
};
|
||||
bitpayCardService.setCacheData(cacheData, function(err) {
|
||||
if (err) $log.error(err);
|
||||
});
|
||||
if ($scope.dateRange.value == 'last30Days') {
|
||||
$log.debug('BitPay Card: store cache history');
|
||||
var cacheHistory = {
|
||||
balance: history.currentCardBalance,
|
||||
transactions: history.txs
|
||||
};
|
||||
bitpayCardService.setBitpayDebitCardsHistory($scope.cardId, cacheHistory, {}, function(err) {
|
||||
if (err) $log.error(err);
|
||||
$scope.historyCached = true;
|
||||
});
|
||||
}
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
this.authenticate = function(email, password) {
|
||||
|
||||
var data = {
|
||||
emailAddress : email,
|
||||
hashedPassword : pbkdf2Service.pbkdf2Sync(password, '..............', 200, 64).toString('hex')
|
||||
};
|
||||
|
||||
// POST /authenticate
|
||||
// emailAddress:
|
||||
// hashedPassword:
|
||||
self.authenticating = true;
|
||||
bitpayCardService.authenticate(data, function(err, auth) {
|
||||
self.authenticating = false;
|
||||
if (err && err.data && err.data.error && !err.data.error.twoFactorPending) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err.statusText || err.data.error || 'Authentiation error');
|
||||
return;
|
||||
}
|
||||
|
||||
self.update();
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
});
|
||||
};
|
||||
|
||||
this.authenticate2FA = function(twoFactorCode) {
|
||||
|
||||
var data = {
|
||||
twoFactorCode : twoFactorCode
|
||||
};
|
||||
|
||||
self.authenticating = true;
|
||||
bitpayCardService.authenticate2FA(data, function(err, auth) {
|
||||
self.authenticating = false;
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Authentiation error'));
|
||||
return;
|
||||
}
|
||||
|
||||
self.update();
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
});
|
||||
};
|
||||
|
||||
this.getMerchantInfo = function(tx) {
|
||||
var _getMerchantInfo = function(tx) {
|
||||
var bpTranCodes = bitpayCardService.bpTranCodes;
|
||||
lodash.keys(bpTranCodes).forEach(function(code) {
|
||||
if (tx.type.indexOf(code) === 0) {
|
||||
lodash.assign(tx, bpTranCodes[code]);
|
||||
}
|
||||
});
|
||||
return tx;
|
||||
};
|
||||
|
||||
this.getIconName = function(tx) {
|
||||
var _getIconName = function(tx) {
|
||||
var icon = tx.mcc || tx.category || null;
|
||||
if (!icon) return 'default';
|
||||
return bitpayCardService.iconMap[icon];
|
||||
};
|
||||
|
||||
this.processDescription = function(tx) {
|
||||
var _processDescription = function(tx) {
|
||||
if (lodash.isArray(tx.description)) {
|
||||
return tx.description[0];
|
||||
}
|
||||
return tx.description;
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
self.update();
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.cardId = data.stateParams.id;
|
||||
if (!$scope.cardId) {
|
||||
var msg = gettextCatalog.getString('Bad param');
|
||||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: true
|
||||
});
|
||||
$state.go('tabs.home');
|
||||
popupService.showAlert(null, msg);
|
||||
} else {
|
||||
updateHistoryFromCache(function() {
|
||||
self.update();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
72
src/js/controllers/bitpayCardIntro.js
Normal file
72
src/js/controllers/bitpayCardIntro.js
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('bitpayCardIntroController', function($scope, $log, $state, $ionicHistory, storageService, externalLinkService, bitpayCardService, gettextCatalog, popupService) {
|
||||
|
||||
var checkOtp = function(obj, cb) {
|
||||
if (obj.otp) {
|
||||
var msg = gettextCatalog.getString('Enter Two Factor for BitPay Card');
|
||||
popupService.showPrompt(null, msg, null, function(res) {
|
||||
cb(res);
|
||||
});
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
|
||||
if (data.stateParams && data.stateParams.secret) {
|
||||
var obj = {
|
||||
secret: data.stateParams.secret,
|
||||
email: data.stateParams.email,
|
||||
otp: data.stateParams.otp
|
||||
};
|
||||
checkOtp(obj, function(otp) {
|
||||
obj.otp = otp;
|
||||
bitpayCardService.bitAuthPair(obj, function(err, data) {
|
||||
if (err) {
|
||||
popupService.showAlert(null, err);
|
||||
return;
|
||||
}
|
||||
var title = gettextCatalog.getString('Add BitPay Card?');
|
||||
var msg = gettextCatalog.getString('Would you like to add this account ({{email}}) to your wallet?', {email: obj.email});
|
||||
var ok = gettextCatalog.getString('Add cards');
|
||||
var cancel = gettextCatalog.getString('Go back');
|
||||
popupService.showConfirm(title, msg, ok, cancel, function(res) {
|
||||
if (res) {
|
||||
// Set flag for nextStep
|
||||
storageService.setNextStep('BitpayCard', true, function(err) {});
|
||||
// Save data
|
||||
bitpayCardService.setBitpayDebitCards(data, function(err) {
|
||||
if (err) return;
|
||||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: true
|
||||
});
|
||||
$state.go('tabs.home').then(function() {
|
||||
if (data.cards[0]) {
|
||||
$state.transitionTo('tabs.bitpayCard', {id: data.cards[0].id});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
bitpayCardService.getCredentials(function(err, credentials) {
|
||||
if (err) popupService.showAlert(null, err);
|
||||
else $log.info('BitPay Debit Card Credentials: Ok.');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$scope.orderBitPayCard = function() {
|
||||
var url = 'https://bitpay.com/visa/';
|
||||
externalLinkService.open(url);
|
||||
};
|
||||
|
||||
$scope.connectBitPayCard = function() {
|
||||
var url = 'https://bitpay.com/visa/login';
|
||||
externalLinkService.open(url);
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -16,12 +16,14 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
$log.debug('Wallet changed: ' + w.name);
|
||||
});
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
this.confirm = function() {
|
||||
var message = gettextCatalog.getString('Amazon.com Gift Card purchase for ${{amount}} USD', {amount: $scope.formData.fiat});
|
||||
var message = gettextCatalog.getString('Amazon.com Gift Card purchase for ${{amount}} USD', {
|
||||
amount: $scope.formData.fiat
|
||||
});
|
||||
var ok = gettextCatalog.getString('Buy');
|
||||
popupService.showConfirm(null, message, ok, null, function(res) {
|
||||
if (res) self.createTx();
|
||||
|
|
@ -209,8 +211,10 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.formData = { fiat: null };
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
$scope.formData = {
|
||||
fiat: null
|
||||
};
|
||||
$scope.wallets = profileService.getWallets({
|
||||
network: network,
|
||||
onlyComplete: true
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.isWallet = data.stateParams.isWallet;
|
||||
$scope.isCard = data.stateParams.isCard;
|
||||
$scope.cardId = data.stateParams.cardId;
|
||||
$scope.toAmount = data.stateParams.toAmount;
|
||||
$scope.toAddress = data.stateParams.toAddress;
|
||||
$scope.toName = data.stateParams.toName;
|
||||
|
|
@ -226,6 +226,9 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
|
||||
var setSendError = function(msg) {
|
||||
$scope.sendStatus = '';
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
popupService.showAlert(gettextCatalog.getString('Error at confirm:'), msg);
|
||||
};
|
||||
|
||||
|
|
@ -377,11 +380,24 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
};
|
||||
|
||||
$scope.onSuccessConfirm = function() {
|
||||
var previousView = $ionicHistory.viewHistory().backView && $ionicHistory.viewHistory().backView.stateName;
|
||||
var fromBitPayCard = previousView.match(/tabs.bitpayCard/) ? true : false;
|
||||
|
||||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: true
|
||||
});
|
||||
$ionicHistory.removeBackView();
|
||||
$scope.sendStatus = '';
|
||||
$state.go('tabs.send');
|
||||
|
||||
if (fromBitPayCard) {
|
||||
$timeout(function() {
|
||||
$state.transitionTo('tabs.bitpayCard', {
|
||||
id: $stateParams.cardId
|
||||
});
|
||||
}, 100);
|
||||
} else {
|
||||
$state.go('tabs.send');
|
||||
}
|
||||
};
|
||||
|
||||
function publishAndSign(wallet, txp, onSendStatusChange) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,45 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
});
|
||||
};
|
||||
|
||||
function getPassword(cb) {
|
||||
if ($scope.password) return cb(null, $scope.password);
|
||||
|
||||
walletService.prepare(wallet, function(err, password) {
|
||||
if (err) return cb(err);
|
||||
$scope.password = password;
|
||||
return cb(null, password);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.generateQrCode = function() {
|
||||
if ($scope.formData.exportWalletInfo || !walletService.isEncrypted(wallet)) {
|
||||
$scope.file.value = false;
|
||||
}
|
||||
|
||||
getPassword(function(err, password) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
|
||||
walletService.getEncodedWalletInfo(wallet, password, function(err, code) {
|
||||
if (err) return cb(err);
|
||||
|
||||
if (!code)
|
||||
$scope.formData.supported = false;
|
||||
else {
|
||||
$scope.formData.supported = true;
|
||||
$scope.formData.exportWalletInfo = code;
|
||||
}
|
||||
|
||||
$scope.file.value = false;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var init = function() {
|
||||
$scope.formData = {};
|
||||
$scope.isEncrypted = wallet.isPrivKeyEncrypted();
|
||||
|
|
@ -24,24 +63,6 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
$scope.showAdvanced = false;
|
||||
$scope.wallet = wallet;
|
||||
$scope.canSign = wallet.canSign();
|
||||
|
||||
walletService.getEncodedWalletInfo(wallet, function(err, code) {
|
||||
if (err || !code) {
|
||||
$log.warn(err);
|
||||
return $ionicHistory.goBack();
|
||||
}
|
||||
|
||||
if (!code)
|
||||
$scope.formData.supported = false;
|
||||
else {
|
||||
$scope.formData.supported = true;
|
||||
$scope.formData.exportWalletInfo = code;
|
||||
}
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -67,23 +88,31 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
};
|
||||
|
||||
$scope.downloadWalletBackup = function() {
|
||||
$scope.getAddressbook(function(err, localAddressBook) {
|
||||
getPassword(function(err, password) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
var opts = {
|
||||
noSign: $scope.formData.noSignEnabled,
|
||||
addressBook: localAddressBook
|
||||
};
|
||||
|
||||
backupService.walletDownload($scope.formData.password, opts, function(err) {
|
||||
$scope.getAddressbook(function(err, localAddressBook) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
||||
return;
|
||||
}
|
||||
$ionicHistory.removeBackView();
|
||||
$state.go('tabs.home');
|
||||
var opts = {
|
||||
noSign: $scope.formData.noSignEnabled,
|
||||
addressBook: localAddressBook,
|
||||
password: password
|
||||
};
|
||||
|
||||
backupService.walletDownload($scope.formData.password, opts, function(err) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
||||
return;
|
||||
}
|
||||
$ionicHistory.removeBackView();
|
||||
$state.go('tabs.home');
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
@ -104,21 +133,29 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
};
|
||||
|
||||
$scope.getBackup = function(cb) {
|
||||
$scope.getAddressbook(function(err, localAddressBook) {
|
||||
getPassword(function(err, password) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
||||
return cb(null);
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
var opts = {
|
||||
noSign: $scope.formData.noSignEnabled,
|
||||
addressBook: localAddressBook
|
||||
};
|
||||
|
||||
var ew = backupService.walletExport($scope.formData.password, opts);
|
||||
if (!ew) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
||||
}
|
||||
return cb(ew);
|
||||
$scope.getAddressbook(function(err, localAddressBook) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
||||
return cb(null);
|
||||
}
|
||||
var opts = {
|
||||
noSign: $scope.formData.noSignEnabled,
|
||||
addressBook: localAddressBook,
|
||||
password: password
|
||||
};
|
||||
|
||||
var ew = backupService.walletExport($scope.formData.password, opts);
|
||||
if (!ew) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
||||
}
|
||||
return cb(ew);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -171,6 +208,11 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
init();
|
||||
$scope.file = {
|
||||
value: true
|
||||
};
|
||||
$scope.formData.exportWalletInfo = null;
|
||||
$scope.password = null;
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
|
||||
$scope.network = glideraService.getEnvironment();
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url) {
|
||||
externalLinkService.open(url);
|
||||
};
|
||||
|
||||
var initGlidera = function(accessToken) {
|
||||
$scope.token = null;
|
||||
$scope.token = accessToken;
|
||||
$scope.permissions = null;
|
||||
$scope.email = null;
|
||||
$scope.personalInfo = null;
|
||||
|
|
@ -27,7 +27,9 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
}
|
||||
$scope.token = glidera.token;
|
||||
$scope.permissions = glidera.permissions;
|
||||
$scope.update({fullUpdate: true});
|
||||
$scope.update({
|
||||
fullUpdate: true
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -113,7 +115,7 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
initGlidera();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('amazonCardDetailsController', function($scope, $log, $timeout, bwcError, amazonService, lodash, ongoingProcess, popupService, gettextCatalog) {
|
||||
angular.module('copayApp.controllers').controller('amazonCardDetailsController', function($scope, $log, $timeout, bwcError, amazonService, lodash, ongoingProcess, popupService, gettextCatalog, externalLinkService) {
|
||||
|
||||
$scope.cancelGiftCard = function() {
|
||||
ongoingProcess.set('Canceling gift card...', true);
|
||||
|
|
@ -62,4 +62,8 @@ angular.module('copayApp.controllers').controller('amazonCardDetailsController',
|
|||
$scope.amazonCardDetailsModal.hide();
|
||||
};
|
||||
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
function updateMemo() {
|
||||
walletService.getTxNote(wallet, $scope.btx.txid, function(err, note) {
|
||||
if (err) {
|
||||
$log.warn('Could not fetch transaction note ' + err);
|
||||
$log.warn('Could not fetch transaction note: ' + err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -139,8 +139,8 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
});
|
||||
};
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
$scope.getShortNetworkName = function() {
|
||||
|
|
|
|||
|
|
@ -96,16 +96,20 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
};
|
||||
|
||||
$scope.reject = function(txp) {
|
||||
$scope.loading = true;
|
||||
var title = gettextCatalog.getString('Warning!');
|
||||
var msg = gettextCatalog.getString('Are you sure you want to reject this transaction?');
|
||||
popupService.showConfirm(title, msg, null, null, function(res) {
|
||||
if (res) {
|
||||
$scope.loading = true;
|
||||
|
||||
walletService.reject($scope.wallet, $scope.tx, function(err, txpr) {
|
||||
if (err)
|
||||
return setError(err, gettextCatalog.getString('Could not reject payment'));
|
||||
walletService.reject($scope.wallet, $scope.tx, function(err, txpr) {
|
||||
if (err)
|
||||
return setError(err, gettextCatalog.getString('Could not reject payment'));
|
||||
|
||||
$scope.close();
|
||||
$scope.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.remove = function() {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ angular.module('copayApp.controllers').controller('termsController', function($s
|
|||
});
|
||||
};
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ angular.module('copayApp.controllers').controller('preferencesAbout',
|
|||
$scope.commitHash = $window.commitHash;
|
||||
$scope.name = $window.appConfig.gitHubRepoName;
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesBitpayCardController',
|
||||
function($scope, $state, $timeout, $ionicHistory, bitpayCardService, popupService) {
|
||||
function($scope, $state, $timeout, $ionicHistory, bitpayCardService, popupService, gettextCatalog) {
|
||||
|
||||
$scope.logout = function() {
|
||||
var title = 'Are you sure you would like to log out of your Bitpay Card account?';
|
||||
popupService.showConfirm(title, null, null, null, function(res) {
|
||||
if (res) logout();
|
||||
$scope.remove = function() {
|
||||
var msg = gettextCatalog.getString('Are you sure you would like to remove your BitPay Card account from this device?');
|
||||
popupService.showConfirm(null, msg, null, null, function(res) {
|
||||
if (res) remove();
|
||||
});
|
||||
};
|
||||
|
||||
var logout = function() {
|
||||
bitpayCardService.logout(function() {
|
||||
var remove = function() {
|
||||
bitpayCardService.remove(function() {
|
||||
$ionicHistory.removeBackView();
|
||||
$timeout(function() {
|
||||
$state.go('tabs.home');
|
||||
|
|
@ -19,4 +19,11 @@ angular.module('copayApp.controllers').controller('preferencesBitpayCardControll
|
|||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
bitpayCardService.getBitpayDebitCards(function(err, data) {
|
||||
if (err) return;
|
||||
$scope.bitpayCards = data.cards;
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
|
|||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
|
||||
} else {
|
||||
$ionicHistory.removeBackView();
|
||||
$ionicHistory.clearHistory();
|
||||
$ionicHistory.clearCache();
|
||||
$state.go('tabs.home');
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,23 +2,25 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('preferencesEmailController', function($scope, $ionicHistory, $stateParams, gettextCatalog, profileService, walletService, configService) {
|
||||
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var walletId = wallet.credentials.walletId;
|
||||
$scope.wallet = profileService.getWallet($stateParams.walletId);
|
||||
var walletId = $scope.wallet.credentials.walletId;
|
||||
|
||||
var config = configService.getSync();
|
||||
config.emailFor = config.emailFor || {};
|
||||
$scope.emailForExist = config.emailFor && config.emailFor[walletId];
|
||||
$scope.email = {
|
||||
value: config.emailFor && config.emailFor[walletId]
|
||||
};
|
||||
|
||||
$scope.save = function() {
|
||||
|
||||
$scope.save = function(val) {
|
||||
var opts = {
|
||||
emailFor: {}
|
||||
};
|
||||
opts.emailFor[walletId] = $scope.email.value;
|
||||
opts.emailFor[walletId] = val;
|
||||
|
||||
walletService.updateRemotePreferences(wallet, {
|
||||
email: $scope.email.value,
|
||||
walletService.updateRemotePreferences($scope.wallet, {
|
||||
email: val,
|
||||
}, function(err) {
|
||||
if (err) $log.warn(err);
|
||||
configService.set(opts, function(err) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ angular.module('copayApp.controllers').controller('preferencesGlideraController'
|
|||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
$scope.network = glideraService.getEnvironment();
|
||||
|
||||
$scope.token = accessToken;
|
||||
$scope.token = null;
|
||||
$scope.permissions = null;
|
||||
$scope.email = null;
|
||||
$scope.personalInfo = null;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,14 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
|
|||
$log.debug('Generating CSV from History');
|
||||
getHistory(function(err, txs) {
|
||||
if (err || lodash.isEmpty(txs)) {
|
||||
if (err) $log.warn('Failed to generate CSV:', err);
|
||||
else $log.warn('Failed to generate CSV: no transactions');
|
||||
if (err) {
|
||||
$log.warn('Failed to generate CSV:', err);
|
||||
$scope.err = err;
|
||||
}
|
||||
else {
|
||||
$log.warn('Failed to generate CSV: no transactions');
|
||||
$scope.err = 'no transactions';
|
||||
}
|
||||
if (cb) return cb(err);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
var listeners = [];
|
||||
var notifications = [];
|
||||
$scope.externalServices = {};
|
||||
$scope.bitpayCardEnabled = true; // TODO
|
||||
$scope.openTxpModal = txpModalService.open;
|
||||
$scope.version = $window.version;
|
||||
$scope.name = $window.appConfig.nameCase;
|
||||
$scope.homeTip = $stateParams.fromOnboarding;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.isAndroid = platformInfo.isAndroid;
|
||||
|
||||
$scope.$on("$ionicView.afterEnter", function() {
|
||||
startupService.ready();
|
||||
|
|
@ -19,7 +19,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
|
||||
if (!$scope.homeTip) {
|
||||
storageService.getHomeTipAccepted(function(error, value) {
|
||||
$scope.homeTip = (value == 'false') ? false : true;
|
||||
$scope.homeTip = (value == 'accepted') ? false : true;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
});
|
||||
|
||||
walletService.getTxNote(wallet, n.txid, function(err, note) {
|
||||
if (err) $log.debug(gettextCatalog.getString('Could not fetch transaction note'));
|
||||
if (err) $log.warn('Could not fetch transaction note: ' + err);
|
||||
$scope.btx.note = note;
|
||||
});
|
||||
});
|
||||
|
|
@ -175,7 +175,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
};
|
||||
|
||||
$scope.hideHomeTip = function() {
|
||||
storageService.setHomeTipAccepted(false, function(error, value) {
|
||||
storageService.setHomeTipAccepted('accepted', function() {
|
||||
$scope.homeTip = false;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
|
|
@ -203,19 +203,32 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
};
|
||||
|
||||
var bitpayCardCache = function() {
|
||||
bitpayCardService.getCacheData(function(err, data) {
|
||||
if (err || lodash.isEmpty(data)) return;
|
||||
$scope.bitpayCard = data;
|
||||
bitpayCardService.getBitpayDebitCards(function(err, data) {
|
||||
if (err) return;
|
||||
if (lodash.isEmpty(data)) {
|
||||
$scope.bitpayCards = null;
|
||||
return;
|
||||
}
|
||||
$scope.bitpayCards = data.cards;
|
||||
});
|
||||
bitpayCardService.getBitpayDebitCardsHistory(null, function(err, data) {
|
||||
if (err) return;
|
||||
if (lodash.isEmpty(data)) {
|
||||
$scope.cardsHistory = null;
|
||||
return;
|
||||
}
|
||||
$scope.cardsHistory = data;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.onRefresh = function() {
|
||||
$scope.$broadcast('scroll.refreshComplete');
|
||||
$timeout(function() {
|
||||
$scope.$broadcast('scroll.refreshComplete');
|
||||
}, 300);
|
||||
updateAllWallets();
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
$scope.bitpayCard = null;
|
||||
nextStep();
|
||||
updateAllWallets();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.isNW = platformInfo.isNW;
|
||||
|
||||
var showModalTimeout;
|
||||
|
||||
$scope.shareAddress = function(addr) {
|
||||
if ($scope.generatingAddress) return;
|
||||
|
|
@ -14,16 +14,21 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
};
|
||||
|
||||
$scope.setAddress = function(forceNew) {
|
||||
if ($scope.generatingAddress || !$scope.wallet.isComplete()) return;
|
||||
|
||||
if (!$scope.wallet || $scope.generatingAddress || !$scope.wallet.isComplete()) return;
|
||||
$scope.addr = null;
|
||||
$scope.generatingAddress = true;
|
||||
walletService.getAddress($scope.wallet, forceNew, function(err, addr) {
|
||||
$scope.generatingAddress = false;
|
||||
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
$scope.addr = addr;
|
||||
if ($scope.wallet.showBackupNeededModal) $scope.openBackupNeededModal();
|
||||
$scope.$apply();
|
||||
if ($scope.wallet.showBackupNeededModal) {
|
||||
showModalTimeout = $timeout(function() {
|
||||
$scope.openBackupNeededModal();
|
||||
}, 2000);
|
||||
}
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 10);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -74,6 +79,10 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
$log.debug('No wallet provided');
|
||||
return;
|
||||
}
|
||||
if (wallet == $scope.wallet) {
|
||||
$log.debug('No change in wallet');
|
||||
return;
|
||||
}
|
||||
$scope.wallet = wallet;
|
||||
$log.debug('Wallet changed: ' + wallet.name);
|
||||
$timeout(function() {
|
||||
|
|
@ -81,6 +90,10 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
}, 100);
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.leave", function(event, data) {
|
||||
$timeout.cancel(showModalTimeout);
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.wallets = profileService.getWallets();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService) {
|
||||
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService, $rootScope) {
|
||||
|
||||
var originalList;
|
||||
var CONTACTS_SHOW_LIMIT;
|
||||
|
|
@ -102,23 +102,28 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
isWallet: item.isWallet,
|
||||
toAddress: addr,
|
||||
toName: item.name,
|
||||
toEmail: item.email
|
||||
toEmail: item.email,
|
||||
toColor: item.color
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
var updateHasFunds = function() {
|
||||
$scope.hasFunds = null;
|
||||
|
||||
if ($rootScope.everHasFunds) {
|
||||
$scope.hasFunds = true;
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.hasFunds = false;
|
||||
|
||||
var wallets = profileService.getWallets({
|
||||
onlyComplete: true,
|
||||
});
|
||||
|
||||
if (!wallets || !wallets.length) {
|
||||
$scope.hasFunds = false;
|
||||
$timeout(function() {
|
||||
return $timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
|
|
@ -132,11 +137,12 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
return;
|
||||
}
|
||||
|
||||
if (status.availableBalanceSat) {
|
||||
if (status.availableBalanceSat > 0) {
|
||||
$scope.hasFunds = true;
|
||||
$rootScope.everHasFunds = true;
|
||||
}
|
||||
|
||||
if (index == wallets.length) {
|
||||
$scope.hasFunds = $scope.hasFunds || false;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
$scope.wallets = profileService.getWallets();
|
||||
};
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ angular.module('copayApp.controllers').controller('tabsController', function($ro
|
|||
if (!incomingData.redir(data)) {
|
||||
popupService.showAlert(null, gettextCatalog.getString('Invalid data'));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$scope.setScanFn = function(scanFn) {
|
||||
$scope.scan = function() {
|
||||
|
|
@ -22,32 +22,8 @@ angular.module('copayApp.controllers').controller('tabsController', function($ro
|
|||
}, 1);
|
||||
};
|
||||
|
||||
var hideTabsViews = [
|
||||
'tabs.send.amount',
|
||||
'tabs.send.confirm',
|
||||
'tabs.send.addressbook',
|
||||
'tabs.addressbook',
|
||||
'tabs.addressbook.add',
|
||||
'tabs.addressbook.view',
|
||||
'tabs.preferences.backupWarning',
|
||||
'tabs.preferences.backup',
|
||||
'tabs.receive.backupWarning',
|
||||
'tabs.receive.backup',
|
||||
'tabs.bitpayCard.amount',
|
||||
'tabs.bitpayCard.confirm',
|
||||
];
|
||||
|
||||
$rootScope.$on('$ionicView.beforeEnter', function() {
|
||||
|
||||
$rootScope.hideTabs = false;
|
||||
|
||||
var currentState = $state.current.name;
|
||||
|
||||
lodash.each(hideTabsViews, function(view) {
|
||||
if (currentState === view) {
|
||||
$rootScope.hideTabs = true;
|
||||
}
|
||||
});
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
$rootScope.hideTabs = '';
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
$scope.completeTxHistory = [];
|
||||
$scope.openTxpModal = txpModalService.open;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.isAndroid = platformInfo.isAndroid;
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
|
|
@ -161,7 +162,9 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
};
|
||||
|
||||
$scope.onRefresh = function() {
|
||||
$scope.$broadcast('scroll.refreshComplete');
|
||||
$timeout(function() {
|
||||
$scope.$broadcast('scroll.refreshComplete');
|
||||
}, 300);
|
||||
$scope.updateAll(true);
|
||||
};
|
||||
|
||||
|
|
|
|||
15
src/js/directives/hideTabs.js
Normal file
15
src/js/directives/hideTabs.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.directives')
|
||||
.directive('hideTabs', function($rootScope, $timeout) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function($scope, $el) {
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||
$timeout(function() {
|
||||
$rootScope.hideTabs = 'tabs-item-hide';
|
||||
$rootScope.$apply();
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
@ -21,16 +21,14 @@ angular.module('copayApp.directives')
|
|||
};
|
||||
scope.sendPaymentToAddress = function(bitcoinAddress) {
|
||||
scope.showMenu = false;
|
||||
$state.go('tabs.send');
|
||||
$timeout(function() {
|
||||
$state.go('tabs.send').then(function() {
|
||||
$state.transitionTo('tabs.send.amount', {toAddress: bitcoinAddress});
|
||||
}, 100);
|
||||
});
|
||||
};
|
||||
scope.addToAddressBook = function(bitcoinAddress) {
|
||||
scope.showMenu = false;
|
||||
$timeout(function() {
|
||||
$state.go('tabs.send');
|
||||
$timeout(function() {
|
||||
$state.go('tabs.send').then(function() {
|
||||
$state.transitionTo('tabs.send.addressbook', {addressbookEntry: bitcoinAddress});
|
||||
});
|
||||
}, 100);
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
*/
|
||||
|
||||
.state('tabs.send.amount', {
|
||||
url: '/amount/:isWallet/:toAddress/:toName/:toEmail',
|
||||
url: '/amount/:isWallet/:toAddress/:toName/:toEmail/:toColor',
|
||||
views: {
|
||||
'tab-send@tabs': {
|
||||
controller: 'amountController',
|
||||
|
|
@ -571,7 +571,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
})
|
||||
.state('tabs.addressbook.view', {
|
||||
url: '/view/:address',
|
||||
url: '/view/:address/:email/:name',
|
||||
views: {
|
||||
'tab-settings@tabs': {
|
||||
templateUrl: 'views/addressbook.view.html',
|
||||
|
|
@ -846,8 +846,17 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
*
|
||||
*/
|
||||
|
||||
.state('tabs.bitpayCard', {
|
||||
url: '/bitpay-card',
|
||||
.state('tabs.bitpayCardIntro', {
|
||||
url: '/bitpay-card-intro/:secret/:email/:otp',
|
||||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'bitpayCardIntroController',
|
||||
templateUrl: 'views/bitpayCardIntro.html'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('tabs.bitpayCard', {
|
||||
url: '/bitpay-card/:id',
|
||||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'bitpayCardController',
|
||||
|
|
@ -857,7 +866,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
})
|
||||
.state('tabs.bitpayCard.amount', {
|
||||
url: '/amount/:isCard/:toName',
|
||||
url: '/amount/:cardId/:toName',
|
||||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'amountController',
|
||||
|
|
@ -866,7 +875,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
})
|
||||
.state('tabs.bitpayCard.confirm', {
|
||||
url: '/confirm/:isCard/:toAddress/:toName/:toAmount/:toEmail/:description/:paypro',
|
||||
url: '/confirm/:cardId/:toAddress/:toName/:toAmount/:toEmail/:description/:paypro',
|
||||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'confirmController',
|
||||
|
|
@ -878,12 +887,13 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
url: '/preferences',
|
||||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'preferencesBitpayCardController',
|
||||
templateUrl: 'views/preferencesBitpayCard.html'
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService) {
|
||||
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService) {
|
||||
|
||||
uxLanguage.init();
|
||||
openURLService.init();
|
||||
|
|
@ -895,7 +905,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
screen.lockOrientation('portrait');
|
||||
|
||||
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
|
||||
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
|
||||
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
|
||||
cordova.plugins.Keyboard.disableScroll(true);
|
||||
}
|
||||
|
||||
|
|
@ -970,8 +980,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
if (lodash.isEmpty(profileService.getWallets())) {
|
||||
$log.debug('No wallets and no disclaimer... redirecting');
|
||||
$state.go('onboarding.welcome');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$log.debug('Display disclaimer... redirecting');
|
||||
$state.go('onboarding.disclaimer', {
|
||||
resume: true
|
||||
|
|
@ -980,8 +989,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
} else {
|
||||
throw new Error(err); // TODO
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
profileService.storeProfileIfDirty();
|
||||
$log.debug('Profile loaded ... Starting UX.');
|
||||
scannerService.gentleInitialize();
|
||||
|
|
@ -997,7 +1005,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
type: "menubar"
|
||||
});
|
||||
try {
|
||||
nativeMenuBar.createMacBuiltin("Copay");
|
||||
nativeMenuBar.createMacBuiltin($window.appConfig.nameCase);
|
||||
} catch (e) {
|
||||
$log.debug('This is not OSX');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,195 +1,239 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('bitpayCardService', function($http, $log, lodash, storageService) {
|
||||
angular.module('copayApp.services').factory('bitpayCardService', function($http, $log, lodash, storageService, bitauthService, platformInfo, moment) {
|
||||
var root = {};
|
||||
var credentials = {};
|
||||
var bpSession = {};
|
||||
var BITPAY_CARD_NETWORK = 'livenet';
|
||||
var BITPAY_CARD_API_URL = BITPAY_CARD_NETWORK == 'livenet' ? 'https://bitpay.com' : 'https://test.bitpay.com';
|
||||
|
||||
var _setCredentials = function() {
|
||||
/*
|
||||
* Development: 'testnet'
|
||||
* Production: 'livenet'
|
||||
*/
|
||||
credentials.NETWORK = 'livenet';
|
||||
if (credentials.NETWORK == 'testnet') {
|
||||
credentials.BITPAY_API_URL = 'https://test.bitpay.com';
|
||||
}
|
||||
else {
|
||||
credentials.BITPAY_API_URL = 'https://bitpay.com';
|
||||
};
|
||||
var _getCredentials = function(cb) {
|
||||
var pubkey, sin, isNew;
|
||||
storageService.getBitpayCardCredentials(BITPAY_CARD_NETWORK, function(err, data) {
|
||||
if (err) return cb(err);
|
||||
if (lodash.isString(data)) {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
var credentials = data || {};
|
||||
if (lodash.isEmpty(credentials) || (credentials && !credentials.priv)) {
|
||||
isNew = true;
|
||||
credentials = bitauthService.generateSin();
|
||||
}
|
||||
try {
|
||||
pubkey = bitauthService.getPublicKeyFromPrivateKey(credentials.priv);
|
||||
sin = bitauthService.getSinFromPublicKey(pubkey);
|
||||
if (isNew)
|
||||
storageService.setBitpayCardCredentials(BITPAY_CARD_NETWORK, JSON.stringify(credentials), function(err) {});
|
||||
}
|
||||
catch (e) {
|
||||
$log.error(e);
|
||||
return cb(e);
|
||||
};
|
||||
return cb(null, credentials);
|
||||
});
|
||||
};
|
||||
|
||||
var _setError = function(msg, e) {
|
||||
$log.error(msg);
|
||||
return e;
|
||||
var error = e.data ? e.data.error : msg;
|
||||
return error;
|
||||
};
|
||||
|
||||
var _getUser = function(cb) {
|
||||
_setCredentials();
|
||||
storageService.getBitpayCard(credentials.NETWORK, function(err, user) {
|
||||
if (err) return cb(err);
|
||||
if (lodash.isString(user)) {
|
||||
user = JSON.parse(user);
|
||||
}
|
||||
return cb(null, user);
|
||||
});
|
||||
};
|
||||
|
||||
var _setUser = function(user, cb) {
|
||||
_setCredentials();
|
||||
user = JSON.stringify(user);
|
||||
storageService.setBitpayCard(credentials.NETWORK, user, function(err) {
|
||||
return cb(err);
|
||||
});
|
||||
// Show pending task from the UI
|
||||
storageService.setNextStep('BitpayCard', true, function(err) {});
|
||||
};
|
||||
|
||||
var _getSession = function(cb) {
|
||||
_setCredentials();
|
||||
$http({
|
||||
var _get = function(endpoint) {
|
||||
return {
|
||||
method: 'GET',
|
||||
url: credentials.BITPAY_API_URL + '/visa-api/session',
|
||||
url: BITPAY_CARD_API_URL + endpoint,
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
}).then(function(data) {
|
||||
$log.info('BitPay Get Session: SUCCESS');
|
||||
bpSession = data.data.data;
|
||||
return cb(null, bpSession);
|
||||
};
|
||||
};
|
||||
|
||||
var _post = function(endpoint, json, credentials) {
|
||||
var dataToSign = BITPAY_CARD_API_URL + endpoint + JSON.stringify(json);
|
||||
var signedData = bitauthService.sign(dataToSign, credentials.priv);
|
||||
|
||||
return {
|
||||
method: 'POST',
|
||||
url: BITPAY_CARD_API_URL + endpoint,
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'x-identity': credentials.pub,
|
||||
'x-signature': signedData
|
||||
},
|
||||
data: json
|
||||
};
|
||||
};
|
||||
|
||||
var _postAuth = function(endpoint, json, credentials) {
|
||||
json['params'].signature = bitauthService.sign(JSON.stringify(json.params), credentials.priv);
|
||||
json['params'].pubkey = credentials.pub;
|
||||
json['params'] = JSON.stringify(json.params);
|
||||
|
||||
var ret = {
|
||||
method: 'POST',
|
||||
url: BITPAY_CARD_API_URL + endpoint,
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
data: json
|
||||
};
|
||||
|
||||
$log.debug('post auth:' + JSON.stringify(ret));
|
||||
return ret;
|
||||
};
|
||||
|
||||
var _afterBitAuthSuccess = function(token, obj, credentials, cb) {
|
||||
var json = {
|
||||
method: 'getDebitCards'
|
||||
};
|
||||
// Get Debit Cards
|
||||
$http(_post('/api/v2/' + token, json, credentials)).then(function(data) {
|
||||
if (data && data.data.error) return cb(data.data.error);
|
||||
$log.info('BitPay Get Debit Cards: SUCCESS');
|
||||
return cb(data.data.error, {token: token, cards: data.data.data, email: obj.email});
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error: Get Session', data));
|
||||
return cb(_setError('BitPay Card Error: Get Debit Cards', data));
|
||||
});
|
||||
};
|
||||
|
||||
var _getBitPay = function(endpoint) {
|
||||
_setCredentials();
|
||||
return {
|
||||
method: 'GET',
|
||||
url: credentials.BITPAY_API_URL + endpoint,
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'x-csrf-token': bpSession.csrfToken
|
||||
var _processTransactions = function(invoices, history) {
|
||||
invoices = invoices || [];
|
||||
for (var i = 0; i < invoices.length; i++) {
|
||||
var matched = false;
|
||||
for (var j = 0; j < history.length; j++) {
|
||||
if (history[j].description[0].indexOf(invoices[i].id) > -1) {
|
||||
matched = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
var isInvoiceLessThanOneDayOld = moment() < moment(new Date(invoices[i].invoiceTime)).add(1, 'day');
|
||||
if (!matched && isInvoiceLessThanOneDayOld) {
|
||||
var isInvoiceUnderpaid = invoices[i].exceptionStatus === 'paidPartial';
|
||||
|
||||
var _postBitPay = function(endpoint, data) {
|
||||
_setCredentials();
|
||||
return {
|
||||
method: 'POST',
|
||||
url: credentials.BITPAY_API_URL + endpoint,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'x-csrf-token': bpSession.csrfToken
|
||||
},
|
||||
data: data
|
||||
};
|
||||
if(['paid', 'confirmed', 'complete'].indexOf(invoices[i].status) >= 0
|
||||
|| (invoices[i].status === 'invalid' || isInvoiceUnderpaid)) {
|
||||
|
||||
history.unshift({
|
||||
timestamp: new Date(invoices[i].invoiceTime),
|
||||
description: invoices[i].itemDesc,
|
||||
amount: invoices[i].price,
|
||||
type: '00611 = Client Funded Deposit',
|
||||
pending: true,
|
||||
status: invoices[i].status
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return history;
|
||||
};
|
||||
|
||||
root.getEnvironment = function() {
|
||||
_setCredentials();
|
||||
return credentials.NETWORK;
|
||||
return BITPAY_CARD_NETWORK;
|
||||
};
|
||||
|
||||
root.topUp = function(data, cb) {
|
||||
var dataSrc = {
|
||||
amount: data.amount,
|
||||
currency: data.currency
|
||||
};
|
||||
$http(_postBitPay('/visa-api/topUp', dataSrc)).then(function(data) {
|
||||
$log.info('BitPay TopUp: SUCCESS');
|
||||
return cb(null, data.data.data.invoice);
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error: TopUp', data));
|
||||
root.getCredentials = function(cb) {
|
||||
_getCredentials(function(err, credentials) {
|
||||
return cb(err, credentials);
|
||||
});
|
||||
};
|
||||
|
||||
root.transactionHistory = function(dateRange, cb) {
|
||||
var params;
|
||||
if (!dateRange.startDate) {
|
||||
params = '';
|
||||
} else {
|
||||
params = '/?startDate=' + dateRange.startDate + '&endDate=' + dateRange.endDate;
|
||||
root.bitAuthPair = function(obj, cb) {
|
||||
var deviceName = 'Unknow device';
|
||||
if (platformInfo.isNW) {
|
||||
deviceName = require('os').platform();
|
||||
} else if (platformInfo.isCordova) {
|
||||
deviceName = device.model;
|
||||
}
|
||||
$http(_getBitPay('/visa-api/transactionHistory' + params)).then(function(data) {
|
||||
$log.info('BitPay Get Transaction History: SUCCESS');
|
||||
return cb(null, data.data.data);
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error: Get Transaction History', data));
|
||||
var json = {
|
||||
method: 'createToken',
|
||||
params: {
|
||||
secret: obj.secret,
|
||||
version: 2,
|
||||
deviceName: deviceName,
|
||||
code: obj.otp
|
||||
}
|
||||
};
|
||||
_getCredentials(function(err, credentials) {
|
||||
if (err) return cb(err);
|
||||
$http(_postAuth('/api/v2/', json, credentials)).then(function(data) {
|
||||
if (data && data.data.error) return cb(data.data.error);
|
||||
$log.info('BitPay Card BitAuth Create Token: SUCCESS');
|
||||
_afterBitAuthSuccess(data.data.data, obj, credentials, cb);
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error Create Token: BitAuth', data));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
root.invoiceHistory = function(cb) {
|
||||
$http(_getBitPay('/visa-api/invoiceHistory')).then(function(data) {
|
||||
$log.info('BitPay Get Invoice History: SUCCESS');
|
||||
return cb(null, data.data.data);
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error: Get Invoice History', data));
|
||||
root.getHistory = function(cardId, params, cb) {
|
||||
var invoices, transactions;
|
||||
params = params || {};
|
||||
var json = {
|
||||
method: 'getInvoiceHistory',
|
||||
params: JSON.stringify(params)
|
||||
};
|
||||
_getCredentials(function(err, credentials) {
|
||||
if (err) return cb(err);
|
||||
root.getBitpayDebitCards(function(err, data) {
|
||||
if (err) return cb(err);
|
||||
var card = lodash.find(data.cards, {id : cardId});
|
||||
if (!card) return cb(_setError('Not card found'));
|
||||
// Get invoices
|
||||
$http(_post('/api/v2/' + card.token, json, credentials)).then(function(data) {
|
||||
$log.info('BitPay Get Invoices: SUCCESS');
|
||||
invoices = data.data.data || [];
|
||||
if (lodash.isEmpty(invoices)) $log.info('No invoices');
|
||||
json = {
|
||||
method: 'getTransactionHistory',
|
||||
params: JSON.stringify(params)
|
||||
};
|
||||
// Get transactions list
|
||||
$http(_post('/api/v2/' + card.token, json, credentials)).then(function(data) {
|
||||
$log.info('BitPay Get Transactions: SUCCESS');
|
||||
transactions = data.data.data || {};
|
||||
transactions['txs'] = _processTransactions(invoices, transactions.transactionList);
|
||||
return cb(data.data.error, transactions);
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error: Get Transactions', data));
|
||||
});
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error: Get Invoices', data));
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
root.topUp = function(cardId, params, cb) {
|
||||
params = params || {};
|
||||
var json = {
|
||||
method: 'generateTopUpInvoice',
|
||||
params: JSON.stringify(params)
|
||||
};
|
||||
_getCredentials(function(err, credentials) {
|
||||
if (err) return cb(err);
|
||||
root.getBitpayDebitCards(function(err, data) {
|
||||
if (err) return cb(err);
|
||||
var card = lodash.find(data.cards, {id : cardId});
|
||||
if (!card) return cb(_setError('Not card found'));
|
||||
$http(_post('/api/v2/' + card.token, json, credentials)).then(function(data) {
|
||||
$log.info('BitPay TopUp: SUCCESS');
|
||||
return cb(data.data.error, data.data.data.invoice);
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error: TopUp', data));
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
root.getInvoice = function(id, cb) {
|
||||
$http(_getBitPay('/invoices/' + id)).then(function(data) {
|
||||
$http(_get('/invoices/' + id)).then(function(data) {
|
||||
$log.info('BitPay Get Invoice: SUCCESS');
|
||||
return cb(null, data.data.data);
|
||||
return cb(data.data.error, data.data.data);
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error: Get Invoice', data));
|
||||
});
|
||||
};
|
||||
|
||||
root.authenticate = function(userData, cb) {
|
||||
_setUser(userData, function(err) {
|
||||
$http(_postBitPay('/visa-api/authenticate', userData)).then(function(data) {
|
||||
$log.info('BitPay Authenticate: SUCCESS');
|
||||
_getSession(function(err, session) {
|
||||
if (err) return cb(err);
|
||||
return cb(null, session);
|
||||
});
|
||||
}, function(data) {
|
||||
if (data && data.data && data.data.error.twoFactorPending) {
|
||||
$log.error('BitPay Card needs 2FA Authentication');
|
||||
_getSession(function(err, session) {
|
||||
if (err) return cb(err);
|
||||
return cb(null, session);
|
||||
});
|
||||
} else {
|
||||
return cb(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
root.authenticate2FA = function(userData, cb) {
|
||||
$http(_postBitPay('/visa-api/verify-two-factor', userData)).then(function(data) {
|
||||
$log.info('BitPay 2FA: SUCCESS');
|
||||
return cb(null, data);
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error: 2FA', data));
|
||||
});
|
||||
};
|
||||
|
||||
root.isAuthenticated = function(cb) {
|
||||
_getSession(function(err, session) {
|
||||
if (err) return cb(err);
|
||||
if (!session.isAuthenticated) {
|
||||
_getUser(function(err, user) {
|
||||
if (err) return cb(err);
|
||||
if (lodash.isEmpty(user)) return cb(null, session);
|
||||
root.authenticate(user, function(err, session) {
|
||||
if (err) return cb(err);
|
||||
return cb(null, session);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return cb(null, session);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
root.getCacheData = function(cb) {
|
||||
_setCredentials();
|
||||
storageService.getBitpayCardCache(credentials.NETWORK, function(err, data) {
|
||||
root.getBitpayDebitCards = function(cb) {
|
||||
storageService.getBitpayDebitCards(BITPAY_CARD_NETWORK, function(err, data) {
|
||||
if (err) return cb(err);
|
||||
if (lodash.isString(data)) {
|
||||
data = JSON.parse(data);
|
||||
|
|
@ -199,32 +243,54 @@ angular.module('copayApp.services').factory('bitpayCardService', function($http,
|
|||
});
|
||||
};
|
||||
|
||||
root.setCacheData = function(data, cb) {
|
||||
_setCredentials();
|
||||
root.setBitpayDebitCards = function(data, cb) {
|
||||
data = JSON.stringify(data);
|
||||
storageService.setBitpayCardCache(credentials.NETWORK, data, function(err) {
|
||||
storageService.setBitpayDebitCards(BITPAY_CARD_NETWORK, data, function(err) {
|
||||
if (err) return cb(err);
|
||||
return cb();
|
||||
});
|
||||
};
|
||||
|
||||
root.removeCacheData = function(cb) {
|
||||
_setCredentials();
|
||||
storageService.removeBitpayCardCache(credentials.NETWORK, function(err) {
|
||||
root.getBitpayDebitCardsHistory = function(cardId, cb) {
|
||||
storageService.getBitpayDebitCardsHistory(BITPAY_CARD_NETWORK, function(err, data) {
|
||||
if (err) return cb(err);
|
||||
return cb();
|
||||
if (lodash.isString(data)) {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
data = data || {};
|
||||
if (cardId) data = data[cardId];
|
||||
return cb(null, data);
|
||||
});
|
||||
};
|
||||
|
||||
root.logout = function(cb) {
|
||||
_setCredentials();
|
||||
root.removeCacheData(function() {});
|
||||
storageService.removeBitpayCard(credentials.NETWORK, function(err) {
|
||||
$http(_getBitPay('/visa-api/logout')).then(function(data) {
|
||||
$log.info('BitPay Logout: SUCCESS');
|
||||
return cb(data);
|
||||
}, function(data) {
|
||||
return cb(_setError('BitPay Card Error: Logout ', data));
|
||||
root.setBitpayDebitCardsHistory = function(cardId, data, opts, cb) {
|
||||
storageService.getBitpayDebitCardsHistory(BITPAY_CARD_NETWORK, function(err, oldData) {
|
||||
if (lodash.isString(oldData)) {
|
||||
oldData = JSON.parse(oldData);
|
||||
}
|
||||
if (lodash.isString(data)) {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
var inv = oldData || {};
|
||||
inv[cardId] = data;
|
||||
if (opts && opts.remove) {
|
||||
delete(inv[cardId]);
|
||||
}
|
||||
inv = JSON.stringify(inv);
|
||||
|
||||
storageService.setBitpayDebitCardsHistory(BITPAY_CARD_NETWORK, inv, function(err) {
|
||||
return cb(err);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
root.remove = function(cb) {
|
||||
storageService.removeBitpayCardCredentials(BITPAY_CARD_NETWORK, function(err) {
|
||||
storageService.removeBitpayDebitCards(BITPAY_CARD_NETWORK, function(err) {
|
||||
storageService.removeBitpayDebitCardsHistory(BITPAY_CARD_NETWORK, function(err) {
|
||||
$log.info('BitPay Debit Cards Removed: SUCCESS');
|
||||
return cb();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').service('externalLinkService', function($window, $timeout, $log, platformInfo, nodeWebkitService) {
|
||||
angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService, popupService, gettextCatalog, $window, $log, $timeout) {
|
||||
|
||||
this.open = function(url, target) {
|
||||
var _restoreHandleOpenURL = function(old) {
|
||||
$timeout(function() {
|
||||
$window.handleOpenURL = old;
|
||||
}, 500);
|
||||
};
|
||||
|
||||
this.open = function(url, optIn, title, message, okText, cancelText) {
|
||||
var old = $window.handleOpenURL;
|
||||
|
||||
$window.handleOpenURL = function(url) {
|
||||
|
|
@ -10,15 +16,24 @@ angular.module('copayApp.services').service('externalLinkService', function($win
|
|||
$log.debug('Skip: ' + url);
|
||||
};
|
||||
|
||||
$timeout(function() {
|
||||
$window.handleOpenURL = old;
|
||||
}, 500);
|
||||
|
||||
if (platformInfo.isNW) {
|
||||
nodeWebkitService.openExternalLink(url);
|
||||
_restoreHandleOpenURL(old);
|
||||
} else {
|
||||
target = target || '_blank';
|
||||
var ref = window.open(url, target, 'location=no');
|
||||
if (optIn) {
|
||||
var message = gettextCatalog.getString(message),
|
||||
title = gettextCatalog.getString(title),
|
||||
okText = gettextCatalog.getString(okText),
|
||||
cancelText = gettextCatalog.getString(cancelText),
|
||||
openBrowser = function(res) {
|
||||
if (res) window.open(url, '_system');
|
||||
_restoreHandleOpenURL(old);
|
||||
};
|
||||
popupService.showConfirm(title, message, okText, cancelText, openBrowser);
|
||||
} else {
|
||||
window.open(url, '_system');
|
||||
_restoreHandleOpenURL(old);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('incomingData', function($log, $ionicModal, $state, $window, $timeout, bitcore, profileService, popupService, ongoingProcess, platformInfo, gettextCatalog, scannerService, $rootScope) {
|
||||
angular.module('copayApp.services').factory('incomingData', function($log, $ionicModal, $state, $window, $timeout, bitcore, profileService, popupService, ongoingProcess, platformInfo, gettextCatalog, scannerService, $rootScope, lodash) {
|
||||
|
||||
var root = {};
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
|||
// }, 2000);
|
||||
|
||||
root.redir = function(data) {
|
||||
$log.debug('Processing incoming data:' +data);
|
||||
$log.debug('Processing incoming data: ' + data);
|
||||
|
||||
function sanitizeUri(data) {
|
||||
// Fixes when a region uses comma to separate decimals
|
||||
|
|
@ -32,17 +32,25 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
|||
return newUri;
|
||||
}
|
||||
|
||||
function getParameterByName(name, url) {
|
||||
if (!url) return;
|
||||
name = name.replace(/[\[\]]/g, "\\$&");
|
||||
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
|
||||
results = regex.exec(url);
|
||||
if (!results) return null;
|
||||
if (!results[2]) return '';
|
||||
return decodeURIComponent(results[2].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
// data extensions for Payment Protocol with non-backwards-compatible request
|
||||
if ((/^bitcoin:\?r=[\w+]/).exec(data)) {
|
||||
data = decodeURIComponent(data.replace('bitcoin:?r=', ''));
|
||||
$state.go('tabs.send');
|
||||
$timeout(function() {
|
||||
$state.go('tabs.send').then(function() {
|
||||
$state.transitionTo('tabs.send.confirm', {paypro: data});
|
||||
}, 100);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
data = sanitizeUri(data);
|
||||
data = '1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX';
|
||||
|
||||
|
|
@ -56,6 +64,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
|||
var amount = parsed.amount ? parsed.amount : '';
|
||||
|
||||
$state.go('tabs.send');
|
||||
// Timeout is required to enable the "Back" button
|
||||
$timeout(function() {
|
||||
if (parsed.r) {
|
||||
$state.transitionTo('tabs.send.confirm', {paypro: parsed.r});
|
||||
|
|
@ -66,7 +75,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
|||
$state.transitionTo('tabs.send.amount', {toAddress: addr});
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
return true;
|
||||
|
||||
// Plain URL
|
||||
|
|
@ -91,40 +100,41 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
|
|||
});
|
||||
// Plain Address
|
||||
} else if (bitcore.Address.isValid(data, 'livenet')) {
|
||||
return root.showMenu({data: data, type: 'bitcoinAddress'});
|
||||
$state.go('tabs.send');
|
||||
$timeout(function() {
|
||||
$state.transitionTo('tabs.send.amount', {toAddress: data});
|
||||
}, 100);
|
||||
return true;
|
||||
root.showMenu({data: data, type: 'bitcoinAddress'});
|
||||
} else if (bitcore.Address.isValid(data, 'testnet')) {
|
||||
return root.showMenu({data: data, type: 'bitcoinAddress'});
|
||||
$state.go('tabs.send');
|
||||
$timeout(function() {
|
||||
$state.transitionTo('tabs.send.amount', {toAddress: data});
|
||||
}, 100);
|
||||
return true;
|
||||
|
||||
root.showMenu({data: data, type: 'bitcoinAddress'});
|
||||
// Protocol
|
||||
} else if (data && data.indexOf($window.appConfig.name + '://glidera')==0) {
|
||||
return $state.go('uriglidera', {url: data});
|
||||
} else if (data && data.indexOf($window.appConfig.name + '://coinbase')==0) {
|
||||
return $state.go('uricoinbase', {url: data});
|
||||
|
||||
// BitPayCard Authentication
|
||||
} else if (data && data.indexOf($window.appConfig.name + '://')==0) {
|
||||
var secret = getParameterByName('secret', data);
|
||||
var email = getParameterByName('email', data);
|
||||
var otp = getParameterByName('otp', data);
|
||||
$state.go('tabs.home').then(function() {
|
||||
$state.transitionTo('tabs.bitpayCardIntro', {
|
||||
secret: secret,
|
||||
email: email,
|
||||
otp: otp
|
||||
});
|
||||
});
|
||||
return true;
|
||||
|
||||
// Join
|
||||
} else if (data && data.match(/^copay:[0-9A-HJ-NP-Za-km-z]{70,80}$/)) {
|
||||
$state.go('tabs.home');
|
||||
$timeout(function() {
|
||||
$state.go('tabs.home').then(function() {
|
||||
$state.transitionTo('tabs.add.join', {url: data});
|
||||
}, 100);
|
||||
});
|
||||
return true;
|
||||
|
||||
// Old join
|
||||
} else if (data && data.match(/^[0-9A-HJ-NP-Za-km-z]{70,80}$/)) {
|
||||
$state.go('tabs.home');
|
||||
$timeout(function() {
|
||||
$state.go('tabs.home').then(function() {
|
||||
$state.transitionTo('tabs.add.join', {url: data});
|
||||
}, 100);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
|
|||
|
||||
this.showAlert = function(title, msg, cb, buttonName) {
|
||||
var message = (msg && msg.message) ? msg.message : msg;
|
||||
$log.warn(title + ": " + message);
|
||||
$log.warn(title ? (title + ': ' + message) : message);
|
||||
|
||||
if (isCordova)
|
||||
_cordovaAlert(title, message, cb, buttonName);
|
||||
|
|
@ -97,7 +97,7 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
|
|||
*/
|
||||
|
||||
this.showConfirm = function(title, message, okText, cancelText, cb) {
|
||||
$log.warn(title + ": " + message);
|
||||
$log.warn(title ? (title + ': ' + message) : message);
|
||||
|
||||
if (isCordova)
|
||||
_cordovaConfirm(title, message, okText, cancelText, cb);
|
||||
|
|
@ -116,7 +116,7 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
|
|||
*/
|
||||
|
||||
this.showPrompt = function(title, message, opts, cb) {
|
||||
$log.warn(title + ": " + message);
|
||||
$log.warn(title ? (title + ': ' + message) : message);
|
||||
|
||||
if (isCordova && !opts.forceHTMLPrompt)
|
||||
_cordovaPrompt(title, message, opts, cb);
|
||||
|
|
|
|||
|
|
@ -134,8 +134,7 @@ angular.module('copayApp.services')
|
|||
|
||||
if (n.type == "NewBlock" && n.data.network == "testnet") {
|
||||
throttledBwsEvent(n, wallet);
|
||||
}
|
||||
else newBwsEvent(n, wallet);
|
||||
} else newBwsEvent(n, wallet);
|
||||
});
|
||||
|
||||
wallet.on('walletCompleted', function() {
|
||||
|
|
@ -600,6 +599,7 @@ angular.module('copayApp.services')
|
|||
var walletClient = bwcService.getClient(null, opts);
|
||||
|
||||
$log.debug('Importing Wallet:', opts);
|
||||
|
||||
try {
|
||||
walletClient.import(str, {
|
||||
compressed: opts.compressed,
|
||||
|
|
@ -611,6 +611,12 @@ angular.module('copayApp.services')
|
|||
|
||||
str = JSON.parse(str);
|
||||
|
||||
if (str.xPrivKey && str.xPrivKeyEncrypted) {
|
||||
$log.warn('Found both encrypted and decrypted key. Deleting the encrypted version');
|
||||
delete str.xPrivKeyEncrypted;
|
||||
delete str.mnemonicEncrypted;
|
||||
}
|
||||
|
||||
var addressBook = str.addressBook || {};
|
||||
|
||||
addAndBindWalletClient(walletClient, {
|
||||
|
|
|
|||
|
|
@ -325,28 +325,40 @@ angular.module('copayApp.services')
|
|||
storage.remove('coinbaseTxs-' + network, cb);
|
||||
};
|
||||
|
||||
root.setBitpayCard = function(network, data, cb) {
|
||||
storage.set('bitpayCard-' + network, data, cb);
|
||||
root.setBitpayDebitCardsHistory = function(network, data, cb) {
|
||||
storage.set('bitpayDebitCardsHistory-' + network, data, cb);
|
||||
};
|
||||
|
||||
root.getBitpayCard = function(network, cb) {
|
||||
storage.get('bitpayCard-' + network, cb);
|
||||
root.getBitpayDebitCardsHistory = function(network, cb) {
|
||||
storage.get('bitpayDebitCardsHistory-' + network, cb);
|
||||
};
|
||||
|
||||
root.removeBitpayCard = function(network, cb) {
|
||||
storage.remove('bitpayCard-' + network, cb);
|
||||
root.removeBitpayDebitCardsHistory = function(network, cb) {
|
||||
storage.remove('bitpayDebitCardsHistory-' + network, cb);
|
||||
};
|
||||
|
||||
root.setBitpayCardCache = function(network, data, cb) {
|
||||
storage.set('bitpayCardCache-' + network, data, cb);
|
||||
root.setBitpayDebitCards = function(network, data, cb) {
|
||||
storage.set('bitpayDebitCards-' + network, data, cb);
|
||||
};
|
||||
|
||||
root.getBitpayCardCache = function(network, cb) {
|
||||
storage.get('bitpayCardCache-' + network, cb);
|
||||
root.getBitpayDebitCards = function(network, cb) {
|
||||
storage.get('bitpayDebitCards-' + network, cb);
|
||||
};
|
||||
|
||||
root.removeBitpayCardCache = function(network, cb) {
|
||||
storage.remove('bitpayCardCache-' + network, cb);
|
||||
root.removeBitpayDebitCards = function(network, cb) {
|
||||
storage.remove('bitpayDebitCards-' + network, cb);
|
||||
};
|
||||
|
||||
root.setBitpayCardCredentials = function(network, data, cb) {
|
||||
storage.set('bitpayCardCredentials-' + network, data, cb);
|
||||
};
|
||||
|
||||
root.getBitpayCardCredentials = function(network, cb) {
|
||||
storage.get('bitpayCardCredentials-' + network, cb);
|
||||
};
|
||||
|
||||
root.removeBitpayCardCredentials = function(network, cb) {
|
||||
storage.remove('bitpayCardCredentials-' + network, cb);
|
||||
};
|
||||
|
||||
root.removeAllWalletData = function(walletId, cb) {
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
wallet.getTxNote({
|
||||
txid: txid
|
||||
}, function(err, note) {
|
||||
if (err || !note) return cb(true);
|
||||
if (err) return cb(err);
|
||||
return cb(null, note);
|
||||
});
|
||||
};
|
||||
|
|
@ -869,9 +869,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
if (!root.isEncrypted(wallet)) return cb();
|
||||
|
||||
askPassword(wallet.name, gettext('Enter Spending Password'), function(password) {
|
||||
if (!password) return cb('no password');
|
||||
if (!wallet.checkPassword(password)) return cb('wrong password');
|
||||
|
||||
if (!password) return cb('No password');
|
||||
if (!wallet.checkPassword(password)) return cb('Wrong password');
|
||||
|
||||
return cb(null, password);
|
||||
});
|
||||
|
|
@ -990,8 +989,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
});
|
||||
};
|
||||
|
||||
root.getEncodedWalletInfo = function(wallet, cb) {
|
||||
|
||||
root.getEncodedWalletInfo = function(wallet, password, cb) {
|
||||
var derivationPath = wallet.credentials.getBaseAddressDerivationPath();
|
||||
var encodingType = {
|
||||
mnemonic: 1,
|
||||
|
|
@ -1002,25 +1000,23 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
|
||||
// not supported yet
|
||||
if (wallet.credentials.derivationStrategy != 'BIP44' || !wallet.canSign())
|
||||
return null;
|
||||
return cb(gettextCatalog.getString('Exporting via QR not supported for this wallet'));
|
||||
|
||||
root.getKeys(wallet, function(err, keys) {
|
||||
if (err || !keys) return cb(err);
|
||||
var keys = root.getKeysWithPassword(wallet, password);
|
||||
|
||||
if (keys.mnemonic) {
|
||||
info = {
|
||||
type: encodingType.mnemonic,
|
||||
data: keys.mnemonic,
|
||||
}
|
||||
} else {
|
||||
info = {
|
||||
type: encodingType.xpriv,
|
||||
data: keys.xPrivKey
|
||||
}
|
||||
if (keys.mnemonic) {
|
||||
info = {
|
||||
type: encodingType.mnemonic,
|
||||
data: keys.mnemonic,
|
||||
}
|
||||
return cb(null, info.type + '|' + info.data + '|' + wallet.credentials.network.toLowerCase() + '|' + derivationPath + '|' + (wallet.credentials.mnemonicHasPassphrase));
|
||||
} else {
|
||||
info = {
|
||||
type: encodingType.xpriv,
|
||||
data: keys.xPrivKey
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return cb(null, info.type + '|' + info.data + '|' + wallet.credentials.network.toLowerCase() + '|' + derivationPath + '|' + (wallet.credentials.mnemonicHasPassphrase));
|
||||
};
|
||||
|
||||
root.setTouchId = function(wallet, enabled, cb) {
|
||||
|
|
@ -1055,6 +1051,12 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
});
|
||||
};
|
||||
|
||||
root.getKeysWithPassword = function(wallet, password) {
|
||||
try {
|
||||
return wallet.getKeys(password);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
root.getViewStatus = function(wallet, txp) {
|
||||
var status = txp.status;
|
||||
var type;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ click-to-accept {
|
|||
}
|
||||
&.button-primary,
|
||||
&.button-secondary,
|
||||
&.button-light,
|
||||
&.button-assertive {
|
||||
&.button-standard {
|
||||
@extend %button-standard;
|
||||
|
|
|
|||
|
|
@ -408,6 +408,14 @@ input[type=file] {
|
|||
line-height: 0px;
|
||||
}
|
||||
|
||||
.w100p {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ $font-size-small: 12px;
|
|||
$font-family-sans-serif: $roboto;
|
||||
$font-family-light-sans-serif: $roboto-light;
|
||||
|
||||
$button-border-radius: $visible-radius;
|
||||
$button-border-radius: $subtle-radius;
|
||||
$button-height: 52px;
|
||||
$button-padding: 16px;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,14 @@
|
|||
left: 8px;
|
||||
font-size: 24px;
|
||||
}
|
||||
.big-icon-svg {
|
||||
left:5px;
|
||||
& > .bg{
|
||||
width:30px;
|
||||
height:30px;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
font-size: 11px;
|
||||
padding-left: 48px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,27 @@
|
|||
#bitpayCard {
|
||||
.bar-header {
|
||||
border: 0;
|
||||
background: #1e3186;
|
||||
.title, .button {
|
||||
color: #fff;
|
||||
}
|
||||
.button {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
.amount {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding: 2rem 1rem 1.5rem 1rem;
|
||||
min-height: 140px;
|
||||
height: 140px;
|
||||
border-color: #172565;
|
||||
background-color: #1e3186;
|
||||
background-image: linear-gradient(0deg, #172565, #172565 0%, transparent 0%);
|
||||
color: #fff;
|
||||
}
|
||||
.wallet-details-wallet-info {
|
||||
bottom: 5px;
|
||||
}
|
||||
strong {
|
||||
line-height: 100%;
|
||||
}
|
||||
|
|
|
|||
70
src/sass/views/bitpayCardIntro.scss
Normal file
70
src/sass/views/bitpayCardIntro.scss
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
#bitpayCard-intro {
|
||||
.slider-pager .slider-pager-page {
|
||||
color: #fff;
|
||||
}
|
||||
.cta-button{
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
bottom: 55px;
|
||||
padding: 0 1.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
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;
|
||||
height: 100%;
|
||||
.bar.bar-header {
|
||||
background: rgb(30, 49, 134);
|
||||
color: #fff;
|
||||
button {
|
||||
color: #fff;
|
||||
}
|
||||
.secondary-buttons {
|
||||
button {
|
||||
color: rgba(255, 255, 255, .5);
|
||||
}
|
||||
}
|
||||
}
|
||||
.bar.bar-stable{
|
||||
border-color: transparent;
|
||||
border:none;
|
||||
}
|
||||
.button-transparent{
|
||||
background: none !important;
|
||||
}
|
||||
.button-translucent{
|
||||
background: rgba(215, 215, 215, 0.1)
|
||||
}
|
||||
.button-primary{
|
||||
background: rgb(100, 124, 232) !important;
|
||||
color:#fff;
|
||||
}
|
||||
.light-blue{
|
||||
color:rgb(100, 124, 232);
|
||||
}
|
||||
.text-white{
|
||||
color: #ffffff;
|
||||
}
|
||||
ion-content {
|
||||
background: url(../img/onboarding-welcome-bg.png);
|
||||
background-position: top center;
|
||||
background-size: contain;
|
||||
background-repeat: repeat-x;
|
||||
height: 100%;
|
||||
.scroll{
|
||||
height: 100%;
|
||||
}
|
||||
color: #fff;
|
||||
p {
|
||||
text-align: center;
|
||||
margin: 40px 20px;
|
||||
font-size: 1.2rem;
|
||||
color: rgba(255, 255, 255, .5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -107,12 +107,8 @@
|
|||
i {
|
||||
color: grey;
|
||||
position: inherit;
|
||||
left: 25px;
|
||||
vertical-align: super;
|
||||
padding-right: 10px;
|
||||
border-right: 1px solid;
|
||||
border-color: grey;
|
||||
font-size: 20px;
|
||||
padding: 0 10px;
|
||||
float: right;
|
||||
}
|
||||
contact {
|
||||
margin-left: 15px;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
.wallets {
|
||||
.slides {
|
||||
.swiper-container {
|
||||
width: 75% !important;
|
||||
width: 85% !important;
|
||||
overflow: visible;
|
||||
}
|
||||
.card {
|
||||
padding: .7rem;
|
||||
padding-left: .25rem;
|
||||
padding-right: .25rem;
|
||||
border-radius: .25rem;
|
||||
max-width: 350px;
|
||||
box-shadow:$subtle-box-shadow;
|
||||
padding:0;
|
||||
border-radius: 6px;
|
||||
@media (min-width: 500px) {
|
||||
& {
|
||||
width: 350px;
|
||||
|
|
@ -17,6 +16,23 @@
|
|||
margin: 1.5rem auto 0;
|
||||
}
|
||||
}
|
||||
.item{
|
||||
padding: calc(100vh - 99vh) calc(100vw - 93vw) calc(100vh - 97vh) calc(100vw - 95vw);
|
||||
i{left:auto;}
|
||||
span{
|
||||
clear:both;
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
&.wallet-name{
|
||||
margin-top:10px;
|
||||
margin-bottom:5px;
|
||||
font-size:13px;
|
||||
}
|
||||
}
|
||||
.big-icon-svg{
|
||||
& > .bg{padding:.3rem;width: 40px;height:40px;}
|
||||
}
|
||||
}
|
||||
}
|
||||
.swiper-slide {
|
||||
width: 100% !important;
|
||||
|
|
@ -37,13 +53,14 @@
|
|||
}
|
||||
&.swiper-slide-prev,
|
||||
&.swiper-slide-next {
|
||||
opacity: .2;
|
||||
opacity: .3;
|
||||
transform: scale(.8);
|
||||
}
|
||||
&.swiper-slide-prev {
|
||||
left: -5%;
|
||||
left: 10vw;
|
||||
}
|
||||
&.swiper-slide-next {
|
||||
left: 4%;
|
||||
left: -10vw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
14
src/sass/views/integrations/glidera.scss
Normal file
14
src/sass/views/integrations/glidera.scss
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#glidera {
|
||||
.glidera-lead {
|
||||
margin: 1rem;
|
||||
color: $mid-gray;
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
}
|
||||
.disclosure {
|
||||
color: $mid-gray;
|
||||
font-size: 12px;
|
||||
text-align: left;
|
||||
margin: 1rem;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
ion-content{
|
||||
padding-top: 1.5rem;
|
||||
color: $dark-gray;
|
||||
margin-bottom: 210px;
|
||||
p {
|
||||
padding: 0 2.5%;
|
||||
margin: 2rem auto;
|
||||
|
|
@ -25,6 +26,9 @@
|
|||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
.checkbox input:before,
|
||||
.checkbox .checkbox-icon:before {
|
||||
border-radius: 50% !important;
|
||||
|
|
@ -54,15 +58,13 @@
|
|||
width: 10%;
|
||||
position: relative;
|
||||
padding-right: 0;
|
||||
top: 25px;
|
||||
padding-left: 50px;
|
||||
.item-content {
|
||||
white-space: normal;
|
||||
}
|
||||
}
|
||||
p {
|
||||
color: rgb(58, 58, 58);
|
||||
float: left;
|
||||
width: 80%;
|
||||
}
|
||||
.checkbox input:before,
|
||||
.checkbox .checkbox-icon:before {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
}
|
||||
.item-sub {
|
||||
&:first-child:before {
|
||||
width: 100%
|
||||
width: 95%
|
||||
}
|
||||
&:before {
|
||||
display: block;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,30 @@
|
|||
.border-top{
|
||||
border-top:1px solid rgb(228,228,228);
|
||||
}
|
||||
.scroll{height:100%;}
|
||||
#address {
|
||||
background: #fff;
|
||||
height: calc(100vh - 33vh);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
flex-flow: column;
|
||||
@media(max-height: 600px){
|
||||
height: calc(100vh - 36vh);
|
||||
}
|
||||
article{
|
||||
flex:1;
|
||||
width: 100%;
|
||||
}
|
||||
#bit-address{
|
||||
position: absolute;
|
||||
bottom:0;
|
||||
width:100%;
|
||||
#next-address{
|
||||
color:$light-gray;
|
||||
}
|
||||
}
|
||||
.incomplete {
|
||||
padding: 50px;
|
||||
height: 352px;
|
||||
|
|
@ -42,20 +64,47 @@
|
|||
display: inline-block;
|
||||
font-size: .7rem;
|
||||
}
|
||||
&-gen-address {}
|
||||
}
|
||||
.qr {
|
||||
padding: 50px 0 20px 0;
|
||||
padding: calc(100vh - 85vh) 0 calc(100vh - 96vh);
|
||||
@media(max-height: 700px){
|
||||
padding: calc(100vh - 90vh) 0 calc(100vh - 96vh);
|
||||
}
|
||||
div{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
#qr-options{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
.item{
|
||||
i{left:25px;}
|
||||
}
|
||||
}
|
||||
.backup {
|
||||
background-color: orange;
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
top: 0;
|
||||
i {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
@media (max-height: 600px){
|
||||
&{
|
||||
.qr{
|
||||
padding:6vh 0 0;
|
||||
div{
|
||||
transform: scale(.7);
|
||||
}
|
||||
}
|
||||
#bit-address{position: realtive;}
|
||||
}
|
||||
}
|
||||
}
|
||||
#wallets {
|
||||
position: relative;
|
||||
|
|
@ -66,10 +115,12 @@
|
|||
height: 0;
|
||||
border-style: solid;
|
||||
border-width: 0 20px 20px 20px;
|
||||
border-color: transparent transparent #f5f5f5 transparent;
|
||||
border-color: transparent transparent rgb(242,242,242) transparent;
|
||||
top: -9px;
|
||||
position: absolute;
|
||||
left: 45%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
#first-time-tip {
|
||||
|
|
@ -112,6 +163,40 @@
|
|||
border-right: 1px solid rgb(228, 228, 228);
|
||||
padding-right: 10px;
|
||||
}
|
||||
.wallets{
|
||||
position: relative;
|
||||
height: calc(100vh - 83vh);
|
||||
.slides {
|
||||
.swiper-container{
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
@media (max-height: 600px){
|
||||
&{
|
||||
transform: translate(-50%, -58%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// @media(min-width: 700px) and (min-height: 700px){
|
||||
// .wallets{display: none;}
|
||||
// #address{
|
||||
// height:90vh;
|
||||
// width:75%;
|
||||
// .qr{
|
||||
// height: 70%;
|
||||
// div{
|
||||
// transform: scale(1.5);
|
||||
// }
|
||||
// }
|
||||
// #bit-address{
|
||||
// height: 10%;
|
||||
// padding: calc(100vh - 99vh);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@
|
|||
color: $mid-gray;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
&-description-disabled {
|
||||
color: cadetblue;
|
||||
text-decoration: none;
|
||||
}
|
||||
.setting-title, .setting-value {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
@import "walletDetails";
|
||||
@import "advancedSettings";
|
||||
@import "bitpayCard";
|
||||
@import "bitpayCardIntro";
|
||||
@import "address-book";
|
||||
@import "wallet-backup-phrase";
|
||||
@import "zero-state";
|
||||
|
|
@ -30,4 +31,5 @@
|
|||
@import "includes/txp-details";
|
||||
@import "includes/tx-status";
|
||||
@import "includes/walletSelector";
|
||||
@import "integrations/coinbase.scss";
|
||||
@import "integrations/coinbase";
|
||||
@import "integrations/glidera";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue