"use strict"; (function () { 'use strict'; angular.module('myitsmApp') .service('mobileClientCheckerService', ['$location', 'localStorageService', 'systemAlertService', '$filter', function ($location, localStorageService, systemAlertService, $filter) { this.checkForMobileDevice = function () { if (!!navigator.userAgent.match(/iPhone|iPad|iPod|Android/i)) { var mobileUrl = 'smart-it://' + $location.path().substr(1); if (localStorageService.get('launchFromNative')) { window.location = mobileUrl; } if (!localStorageService.get('userHasPickedlaunchFrom')) { var modalInstance = systemAlertService.modal({ title: $filter('i18n')('common.notification.mobile.title'), text: $filter('i18n')('common.notification.mobile.message'), buttons: [ { text: $filter('i18n')('common.labels.yes'), data: true }, { text: $filter('i18n')('common.labels.no'), data: false } ] }); modalInstance.result.then(function (data) { localStorageService.set('launchFromNative', data); data && (window.location = mobileUrl); }).finally(function () { localStorageService.set('userHasPickedlaunchFrom', true); }); } } }; }]); }());