remote ignoreMobilePause, refactor openURL
This commit is contained in:
parent
df12f9c177
commit
2a97446ef9
23 changed files with 356 additions and 337 deletions
|
|
@ -60,6 +60,7 @@ angular.module('copayApp.services').factory('animationService', function(platfor
|
|||
};
|
||||
|
||||
function cleanUpLater(e, e2) {
|
||||
console.log('[animationService.js.62:cleanUpLater:]'); //TODO
|
||||
var cleanedUp = false,
|
||||
timeoutID;
|
||||
var cleanUp = function() {
|
||||
|
|
|
|||
|
|
@ -111,11 +111,11 @@ angular.module('copayApp.services').factory('configService', function(storageSer
|
|||
|
||||
// Glidera
|
||||
// Disabled for testnet
|
||||
configCache.glidera.testnet = false;
|
||||
configCache.glidera.testnet = true;
|
||||
|
||||
// Coinbase
|
||||
// Disabled for testnet
|
||||
configCache.coinbase.testnet = false;
|
||||
configCache.coinbase.testnet = true;
|
||||
|
||||
$log.debug('Preferences read:', configCache)
|
||||
return cb(err, configCache);
|
||||
|
|
|
|||
|
|
@ -48,15 +48,15 @@ angular.module('copayApp.services').factory('go', function($window, $ionicSideMe
|
|||
};
|
||||
|
||||
root.addWallet = function() {
|
||||
$state.go('add');
|
||||
$state.transitionTo('add');
|
||||
};
|
||||
|
||||
root.preferences = function() {
|
||||
$state.go('preferences');
|
||||
$state.transitionTo('preferences');
|
||||
};
|
||||
|
||||
root.preferencesGlobal = function() {
|
||||
$state.go('preferencesGlobal');
|
||||
$state.transitionTo('preferencesGlobal');
|
||||
};
|
||||
|
||||
root.reload = function() {
|
||||
|
|
|
|||
69
src/js/services/openURL.js
Normal file
69
src/js/services/openURL.js
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('openURLService', function($ionicHistory, $document, $log, $state, go) {
|
||||
var root = {};
|
||||
|
||||
root.registeredUriHandlers = [{
|
||||
name: 'Bitcoin BIP21 URL',
|
||||
startsWith: 'bitcoin:',
|
||||
transitionTo: 'uripayment',
|
||||
}, {
|
||||
name: 'Glidera Authentication Callback',
|
||||
startsWith: 'copay://glidera',
|
||||
transitionTo: 'uriglidera',
|
||||
}, {
|
||||
name: 'Coinbase Authentication Callback',
|
||||
startsWith: 'copay://coinbase',
|
||||
transitionTo: 'uricoinbase',
|
||||
}];
|
||||
|
||||
|
||||
var handleOpenURL = function(args) {
|
||||
$log.info('Handling Open URL: ' + JSON.stringify(args));
|
||||
|
||||
// Stop it from caching the first view as one to return when the app opens
|
||||
$ionicHistory.nextViewOptions({
|
||||
historyRoot: true,
|
||||
disableBack: true,
|
||||
disableAnimation: true
|
||||
});
|
||||
|
||||
if (url) {
|
||||
window.cordova.removeDocumentEventHandler('handleopenurl');
|
||||
window.cordova.addStickyDocumentEventHandler('handleopenurl');
|
||||
document.removeEventListener('handleopenurl', root.handleOpenUrl);
|
||||
}
|
||||
|
||||
|
||||
var url = args.url;
|
||||
|
||||
lodash.each(root.registeredUriHandlers, function(x) {
|
||||
if (url.indexOf(x.startWith) == 0) {
|
||||
$log.debug('openURL GOT ' + x.name + ' URL');
|
||||
return $state.transitionTo(x.transitionTo, {
|
||||
url: url
|
||||
});
|
||||
}
|
||||
});
|
||||
$log.warn('Unknown URL! : ' + url);
|
||||
};
|
||||
|
||||
var handleResume = function() {
|
||||
$log.debug('Handle Resume @ openURL...');
|
||||
document.addEventListener('handleopenurl', handleOpenUrl, false);
|
||||
};
|
||||
|
||||
root.init = function() {
|
||||
console.log('[openURL.js.29]'); //TODO
|
||||
document.addEventListener('handleopenurl', handleOpenURL, false);
|
||||
document.addEventListener('resume', handleResume, false);
|
||||
};
|
||||
|
||||
|
||||
root.registerHandler = function(x) {
|
||||
$log.debug('Registering URL Handler: ' + x.name);
|
||||
root.registeredUriHandlers.push(x);
|
||||
};
|
||||
|
||||
return root;
|
||||
});
|
||||
|
|
@ -182,7 +182,6 @@ angular.module('copayApp.services')
|
|||
|
||||
push.on('notification', function(data) {
|
||||
if (!data.additionalData.foreground) {
|
||||
window.ignoreMobilePause = true;
|
||||
$log.debug('Push notification event: ', data.message);
|
||||
|
||||
$timeout(function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue