Merge pull request #327 from msalcala11/slideToPayComponent
Implement Slide to Pay
This commit is contained in:
commit
8607867d71
30 changed files with 842 additions and 164 deletions
|
|
@ -48,7 +48,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
|
|||
return ongoingProcess[processName];
|
||||
};
|
||||
|
||||
root.set = function(processName, isOn) {
|
||||
root.set = function(processName, isOn, customHandler) {
|
||||
$log.debug('ongoingProcess', processName, isOn);
|
||||
root[processName] = isOn;
|
||||
ongoingProcess[processName] = isOn;
|
||||
|
|
@ -64,7 +64,9 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
|
|||
|
||||
var showName = $filter('translate')(processNames[name] || name);
|
||||
|
||||
if (root.onGoingProcessName) {
|
||||
if(customHandler) {
|
||||
customHandler(processName, showName, isOn);
|
||||
} else if (root.onGoingProcessName) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.show(null, showName, true);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -39,5 +39,21 @@ angular.module('copayApp.services').factory('platformInfo', function($window) {
|
|||
ret.isChromeApp = $window.chrome && chrome.runtime && chrome.runtime.id && !ret.isNW;
|
||||
ret.isDevel = !ret.isMobile && !ret.isChromeApp && !ret.isNW;
|
||||
|
||||
ret.hasClick = false;
|
||||
|
||||
if($window.sessionStorage.getItem('hasClick')) {
|
||||
ret.hasClick = true;
|
||||
}
|
||||
|
||||
$window.addEventListener('mousedown', function() {
|
||||
ret.hasClick = true;
|
||||
$window.sessionStorage.setItem('hasClick', 'true');
|
||||
});
|
||||
|
||||
$window.addEventListener('touchstart', function() {
|
||||
ret.hasClick = false;
|
||||
$window.sessionStorage.removeItem('hasClick');
|
||||
});
|
||||
|
||||
return ret;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -915,7 +915,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
});
|
||||
};
|
||||
|
||||
root.publishAndSign = function(wallet, txp, cb) {
|
||||
root.publishAndSign = function(wallet, txp, cb, customStatusHandler) {
|
||||
|
||||
var publishFn = root.publishTx;
|
||||
|
||||
|
|
@ -929,14 +929,15 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
root.prepare(wallet, function(err, password) {
|
||||
if (err) return cb('Prepare error: ' + err);
|
||||
|
||||
ongoingProcess.set('sendingTx', true);
|
||||
ongoingProcess.set('sendingTx', true, customStatusHandler);
|
||||
|
||||
publishFn(wallet, txp, function(err, publishedTxp) {
|
||||
ongoingProcess.set('sendingTx', false);
|
||||
ongoingProcess.set('sendingTx', false, customStatusHandler);
|
||||
if (err) return cb('Send Error: ' + err);
|
||||
|
||||
ongoingProcess.set('signingTx', true);
|
||||
ongoingProcess.set('signingTx', true, customStatusHandler);
|
||||
root.signTx(wallet, publishedTxp, password, function(err, signedTxp) {
|
||||
ongoingProcess.set('signingTx', false);
|
||||
ongoingProcess.set('signingTx', false, customStatusHandler);
|
||||
root.invalidateCache(wallet);
|
||||
|
||||
|
||||
|
|
@ -952,22 +953,29 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
}
|
||||
|
||||
if (signedTxp.status == 'accepted') {
|
||||
ongoingProcess.set('broadcastingTx', true);
|
||||
ongoingProcess.set('broadcastingTx', true, customStatusHandler);
|
||||
root.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
|
||||
ongoingProcess.set('broadcastingTx', false);
|
||||
ongoingProcess.set('broadcastingTx', false, customStatusHandler);
|
||||
if (err) return cb('sign error' + err);
|
||||
|
||||
$rootScope.$emit('Local/TxAction', wallet.id);
|
||||
var type = root.getViewStatus(wallet, broadcastedTxp);
|
||||
root.openStatusModal(type, broadcastedTxp, function() {});
|
||||
|
||||
return cb(null, 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);
|
||||
root.openStatusModal(type, signedTxp, function() {});
|
||||
|
||||
if(!customStatusHandler) {
|
||||
root.openStatusModal(type, signedTxp, function() {});
|
||||
}
|
||||
|
||||
return cb(null, signedTxp);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue