rm all services
This commit is contained in:
parent
cfafb9a92c
commit
36cf4f0560
6 changed files with 42 additions and 46 deletions
|
|
@ -1,5 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
angular.module('copayApp.services').factory('isChromeApp', function(nodeWebkit) {
|
|
||||||
return !!(window.chrome && chrome.runtime && chrome.runtime.id && !nodeWebkit.isDefined());
|
|
||||||
});
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
angular.module('copayApp.services').value('isCordova', window.cordova ? true : false);
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
angular.module('copayApp.services').factory('isDevel', function(nodeWebkit, isChromeApp, isMobile) {
|
|
||||||
return !isMobile.any() && !isChromeApp && !nodeWebkit.isDefined();
|
|
||||||
});
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// Detect mobile devices
|
|
||||||
var isMobile = {
|
|
||||||
Android: function() {
|
|
||||||
return !!navigator.userAgent.match(/Android/i);
|
|
||||||
},
|
|
||||||
BlackBerry: function() {
|
|
||||||
return !!navigator.userAgent.match(/BlackBerry/i);
|
|
||||||
},
|
|
||||||
iOS: function() {
|
|
||||||
return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
|
||||||
},
|
|
||||||
Opera: function() {
|
|
||||||
return !!navigator.userAgent.match(/Opera Mini/i);
|
|
||||||
},
|
|
||||||
Windows: function() {
|
|
||||||
return !!navigator.userAgent.match(/IEMobile/i);
|
|
||||||
},
|
|
||||||
Safari: function() {
|
|
||||||
return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
|
|
||||||
},
|
|
||||||
any: function() {
|
|
||||||
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
angular.module('copayApp.services').value('isMobile', isMobile);
|
|
||||||
|
|
@ -14,10 +14,6 @@ angular.module('copayApp.services').factory('nodeWebkit', function nodeWebkitFac
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
root.isDefined = function() {
|
|
||||||
return isNodeWebkit();
|
|
||||||
};
|
|
||||||
|
|
||||||
root.readFromClipboard = function() {
|
root.readFromClipboard = function() {
|
||||||
if (!isNodeWebkit()) return;
|
if (!isNodeWebkit()) return;
|
||||||
var gui = require('nw.gui');
|
var gui = require('nw.gui');
|
||||||
|
|
|
||||||
42
src/js/services/platformInfo.js
Normal file
42
src/js/services/platformInfo.js
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.services').factory('platformInfo', function( $navigator, $window) {
|
||||||
|
|
||||||
|
var ua= $navigator.userAgent;
|
||||||
|
|
||||||
|
var isNodeWebkit = function() {
|
||||||
|
var isNode = (typeof process !== "undefined" && typeof require !== "undefined");
|
||||||
|
if(isNode) {
|
||||||
|
try {
|
||||||
|
return (typeof require('nw.gui') !== "undefined");
|
||||||
|
} catch(e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Detect mobile devices
|
||||||
|
var ret = {
|
||||||
|
isAndroid: function() {
|
||||||
|
return !!ua.match(/Android/i);
|
||||||
|
},
|
||||||
|
isIOS: function() {
|
||||||
|
return /iPad|iPhone|iPod/.test(ua) && !$window.MSStream;
|
||||||
|
},
|
||||||
|
isWP: function() {
|
||||||
|
return !!ua.match(/IEMobile/i);
|
||||||
|
},
|
||||||
|
Safari: function() {
|
||||||
|
return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue