2014-06-19 11:07:20 -07:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Detect mobile devices
|
|
|
|
var isMobile = {
|
|
|
|
Android: function() {
|
2014-06-24 08:36:32 -07:00
|
|
|
return !!navigator.userAgent.match(/Android/i);
|
2014-06-19 11:07:20 -07:00
|
|
|
},
|
|
|
|
BlackBerry: function() {
|
2014-06-24 08:36:32 -07:00
|
|
|
return !!navigator.userAgent.match(/BlackBerry/i);
|
2014-06-19 11:07:20 -07:00
|
|
|
},
|
|
|
|
iOS: function() {
|
2014-06-24 08:36:32 -07:00
|
|
|
return !!navigator.userAgent.match(/iPhone|iPad|iPod/i);
|
2014-06-19 11:07:20 -07:00
|
|
|
},
|
|
|
|
Opera: function() {
|
2014-06-24 08:36:32 -07:00
|
|
|
return !!navigator.userAgent.match(/Opera Mini/i);
|
2014-06-19 11:07:20 -07:00
|
|
|
},
|
|
|
|
Windows: function() {
|
2014-06-24 08:36:32 -07:00
|
|
|
return !!navigator.userAgent.match(/IEMobile/i);
|
2014-06-19 11:07:20 -07:00
|
|
|
},
|
|
|
|
any: function() {
|
|
|
|
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
angular.module('copayApp.services').value('isMobile', isMobile);
|