remote ignoreMobilePause, refactor openURL
This commit is contained in:
parent
df12f9c177
commit
2a97446ef9
23 changed files with 356 additions and 337 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content p20v row payment-uri" ng-controller="paymentUriController as payment">
|
<div class="content p20v row payment-uri" ng-controller="paymentUriController as payment">
|
||||||
<div class="large-12 columns" ng-init="payment.checkBitcoinUri()">
|
<div class="large-12 columns" ng-init="payment.init()">
|
||||||
<div class="panel text-center" ng-if="!payment.uri">
|
<div class="panel text-center" ng-if="!payment.uri">
|
||||||
<h1 translate>Bitcoin URI is NOT valid!</h1>
|
<h1 translate>Bitcoin URI is NOT valid!</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
||||||
function($scope, $modal, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, bwsError, addressService) {
|
function($scope, $modal, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, bwsError, addressService) {
|
||||||
|
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var fc;
|
var fc;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,6 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
||||||
this.error = null;
|
this.error = null;
|
||||||
this.success = null;
|
this.success = null;
|
||||||
this.loading = null;
|
this.loading = null;
|
||||||
|
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
|
|
||||||
var otherWallets = function(testnet) {
|
var otherWallets = function(testnet) {
|
||||||
var network = testnet ? 'testnet' : 'livenet';
|
var network = testnet ? 'testnet' : 'livenet';
|
||||||
return lodash.filter(profileService.getWallets(network), function(w) {
|
return lodash.filter(profileService.getWallets(network), function(w) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ angular.module('copayApp.controllers').controller('coinbaseController',
|
||||||
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, coinbaseService, lodash, platformInfo) {
|
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, coinbaseService, lodash, platformInfo) {
|
||||||
|
|
||||||
var isNW = platformInfo.isNW;
|
var isNW = platformInfo.isNW;
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
|
|
||||||
this.openAuthenticateWindow = function() {
|
this.openAuthenticateWindow = function() {
|
||||||
var oauthUrl = this.getAuthenticateUrl();
|
var oauthUrl = this.getAuthenticateUrl();
|
||||||
|
|
|
||||||
|
|
@ -92,9 +92,6 @@ angular.module('copayApp.controllers').controller('copayersController',
|
||||||
|
|
||||||
self.shareSecret = function(secret) {
|
self.shareSecret = function(secret) {
|
||||||
if (isCordova) {
|
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', {
|
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
|
secret: secret
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -126,9 +126,6 @@ angular.module('copayApp.controllers').controller('exportController',
|
||||||
|
|
||||||
self.sendWalletBackup = function() {
|
self.sendWalletBackup = function() {
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
if (isAndroid || isWP) {
|
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
}
|
|
||||||
window.plugins.toast.showShortCenter(gettextCatalog.getString('Preparing backup...'));
|
window.plugins.toast.showShortCenter(gettextCatalog.getString('Preparing backup...'));
|
||||||
var name = (fc.credentials.walletName || fc.credentials.walletId);
|
var name = (fc.credentials.walletName || fc.credentials.walletId);
|
||||||
if (fc.alias) {
|
if (fc.alias) {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ angular.module('copayApp.controllers').controller('glideraUriController',
|
||||||
function($scope, $stateParams, $timeout, profileService, configService, glideraService, storageService, go) {
|
function($scope, $stateParams, $timeout, profileService, configService, glideraService, storageService, go) {
|
||||||
|
|
||||||
this.submitOauthCode = function(code) {
|
this.submitOauthCode = function(code) {
|
||||||
|
console.log('[glideraUri.js.5:code:]'+code); //TODO
|
||||||
var self = this;
|
var self = this;
|
||||||
var glideraTestnet = configService.getSync().glidera.testnet;
|
var glideraTestnet = configService.getSync().glidera.testnet;
|
||||||
var network = glideraTestnet ? 'testnet' : 'livenet';
|
var network = glideraTestnet ? 'testnet' : 'livenet';
|
||||||
|
|
@ -31,6 +32,7 @@ angular.module('copayApp.controllers').controller('glideraUriController',
|
||||||
};
|
};
|
||||||
|
|
||||||
this.checkCode = function() {
|
this.checkCode = function() {
|
||||||
|
console.log('[glideraUri.js.35:$stateParams:]' + JSON.stringify($stateParams)); //TODO
|
||||||
this.code = $stateParams.code;
|
this.code = $stateParams.code;
|
||||||
this.submitOauthCode(this.code);
|
this.submitOauthCode(this.code);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,6 @@ angular.module('copayApp.controllers').controller('importController',
|
||||||
$scope.account = 1;
|
$scope.account = 1;
|
||||||
self.importErr = false;
|
self.importErr = false;
|
||||||
|
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
$scope.$on('$destroy', function() {
|
|
||||||
$timeout(function() {
|
|
||||||
window.ignoreMobilePause = false;
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
var updateSeedSourceSelect = function() {
|
var updateSeedSourceSelect = function() {
|
||||||
self.seedOptions = [];
|
self.seedOptions = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'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 self = this;
|
||||||
var SOFT_CONFIRMATION_LIMIT = 12;
|
var SOFT_CONFIRMATION_LIMIT = 12;
|
||||||
var errors = bwcService.getErrors();
|
var errors = bwcService.getErrors();
|
||||||
|
|
@ -289,6 +289,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
initStatusHash = _walletStatusHash();
|
initStatusHash = _walletStatusHash();
|
||||||
$log.debug('Updating status until it changes. initStatusHash:' + initStatusHash)
|
$log.debug('Updating status until it changes. initStatusHash:' + initStatusHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
var get = function(cb) {
|
var get = function(cb) {
|
||||||
if (opts.walletStatus)
|
if (opts.walletStatus)
|
||||||
return cb(null, opts.walletStatus);
|
return cb(null, opts.walletStatus);
|
||||||
|
|
@ -351,6 +352,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.setPendingTxps(walletStatus.pendingTxps);
|
self.setPendingTxps(walletStatus.pendingTxps);
|
||||||
|
|
||||||
// Status Shortcuts
|
// Status Shortcuts
|
||||||
|
self.lastUpdate = Date.now();
|
||||||
self.walletName = walletStatus.wallet.name;
|
self.walletName = walletStatus.wallet.name;
|
||||||
self.walletSecret = walletStatus.wallet.secret;
|
self.walletSecret = walletStatus.wallet.secret;
|
||||||
self.walletStatus = walletStatus.wallet.status;
|
self.walletStatus = walletStatus.wallet.status;
|
||||||
|
|
@ -1492,14 +1494,16 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
self.debouncedUpdate = lodash.throttle(function() {
|
self.debouncedUpdate = function() {
|
||||||
|
var now = Date.now();
|
||||||
|
var oneHr = 1000 * 60 * 60;
|
||||||
|
|
||||||
|
if (!self.lastUpdate || (now - self.lastUpdate) > oneHr) {
|
||||||
self.updateAll({
|
self.updateAll({
|
||||||
quiet: true
|
quiet: true
|
||||||
|
triggerTxUpdate: true,
|
||||||
});
|
});
|
||||||
self.debounceUpdateHistory();
|
}
|
||||||
}, 2000, {
|
|
||||||
leading: false,
|
|
||||||
trailing: true
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('Local/Resume', function(event) {
|
$rootScope.$on('Local/Resume', function(event) {
|
||||||
|
|
@ -1791,5 +1795,5 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
|
|
||||||
|
|
||||||
/* Start setup */
|
/* Start setup */
|
||||||
lodash.assign(self, vanillaScope);
|
lodash.assign(self, vanillaScope); openURLService.init();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -69,9 +69,6 @@ angular.module('copayApp.controllers').controller('customAmountController', func
|
||||||
|
|
||||||
$scope.shareAddress = function(uri) {
|
$scope.shareAddress = function(uri) {
|
||||||
if (platformInfo.isCordova) {
|
if (platformInfo.isCordova) {
|
||||||
if (platformInfo.isAndroid || platformInfo.isWP) {
|
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
}
|
|
||||||
window.plugins.socialsharing.share(uri, null, null, null);
|
window.plugins.socialsharing.share(uri, null, null, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,14 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
angular.module('copayApp.controllers').controller('paymentUriController',
|
angular.module('copayApp.controllers').controller('paymentUriController',
|
||||||
function($rootScope, $stateParams, $location, $timeout, profileService, configService, lodash, bitcore, go) {
|
function($rootScope, $stateParams, $location, $timeout, profileService, configService, lodash, bitcore, go) {
|
||||||
|
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
function strip(number) {
|
function strip(number) {
|
||||||
return (parseFloat(number.toPrecision(12)));
|
return (parseFloat(number.toPrecision(12)));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Build bitcoinURI with querystring
|
// Build bitcoinURI with querystring
|
||||||
this.checkBitcoinUri = function() {
|
this.init = function() {
|
||||||
var query = [];
|
var query = [];
|
||||||
angular.forEach($location.search(), function(value, key) {
|
this.bitcoinURI = $stateParams.url;
|
||||||
query.push(key + "=" + value);
|
|
||||||
});
|
|
||||||
var queryString = query ? query.join("&") : null;
|
|
||||||
this.bitcoinURI = $stateParams.data + (queryString ? '?' + queryString : '');
|
|
||||||
|
|
||||||
var URI = bitcore.URI;
|
var URI = bitcore.URI;
|
||||||
var isUriValid = URI.isValid(this.bitcoinURI);
|
var isUriValid = URI.isValid(this.bitcoinURI);
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,6 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
|
||||||
this.sendAddrs = function() {
|
this.sendAddrs = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (platformInfo.isAndroid || platformInfo.isWP) {
|
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.loading = true;
|
self.loading = true;
|
||||||
|
|
||||||
function formatDate(ts) {
|
function formatDate(ts) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
||||||
function($rootScope, $scope, $modal, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, bwsError, configService, walletService, fingerprintService) {
|
function($rootScope, $scope, $modal, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, bwsError, configService, walletService, fingerprintService) {
|
||||||
|
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var fc;
|
var fc;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
||||||
this.loading = null;
|
this.loading = null;
|
||||||
var fc;
|
var fc;
|
||||||
|
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
|
|
||||||
var otherWallets = function(testnet) {
|
var otherWallets = function(testnet) {
|
||||||
var network = testnet ? 'testnet' : 'livenet';
|
var network = testnet ? 'testnet' : 'livenet';
|
||||||
return lodash.filter(profileService.getWallets(network), function(w) {
|
return lodash.filter(profileService.getWallets(network), function(w) {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
var isChromeApp = platformInfo.isChromeApp;
|
var isChromeApp = platformInfo.isChromeApp;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
window.ignoreMobilePause = false;
|
|
||||||
$rootScope.shouldHideMenuBar = false;
|
$rootScope.shouldHideMenuBar = false;
|
||||||
$rootScope.wpInputFocused = false;
|
$rootScope.wpInputFocused = false;
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
|
|
@ -217,9 +216,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
|
|
||||||
this.shareAddress = function(addr) {
|
this.shareAddress = function(addr) {
|
||||||
if (isCordova) {
|
if (isCordova) {
|
||||||
if (isAndroid || isWP) {
|
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
}
|
|
||||||
window.plugins.socialsharing.share('bitcoin:' + addr, null, null, null);
|
window.plugins.socialsharing.share('bitcoin:' + addr, null, null, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ angular.module('copayApp.directives')
|
||||||
var onSuccess = function(result) {
|
var onSuccess = function(result) {
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
window.plugins.spinnerDialog.hide();
|
window.plugins.spinnerDialog.hide();
|
||||||
window.ignoreMobilePause = false;
|
|
||||||
}, 100);
|
}, 100);
|
||||||
if (isWP && result.cancelled) return;
|
if (isWP && result.cancelled) return;
|
||||||
|
|
||||||
|
|
@ -26,13 +25,11 @@ angular.module('copayApp.directives')
|
||||||
|
|
||||||
var onError = function(error) {
|
var onError = function(error) {
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
window.ignoreMobilePause = false;
|
|
||||||
window.plugins.spinnerDialog.hide();
|
window.plugins.spinnerDialog.hide();
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.cordovaOpenScanner = function() {
|
$scope.cordovaOpenScanner = function() {
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Preparing camera...'), true);
|
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Preparing camera...'), true);
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
if (isIOS) {
|
if (isIOS) {
|
||||||
|
|
|
||||||
|
|
@ -7,42 +7,32 @@ angular.element(document).ready(function() {
|
||||||
angular.bootstrap(document, ['copayApp']);
|
angular.bootstrap(document, ['copayApp']);
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleBitcoinURI = function(url) {
|
|
||||||
if (!url) return;
|
|
||||||
console.log('Custom URL:' + url); //TODO
|
|
||||||
|
|
||||||
var glidera = 'copay://glidera';
|
function handleOpenURL(url) {
|
||||||
var coinbase = 'copay://coinbase';
|
if ('cordova' in window) {
|
||||||
|
console.log('DEEP LINK:' + url);
|
||||||
if (url.indexOf('bitcoin:') == 0) {
|
cordova.fireDocumentEvent('handleopenurl', {
|
||||||
url = '#/uri-payment/' + url;
|
url: url
|
||||||
} else if (url.indexOf(glidera) != -1) {
|
});
|
||||||
url = '#/uri-glidera' + url.replace(glidera, '');
|
|
||||||
} else if (url.indexOf(coinbase) != -1) {
|
|
||||||
url = '#/uri-coinbase' + url.replace(coinbase, '');
|
|
||||||
} else {
|
} else {
|
||||||
console.log('Unknown URL!')
|
console.log("ERROR: Cannont handle open URL in non-cordova apps")
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
window.location = url;
|
|
||||||
}, 1000);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Cordova specific Init */
|
/* Cordova specific Init */
|
||||||
if (window.cordova !== undefined) {
|
if ('cordova' in window) {
|
||||||
|
|
||||||
|
window.handleOpenURL = handleOpenURL;
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('deviceready', function() {
|
document.addEventListener('deviceready', function() {
|
||||||
window.handleOpenURL = handleBitcoinURI;
|
|
||||||
|
// Create a sticky event for handling the app being opened via a custom URL
|
||||||
|
cordova.addStickyDocumentEventHandler('handleopenurl');
|
||||||
startAngular();
|
startAngular();
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
|
||||||
window.handleOpenURL = handleBitcoinURI;
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
startAngular();
|
startAngular();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('payment', {
|
.state('uripayment', {
|
||||||
url: '/uri-payment/:data',
|
url: '/uri-payment/:url',
|
||||||
templateUrl: 'views/paymentUri.html',
|
templateUrl: 'views/paymentUri.html',
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
|
|
@ -215,7 +215,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('uriglidera', {
|
.state('uriglidera', {
|
||||||
url: '/uri-glidera?code',
|
url: '/uri-glidera/:code',
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
|
|
@ -284,7 +284,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('uricoinbase', {
|
.state('uricoinbase', {
|
||||||
url: '/uri-coinbase?code',
|
url: '/uri-coinbase/:code',
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
|
|
@ -520,7 +520,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.run(function($rootScope, $state, $log, $timeout, $ionicPlatform, uriHandler, platformInfo, profileService, uxLanguage, animationService, go, gettextCatalog) {
|
.run(function($rootScope, $state, $location, $log, $timeout, $ionicPlatform, uriHandler, platformInfo, profileService, uxLanguage, animationService, go, gettextCatalog) {
|
||||||
|
|
||||||
$ionicPlatform.ready(function() {
|
$ionicPlatform.ready(function() {
|
||||||
if (platformInfo.isCordova) {
|
if (platformInfo.isCordova) {
|
||||||
|
|
@ -539,14 +539,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
});
|
});
|
||||||
|
|
||||||
$ionicPlatform.on('resume', function() {
|
$ionicPlatform.on('resume', function() {
|
||||||
if (!window.ignoreMobilePause) {
|
// Nothing to do
|
||||||
$rootScope.$emit('Local/Resume');
|
$rootScope.$emit('Local/Resume');
|
||||||
}
|
|
||||||
setTimeout(function() {
|
|
||||||
var loc = window.location;
|
|
||||||
var ignoreMobilePause = loc.toString().match(/(buy|sell|buycoinbase|sellcoinbase)/) ? true : false;
|
|
||||||
window.ignoreMobilePause = ignoreMobilePause;
|
|
||||||
}, 100);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$ionicPlatform.on('backbutton', function(event) {
|
$ionicPlatform.on('backbutton', function(event) {
|
||||||
|
|
@ -575,10 +569,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
go.walletHome();
|
go.walletHome();
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
window.ignoreMobilePause = false;
|
|
||||||
}, 100);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$ionicPlatform.on('menubutton', function() {
|
$ionicPlatform.on('menubutton', function() {
|
||||||
|
|
@ -614,6 +604,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
|
|
||||||
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
|
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
|
||||||
$log.debug('Route change from:', fromState.name || '-', ' to:', toState.name);
|
$log.debug('Route change from:', fromState.name || '-', ' to:', toState.name);
|
||||||
|
$log.debug(' toParams:' + JSON.stringify(toParams || {}));
|
||||||
|
$log.debug(' fromParams:' + JSON.stringify(fromParams || {}));
|
||||||
|
|
||||||
if (!profileService.profile && toState.needProfile) {
|
if (!profileService.profile && toState.needProfile) {
|
||||||
|
|
||||||
|
|
@ -640,17 +632,22 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
} else {
|
} else {
|
||||||
if (profileService.focusedClient && !profileService.focusedClient.isComplete() && toState.walletShouldBeComplete) {
|
if (profileService.focusedClient && !profileService.focusedClient.isComplete() && toState.walletShouldBeComplete) {
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
$state.transitionTo('copayers');
|
$state.transitionTo('copayers');
|
||||||
event.preventDefault();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// event.preventDefault();
|
||||||
if (!animationService.transitionAnimated(fromState, toState)) {
|
// $state.transitionTo(toState);
|
||||||
event.preventDefault();
|
// if (!animationService.transitionAnimated(fromState, toState)) {
|
||||||
// Time for the backpane to render
|
//
|
||||||
setTimeout(function() {
|
// console.log('[routes.js.649] ANIMATION!'); //TODO
|
||||||
$state.transitionTo(toState);
|
// event.preventDefault();
|
||||||
}, 50);
|
// // Time for the backpane to render
|
||||||
}
|
// return setTimeout(function() {
|
||||||
|
//
|
||||||
|
// console.log('[routes.js.654] TRANSITION'); //TODO
|
||||||
|
// $state.transitionTo(toState);
|
||||||
|
// }, 50);
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ angular.module('copayApp.services').factory('animationService', function(platfor
|
||||||
};
|
};
|
||||||
|
|
||||||
function cleanUpLater(e, e2) {
|
function cleanUpLater(e, e2) {
|
||||||
|
console.log('[animationService.js.62:cleanUpLater:]'); //TODO
|
||||||
var cleanedUp = false,
|
var cleanedUp = false,
|
||||||
timeoutID;
|
timeoutID;
|
||||||
var cleanUp = function() {
|
var cleanUp = function() {
|
||||||
|
|
|
||||||
|
|
@ -111,11 +111,11 @@ angular.module('copayApp.services').factory('configService', function(storageSer
|
||||||
|
|
||||||
// Glidera
|
// Glidera
|
||||||
// Disabled for testnet
|
// Disabled for testnet
|
||||||
configCache.glidera.testnet = false;
|
configCache.glidera.testnet = true;
|
||||||
|
|
||||||
// Coinbase
|
// Coinbase
|
||||||
// Disabled for testnet
|
// Disabled for testnet
|
||||||
configCache.coinbase.testnet = false;
|
configCache.coinbase.testnet = true;
|
||||||
|
|
||||||
$log.debug('Preferences read:', configCache)
|
$log.debug('Preferences read:', configCache)
|
||||||
return cb(err, configCache);
|
return cb(err, configCache);
|
||||||
|
|
|
||||||
|
|
@ -48,15 +48,15 @@ angular.module('copayApp.services').factory('go', function($window, $ionicSideMe
|
||||||
};
|
};
|
||||||
|
|
||||||
root.addWallet = function() {
|
root.addWallet = function() {
|
||||||
$state.go('add');
|
$state.transitionTo('add');
|
||||||
};
|
};
|
||||||
|
|
||||||
root.preferences = function() {
|
root.preferences = function() {
|
||||||
$state.go('preferences');
|
$state.transitionTo('preferences');
|
||||||
};
|
};
|
||||||
|
|
||||||
root.preferencesGlobal = function() {
|
root.preferencesGlobal = function() {
|
||||||
$state.go('preferencesGlobal');
|
$state.transitionTo('preferencesGlobal');
|
||||||
};
|
};
|
||||||
|
|
||||||
root.reload = function() {
|
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) {
|
push.on('notification', function(data) {
|
||||||
if (!data.additionalData.foreground) {
|
if (!data.additionalData.foreground) {
|
||||||
window.ignoreMobilePause = true;
|
|
||||||
$log.debug('Push notification event: ', data.message);
|
$log.debug('Push notification event: ', data.message);
|
||||||
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue