commit
88b25370ff
39 changed files with 616 additions and 1041 deletions
|
|
@ -2,36 +2,19 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
||||
function($scope, $modal, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, bwsError, addressService) {
|
||||
|
||||
window.ignoreMobilePause = true;
|
||||
var self = this;
|
||||
var fc;
|
||||
|
||||
var otherWallets = function(testnet) {
|
||||
var network = testnet ? 'testnet' : 'livenet';
|
||||
return lodash.filter(profileService.getWallets(network), function(w) {
|
||||
return w.network == network;
|
||||
});
|
||||
};
|
||||
|
||||
this.init = function(testnet) {
|
||||
self.otherWallets = otherWallets(testnet);
|
||||
// Choose focused wallet
|
||||
try {
|
||||
var currentWalletId = profileService.focusedClient.credentials.walletId;
|
||||
lodash.find(self.otherWallets, function(w) {
|
||||
if (w.id == currentWalletId) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = w.id;
|
||||
self.selectedWalletName = w.name;
|
||||
fc = profileService.getClient(w.id);
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
$log.debug(e);
|
||||
};
|
||||
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1)
|
||||
|
||||
var client = profileService.focusedClient;
|
||||
if (client) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = client.credentials.walletId;
|
||||
self.selectedWalletName = client.credentials.walletName;
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
this.getPaymentMethods = function(token) {
|
||||
|
|
|
|||
|
|
@ -9,32 +9,17 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
this.success = null;
|
||||
this.loading = null;
|
||||
|
||||
window.ignoreMobilePause = true;
|
||||
|
||||
var otherWallets = function(testnet) {
|
||||
var network = testnet ? 'testnet' : 'livenet';
|
||||
return lodash.filter(profileService.getWallets(network), function(w) {
|
||||
return w.network == network;
|
||||
});
|
||||
};
|
||||
|
||||
this.init = function(testnet) {
|
||||
self.otherWallets = otherWallets(testnet);
|
||||
// Choose focused wallet
|
||||
try {
|
||||
var currentWalletId = profileService.focusedClient.credentials.walletId;
|
||||
lodash.find(self.otherWallets, function(w) {
|
||||
if (w.id == currentWalletId) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = w.id;
|
||||
self.selectedWalletName = w.name;
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
$log.debug(e);
|
||||
};
|
||||
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1)
|
||||
|
||||
var client = profileService.focusedClient;
|
||||
if (client) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = client.credentials.walletId;
|
||||
self.selectedWalletName = client.credentials.walletName;
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.openWalletsModal = function(wallets) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ angular.module('copayApp.controllers').controller('coinbaseController',
|
|||
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, coinbaseService, lodash, platformInfo) {
|
||||
|
||||
var isNW = platformInfo.isNW;
|
||||
window.ignoreMobilePause = true;
|
||||
|
||||
this.openAuthenticateWindow = function() {
|
||||
var oauthUrl = this.getAuthenticateUrl();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('coinbaseUriController',
|
||||
function($scope, $stateParams, $timeout, profileService, configService, coinbaseService, storageService, go) {
|
||||
function($scope, $stateParams, $timeout, profileService, configService, coinbaseService, storageService, go) {
|
||||
|
||||
this.submitOauthCode = function(code) {
|
||||
var self = this;
|
||||
|
|
@ -14,10 +14,9 @@ angular.module('copayApp.controllers').controller('coinbaseUriController',
|
|||
if (err) {
|
||||
self.error = err;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
else if (data && data.access_token && data.refresh_token) {
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
} else if (data && data.access_token && data.refresh_token) {
|
||||
storageService.setCoinbaseToken(network, data.access_token, function() {
|
||||
storageService.setCoinbaseRefreshToken(network, data.refresh_token, function() {
|
||||
$scope.$emit('Local/CoinbaseUpdated', data.access_token);
|
||||
|
|
@ -33,8 +32,13 @@ angular.module('copayApp.controllers').controller('coinbaseUriController',
|
|||
};
|
||||
|
||||
this.checkCode = function() {
|
||||
this.code = $stateParams.code;
|
||||
this.submitOauthCode(this.code);
|
||||
};
|
||||
|
||||
if ($stateParams.url) {
|
||||
var match = $stateParams.url.match(/code=(.+)&/);
|
||||
if (match && match[1]) {
|
||||
this.code = match[1];
|
||||
return this.submitOauthCode(this.code);
|
||||
}
|
||||
}
|
||||
$log.error('Bad state: ' + JSON.stringify($stateParams));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -92,9 +92,6 @@ angular.module('copayApp.controllers').controller('copayersController',
|
|||
|
||||
self.shareSecret = function(secret) {
|
||||
if (isCordova) {
|
||||
if (isAndroid || isWP) {
|
||||
window.ignoreMobilePause = true;
|
||||
}
|
||||
var message = gettextCatalog.getString('Join my Copay wallet. Here is the invitation code: {{secret}} You can download Copay for your phone or desktop at https://copay.io', {
|
||||
secret: secret
|
||||
});
|
||||
|
|
|
|||
|
|
@ -126,9 +126,6 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
|
||||
self.sendWalletBackup = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
if (isAndroid || isWP) {
|
||||
window.ignoreMobilePause = true;
|
||||
}
|
||||
window.plugins.toast.showShortCenter(gettextCatalog.getString('Preparing backup...'));
|
||||
var name = (fc.credentials.walletName || fc.credentials.walletId);
|
||||
if (fc.alias) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('glideraUriController',
|
||||
function($scope, $stateParams, $timeout, profileService, configService, glideraService, storageService, go) {
|
||||
function($scope, $log, $stateParams, $timeout, profileService, configService, glideraService, storageService, go) {
|
||||
|
||||
this.submitOauthCode = function(code) {
|
||||
$log.debug('Glidera Oauth Code:' + code);
|
||||
var self = this;
|
||||
var glideraTestnet = configService.getSync().glidera.testnet;
|
||||
var network = glideraTestnet ? 'testnet' : 'livenet';
|
||||
|
|
@ -14,10 +15,9 @@ angular.module('copayApp.controllers').controller('glideraUriController',
|
|||
if (err) {
|
||||
self.error = err;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
else if (data && data.access_token) {
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
} else if (data && data.access_token) {
|
||||
storageService.setGlideraToken(network, data.access_token, function() {
|
||||
$scope.$emit('Local/GlideraUpdated', data.access_token);
|
||||
$timeout(function() {
|
||||
|
|
@ -31,8 +31,13 @@ angular.module('copayApp.controllers').controller('glideraUriController',
|
|||
};
|
||||
|
||||
this.checkCode = function() {
|
||||
this.code = $stateParams.code;
|
||||
this.submitOauthCode(this.code);
|
||||
};
|
||||
|
||||
if ($stateParams.url) {
|
||||
var match = $stateParams.url.match(/code=(.+)/);
|
||||
if (match && match[1]) {
|
||||
this.code = match[1];
|
||||
return this.submitOauthCode(this.code);
|
||||
}
|
||||
}
|
||||
$log.error('Bad state: ' + JSON.stringify($stateParams));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,14 +15,6 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$scope.account = 1;
|
||||
self.importErr = false;
|
||||
|
||||
window.ignoreMobilePause = true;
|
||||
$scope.$on('$destroy', function() {
|
||||
$timeout(function() {
|
||||
window.ignoreMobilePause = false;
|
||||
}, 100);
|
||||
});
|
||||
|
||||
|
||||
var updateSeedSourceSelect = function() {
|
||||
self.seedOptions = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('importLegacyController',
|
||||
function($rootScope, $scope, $log, $timeout, notification, legacyImportService, profileService, go, lodash, bitcore, gettext, gettextCatalog) {
|
||||
|
||||
var self = this;
|
||||
self.messages = [];
|
||||
self.fromCloud = true;
|
||||
self.server = "https://insight.bitpay.com:443/api/email";
|
||||
|
||||
|
||||
$rootScope.$on('Local/ImportStatusUpdate', function(event, status) {
|
||||
$timeout(function() {
|
||||
$log.debug(status);
|
||||
|
||||
self.messages.unshift({
|
||||
message: status,
|
||||
});
|
||||
|
||||
var op = 1;
|
||||
lodash.each(self.messages, function(m) {
|
||||
if (op < 0.1) op = 0.1;
|
||||
m.opacity = op;
|
||||
op = op - 0.15;
|
||||
});
|
||||
}, 100);
|
||||
});
|
||||
|
||||
self.scan = function(ids) {
|
||||
$log.debug('### Scanning: ' + ids)
|
||||
var i = 0;
|
||||
lodash.each(ids, function(id) {
|
||||
$rootScope.$emit('Local/WalletImported', id);
|
||||
if (++i == ids.length) {
|
||||
go.walletHome();
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
self.import = function(form) {
|
||||
var username = form.username.$modelValue;
|
||||
var password = form.password.$modelValue;
|
||||
var serverURL = form.server.$modelValue;
|
||||
var fromCloud = form.fromCloud.$modelValue;
|
||||
|
||||
self.error = null;
|
||||
self.importing = true;
|
||||
$timeout(function() {
|
||||
legacyImportService.import(username, password, serverURL, fromCloud, function(err, ids, toScanIds) {
|
||||
if (err || !ids || !ids.length) {
|
||||
self.importing = false;
|
||||
self.error = err || gettext('Failed to import wallets');
|
||||
return;
|
||||
}
|
||||
|
||||
notification.success( gettextCatalog.getString('{{len}} wallets imported. Funds scanning in progress. Hold on to see updated balance', {len: ids.length}));
|
||||
self.scan(toScanIds);
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
// TODO destroy event...
|
||||
});
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, $ionicPopup, latestReleaseService, feeService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService) {
|
||||
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, $ionicPopup, latestReleaseService, feeService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, openURLService) {
|
||||
var self = this;
|
||||
var SOFT_CONFIRMATION_LIMIT = 12;
|
||||
var errors = bwcService.getErrors();
|
||||
|
|
@ -289,6 +289,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
initStatusHash = _walletStatusHash();
|
||||
$log.debug('Updating status until it changes. initStatusHash:' + initStatusHash)
|
||||
}
|
||||
|
||||
var get = function(cb) {
|
||||
if (opts.walletStatus)
|
||||
return cb(null, opts.walletStatus);
|
||||
|
|
@ -351,6 +352,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.setPendingTxps(walletStatus.pendingTxps);
|
||||
|
||||
// Status Shortcuts
|
||||
self.lastUpdate = Date.now();
|
||||
self.walletName = walletStatus.wallet.name;
|
||||
self.walletSecret = walletStatus.wallet.secret;
|
||||
self.walletStatus = walletStatus.wallet.status;
|
||||
|
|
@ -1425,6 +1427,19 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.tab = 'walletHome';
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/ValidatingWallet', function() {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
window.plugins.spinnerDialog.show(null, gettext('Validating wallet integrity...'), true);
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/ProfileBound', function() {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/ClearHistory', function(event) {
|
||||
$log.debug('The wallet transaction history has been deleted');
|
||||
self.txHistory = self.completeHistory = self.txHistorySearchResults = [];
|
||||
|
|
@ -1492,59 +1507,105 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
}
|
||||
});
|
||||
|
||||
self.debouncedUpdate = lodash.throttle(function() {
|
||||
self.updateAll({
|
||||
quiet: true
|
||||
});
|
||||
self.debounceUpdateHistory();
|
||||
}, 2000, {
|
||||
leading: false,
|
||||
trailing: true
|
||||
});
|
||||
self.debouncedUpdate = function() {
|
||||
var now = Date.now();
|
||||
var oneHr = 1000 * 60 * 60;
|
||||
|
||||
$rootScope.$on('Local/Resume', function(event) {
|
||||
$log.debug('### Resume event');
|
||||
profileService.isDisclaimerAccepted(function(v) {
|
||||
if (!v) {
|
||||
$log.debug('Disclaimer not accepted, resume to home');
|
||||
go.path('disclaimer');
|
||||
}
|
||||
});
|
||||
self.debouncedUpdate();
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/BackupDone', function(event, walletId) {
|
||||
self.needsBackup = false;
|
||||
$log.debug('Backup done');
|
||||
storageService.setBackupFlag(walletId || self.walletId, function(err) {
|
||||
$log.debug('Backup stored');
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/DeviceError', function(event, err) {
|
||||
self.showErrorPopup(err, function() {
|
||||
if (isCordova && navigator && navigator.app) {
|
||||
navigator.app.exitApp();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/WalletImported', function(event, walletId) {
|
||||
self.needsBackup = false;
|
||||
storageService.setBackupFlag(walletId, function() {
|
||||
$log.debug('Backup done stored');
|
||||
addressService.expireAddress(walletId, function(err) {
|
||||
$timeout(function() {
|
||||
self.txHistory = self.completeHistory = self.txHistorySearchResults = [];
|
||||
storageService.removeTxHistory(walletId, function() {
|
||||
self.startScan(walletId);
|
||||
});
|
||||
}, 500);
|
||||
if (!self.lastUpdate || (now - self.lastUpdate) > oneHr) {
|
||||
self.updateAll({
|
||||
quiet: true,
|
||||
triggerTxUpdate: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$rootScope.$on('Local/Resume', function(event) {
|
||||
$log.debug('### Resume event');
|
||||
profileService.isDisclaimerAccepted(function(v) {
|
||||
if (!v) {
|
||||
$log.debug('Disclaimer not accepted, resume to home');
|
||||
go.path('disclaimer');
|
||||
}
|
||||
});
|
||||
self.debouncedUpdate();
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/BackupDone', function(event, walletId) {
|
||||
self.needsBackup = false;
|
||||
$log.debug('Backup done');
|
||||
storageService.setBackupFlag(walletId || self.walletId, function(err) {
|
||||
$log.debug('Backup stored');
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/DeviceError', function(event, err) {
|
||||
self.showErrorPopup(err, function() {
|
||||
if (isCordova && navigator && navigator.app) {
|
||||
navigator.app.exitApp();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/WalletImported', function(event, walletId) {
|
||||
self.needsBackup = false;
|
||||
storageService.setBackupFlag(walletId, function() {
|
||||
$log.debug('Backup done stored');
|
||||
addressService.expireAddress(walletId, function(err) {
|
||||
$timeout(function() {
|
||||
self.txHistory = self.completeHistory = self.txHistorySearchResults = [];
|
||||
storageService.removeTxHistory(walletId, function() {
|
||||
self.startScan(walletId);
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('NewIncomingTx', function() {
|
||||
$rootScope.$on('NewIncomingTx', function() {
|
||||
self.newTx = true;
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
untilItChanges: true,
|
||||
triggerTxUpdate: true,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$rootScope.$on('NewBlock', function() {
|
||||
if (self.glideraEnabled) {
|
||||
$timeout(function() {
|
||||
self.updateGlidera();
|
||||
});
|
||||
}
|
||||
if (self.coinbaseEnabled) {
|
||||
$timeout(function() {
|
||||
self.updateCoinbase();
|
||||
});
|
||||
}
|
||||
if (self.pendingAmount) {
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
untilItChanges: null,
|
||||
triggerTxUpdate: true,
|
||||
});
|
||||
} else if (self.hasUnsafeConfirmed) {
|
||||
$log.debug('Wallet has transactions with few confirmations. Updating.')
|
||||
if (self.network == 'testnet') {
|
||||
self.throttledUpdateHistory();
|
||||
} else {
|
||||
self.debounceUpdateHistory();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.$on('BalanceUpdated', function(e, n) {
|
||||
self.setBalance(n.data);
|
||||
});
|
||||
|
||||
|
||||
//untilItChange TRUE
|
||||
lodash.each(['NewOutgoingTx', 'NewOutgoingTxByThirdParty'], function(eventName) {
|
||||
$rootScope.$on(eventName, function(event) {
|
||||
self.newTx = true;
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
|
|
@ -1552,244 +1613,200 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
triggerTxUpdate: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$rootScope.$on('NewBlock', function() {
|
||||
if (self.glideraEnabled) {
|
||||
$timeout(function() {
|
||||
self.updateGlidera();
|
||||
});
|
||||
}
|
||||
if (self.coinbaseEnabled) {
|
||||
$timeout(function() {
|
||||
self.updateCoinbase();
|
||||
});
|
||||
}
|
||||
if (self.pendingAmount) {
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
untilItChanges: null,
|
||||
triggerTxUpdate: true,
|
||||
});
|
||||
} else if (self.hasUnsafeConfirmed) {
|
||||
$log.debug('Wallet has transactions with few confirmations. Updating.')
|
||||
if (self.network == 'testnet') {
|
||||
self.throttledUpdateHistory();
|
||||
} else {
|
||||
self.debounceUpdateHistory();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.$on('BalanceUpdated', function(e, n) {
|
||||
self.setBalance(n.data);
|
||||
});
|
||||
|
||||
|
||||
//untilItChange TRUE
|
||||
lodash.each(['NewOutgoingTx', 'NewOutgoingTxByThirdParty'], function(eventName) {
|
||||
$rootScope.$on(eventName, function(event) {
|
||||
self.newTx = true;
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
untilItChanges: true,
|
||||
triggerTxUpdate: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//untilItChange FALSE
|
||||
lodash.each(['NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved', 'NewOutgoingTxByThirdParty',
|
||||
'Local/GlideraTx'
|
||||
], function(eventName) {
|
||||
$rootScope.$on(eventName, function(event) {
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
untilItChanges: null,
|
||||
triggerTxUpdate: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//untilItChange Maybe
|
||||
$rootScope.$on('Local/TxProposalAction', function(event, untilItChanges) {
|
||||
self.newTx = untilItChanges;
|
||||
//untilItChange FALSE
|
||||
lodash.each(['NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved', 'NewOutgoingTxByThirdParty',
|
||||
'Local/GlideraTx'
|
||||
], function(eventName) {
|
||||
$rootScope.$on(eventName, function(event) {
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
untilItChanges: untilItChanges,
|
||||
untilItChanges: null,
|
||||
triggerTxUpdate: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('ScanFinished', function() {
|
||||
$log.debug('Scan Finished. Updating history');
|
||||
storageService.removeTxHistory(self.walletId, function() {
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
triggerTxUpdate: true,
|
||||
});
|
||||
|
||||
//untilItChange Maybe
|
||||
$rootScope.$on('Local/TxProposalAction', function(event, untilItChanges) {
|
||||
self.newTx = untilItChanges;
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
untilItChanges: untilItChanges,
|
||||
triggerTxUpdate: true,
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('ScanFinished', function() {
|
||||
$log.debug('Scan Finished. Updating history');
|
||||
storageService.removeTxHistory(self.walletId, function() {
|
||||
self.updateAll({
|
||||
walletStatus: null,
|
||||
triggerTxUpdate: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
lodash.each(['TxProposalRejectedBy', 'TxProposalAcceptedBy'], function(eventName) {
|
||||
$rootScope.$on(eventName, function() {
|
||||
var f = function() {
|
||||
if (self.updatingStatus) {
|
||||
return $timeout(f, 200);
|
||||
};
|
||||
self.updatePendingTxps();
|
||||
lodash.each(['TxProposalRejectedBy', 'TxProposalAcceptedBy'], function(eventName) {
|
||||
$rootScope.$on(eventName, function() {
|
||||
var f = function() {
|
||||
if (self.updatingStatus) {
|
||||
return $timeout(f, 200);
|
||||
};
|
||||
f();
|
||||
});
|
||||
self.updatePendingTxps();
|
||||
};
|
||||
f();
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/NoWallets', function(event) {
|
||||
$timeout(function() {
|
||||
self.hasProfile = true;
|
||||
self.noFocusedWallet = true;
|
||||
self.isComplete = null;
|
||||
self.walletName = null;
|
||||
uxLanguage.update();
|
||||
|
||||
profileService.isDisclaimerAccepted(function(v) {
|
||||
if (v) {
|
||||
go.path('import');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/NewFocusedWallet', function() {
|
||||
$rootScope.$on('Local/NoWallets', function(event) {
|
||||
$timeout(function() {
|
||||
self.hasProfile = true;
|
||||
self.noFocusedWallet = true;
|
||||
self.isComplete = null;
|
||||
self.walletName = null;
|
||||
uxLanguage.update();
|
||||
self.setFocusedWallet();
|
||||
self.updateHistory();
|
||||
storageService.getCleanAndScanAddresses(function(err, walletId) {
|
||||
|
||||
if (walletId && profileService.walletClients[walletId]) {
|
||||
$log.debug('Clear last address cache and Scan ', walletId);
|
||||
addressService.expireAddress(walletId, function(err) {
|
||||
self.startScan(walletId);
|
||||
});
|
||||
storageService.removeCleanAndScanAddresses(function() {
|
||||
$rootScope.$emit('Local/NewFocusedWalletReady');
|
||||
});
|
||||
} else {
|
||||
$rootScope.$emit('Local/NewFocusedWalletReady');
|
||||
profileService.isDisclaimerAccepted(function(v) {
|
||||
if (v) {
|
||||
go.path('import');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/SetTab', function(event, tab, reset) {
|
||||
self.setTab(tab, reset);
|
||||
});
|
||||
$rootScope.$on('Local/NewFocusedWallet', function() {
|
||||
uxLanguage.update();
|
||||
self.setFocusedWallet();
|
||||
self.updateHistory();
|
||||
storageService.getCleanAndScanAddresses(function(err, walletId) {
|
||||
|
||||
$rootScope.$on('Local/NeedsConfirmation', function(event, txp, cb) {
|
||||
|
||||
function openConfirmationPopup(txp, cb) {
|
||||
|
||||
$scope.tx = txFormatService.processTx(txp);
|
||||
|
||||
self.confirmationPopup = $ionicPopup.show({
|
||||
templateUrl: 'views/includes/confirm-tx.html',
|
||||
scope: $scope,
|
||||
if (walletId && profileService.walletClients[walletId]) {
|
||||
$log.debug('Clear last address cache and Scan ', walletId);
|
||||
addressService.expireAddress(walletId, function(err) {
|
||||
self.startScan(walletId);
|
||||
});
|
||||
|
||||
$scope.processFee = function(amount, fee) {
|
||||
var walletSettings = configService.getSync().wallet.settings;
|
||||
var feeAlternativeIsoCode = walletSettings.alternativeIsoCode;
|
||||
|
||||
$scope.feeLevel = feeService.feeOpts[feeService.getCurrentFeeLevel()];
|
||||
$scope.feeAlternativeStr = parseFloat((rateService.toFiat(fee, feeAlternativeIsoCode)).toFixed(2), 10) + ' ' + feeAlternativeIsoCode;
|
||||
$scope.feeRateStr = (fee / (amount + fee) * 100).toFixed(2) + '%';
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
return cb();
|
||||
};
|
||||
|
||||
$scope.accept = function() {
|
||||
return cb(true);
|
||||
};
|
||||
storageService.removeCleanAndScanAddresses(function() {
|
||||
$rootScope.$emit('Local/NewFocusedWalletReady');
|
||||
});
|
||||
} else {
|
||||
$rootScope.$emit('Local/NewFocusedWalletReady');
|
||||
}
|
||||
|
||||
openConfirmationPopup(txp, function(accept) {
|
||||
self.confirmationPopup.close();
|
||||
return cb(accept);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/NeedsPassword', function(event, isSetup, cb) {
|
||||
$rootScope.$on('Local/SetTab', function(event, tab, reset) {
|
||||
self.setTab(tab, reset);
|
||||
});
|
||||
|
||||
function openPasswordPopup(isSetup, cb) {
|
||||
$scope.data = {};
|
||||
$scope.data.password = null;
|
||||
$scope.isSetup = isSetup;
|
||||
$scope.isVerification = false;
|
||||
$scope.loading = false;
|
||||
var pass = null;
|
||||
$rootScope.$on('Local/NeedsConfirmation', function(event, txp, cb) {
|
||||
|
||||
self.passwordPopup = $ionicPopup.show({
|
||||
templateUrl: 'views/includes/password.html',
|
||||
scope: $scope,
|
||||
});
|
||||
function openConfirmationPopup(txp, cb) {
|
||||
|
||||
$scope.cancel = function() {
|
||||
return cb('No spending password given');
|
||||
};
|
||||
$scope.tx = txFormatService.processTx(txp);
|
||||
|
||||
$scope.set = function() {
|
||||
$scope.loading = true;
|
||||
$scope.error = null;
|
||||
self.confirmationPopup = $ionicPopup.show({
|
||||
templateUrl: 'views/includes/confirm-tx.html',
|
||||
scope: $scope,
|
||||
});
|
||||
|
||||
$timeout(function() {
|
||||
if (isSetup && !$scope.isVerification) {
|
||||
$scope.loading = false;
|
||||
$scope.isVerification = true;
|
||||
pass = $scope.data.password;
|
||||
$scope.data.password = null;
|
||||
return;
|
||||
}
|
||||
if (isSetup && pass != $scope.data.password) {
|
||||
$scope.loading = false;
|
||||
$scope.error = gettext('Spending Passwords do not match');
|
||||
$scope.isVerification = false;
|
||||
$scope.data.password = null;
|
||||
pass = null;
|
||||
return;
|
||||
}
|
||||
return cb(null, $scope.data.password);
|
||||
}, 100);
|
||||
};
|
||||
$scope.processFee = function(amount, fee) {
|
||||
var walletSettings = configService.getSync().wallet.settings;
|
||||
var feeAlternativeIsoCode = walletSettings.alternativeIsoCode;
|
||||
|
||||
$scope.feeLevel = feeService.feeOpts[feeService.getCurrentFeeLevel()];
|
||||
$scope.feeAlternativeStr = parseFloat((rateService.toFiat(fee, feeAlternativeIsoCode)).toFixed(2), 10) + ' ' + feeAlternativeIsoCode;
|
||||
$scope.feeRateStr = (fee / (amount + fee) * 100).toFixed(2) + '%';
|
||||
};
|
||||
|
||||
openPasswordPopup(isSetup, function(err, pass) {
|
||||
self.passwordPopup.close();
|
||||
return cb(err, pass);
|
||||
});
|
||||
$scope.cancel = function() {
|
||||
return cb();
|
||||
};
|
||||
|
||||
$scope.accept = function() {
|
||||
return cb(true);
|
||||
};
|
||||
}
|
||||
|
||||
openConfirmationPopup(txp, function(accept) {
|
||||
self.confirmationPopup.close();
|
||||
return cb(accept);
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/EmailUpdated', function(event, email) {
|
||||
self.preferences.email = email;
|
||||
});
|
||||
|
||||
lodash.each(['NewCopayer', 'CopayerUpdated'], function(eventName) {
|
||||
$rootScope.$on(eventName, function() {
|
||||
// Re try to open wallet (will triggers)
|
||||
self.setFocusedWallet();
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/NewEncryptionSetting', function() {
|
||||
var fc = profileService.focusedClient;
|
||||
self.isPrivKeyEncrypted = fc.isPrivKeyEncrypted();
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/* Start setup */
|
||||
lodash.assign(self, vanillaScope);
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/NeedsPassword', function(event, isSetup, cb) {
|
||||
|
||||
function openPasswordPopup(isSetup, cb) {
|
||||
$scope.data = {};
|
||||
$scope.data.password = null;
|
||||
$scope.isSetup = isSetup;
|
||||
$scope.isVerification = false;
|
||||
$scope.loading = false;
|
||||
var pass = null;
|
||||
|
||||
self.passwordPopup = $ionicPopup.show({
|
||||
templateUrl: 'views/includes/password.html',
|
||||
scope: $scope,
|
||||
});
|
||||
|
||||
$scope.cancel = function() {
|
||||
return cb('No spending password given');
|
||||
};
|
||||
|
||||
$scope.set = function() {
|
||||
$scope.loading = true;
|
||||
$scope.error = null;
|
||||
|
||||
$timeout(function() {
|
||||
if (isSetup && !$scope.isVerification) {
|
||||
$scope.loading = false;
|
||||
$scope.isVerification = true;
|
||||
pass = $scope.data.password;
|
||||
$scope.data.password = null;
|
||||
return;
|
||||
}
|
||||
if (isSetup && pass != $scope.data.password) {
|
||||
$scope.loading = false;
|
||||
$scope.error = gettext('Spending Passwords do not match');
|
||||
$scope.isVerification = false;
|
||||
$scope.data.password = null;
|
||||
pass = null;
|
||||
return;
|
||||
}
|
||||
return cb(null, $scope.data.password);
|
||||
}, 100);
|
||||
};
|
||||
};
|
||||
|
||||
openPasswordPopup(isSetup, function(err, pass) {
|
||||
self.passwordPopup.close();
|
||||
return cb(err, pass);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/EmailUpdated', function(event, email) {
|
||||
self.preferences.email = email;
|
||||
});
|
||||
|
||||
lodash.each(['NewCopayer', 'CopayerUpdated'], function(eventName) {
|
||||
$rootScope.$on(eventName, function() {
|
||||
// Re try to open wallet (will triggers)
|
||||
self.setFocusedWallet();
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/NewEncryptionSetting', function() {
|
||||
var fc = profileService.focusedClient;
|
||||
self.isPrivKeyEncrypted = fc.isPrivKeyEncrypted();
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/* Start setup */
|
||||
lodash.assign(self, vanillaScope); openURLService.init();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -69,9 +69,6 @@ angular.module('copayApp.controllers').controller('customAmountController', func
|
|||
|
||||
$scope.shareAddress = function(uri) {
|
||||
if (platformInfo.isCordova) {
|
||||
if (platformInfo.isAndroid || platformInfo.isWP) {
|
||||
window.ignoreMobilePause = true;
|
||||
}
|
||||
window.plugins.socialsharing.share(uri, null, null, null);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,20 +1,14 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('paymentUriController',
|
||||
function($rootScope, $stateParams, $location, $timeout, profileService, configService, lodash, bitcore, go) {
|
||||
|
||||
window.ignoreMobilePause = true;
|
||||
function strip(number) {
|
||||
return (parseFloat(number.toPrecision(12)));
|
||||
};
|
||||
|
||||
// Build bitcoinURI with querystring
|
||||
this.checkBitcoinUri = function() {
|
||||
this.init = function() {
|
||||
var query = [];
|
||||
angular.forEach($location.search(), function(value, key) {
|
||||
query.push(key + "=" + value);
|
||||
});
|
||||
var queryString = query ? query.join("&") : null;
|
||||
this.bitcoinURI = $stateParams.data + (queryString ? '?' + queryString : '');
|
||||
this.bitcoinURI = $stateParams.url;
|
||||
|
||||
var URI = bitcore.URI;
|
||||
var isUriValid = URI.isValid(this.bitcoinURI);
|
||||
|
|
|
|||
|
|
@ -46,10 +46,6 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
|
|||
this.sendAddrs = function() {
|
||||
var self = this;
|
||||
|
||||
if (platformInfo.isAndroid || platformInfo.isWP) {
|
||||
window.ignoreMobilePause = true;
|
||||
}
|
||||
|
||||
self.loading = true;
|
||||
|
||||
function formatDate(ts) {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,8 @@
|
|||
angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
||||
function($rootScope, $scope, $modal, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, bwsError, configService, walletService, fingerprintService) {
|
||||
|
||||
window.ignoreMobilePause = true;
|
||||
var self = this;
|
||||
var fc;
|
||||
var client;
|
||||
|
||||
$scope.priceSensitivity = [
|
||||
{
|
||||
|
|
@ -31,13 +30,6 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
];
|
||||
$scope.selectedPriceSensitivity = $scope.priceSensitivity[1];
|
||||
|
||||
var otherWallets = function(testnet) {
|
||||
var network = testnet ? 'testnet' : 'livenet';
|
||||
return lodash.filter(profileService.getWallets(network), function(w) {
|
||||
return w.network == network && w.m == 1;
|
||||
});
|
||||
};
|
||||
|
||||
var handleEncryptedWallet = function(client, cb) {
|
||||
if (!walletService.isEncrypted(client)) return cb();
|
||||
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
|
||||
|
|
@ -47,23 +39,16 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
};
|
||||
|
||||
this.init = function(testnet) {
|
||||
self.otherWallets = otherWallets(testnet);
|
||||
// Choose focused wallet
|
||||
try {
|
||||
var currentWalletId = profileService.focusedClient.credentials.walletId;
|
||||
lodash.find(self.otherWallets, function(w) {
|
||||
if (w.id == currentWalletId) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = w.id;
|
||||
self.selectedWalletName = w.name;
|
||||
fc = profileService.getClient(w.id);
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
$log.debug(e);
|
||||
};
|
||||
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1);
|
||||
|
||||
client = profileService.focusedClient;
|
||||
if (client) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = client.credentials.walletId;
|
||||
self.selectedWalletName = client.credentials.walletName;
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
this.getPaymentMethods = function(token) {
|
||||
|
|
@ -157,6 +142,11 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
this.createTx = function(token, account, amount) {
|
||||
self.error = null;
|
||||
|
||||
if (!client) {
|
||||
self.error = 'No wallet selected';
|
||||
return;
|
||||
}
|
||||
|
||||
var accountId = account.id;
|
||||
var dataSrc = {
|
||||
name: 'Received from Copay: ' + self.selectedWalletName
|
||||
|
|
@ -199,7 +189,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
feeLevel: walletSettings.feeLevel || 'normal'
|
||||
};
|
||||
|
||||
walletService.createTx(fc, txp, function(err, createdTxp) {
|
||||
walletService.createTx(client, txp, function(err, createdTxp) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
self.loading = null;
|
||||
|
|
@ -239,7 +229,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
ctx['price_sensitivity'] = $scope.selectedPriceSensitivity;
|
||||
ctx['sell_price_amount'] = self.sellPrice.amount;
|
||||
ctx['sell_price_currency'] = self.sellPrice.currency;
|
||||
ctx['description'] = 'Copay Wallet: ' + fc.credentials.walletName;
|
||||
ctx['description'] = 'Copay Wallet: ' + client.credentials.walletName;
|
||||
coinbaseService.savePendingTransaction(ctx, null, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
self.sendInfo = ctx;
|
||||
|
|
@ -262,20 +252,20 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
|
||||
this.confirmTx = function(txp, cb) {
|
||||
|
||||
fingerprintService.check(fc, function(err) {
|
||||
fingerprintService.check(client, function(err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
handleEncryptedWallet(fc, function(err) {
|
||||
handleEncryptedWallet(client, function(err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
self.loading = 'Sending bitcoin to Coinbase...';
|
||||
walletService.publishTx(fc, txp, function(err, publishedTxp) {
|
||||
walletService.publishTx(client, txp, function(err, publishedTxp) {
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
$log.debug(err);
|
||||
|
|
@ -286,12 +276,12 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
});
|
||||
}
|
||||
|
||||
walletService.signTx(fc, publishedTxp, function(err, signedTxp) {
|
||||
walletService.lock(fc);
|
||||
walletService.signTx(client, publishedTxp, function(err, signedTxp) {
|
||||
walletService.lock(client);
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
$log.debug(err);
|
||||
walletService.removeTx(fc, signedTxp, function(err) {
|
||||
walletService.removeTx(client, signedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
return cb({
|
||||
|
|
@ -301,11 +291,11 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
|||
});
|
||||
}
|
||||
|
||||
walletService.broadcastTx(fc, signedTxp, function(err, broadcastedTxp) {
|
||||
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) {
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
$log.debug(err);
|
||||
walletService.removeTx(fc, broadcastedTxp, function(err) {
|
||||
walletService.removeTx(client, broadcastedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
return cb({
|
||||
|
|
|
|||
|
|
@ -10,16 +10,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
this.success = null;
|
||||
this.error = null;
|
||||
this.loading = null;
|
||||
var fc;
|
||||
|
||||
window.ignoreMobilePause = true;
|
||||
|
||||
var otherWallets = function(testnet) {
|
||||
var network = testnet ? 'testnet' : 'livenet';
|
||||
return lodash.filter(profileService.getWallets(network), function(w) {
|
||||
return w.network == network && w.m == 1;
|
||||
});
|
||||
};
|
||||
var client;
|
||||
|
||||
var handleEncryptedWallet = function(client, cb) {
|
||||
if (!walletService.isEncrypted(client)) return cb();
|
||||
|
|
@ -30,25 +21,20 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
};
|
||||
|
||||
this.init = function(testnet) {
|
||||
self.otherWallets = otherWallets(testnet);
|
||||
// Choose focused wallet
|
||||
try {
|
||||
var currentWalletId = profileService.focusedClient.credentials.walletId;
|
||||
lodash.find(self.otherWallets, function(w) {
|
||||
if (w.id == currentWalletId) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = w.id;
|
||||
self.selectedWalletName = w.name;
|
||||
fc = profileService.getClient(w.id);
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
$log.debug(e);
|
||||
};
|
||||
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1)
|
||||
|
||||
client = profileService.focusedClient;
|
||||
if (client) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = client.credentials.walletId;
|
||||
self.selectedWalletName = client.credentials.walletName;
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.openWalletsModal = function(wallets) {
|
||||
self.error = null;
|
||||
self.selectedWalletId = null;
|
||||
|
|
@ -108,7 +94,12 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
var configWallet = config.wallet;
|
||||
var walletSettings = configWallet.settings;
|
||||
|
||||
addressService.getAddress(fc.credentials.walletId, null, function(err, refundAddress) {
|
||||
if (!client) {
|
||||
self.error = 'No wallet selected';
|
||||
return;
|
||||
}
|
||||
|
||||
addressService.getAddress(client.credentials.walletId, null, function(err, refundAddress) {
|
||||
if (!refundAddress) {
|
||||
self.loading = null;
|
||||
self.error = bwsError.msg(err, 'Could not create address');
|
||||
|
|
@ -143,7 +134,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
};
|
||||
|
||||
self.loading = 'Creating transaction...';
|
||||
walletService.createTx(fc, txp, function(err, createdTxp) {
|
||||
walletService.createTx(client, txp, function(err, createdTxp) {
|
||||
self.loading = null;
|
||||
if (err) {
|
||||
self.error = err.message || bwsError.msg(err);
|
||||
|
|
@ -151,13 +142,13 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
}
|
||||
$scope.$emit('Local/NeedsConfirmation', createdTxp, function(accept) {
|
||||
if (accept) {
|
||||
fingerprintService.check(fc, function(err) {
|
||||
fingerprintService.check(client, function(err) {
|
||||
if (err) {
|
||||
self.error = err.message || bwsError.msg(err);
|
||||
return;
|
||||
}
|
||||
|
||||
handleEncryptedWallet(fc, function(err) {
|
||||
handleEncryptedWallet(client, function(err) {
|
||||
if (err) {
|
||||
self.error = err.message || bwsError.msg(err);
|
||||
return;
|
||||
|
|
@ -165,15 +156,15 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
|
||||
self.loading = 'Signing transaction...';
|
||||
|
||||
walletService.publishTx(fc, createdTxp, function(err, publishedTxp) {
|
||||
walletService.publishTx(client, createdTxp, function(err, publishedTxp) {
|
||||
if (err) {
|
||||
self.loading = null;
|
||||
self.error = err.message || bwsError.msg(err);
|
||||
}
|
||||
|
||||
walletService.signTx(fc, publishedTxp, function(err, signedTxp) {
|
||||
walletService.lock(fc);
|
||||
walletService.removeTx(fc, signedTxp, function(err) {
|
||||
walletService.signTx(client, publishedTxp, function(err, signedTxp) {
|
||||
walletService.lock(client);
|
||||
walletService.removeTx(client, signedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
if (err) {
|
||||
|
|
|
|||
12
src/js/controllers/uri.js
Normal file
12
src/js/controllers/uri.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('uriController',
|
||||
function($stateParams, $log, openURLService) {
|
||||
|
||||
|
||||
/* This is only for BROWSER links, it is not excecuted on mobile devices */
|
||||
|
||||
$log.info('DEEP LINK from Browser:' + $stateParams.url);
|
||||
openURLService.handleURL({
|
||||
url: $stateParams.url
|
||||
});
|
||||
});
|
||||
|
|
@ -8,7 +8,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
var isChromeApp = platformInfo.isChromeApp;
|
||||
|
||||
var self = this;
|
||||
window.ignoreMobilePause = false;
|
||||
$rootScope.shouldHideMenuBar = false;
|
||||
$rootScope.wpInputFocused = false;
|
||||
var config = configService.getSync();
|
||||
|
|
@ -217,9 +216,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
this.shareAddress = function(addr) {
|
||||
if (isCordova) {
|
||||
if (isAndroid || isWP) {
|
||||
window.ignoreMobilePause = true;
|
||||
}
|
||||
window.plugins.socialsharing.share('bitcoin:' + addr, null, null, null);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue