migration to platformInfo WIP
Conflicts: src/js/controllers/buyGlidera.js src/js/controllers/walletHome.js src/js/services/localStorage.js
This commit is contained in:
parent
36cf4f0560
commit
dd1981a26c
23 changed files with 108 additions and 66 deletions
|
|
@ -1,15 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('platformInfo', function( $navigator, $window) {
|
||||
angular.module('copayApp.services').factory('platformInfo', function($window) {
|
||||
|
||||
var ua= $navigator.userAgent;
|
||||
var ua = navigator ? navigator.userAgent : null;
|
||||
|
||||
if (!ua) {
|
||||
console.log('Could not determine navigator. Using a random string');
|
||||
ua = Math.floor(Math.random() * 100000);
|
||||
}
|
||||
|
||||
var isNodeWebkit = function() {
|
||||
var isNode = (typeof process !== "undefined" && typeof require !== "undefined");
|
||||
if(isNode) {
|
||||
if (isNode) {
|
||||
try {
|
||||
return (typeof require('nw.gui') !== "undefined");
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -27,16 +32,17 @@ angular.module('copayApp.services').factory('platformInfo', function( $navigator
|
|||
isWP: function() {
|
||||
return !!ua.match(/IEMobile/i);
|
||||
},
|
||||
Safari: function() {
|
||||
isSafari: function() {
|
||||
return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
|
||||
}
|
||||
};
|
||||
|
||||
ret.ua = ua;
|
||||
ret.isMobile = ret.isAndroid() || ret.isIOS() || ret.isWP();
|
||||
ret.isChromeApp = !!($window.chrome && chrome.runtime && chrome.runtime.id && !nodeWebkit.isDefined());
|
||||
ret.isCordova = !!$window.cordova;
|
||||
ret.isNW = isNodeWebkit();
|
||||
ret.isDevel =!ret.isMobile() && !ret.isChromeApp && !ret.isNW();
|
||||
ret.isChromeApp = $window.chrome && chrome.runtime && chrome.runtime.id && !ret.isNW;
|
||||
ret.isDevel = !ret.isMobile && !ret.isChromeApp && !ret.isNW;
|
||||
|
||||
return ret;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue