[Mobile] AgentService
Replaced name queryService with agentService.
This commit is contained in:
@@ -10,8 +10,8 @@
|
||||
"depends": [ "$location" ]
|
||||
},
|
||||
{
|
||||
"key": "queryService",
|
||||
"implementation": "/services/QueryService.js",
|
||||
"key": "agentService",
|
||||
"implementation": "/services/AgentService.js",
|
||||
"depends": [ "$window" ]
|
||||
}
|
||||
],
|
||||
@@ -65,7 +65,7 @@
|
||||
{
|
||||
"key": "TreeNodeController",
|
||||
"implementation": "controllers/TreeNodeController.js",
|
||||
"depends": [ "$scope", "$timeout", "queryService" ]
|
||||
"depends": [ "$scope", "$timeout", "agentService" ]
|
||||
},
|
||||
{
|
||||
"key": "ActionGroupController",
|
||||
|
||||
@@ -50,7 +50,7 @@ define(
|
||||
* expand-to-show-navigated-object behavior.)
|
||||
* @constructor
|
||||
*/
|
||||
function TreeNodeController($scope, $timeout, queryService) {
|
||||
function TreeNodeController($scope, $timeout, agentService) {
|
||||
var selectedObject = ($scope.ngModel || {}).selectedObject,
|
||||
isSelected = false,
|
||||
hasBeenExpanded = false;
|
||||
@@ -88,7 +88,7 @@ define(
|
||||
}
|
||||
|
||||
function checkMobile() {
|
||||
return queryService.isMobile(navigator.userAgent);
|
||||
return agentService.isMobile(navigator.userAgent);
|
||||
}
|
||||
|
||||
// Consider the currently-navigated object and update
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/*global define,Promise*/
|
||||
|
||||
/**
|
||||
* Module defining QueryService.
|
||||
* Module defining AgentService.
|
||||
*/
|
||||
|
||||
define(
|
||||
@@ -35,7 +35,7 @@ define(
|
||||
* info using a comparison between the userAgent and key
|
||||
* device names
|
||||
*/
|
||||
function QueryService($window) {
|
||||
function AgentService($window) {
|
||||
|
||||
// Gets the UA name if it is one of the following.
|
||||
// If it is not (a desktop for example) nothing is
|
||||
@@ -97,6 +97,6 @@ define(
|
||||
};
|
||||
}
|
||||
|
||||
return QueryService;
|
||||
return AgentService;
|
||||
}
|
||||
);
|
||||
@@ -29,7 +29,7 @@ define(
|
||||
describe("The tree node controller", function () {
|
||||
var mockScope,
|
||||
mockTimeout,
|
||||
mockQueryService,
|
||||
mockAgentService,
|
||||
controller;
|
||||
|
||||
function TestObject(id, context) {
|
||||
@@ -44,8 +44,8 @@ define(
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj("$scope", ["$watch", "$on"]);
|
||||
mockTimeout = jasmine.createSpy("$timeout");
|
||||
mockQueryService = jasmine.createSpyObj("queryService", ["isMobile"]);
|
||||
controller = new TreeNodeController(mockScope, mockTimeout, mockQueryService);
|
||||
mockAgentService = jasmine.createSpyObj("agentService", ["isMobile"]);
|
||||
controller = new TreeNodeController(mockScope, mockTimeout, mockAgentService);
|
||||
});
|
||||
|
||||
it("allows tracking of expansion state", function () {
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
|
||||
*/
|
||||
define(
|
||||
["../../src/services/QueryService"],
|
||||
function (QueryService) {
|
||||
["../../src/services/AgentService"],
|
||||
function (AgentService) {
|
||||
"use strict";
|
||||
|
||||
describe("The url service", function () {
|
||||
var queryService,
|
||||
var agentService,
|
||||
mockWindow,
|
||||
mockNavigator;
|
||||
|
||||
@@ -47,24 +47,24 @@ define(
|
||||
[ "userAgent" ]
|
||||
);
|
||||
|
||||
queryService = new QueryService(mockWindow);
|
||||
agentService = new AgentService(mockWindow);
|
||||
});
|
||||
|
||||
it("get current device user agent", function () {
|
||||
mockNavigator.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36";
|
||||
queryService.isMobile(mockNavigator.userAgent);
|
||||
agentService.isMobile(mockNavigator.userAgent);
|
||||
mockNavigator.userAgent = "Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53";
|
||||
queryService.isMobile(mockNavigator.userAgent);
|
||||
agentService.isMobile(mockNavigator.userAgent);
|
||||
});
|
||||
|
||||
it("get orientation of the current device", function () {
|
||||
mockWindow.outerWidth = 768;
|
||||
mockWindow.outerHeight = 1024;
|
||||
queryService.getOrientation();
|
||||
agentService.getOrientation();
|
||||
|
||||
mockWindow.outerWidth = 1024;
|
||||
mockWindow.outerHeight = 768;
|
||||
queryService.getOrientation();
|
||||
agentService.getOrientation();
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
"directives/MCTDrag",
|
||||
"directives/MCTResize",
|
||||
"directives/MCTScroll",
|
||||
"services/QueryService",
|
||||
"services/AgentService",
|
||||
"services/UrlService",
|
||||
"StyleSheetLoader"
|
||||
]
|
||||
@@ -24,7 +24,7 @@
|
||||
"implementation": "gestures/InfoGesture.js",
|
||||
"depends": [
|
||||
"$timeout",
|
||||
"queryService",
|
||||
"agentService",
|
||||
"infoService",
|
||||
"INFO_HOVER_DELAY"
|
||||
]
|
||||
@@ -34,7 +34,7 @@
|
||||
"implementation": "gestures/InfoButtonGesture.js",
|
||||
"depends": [
|
||||
"$document",
|
||||
"queryService",
|
||||
"agentService",
|
||||
"infoService"
|
||||
]
|
||||
}
|
||||
@@ -48,7 +48,7 @@
|
||||
"$document",
|
||||
"$window",
|
||||
"$rootScope",
|
||||
"queryService"
|
||||
"agentService"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -37,7 +37,7 @@ define(
|
||||
* @param {DomainObject} domainObject the domain object for which to
|
||||
* show information
|
||||
*/
|
||||
function InfoGestureButton($document, queryService, infoService, element, domainObject) {
|
||||
function InfoGestureButton($document, agentService, infoService, element, domainObject) {
|
||||
var dismissBubble,
|
||||
pendingBubble,
|
||||
touchPosition,
|
||||
@@ -82,10 +82,10 @@ define(
|
||||
}
|
||||
|
||||
// Checks if you are on a mobile device, if the device is
|
||||
// mobile (queryService.isMobile() = true), then
|
||||
// mobile (agentService.isMobile() = true), then
|
||||
// the a click on something (info button) brings up
|
||||
// the bubble
|
||||
if (queryService.isMobile(navigator.userAgent)) {
|
||||
if (agentService.isMobile(navigator.userAgent)) {
|
||||
element.on('click', showBubble);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ define(
|
||||
* @param {DomainObject} domainObject the domain object for which to
|
||||
* show information
|
||||
*/
|
||||
function InfoGesture($timeout, queryService, infoService, DELAY, element, domainObject) {
|
||||
function InfoGesture($timeout, agentService, infoService, DELAY, element, domainObject) {
|
||||
var dismissBubble,
|
||||
pendingBubble,
|
||||
mousePosition,
|
||||
@@ -93,9 +93,9 @@ define(
|
||||
}
|
||||
|
||||
// Checks if you are on a mobile device, if the device is
|
||||
// not mobile (queryService.isMobile() = false), then
|
||||
// not mobile (agentService.isMobile() = false), then
|
||||
// the pendingBubble and therefore hovering is allowed
|
||||
if (!queryService.isMobile(navigator.userAgent)) {
|
||||
if (!agentService.isMobile(navigator.userAgent)) {
|
||||
// Show bubble (on a timeout) on mouse over
|
||||
element.on('mouseenter', showBubble);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ define(
|
||||
* Displays informative content ("info bubbles") for the user.
|
||||
* @constructor
|
||||
*/
|
||||
function InfoService($compile, $document, $window, $rootScope, queryService) {
|
||||
function InfoService($compile, $document, $window, $rootScope, agentService) {
|
||||
|
||||
function display(templateKey, title, content, position) {
|
||||
var body = $document.find('body'),
|
||||
@@ -61,7 +61,7 @@ define(
|
||||
// info bubble positioned as normal (with triangle pointing
|
||||
// to where clicked or pressed)
|
||||
bubble.css('position', 'absolute');
|
||||
if(queryService.isPhone(navigator.userAgent)) {
|
||||
if(agentService.isPhone(navigator.userAgent)) {
|
||||
bubble.css('right', 5 + 'px');
|
||||
bubble.css('left', 5 + 'px');
|
||||
bubble.css('top', 40 + 'px');
|
||||
|
||||
@@ -28,7 +28,7 @@ define(
|
||||
|
||||
describe("The info gesture", function () {
|
||||
var mockTimeout,
|
||||
mockQueryService,
|
||||
mockAgentService,
|
||||
mockInfoService,
|
||||
testDelay = 12321,
|
||||
mockElement,
|
||||
@@ -51,7 +51,7 @@ define(
|
||||
beforeEach(function () {
|
||||
mockTimeout = jasmine.createSpy('$timeout');
|
||||
mockTimeout.cancel = jasmine.createSpy('cancel');
|
||||
mockQueryService = jasmine.createSpyObj('queryService', ['isMobile']);
|
||||
mockAgentService = jasmine.createSpyObj('agentService', ['isMobile']);
|
||||
mockInfoService = jasmine.createSpyObj(
|
||||
'infoService',
|
||||
[ 'display' ]
|
||||
@@ -81,7 +81,7 @@ define(
|
||||
|
||||
gesture = new InfoGesture(
|
||||
mockTimeout,
|
||||
mockQueryService,
|
||||
mockAgentService,
|
||||
mockInfoService,
|
||||
testDelay,
|
||||
mockElement,
|
||||
|
||||
Reference in New Issue
Block a user