Merge branch 'master' of https://github.com/bitpay/copay into feat/app-identity
This commit is contained in:
commit
189117433a
85 changed files with 1252 additions and 1224 deletions
|
|
@ -10,7 +10,7 @@ angular.module('copayApp.controllers').controller('addressbookAddController', fu
|
|||
'email': ''
|
||||
};
|
||||
|
||||
$scope.onQrCodeScanned = function(data, addressbookForm) {
|
||||
$scope.onQrCodeScannedAddressBook = function(data, addressbookForm) {
|
||||
$timeout(function() {
|
||||
var form = addressbookForm;
|
||||
if (data && form) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('addressesController', function($scope, $stateParams, $state, $timeout, $ionicHistory, $ionicPopover, $ionicScrollDelegate, configService, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, platformInfo) {
|
||||
angular.module('copayApp.controllers').controller('addressesController', function($scope, $stateParams, $state, $timeout, $ionicHistory, $ionicScrollDelegate, configService, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, platformInfo) {
|
||||
var UNUSED_ADDRESS_LIMIT = 5;
|
||||
var BALANCE_ADDRESS_LIMIT = 5;
|
||||
var MENU_ITEM_HEIGHT = 55;
|
||||
var config;
|
||||
var unitName;
|
||||
var unitToSatoshi;
|
||||
|
|
@ -100,6 +99,13 @@ angular.module('copayApp.controllers').controller('addressesController', functio
|
|||
});
|
||||
};
|
||||
|
||||
$scope.requestSpecificAmount = function() {
|
||||
$state.go('tabs.receive.amount', {
|
||||
customAmount: true,
|
||||
toAddress: $stateParams.toAddress
|
||||
});
|
||||
}
|
||||
|
||||
$scope.showInformation = function() {
|
||||
$timeout(function() {
|
||||
$scope.showInfo = !$scope.showInfo;
|
||||
|
|
@ -114,36 +120,13 @@ angular.module('copayApp.controllers').controller('addressesController', functio
|
|||
}, 10);
|
||||
};
|
||||
|
||||
$scope.showMenu = function(allAddresses, $event) {
|
||||
var scanObj = {
|
||||
text: gettextCatalog.getString('Scan addresses for funds'),
|
||||
action: scan,
|
||||
};
|
||||
|
||||
var sendAddressesObj = {
|
||||
text: gettextCatalog.getString('Send addresses by email'),
|
||||
action: sendByEmail,
|
||||
}
|
||||
|
||||
$scope.items = allAddresses ? [sendAddressesObj] : [scanObj];
|
||||
$scope.height = $scope.items.length * MENU_ITEM_HEIGHT;
|
||||
|
||||
$ionicPopover.fromTemplateUrl('views/includes/menu-popover.html', {
|
||||
scope: $scope
|
||||
}).then(function(popover) {
|
||||
$scope.menu = popover;
|
||||
$scope.menu.show($event);
|
||||
});
|
||||
};
|
||||
|
||||
var scan = function() {
|
||||
$scope.scan = function() {
|
||||
walletService.startScan($scope.wallet);
|
||||
$scope.menu.hide();
|
||||
$ionicHistory.clearHistory();
|
||||
$state.go('tabs.home');
|
||||
};
|
||||
|
||||
var sendByEmail = function() {
|
||||
$scope.sendByEmail = function() {
|
||||
function formatDate(ts) {
|
||||
var dateObj = new Date(ts * 1000);
|
||||
if (!dateObj) {
|
||||
|
|
|
|||
|
|
@ -29,50 +29,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
|
|||
};
|
||||
};
|
||||
|
||||
$scope.global = $rootScope;
|
||||
if (!$scope.global.developmentUtilitiesEnabled) {
|
||||
$scope.global.developmentUtilitiesEnabled = {
|
||||
value: false
|
||||
};
|
||||
}
|
||||
|
||||
$scope.toggledDevelopmentUtils = function() {
|
||||
if ($scope.global.developmentUtilitiesEnabled.value) {
|
||||
$log.debug('User enabled development utilities.');
|
||||
$timeout(function() {
|
||||
$ionicScrollDelegate.resize();
|
||||
}, 10);
|
||||
} else {
|
||||
$log.debug('User disabled development utilities.');
|
||||
}
|
||||
}
|
||||
|
||||
$scope.activateFeedbackCard = function() {
|
||||
$scope.feedbackCardActivating = true;
|
||||
storageService.getFeedbackInfo(function(error, info) {
|
||||
var feedbackInfo = JSON.parse(info);
|
||||
// hardcoding so we can distinguish from normal operation
|
||||
feedbackInfo.time = 1231006505; // genesis block time
|
||||
feedbackInfo.version = window.version;
|
||||
feedbackInfo.sent = false;
|
||||
storageService.setFeedbackInfo(JSON.stringify(feedbackInfo), function() {
|
||||
$log.debug('Activated feedback card with: ' + JSON.stringify(feedbackInfo));
|
||||
$ionicHistory.clearCache();
|
||||
$timeout(function() {
|
||||
$scope.feedbackCardActivating = false;
|
||||
$scope.feedbackCardActivated = true;
|
||||
$timeout(function() {
|
||||
$scope.feedbackCardActivated = false;
|
||||
}, 10000);
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$scope.resetActivateFeedbackCard = function() {
|
||||
$scope.feedbackCardActivated = false;
|
||||
}
|
||||
|
||||
$scope.spendUnconfirmedChange = function() {
|
||||
var opts = {
|
||||
wallet: {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('amazonController',
|
||||
function($scope, $timeout, $ionicModal, $log, lodash, amazonService, platformInfo, externalLinkService, popupService, gettextCatalog) {
|
||||
function($scope, $timeout, $ionicModal, $log, $ionicScrollDelegate, lodash, amazonService, platformInfo, externalLinkService, popupService, ongoingProcess) {
|
||||
|
||||
$scope.network = amazonService.getEnvironment();
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
var initAmazon = function() {
|
||||
amazonService.getPendingGiftCards(function(err, gcds) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
popupService.showAlert('Error', err);
|
||||
return;
|
||||
}
|
||||
$scope.giftCards = lodash.isEmpty(gcds) ? null : gcds;
|
||||
|
|
@ -24,7 +24,7 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
claimCode: $scope.cardClaimCode
|
||||
});
|
||||
if (lodash.isEmpty(card)) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Card not found'));
|
||||
popupService.showAlert('Error', 'Card not found');
|
||||
return;
|
||||
}
|
||||
$scope.openCardModal(card);
|
||||
|
|
@ -34,18 +34,29 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
};
|
||||
|
||||
$scope.updatePendingGiftCards = lodash.debounce(function() {
|
||||
|
||||
ongoingProcess.set('updatingGiftCards', true);
|
||||
amazonService.getPendingGiftCards(function(err, gcds) {
|
||||
if (lodash.isEmpty(gcds)) {
|
||||
$timeout(function() {
|
||||
ongoingProcess.set('updatingGiftCards', false);
|
||||
}, 1000);
|
||||
}
|
||||
$timeout(function() {
|
||||
$scope.giftCards = gcds;
|
||||
$scope.giftCards = lodash.isEmpty(gcds) ? null : gcds;
|
||||
$scope.$digest();
|
||||
});
|
||||
var index = 0;
|
||||
lodash.forEach(gcds, function(dataFromStorage) {
|
||||
if (++index == Object.keys(gcds).length) {
|
||||
$timeout(function() {
|
||||
ongoingProcess.set('updatingGiftCards', false);
|
||||
}, 1000);
|
||||
}
|
||||
if (dataFromStorage.status == 'PENDING') {
|
||||
$log.debug("creating gift card");
|
||||
amazonService.createGiftCard(dataFromStorage, function(err, giftCard) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
popupService.showAlert('Error', err);
|
||||
return;
|
||||
}
|
||||
if (giftCard.status != 'PENDING') {
|
||||
|
|
@ -65,13 +76,14 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
$log.debug("Saving new gift card");
|
||||
amazonService.getPendingGiftCards(function(err, gcds) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
popupService.showAlert('Error', err);
|
||||
return;
|
||||
}
|
||||
$scope.giftCards = gcds;
|
||||
$scope.giftCards = lodash.isEmpty(gcds) ? null : gcds;
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
});
|
||||
$ionicScrollDelegate.resize();
|
||||
}, 10);
|
||||
});
|
||||
});
|
||||
} else $log.debug("pending gift card not available yet");
|
||||
|
|
@ -80,7 +92,9 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
});
|
||||
});
|
||||
|
||||
}, 1000);
|
||||
}, 1000, {
|
||||
'leading': true
|
||||
});
|
||||
|
||||
$scope.openCardModal = function(card) {
|
||||
$scope.card = card;
|
||||
|
|
@ -92,8 +106,8 @@ angular.module('copayApp.controllers').controller('amazonController',
|
|||
$scope.amazonCardDetailsModal.show();
|
||||
});
|
||||
|
||||
$scope.$on('UpdateAmazonList', function(event) {
|
||||
initAmazon();
|
||||
$scope.$on('modal.hidden', function() {
|
||||
$scope.updatePendingGiftCards();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicScrollDelegate, $ionicHistory, $ionicPopover, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError, payproService, profileService, bitcore, amazonService, glideraService) {
|
||||
angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicScrollDelegate, $ionicHistory, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError, payproService, profileService, bitcore, amazonService, glideraService) {
|
||||
var unitToSatoshi;
|
||||
var satToUnit;
|
||||
var unitDecimals;
|
||||
var satToBtc;
|
||||
var SMALL_FONT_SIZE_LIMIT = 10;
|
||||
var LENGTH_EXPRESSION_LIMIT = 19;
|
||||
var MENU_ITEM_HEIGHT = 55;
|
||||
|
||||
$scope.$on('$ionicView.leave', function() {
|
||||
angular.element($window).off('keydown');
|
||||
|
|
@ -21,7 +20,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
$scope.glideraAccessToken = data.stateParams.glideraAccessToken;
|
||||
|
||||
$scope.cardId = data.stateParams.cardId;
|
||||
$scope.showMenu = $ionicHistory.backView().stateName == 'tabs.send';
|
||||
$scope.showMenu = $ionicHistory.backView() && $ionicHistory.backView().stateName == 'tabs.send';
|
||||
var isWallet = data.stateParams.isWallet || 'false';
|
||||
$scope.isWallet = (isWallet.toString().trim().toLowerCase() == 'true' ? true : false);
|
||||
$scope.toAddress = data.stateParams.toAddress;
|
||||
|
|
@ -29,6 +28,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
$scope.toEmail = data.stateParams.toEmail;
|
||||
$scope.showAlternativeAmount = !!$scope.cardId || !!$scope.isGiftCard || !!$scope.isGlidera;
|
||||
$scope.toColor = data.stateParams.toColor;
|
||||
$scope.showSendMax = false;
|
||||
|
||||
$scope.customAmount = data.stateParams.customAmount;
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
|
||||
var config = configService.getSync().wallet.settings;
|
||||
$scope.unitName = config.unitName;
|
||||
$scope.alternativeIsoCode = config.alternativeIsoCode;
|
||||
$scope.alternativeIsoCode = !!$scope.cardId || !!$scope.isGiftCard ? 'USD' : config.alternativeIsoCode;
|
||||
$scope.specificAmount = $scope.specificAlternativeAmount = '';
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
unitToSatoshi = config.unitToSatoshi;
|
||||
|
|
@ -93,25 +93,12 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
}, 10);
|
||||
});
|
||||
|
||||
$scope.showSendMaxMenu = function($event) {
|
||||
var sendMaxObj = {
|
||||
text: gettextCatalog.getString('Send max amount'),
|
||||
action: setSendMax,
|
||||
};
|
||||
|
||||
$scope.items = [sendMaxObj];
|
||||
$scope.height = $scope.items.length * MENU_ITEM_HEIGHT;
|
||||
|
||||
$ionicPopover.fromTemplateUrl('views/includes/menu-popover.html', {
|
||||
scope: $scope
|
||||
}).then(function(popover) {
|
||||
$scope.menu = popover;
|
||||
$scope.menu.show($event);
|
||||
});
|
||||
$scope.showSendMaxMenu = function() {
|
||||
$scope.showSendMax = true;
|
||||
};
|
||||
|
||||
function setSendMax() {
|
||||
$scope.menu.hide();
|
||||
$scope.sendMax = function() {
|
||||
$scope.showSendMax = false;
|
||||
$state.transitionTo('tabs.send.confirm', {
|
||||
isWallet: $scope.isWallet,
|
||||
toAmount: null,
|
||||
|
|
@ -205,11 +192,11 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
};
|
||||
|
||||
function fromFiat(val) {
|
||||
return parseFloat((rateService.fromFiat(val, $scope.alternativeIsoCode) * satToUnit).toFixed(unitDecimals), 10);
|
||||
return parseFloat((rateService.fromFiat(val, $scope.alternativeIsoCode) * satToUnit).toFixed(unitDecimals));
|
||||
};
|
||||
|
||||
function toFiat(val) {
|
||||
return parseFloat((rateService.toFiat(val * unitToSatoshi, $scope.alternativeIsoCode)).toFixed(2), 10);
|
||||
return parseFloat((rateService.toFiat(val * unitToSatoshi, $scope.alternativeIsoCode)).toFixed(2));
|
||||
};
|
||||
|
||||
function evaluate(val) {
|
||||
|
|
@ -283,6 +270,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
}
|
||||
var stateParams = {
|
||||
cardId: $scope.cardId,
|
||||
cardAmountUSD: amountUSD,
|
||||
toName: $scope.toName,
|
||||
toAmount: payProDetails.amount,
|
||||
toAddress: payProDetails.toAddress,
|
||||
|
|
@ -303,7 +291,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
try {
|
||||
uuid = profileService.getWallets({
|
||||
onlyComplete: true,
|
||||
network: 'livenet',
|
||||
network: amazonService.getEnvironment(),
|
||||
})[0].id;
|
||||
} catch (err) {
|
||||
ongoingProcess.set('Preparing transaction...', false);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
var isWallet = data.stateParams.isWallet || 'false';
|
||||
$scope.isWallet = (isWallet.toString().trim().toLowerCase() == 'true' ? true : false);
|
||||
$scope.cardId = data.stateParams.cardId;
|
||||
$scope.cardAmountUSD = data.stateParams.cardAmountUSD;
|
||||
$scope.toAddress = data.stateParams.toAddress;
|
||||
$scope.toName = data.stateParams.toName;
|
||||
$scope.toEmail = data.stateParams.toEmail;
|
||||
|
|
@ -62,9 +63,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
|
||||
if (!$scope.wallets || !$scope.wallets.length) {
|
||||
$scope.noMatchingWallet = true;
|
||||
if ($scope.paypro) {
|
||||
displayValues();
|
||||
}
|
||||
displayValues();
|
||||
$log.warn('No ' + $scope.network + ' wallets to make the payment');
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
|
|
@ -106,6 +106,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
} else initConfirm();
|
||||
} else {
|
||||
if (!enoughFunds) $scope.insufficientFunds = true;
|
||||
displayValues();
|
||||
$log.warn('No wallet available to make the payment');
|
||||
}
|
||||
$timeout(function() {
|
||||
|
|
@ -132,9 +133,15 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
$scope.amountStr = txFormatService.formatAmountStr(toAmount);
|
||||
$scope.displayAmount = getDisplayAmount($scope.amountStr);
|
||||
$scope.displayUnit = getDisplayUnit($scope.amountStr);
|
||||
txFormatService.formatAlternativeStr(toAmount, function(v) {
|
||||
$scope.alternativeAmountStr = v;
|
||||
});
|
||||
if ($scope.cardAmountUSD) {
|
||||
$scope.alternativeAmountStr = $filter('formatFiatAmount')($scope.cardAmountUSD) + ' USD';
|
||||
} else if ($scope.giftCardAmountUSD) {
|
||||
$scope.alternativeAmountStr = $filter('formatFiatAmount')($scope.giftCardAmountUSD) + ' USD';
|
||||
} else {
|
||||
txFormatService.formatAlternativeStr(toAmount, function(v) {
|
||||
$scope.alternativeAmountStr = v;
|
||||
});
|
||||
}
|
||||
if ($scope.isGlidera == 'buy') $scope.getBuyPrice();
|
||||
if ($scope.isGlidera == 'sell') $scope.getSellPrice();
|
||||
};
|
||||
|
|
@ -428,6 +435,10 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
});
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
$scope.payproModal.hide();
|
||||
};
|
||||
|
||||
$scope.approve = function(onSendStatusChange) {
|
||||
|
||||
var wallet = $scope.wallet;
|
||||
|
|
@ -783,6 +794,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
invoiceUrl: $scope.paypro.url,
|
||||
invoiceTime: giftCardInvoiceTime
|
||||
};
|
||||
ongoingProcess.set('creatingGiftCard', true);
|
||||
debounceCreate(count, dataSrc, onSendStatusChange);
|
||||
}
|
||||
}, onSendStatusChange);
|
||||
|
|
@ -795,7 +807,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
});
|
||||
|
||||
var debounceCreateGiftCard = function(count, dataSrc, onSendStatusChange) {
|
||||
|
||||
amazonService.createGiftCard(dataSrc, function(err, giftCard) {
|
||||
$log.debug("creating gift card " + count);
|
||||
if (err) {
|
||||
|
|
@ -830,6 +841,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
}
|
||||
|
||||
amazonService.savePendingGiftCard(newData, null, function(err) {
|
||||
ongoingProcess.set('creatingGiftCard', false);
|
||||
$log.debug("Saving new gift card with status: " + newData.status);
|
||||
$scope.amazonGiftCard = newData;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('copayersController',
|
||||
function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, $window, lodash, profileService, walletService, popupService, platformInfo, gettextCatalog, ongoingProcess) {
|
||||
function($scope, $log, $timeout, $stateParams, $state, $rootScope, $ionicHistory, appConfigService, lodash, profileService, walletService, popupService, platformInfo, gettextCatalog, ongoingProcess) {
|
||||
|
||||
var appName = $window.appConfig.userVisibleName;
|
||||
var appUrl = $window.appConfig.url;
|
||||
var appName = appConfigService.userVisibleName;
|
||||
var appUrl = appConfigService.url;
|
||||
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('createController',
|
||||
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService, $window) {
|
||||
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, $ionicHistory, profileService, configService, gettextCatalog, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService, appConfigService) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isCordova = platformInfo.isCordova;
|
||||
|
|
@ -80,7 +80,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
|
||||
*/
|
||||
|
||||
if ($window.appConfig.name == 'copay') {
|
||||
if (appConfigService.name == 'copay') {
|
||||
if (n > 1 && isChromeApp) {
|
||||
seedOptions.push({
|
||||
id: 'ledger',
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@ angular.module('copayApp.controllers').controller('customAmountController', func
|
|||
|
||||
$scope.finish = function() {
|
||||
$ionicHistory.nextViewOptions({
|
||||
disableAnimate: false,
|
||||
historyRoot: true
|
||||
disableAnimate: false
|
||||
});
|
||||
$ionicHistory.goBack(-2);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('exportController',
|
||||
function($scope, $timeout, $log, $ionicHistory, $ionicScrollDelegate, backupService, walletService, storageService, profileService, platformInfo, gettextCatalog, $state, $stateParams, popupService, $window) {
|
||||
function($scope, $timeout, $log, $ionicHistory, $ionicScrollDelegate, backupService, walletService, storageService, profileService, platformInfo, gettextCatalog, $state, $stateParams, popupService, appConfigService) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
|
||||
$scope.showAdvChange = function() {
|
||||
|
|
@ -191,7 +191,7 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
if ($scope.formData.noSignEnabled)
|
||||
name = name + '(No Private Key)';
|
||||
|
||||
var subject = $window.appConfig.nameCase + ' Wallet Backup: ' + name;
|
||||
var subject = appConfigService.nameCase + ' Wallet Backup: ' + name;
|
||||
var body = 'Here is the encrypted backup of the wallet ' + name + ': \n\n' + ew + '\n\n To import this backup, copy all text between {...}, including the symbols {}';
|
||||
window.plugins.socialsharing.shareViaEmail(
|
||||
body,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('sendController', function($scope, $state, $log, $timeout, $stateParams, $ionicNavBarDelegate, $ionicHistory, $ionicConfig, $window, gettextCatalog, popupService, configService, lodash, feedbackService, ongoingProcess) {
|
||||
angular.module('copayApp.controllers').controller('sendController', function($scope, $state, $log, $timeout, $stateParams, $ionicNavBarDelegate, $ionicHistory, $ionicConfig, $window, gettextCatalog, popupService, configService, lodash, feedbackService, ongoingProcess, platformInfo) {
|
||||
|
||||
$scope.sendFeedback = function(feedback, goHome) {
|
||||
|
||||
|
|
@ -42,6 +42,7 @@ angular.module('copayApp.controllers').controller('sendController', function($sc
|
|||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.score = (data.stateParams && data.stateParams.score) ? parseInt(data.stateParams.score) : null;
|
||||
$scope.feedback = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('headController',
|
||||
function($scope, $window, $log) {
|
||||
$scope.appConfig = $window.appConfig;
|
||||
$log.info('Running head controller:' + $window.appConfig.nameCase)
|
||||
});
|
||||
angular.module('copayApp.controllers').controller('headController', function($scope, appConfigService, $log) {
|
||||
$scope.appConfig = appConfigService;
|
||||
$log.info('Running head controller:' + appConfigService.nameCase)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('importController',
|
||||
function($scope, $timeout, $log, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, profileService, configService, sjcl, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService, popupService, gettextCatalog, $window) {
|
||||
function($scope, $timeout, $log, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, profileService, configService, sjcl, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService, popupService, gettextCatalog, appConfigService) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
|
|
@ -17,7 +17,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$scope.formData.derivationPath = derivationPathHelper.default;
|
||||
$scope.formData.account = 1;
|
||||
$scope.importErr = false;
|
||||
$scope.showHardwareWallet = $window.appConfig.name == 'copay';
|
||||
$scope.showHardwareWallet = appConfigService.name == 'copay';
|
||||
|
||||
if ($stateParams.code)
|
||||
$scope.processWalletInfo($stateParams.code);
|
||||
|
|
@ -238,6 +238,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
|
||||
if (!words) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the recovery phrase'));
|
||||
return;
|
||||
} else if (words.indexOf('xprv') == 0 || words.indexOf('tprv') == 0) {
|
||||
return _importExtendedPrivateKey(words, opts);
|
||||
} else if (words.indexOf('xpub') == 0 || words.indexOf('tpuv') == 0) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('joinController',
|
||||
function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, $window) {
|
||||
function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, appConfigService) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
|
|
@ -33,7 +33,7 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
}
|
||||
};
|
||||
|
||||
this.onQrCodeScanned = function(data) {
|
||||
this.onQrCodeScannedJoin = function(data) {
|
||||
$scope.secret = data;
|
||||
if ($scope.joinForm) {
|
||||
$scope.joinForm.secret.$setViewValue(data);
|
||||
|
|
@ -44,7 +44,7 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
if ($stateParams.url) {
|
||||
var data = $stateParams.url;
|
||||
data = data.replace('copay:', '');
|
||||
this.onQrCodeScanned(data);
|
||||
this.onQrCodeScannedJoin(data);
|
||||
}
|
||||
|
||||
var updateSeedSourceSelect = function() {
|
||||
|
|
@ -63,7 +63,7 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
|
||||
*/
|
||||
|
||||
if ($window.appConfig.name == 'copay') {
|
||||
if (appConfigService.name == 'copay') {
|
||||
if (isChromeApp) {
|
||||
self.seedOptions.push({
|
||||
id: 'ledger',
|
||||
|
|
|
|||
|
|
@ -1,18 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('amazonCardDetailsController', function($scope, $log, $timeout, bwcError, amazonService, lodash, ongoingProcess, popupService, gettextCatalog, externalLinkService) {
|
||||
angular.module('copayApp.controllers').controller('amazonCardDetailsController', function($scope, $log, $timeout, $ionicScrollDelegate, bwcError, amazonService, lodash, ongoingProcess, popupService, externalLinkService) {
|
||||
|
||||
$scope.cancelGiftCard = function() {
|
||||
ongoingProcess.set('Canceling gift card...', true);
|
||||
ongoingProcess.set('cancelingGiftCard', true);
|
||||
amazonService.cancelGiftCard($scope.card, function(err, data) {
|
||||
ongoingProcess.set('Canceling gift card...', false);
|
||||
ongoingProcess.set('cancelingGiftCard', false);
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
|
||||
popupService.showAlert('Error', bwcError.msg(err));
|
||||
return;
|
||||
}
|
||||
$scope.card.cardStatus = data.cardStatus;
|
||||
$timeout(function() {
|
||||
$ionicScrollDelegate.resize();
|
||||
$ionicScrollDelegate.scrollTop();
|
||||
}, 10);
|
||||
amazonService.savePendingGiftCard($scope.card, null, function(err) {
|
||||
$scope.$emit('UpdateAmazonList');
|
||||
$scope.refreshGiftCard();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
@ -21,23 +25,34 @@ angular.module('copayApp.controllers').controller('amazonCardDetailsController',
|
|||
amazonService.savePendingGiftCard($scope.card, {
|
||||
remove: true
|
||||
}, function(err) {
|
||||
$scope.$emit('UpdateAmazonList');
|
||||
$scope.cancel();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.refreshGiftCard = function() {
|
||||
ongoingProcess.set('updatingGiftCard', true);
|
||||
amazonService.getPendingGiftCards(function(err, gcds) {
|
||||
if (lodash.isEmpty(gcds)) {
|
||||
$timeout(function() {
|
||||
ongoingProcess.set('updatingGiftCard', false);
|
||||
}, 1000);
|
||||
}
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
popupService.showAlert('Error', err);
|
||||
return;
|
||||
}
|
||||
var index = 0;
|
||||
lodash.forEach(gcds, function(dataFromStorage) {
|
||||
if (++index == Object.keys(gcds).length) {
|
||||
$timeout(function() {
|
||||
ongoingProcess.set('updatingGiftCard', false);
|
||||
}, 1000);
|
||||
}
|
||||
if (dataFromStorage.status == 'PENDING' && dataFromStorage.invoiceId == $scope.card.invoiceId) {
|
||||
$log.debug("creating gift card");
|
||||
amazonService.createGiftCard(dataFromStorage, function(err, giftCard) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
|
||||
popupService.showAlert('Error', bwcError.msg(err));
|
||||
return;
|
||||
}
|
||||
if (!lodash.isEmpty(giftCard)) {
|
||||
|
|
@ -46,7 +61,6 @@ angular.module('copayApp.controllers').controller('amazonCardDetailsController',
|
|||
amazonService.savePendingGiftCard(newData, null, function(err) {
|
||||
$log.debug("Saving new gift card");
|
||||
$scope.card = newData;
|
||||
$scope.$emit('UpdateAmazonList');
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('payproController', function($scope) {
|
||||
var self = $scope.self;
|
||||
|
||||
$scope.cancel = function() {
|
||||
$scope.payproModal.hide();
|
||||
};
|
||||
});
|
||||
|
|
@ -7,15 +7,15 @@ angular.module('copayApp.controllers').controller('backupRequestController', fun
|
|||
|
||||
$scope.openPopup = function() {
|
||||
|
||||
var title = gettextCatalog.getString('Without a backup, you could lose money.');
|
||||
var title = gettextCatalog.getString('Watch out!');
|
||||
var message = gettextCatalog.getString('If this device is replaced or this app is deleted, neither you nor BitPay can recover your funds without a backup.');
|
||||
var okText = gettextCatalog.getString('I understand');
|
||||
var cancelText = gettextCatalog.getString('Go back');
|
||||
popupService.showConfirm(title, message, okText, cancelText, function(val) {
|
||||
if (val) {
|
||||
var title = gettextCatalog.getString('Are you sure you want to skip the backup?');
|
||||
var title = gettextCatalog.getString('Are you sure you want to skip it?');
|
||||
var message = gettextCatalog.getString('You can create a backup later from your wallet settings.');
|
||||
var okText = gettextCatalog.getString('Yes, skip backup');
|
||||
var okText = gettextCatalog.getString('Yes, skip');
|
||||
var cancelText = gettextCatalog.getString('Go back');
|
||||
popupService.showConfirm(title, message, okText, cancelText, function(val) {
|
||||
if (val) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ angular.module('copayApp.controllers').controller('disclaimerController', functi
|
|||
$scope.$on("$ionicView.afterEnter", function() {
|
||||
startupService.ready();
|
||||
});
|
||||
$scope.init = function() {
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function() {
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
$scope.terms = {};
|
||||
$scope.accepted = {};
|
||||
|
|
@ -13,10 +14,7 @@ angular.module('copayApp.controllers').controller('disclaimerController', functi
|
|||
$scope.backedUp = $stateParams.backedUp;
|
||||
$scope.resume = $stateParams.resume;
|
||||
$scope.shrinkView = false;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
};
|
||||
});
|
||||
|
||||
$scope.confirm = function() {
|
||||
profileService.setDisclaimerAccepted(function(err) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, $window, uxLanguage, profileService, externalLinkService, gettextCatalog) {
|
||||
angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, appConfigService, uxLanguage, profileService, externalLinkService, gettextCatalog) {
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
|
||||
$scope.confirm = function() {
|
||||
|
|
@ -15,10 +15,10 @@ angular.module('copayApp.controllers').controller('termsController', function($s
|
|||
};
|
||||
|
||||
$scope.openExternalLink = function() {
|
||||
var url = $window.appConfig.disclaimerUrl;
|
||||
var url = appConfigService.disclaimerUrl;
|
||||
var optIn = true;
|
||||
var title = gettextCatalog.getString('View Terms of Service');
|
||||
var message = gettextCatalog.getString('The official English Terms of Service are available on the BitPay website. Would you like to view them?');
|
||||
var message = gettextCatalog.getString('The official English Terms of Service are available on the BitPay website.');
|
||||
var okText = gettextCatalog.getString('Open Website');
|
||||
var cancelText = gettextCatalog.getString('Go Back');
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
|
|
|
|||
|
|
@ -8,13 +8,6 @@ angular.module('copayApp.controllers').controller('welcomeController', function(
|
|||
startupService.ready();
|
||||
});
|
||||
|
||||
$scope.goImport = function(code) {
|
||||
$state.go('onboarding.import', {
|
||||
fromOnboarding: true,
|
||||
code: code
|
||||
});
|
||||
};
|
||||
|
||||
$scope.createProfile = function() {
|
||||
$log.debug('Creating profile');
|
||||
profileService.createProfile(function(err) {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesAbout',
|
||||
function($scope, $window, gettextCatalog, externalLinkService) {
|
||||
function($scope, $window, appConfigService, gettextCatalog, externalLinkService) {
|
||||
|
||||
$scope.title = gettextCatalog.getString('About') + ' ' + $window.appConfig.nameCase;
|
||||
$scope.title = gettextCatalog.getString('About') + ' ' + appConfigService.nameCase;
|
||||
$scope.version = $window.version;
|
||||
$scope.commitHash = $window.commitHash;
|
||||
|
||||
$scope.openExternalLink = function() {
|
||||
var url = 'https://github.com/bitpay/' + $window.appConfig.gitHubRepoName + '/tree/' + $window.commitHash + '';
|
||||
var url = 'https://github.com/bitpay/' + appConfigService.gitHubRepoName + '/tree/' + $window.commitHash + '';
|
||||
var optIn = true;
|
||||
var title = gettextCatalog.getString('Open GitHub Project');
|
||||
var message = gettextCatalog.getString('You can see the latest developments and contribute to this open source app by visiting our project on GitHub.');
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesBwsUrlController',
|
||||
function($scope, $log, $stateParams, configService, applicationService, profileService, storageService, $window) {
|
||||
function($scope, $log, $stateParams, configService, applicationService, profileService, storageService, appConfigService) {
|
||||
$scope.success = null;
|
||||
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var walletId = wallet.credentials.walletId;
|
||||
var defaults = configService.getDefaults();
|
||||
var config = configService.getSync();
|
||||
$scope.appName = $window.appConfig.nameCase;
|
||||
$scope.appName = appConfigService.nameCase;
|
||||
$scope.bwsurl = {
|
||||
value: (config.bwsFor && config.bwsFor[walletId]) || defaults.bws.url
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesHistory',
|
||||
function($scope, $log, $stateParams, $timeout, $state, $ionicHistory, storageService, platformInfo, profileService, lodash, $window) {
|
||||
function($scope, $log, $stateParams, $timeout, $state, $ionicHistory, storageService, platformInfo, profileService, lodash, appConfigService) {
|
||||
$scope.wallet = profileService.getWallet($stateParams.walletId);
|
||||
$scope.csvReady = false;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.appName = $window.appConfig.nameCase;
|
||||
$scope.appName = appConfigService.nameCase;
|
||||
|
||||
$scope.csvHistory = function(cb) {
|
||||
var allTxs = [];
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesNotificationsController', function($scope, $log, $timeout, $window, lodash, configService, platformInfo, pushNotificationsService, profileService, emailService) {
|
||||
angular.module('copayApp.controllers').controller('preferencesNotificationsController', function($scope, $log, $timeout, appConfigService, lodash, configService, platformInfo, pushNotificationsService, profileService, emailService) {
|
||||
var updateConfig = function() {
|
||||
var config = configService.getSync();
|
||||
$scope.appName = $window.appConfig.nameCase;
|
||||
$scope.appName = appConfigService.nameCase;
|
||||
$scope.PNEnabledByUser = true;
|
||||
$scope.usePushNotifications = platformInfo.isCordova && !platformInfo.isWP;
|
||||
$scope.isIOSApp = platformInfo.isIOS && platformInfo.isCordova;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabHomeController',
|
||||
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, externalLinkService, latestReleaseService, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService, startupService, addressbookService, feedbackService) {
|
||||
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, $window, gettextCatalog, lodash, popupService, ongoingProcess, externalLinkService, latestReleaseService, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, appConfigService, bitpayCardService, startupService, addressbookService, feedbackService) {
|
||||
var wallet;
|
||||
var listeners = [];
|
||||
var notifications = [];
|
||||
$scope.externalServices = {};
|
||||
$scope.openTxpModal = txpModalService.open;
|
||||
$scope.version = $window.version;
|
||||
$scope.name = $window.appConfig.nameCase;
|
||||
$scope.name = appConfigService.nameCase;
|
||||
$scope.homeTip = $stateParams.fromOnboarding;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.isAndroid = platformInfo.isAndroid;
|
||||
|
|
@ -43,7 +43,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
} else {
|
||||
var feedbackInfo = JSON.parse(info);
|
||||
//Check if current version is greater than saved version
|
||||
var currentVersion = window.version;
|
||||
var currentVersion = $scope.version;
|
||||
var savedVersion = feedbackInfo.version;
|
||||
var isVersionUpdated = feedbackService.isVersionUpdated(currentVersion, savedVersion);
|
||||
if (!isVersionUpdated) {
|
||||
|
|
@ -62,7 +62,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
function initFeedBackInfo() {
|
||||
var feedbackInfo = {};
|
||||
feedbackInfo.time = moment().unix();
|
||||
feedbackInfo.version = window.version;
|
||||
feedbackInfo.version = $scope.version;
|
||||
feedbackInfo.sent = false;
|
||||
storageService.setFeedbackInfo(JSON.stringify(feedbackInfo), function() {
|
||||
$scope.showRateCard.value = false;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
angular.module('copayApp.controllers').controller('tabReceiveController', function($rootScope, $scope, $timeout, $log, $ionicModal, $state, $ionicHistory, $ionicPopover, storageService, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService, bwcError) {
|
||||
|
||||
var listeners = [];
|
||||
var MENU_ITEM_HEIGHT = 55;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.isNW = platformInfo.isNW;
|
||||
$scope.walletAddrs = {};
|
||||
|
|
@ -50,8 +49,9 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
};
|
||||
|
||||
$scope.showAddresses = function() {
|
||||
$state.transitionTo('tabs.receive.addresses', {
|
||||
walletId: $scope.wallet.credentials.walletId
|
||||
$state.go('tabs.receive.addresses', {
|
||||
walletId: $scope.wallet.credentials.walletId,
|
||||
toAddress: $scope.addr
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -140,31 +140,6 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
});
|
||||
};
|
||||
|
||||
var goRequestAmount = function() {
|
||||
$scope.menu.hide();
|
||||
$state.go('tabs.receive.amount', {
|
||||
customAmount: true,
|
||||
toAddress: $scope.addr
|
||||
});
|
||||
}
|
||||
|
||||
$scope.showMenu = function(allAddresses, $event) {
|
||||
var requestAmountObj = {
|
||||
text: gettextCatalog.getString('Request Specific amount'),
|
||||
action: goRequestAmount,
|
||||
};
|
||||
|
||||
$scope.items = [requestAmountObj];
|
||||
$scope.height = $scope.items.length * MENU_ITEM_HEIGHT;
|
||||
|
||||
$ionicPopover.fromTemplateUrl('views/includes/menu-popover.html', {
|
||||
scope: $scope
|
||||
}).then(function(popover) {
|
||||
$scope.menu = popover;
|
||||
$scope.menu.show($event);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.wallets = profileService.getWallets();
|
||||
|
||||
|
|
|
|||
|
|
@ -133,13 +133,9 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
lodash.each(wallets, function(w) {
|
||||
walletService.getStatus(w, {}, function(err, status) {
|
||||
++index;
|
||||
if (index == wallets.length) $scope.checkingBalance = false;
|
||||
if (err || !status) {
|
||||
if (err && !status) {
|
||||
$log.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (status.availableBalanceSat > 0) {
|
||||
} else if (status.availableBalanceSat > 0) {
|
||||
$scope.hasFunds = true;
|
||||
$rootScope.everHasFunds = true;
|
||||
}
|
||||
|
|
@ -148,6 +144,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
if ($scope.hasFunds != true) {
|
||||
$ionicScrollDelegate.freezeScroll(true);
|
||||
}
|
||||
$scope.checkingBalance = false;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $window, $ionicModal, $log, lodash, uxLanguage, platformInfo, profileService, feeService, configService, externalLinkService, bitpayCardService, storageService, glideraService, gettextCatalog) {
|
||||
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, appConfigService, $ionicModal, $log, lodash, uxLanguage, platformInfo, profileService, feeService, configService, externalLinkService, bitpayCardService, storageService, glideraService, gettextCatalog) {
|
||||
|
||||
var updateConfig = function() {
|
||||
var isCordova = platformInfo.isCordova;
|
||||
|
|
@ -10,13 +10,13 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
$scope.usePushNotifications = isCordova && !isWP;
|
||||
$scope.isCordova = isCordova;
|
||||
|
||||
$scope.appName = $window.appConfig.nameCase;
|
||||
$scope.appName = appConfigService.nameCase;
|
||||
$scope.currentLanguageName = uxLanguage.getCurrentLanguageName();
|
||||
$scope.feeOpts = feeService.feeOpts;
|
||||
$scope.currentFeeLevel = feeService.getCurrentFeeLevel();
|
||||
|
||||
|
||||
$scope.wallets = profileService.getWallets();
|
||||
|
||||
|
||||
configService.whenAvailable(function(config) {
|
||||
$scope.unitName = config.wallet.settings.unitName;
|
||||
$scope.selectedAlternative = {
|
||||
|
|
@ -33,7 +33,7 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
if (!lodash.isEmpty(data)) {
|
||||
$scope.bitpayCards = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if ($scope.glideraEnabled) {
|
||||
|
|
@ -50,7 +50,7 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
|
|||
var url = 'https://help.bitpay.com/bitpay-app';
|
||||
var optIn = true;
|
||||
var title = gettextCatalog.getString('BitPay Help Center');
|
||||
var message = gettextCatalog.getString('Help and support information is available at the BitPay Help Center website. Would you like to go there now?');
|
||||
var message = gettextCatalog.getString('Help and support information is available at the BitPay Help Center website.');
|
||||
var okText = gettextCatalog.getString('Open Help Center');
|
||||
var cancelText = gettextCatalog.getString('Go Back');
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('termOfUseController',
|
||||
function($scope, $window, uxLanguage, externalLinkService) {
|
||||
function($scope, appConfigService, uxLanguage, externalLinkService) {
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
$scope.disclaimerUrl = $window.appConfig.disclaimerUrl;
|
||||
$scope.disclaimerUrl = appConfigService.disclaimerUrl;
|
||||
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
externalLinkService.open(url, target);
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
|||
var btx = $scope.btx;
|
||||
var url = 'https://' + ($scope.getShortNetworkName() == 'test' ? 'test-' : '') + 'insight.bitpay.com/tx/' + btx.txid;
|
||||
var optIn = true;
|
||||
var title = gettextCatalog.getString('View Transaction on Insight');
|
||||
var message = gettextCatalog.getString('Would you like to view this transaction on the Insight blockchain explorer?');
|
||||
var title = null;
|
||||
var message = gettextCatalog.getString('View Transaction on Insight');
|
||||
var okText = gettextCatalog.getString('Open Insight');
|
||||
var cancelText = gettextCatalog.getString('Go Back');
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ angular.module('copayApp.directives')
|
|||
transclude: true,
|
||||
scope: {
|
||||
sendStatus: '=clickSendStatus',
|
||||
wallet: '=hasWalletChosen'
|
||||
hasWalletChosen: '=hasWalletChosen',
|
||||
insufficientFunds: '=insufficientFunds',
|
||||
noMatchingWallet: '=noMatchingWallet'
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.$watch('sendStatus', function() {
|
||||
|
|
|
|||
25
src/js/directives/itemSelector.js
Normal file
25
src/js/directives/itemSelector.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.directives')
|
||||
.directive('itemSelector', function($timeout) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'views/includes/itemSelector.html',
|
||||
transclude: true,
|
||||
scope: {
|
||||
show: '=itemSelectorShow',
|
||||
onSelect: '=itemSelectorOnSelect'
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.hide = function() {
|
||||
scope.show = false;
|
||||
};
|
||||
scope.sendMax = function() {
|
||||
$timeout(function() {
|
||||
scope.hide();
|
||||
}, 100);
|
||||
scope.onSelect();
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
@ -614,7 +614,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
*/
|
||||
|
||||
.state('tabs.receive.addresses', {
|
||||
url: '/addresses/:walletId',
|
||||
url: '/addresses/:walletId/:toAddress',
|
||||
views: {
|
||||
'tab-receive@tabs': {
|
||||
controller: 'addressesController',
|
||||
|
|
@ -1031,7 +1031,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
})
|
||||
.state('tabs.bitpayCard.confirm', {
|
||||
url: '/confirm/:cardId/:toAddress/:toName/:toAmount/:toEmail/:description',
|
||||
url: '/confirm/:cardId/:cardAmountUSD/:toAddress/:toName/:toAmount/:toEmail/:description',
|
||||
views: {
|
||||
'tab-home@tabs': {
|
||||
controller: 'confirmController',
|
||||
|
|
@ -1052,7 +1052,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
});
|
||||
})
|
||||
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService) {
|
||||
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService) {
|
||||
|
||||
uxLanguage.init();
|
||||
|
||||
|
|
@ -1171,7 +1171,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
type: "menubar"
|
||||
});
|
||||
try {
|
||||
nativeMenuBar.createMacBuiltin($window.appConfig.nameCase);
|
||||
nativeMenuBar.createMacBuiltin(appConfigService.nameCase);
|
||||
} catch (e) {
|
||||
$log.debug('This is not OSX');
|
||||
}
|
||||
|
|
|
|||
5
src/js/services/appConfigService.js
Normal file
5
src/js/services/appConfigService.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('appConfigService', function($window) {
|
||||
return $window.appConfig;
|
||||
});
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.services')
|
||||
.factory('backupService', function backupServiceFactory($log, $timeout, $stateParams, profileService, sjcl, $window) {
|
||||
.factory('backupService', function backupServiceFactory($log, $timeout, $stateParams, profileService, sjcl, appConfigService) {
|
||||
|
||||
var root = {};
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ angular.module('copayApp.services')
|
|||
|
||||
var walletName = (wallet.alias || '') + (wallet.alias ? '-' : '') + wallet.credentials.walletName;
|
||||
if (opts.noSign) walletName = walletName + '-noSign'
|
||||
var filename = walletName + '-' + $window.appConfig.nameCase + 'backup.aes.json';
|
||||
var filename = walletName + '-' + appConfigService.nameCase + 'backup.aes.json';
|
||||
_download(ew, filename, cb)
|
||||
};
|
||||
return root;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('incomingData', function($log, $state, $window, $timeout, bitcore, $rootScope, payproService, scannerService) {
|
||||
angular.module('copayApp.services').factory('incomingData', function($log, $state, $timeout, bitcore, $rootScope, payproService, scannerService, appConfigService) {
|
||||
|
||||
var root = {};
|
||||
|
||||
|
|
@ -121,17 +121,17 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
} else {
|
||||
goToAmountPage(data);
|
||||
}
|
||||
} else if (data && data.indexOf($window.appConfig.name + '://glidera') === 0) {
|
||||
} else if (data && data.indexOf(appConfigService.name + '://glidera') === 0) {
|
||||
return $state.go('uriglidera', {
|
||||
url: data
|
||||
});
|
||||
} else if (data && data.indexOf($window.appConfig.name + '://coinbase') === 0) {
|
||||
} else if (data && data.indexOf(appConfigService.name + '://coinbase') === 0) {
|
||||
return $state.go('uricoinbase', {
|
||||
url: data
|
||||
});
|
||||
|
||||
// BitPay Authentication
|
||||
} else if (data && data.indexOf($window.appConfig.name + '://') === 0) {
|
||||
// BitPayCard Authentication
|
||||
} else if (data && data.indexOf(appConfigService.name + '://') === 0) {
|
||||
var secret = getParameterByName('secret', data);
|
||||
var email = getParameterByName('email', data);
|
||||
var otp = getParameterByName('otp', data);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.services')
|
||||
.factory('logHeader', function($window, $log, platformInfo) {
|
||||
$log.info($window.appConfig.nameCase + ' v' + window.version + ' #' + window.commitHash);
|
||||
$log.info('Client: '+ JSON.stringify(platformInfo) );
|
||||
.factory('logHeader', function($window, appConfigService, $log, platformInfo) {
|
||||
$log.info(appConfigService.nameCase + ' v' + $window.version + ' #' + $window.commitHash);
|
||||
$log.info('Client: ' + JSON.stringify(platformInfo));
|
||||
return {};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -39,7 +39,11 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
|
|||
'sendingByEmail': gettext('Preparing addresses...'),
|
||||
'sending2faCode': gettext('Sending 2FA code...'),
|
||||
'buyingBitcoin': gettext('Buying Bitcoin...'),
|
||||
'sellingBitcoin': gettext('Selling Bitcoin...')
|
||||
'sellingBitcoin': gettext('Selling Bitcoin...'),
|
||||
'updatingGiftCards': 'Updating Gift Cards...',
|
||||
'updatingGiftCard': 'Updating Gift Card...',
|
||||
'cancelingGiftCard': 'Canceling Gift Card...',
|
||||
'creatingGiftCard': 'Creating Gift Card...'
|
||||
};
|
||||
|
||||
root.clear = function() {
|
||||
|
|
|
|||
|
|
@ -712,7 +712,7 @@ angular.module('copayApp.services')
|
|||
var opts = {};
|
||||
opts.m = 1;
|
||||
opts.n = 1;
|
||||
opts.network = 'livenet';
|
||||
opts.networkName = 'livenet';
|
||||
root.createWallet(opts, cb);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('txFormatService', function(bwcService, rateService, configService, lodash) {
|
||||
angular.module('copayApp.services').factory('txFormatService', function($filter, bwcService, rateService, configService, lodash) {
|
||||
var root = {};
|
||||
|
||||
root.Utils = bwcService.getUtils();
|
||||
|
|
@ -48,10 +48,11 @@ angular.module('copayApp.services').factory('txFormatService', function(bwcServi
|
|||
var config = configService.getSync().wallet.settings;
|
||||
|
||||
var val = function() {
|
||||
var v1 = rateService.toFiat(satoshis, config.alternativeIsoCode);
|
||||
var v1 = parseFloat((rateService.toFiat(satoshis, config.alternativeIsoCode)).toFixed(2));
|
||||
v1 = $filter('formatFiatAmount')(v1);
|
||||
if (!v1) return null;
|
||||
|
||||
return v1.toFixed(2) + ' ' + config.alternativeIsoCode;
|
||||
return v1 + ' ' + config.alternativeIsoCode;
|
||||
};
|
||||
|
||||
// Async version
|
||||
|
|
|
|||
|
|
@ -12,23 +12,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
|
||||
var errors = bwcService.getErrors();
|
||||
|
||||
// UI Related
|
||||
root.openStatusModal = function(type, txp, cb) {
|
||||
var scope = $rootScope.$new(true);
|
||||
scope.type = type;
|
||||
scope.tx = txFormatService.processTx(txp);
|
||||
scope.color = txp.color;
|
||||
scope.cb = cb;
|
||||
|
||||
$ionicModal.fromTemplateUrl('views/modals/tx-status.html', {
|
||||
scope: scope,
|
||||
animation: 'slide-in-up'
|
||||
}).then(function(modal) {
|
||||
scope.txStatusModal = modal;
|
||||
scope.txStatusModal.show();
|
||||
});
|
||||
};
|
||||
|
||||
var _signWithLedger = function(wallet, txp, cb) {
|
||||
$log.info('Requesting Ledger Chrome app to sign the transaction');
|
||||
|
||||
|
|
@ -961,23 +944,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
if (err) return cb(bwcError.msg(err));
|
||||
|
||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||
var type = root.getViewStatus(wallet, broadcastedTxp);
|
||||
|
||||
if (!customStatusHandler) {
|
||||
root.openStatusModal(type, broadcastedTxp, function() {});
|
||||
}
|
||||
|
||||
return cb(null, broadcastedTxp);
|
||||
});
|
||||
} else {
|
||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||
|
||||
var type = root.getViewStatus(wallet, signedTxp);
|
||||
|
||||
if (!customStatusHandler) {
|
||||
root.openStatusModal(type, signedTxp, function() {});
|
||||
}
|
||||
|
||||
return cb(null, signedTxp);
|
||||
}
|
||||
});
|
||||
|
|
@ -1053,38 +1023,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
} catch (e) {}
|
||||
}
|
||||
|
||||
root.getViewStatus = function(wallet, txp) {
|
||||
var status = txp.status;
|
||||
var type;
|
||||
var INMEDIATE_SECS = 10;
|
||||
|
||||
if (status == 'broadcasted') {
|
||||
type = 'broadcasted';
|
||||
} else {
|
||||
|
||||
var n = txp.actions.length;
|
||||
var action = lodash.find(txp.actions, {
|
||||
copayerId: wallet.credentials.copayerId
|
||||
});
|
||||
|
||||
if (!action) {
|
||||
type = 'created';
|
||||
} else if (action.type == 'accept') {
|
||||
// created and accepted at the same time?
|
||||
if (n == 1 && action.createdOn - txp.createdOn < INMEDIATE_SECS) {
|
||||
type = 'created';
|
||||
} else {
|
||||
type = 'accepted';
|
||||
}
|
||||
} else if (action.type == 'reject') {
|
||||
type = 'rejected';
|
||||
} else {
|
||||
throw new Error('Unknown type:' + type);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
};
|
||||
|
||||
root.getSendMaxInfo = function(wallet, opts, cb) {
|
||||
opts = opts || {};
|
||||
wallet.getSendMaxInfo(opts, function(err, res) {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ ion-tabs.ion-tabs-transparent {
|
|||
background: none transparent;
|
||||
}
|
||||
|
||||
ion-nav-bar.hide { display: block !important; }
|
||||
|
||||
// .placeholder-icon padding cannot be modified by a variable
|
||||
$placeholder-icon-padding: 10px;
|
||||
.placeholder-icon {
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ input[type=number] {
|
|||
|
||||
.input-notification {
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
margin-right: 25px;
|
||||
}
|
||||
|
||||
.pr {
|
||||
|
|
|
|||
|
|
@ -14,9 +14,43 @@
|
|||
padding: 0 10px;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
line-height: 155px;
|
||||
}
|
||||
.qr-icon {
|
||||
line-height: 45px;
|
||||
.icon {
|
||||
&.valid {
|
||||
padding-top: 3px;
|
||||
color: #13E5B6;
|
||||
}
|
||||
&.invalid {
|
||||
padding-top: 3px;
|
||||
color: #DF2121;
|
||||
}
|
||||
}
|
||||
.add-address-input-group {
|
||||
background-color: #fff;
|
||||
.item-stacked-label {
|
||||
padding: 1rem;
|
||||
}
|
||||
.input-label {
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.add-address-list {
|
||||
.item {
|
||||
color: $dark-gray;
|
||||
padding-top: 1.3rem;
|
||||
padding-bottom: 1.3rem;
|
||||
&.item-divider {
|
||||
color: $mid-gray;
|
||||
padding-bottom: .5rem;
|
||||
font-size: .9rem;
|
||||
}
|
||||
}
|
||||
.item-note {
|
||||
color: $light-gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
#view-address-book {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@
|
|||
font-size: .9rem;
|
||||
}
|
||||
&.view-all {
|
||||
margin: 20px 0px 20px 0px;
|
||||
cursor: pointer;
|
||||
cursor: hand;
|
||||
i {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#view-confirm {
|
||||
background-color: #ffffff;
|
||||
@extend .deflash-blue;
|
||||
.icon-amazon {
|
||||
background-image: url("../img/icon-amazon.svg");
|
||||
|
|
|
|||
61
src/sass/views/includes/itemSelector.scss
Normal file
61
src/sass/views/includes/itemSelector.scss
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
item-selector {
|
||||
|
||||
$border-color: #EFEFEF;
|
||||
|
||||
.bp-action-sheet__sheet {
|
||||
padding-left: 2rem;
|
||||
padding-right: .75rem;
|
||||
}
|
||||
|
||||
.item-selector {
|
||||
.option {
|
||||
border: 0;
|
||||
padding-right: 0;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 1px;
|
||||
overflow: visible;
|
||||
|
||||
> i {
|
||||
color: #647ce8;
|
||||
padding: 0 0 5px 0;
|
||||
margin-left: -5px;
|
||||
|
||||
> img {
|
||||
height: 39px;
|
||||
width: 39px;
|
||||
padding: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.item-selector-inner {
|
||||
display: flex;
|
||||
position: relative;
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
|
||||
&::after {
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background: $border-color;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
content: '';
|
||||
}
|
||||
|
||||
.check {
|
||||
padding: 0 1.2rem;
|
||||
}
|
||||
}
|
||||
.item-selector-details {
|
||||
flex-grow: 1;
|
||||
|
||||
.item-selector-name {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -8,8 +8,20 @@
|
|||
padding: 0 10px;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.qr-icon {
|
||||
line-height: 45px;
|
||||
}
|
||||
.item-stacked-label .icon {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
.icon {
|
||||
&.valid {
|
||||
padding-top: 3px;
|
||||
color: #13E5B6;
|
||||
}
|
||||
&.invalid {
|
||||
padding-top: 3px;
|
||||
color: #DF2121;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
}
|
||||
.checkbox input:before,
|
||||
.checkbox .checkbox-icon:before {
|
||||
padding: 1.1rem;
|
||||
padding: 1.2rem;
|
||||
position: relative;
|
||||
background:url("../img/onboarding-checkbox-unchecked.svg") top center no-repeat;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@
|
|||
transform: translate(-150%, -40%);
|
||||
}
|
||||
.item {
|
||||
white-space: nowrap;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
font-size: .7rem;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
@import "includes/tx-details";
|
||||
@import "includes/txp-details";
|
||||
@import "includes/tx-status";
|
||||
@import "includes/itemSelector";
|
||||
@import "includes/walletSelector";
|
||||
@import "integrations/coinbase";
|
||||
@import "integrations/glidera";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue