You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
31 KiB

  1. /*!
  2. * ngCordova
  3. * v0.1.27-alpha
  4. * Copyright 2015 Drifty Co. http://drifty.com/
  5. * See LICENSE in this repository for license information
  6. */
  7. !function(){var e=angular.module("ngCordovaMocks",[]);e.factory("$cordovaActionSheet",["$q",function(e){var r=!1;return{throwsError:r,show:function(){var r=e.defer();return this.throwsError?r.reject("There was an error on showing action sheet"):r.resolve(),r.promise}}}]),e.factory("$cordovaAppVersion",["$q",function(e){var r=!1;return{throwsError:r,getAppName:function(){var r=e.defer();return r.resolve("mock app name"),r.promise},getPackageName:function(){var r=e.defer();return r.resolve("com.package.mock"),r.promise},getVersionNumber:function(){var r=e.defer();return r.resolve("1.2.3"),r.promise},getVersionCode:function(){var r=e.defer();return r.resolve("4.5.6"),r.promise}}}]),e.factory("$cordovaBarcodeScanner",["$q",function(e){var r=!1,t="",o="",n=!1;return{throwsError:r,scannedText:t,scannedFormat:o,wasCancelled:n,scan:function(){var r=e.defer();return this.throwsError?r.reject("There was an error scanning."):r.resolve({text:this.scannedText,format:this.scannedFormat,cancelled:this.wasCancelled}),r.promise},encode:function(r,t){this.scannedFormat=r,this.scannedText=t;var o=e.defer();return this.throwsError?o.reject("There was an error encoding the data."):o.resolve(),o.promise}}}]),e.factory("$cordovaBLE",["$q","$timeout","$interval","$log",function(e,r,t,o){var n={name:"Test Device",id:"AA:BB:CC:DD:EE:FF",advertising:[2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],rssi:-55},i={name:"Test Device",id:"AA:BB:CC:DD:EE:FF",advertising:[2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],rssi:-55,services:["1800","1801","180f"],characteristics:[{service:"1800",characteristic:"2a00",properties:["Read"]},{service:"1800",characteristic:"2a01",properties:["Read"]},{service:"1801",characteristic:"2a05",properties:["Read"]},{service:"180f",characteristic:"2a19",properties:["Read"],descriptors:[{uuid:"2901"},{uuid:"2904"}]}]},s=new ArrayBuffer(8);return{scan:function(t,o){var i=e.defer();return r(function(){i.notify(n)},Math.round(1e3*o*Math.random())),r(function(){i.resolve()},1e3*o),i.promise},startScan:function(e,t,o){r(function(){t(n)},Math.round(1e3*Math.random()))},stopScan:function(){var t=e.defer();return r(function(){t.resolve()},500),t.promise},connect:function(t){var o=e.defer();return r(function(){o.resolve(i)},1500),o.promise},disconnect:function(t){var o=e.defer();return r(function(){o.resolve(!0)},500),o.promise},read:function(t,o,n){var i=e.defer();return r(function(){i.resolve(s)},100),i.promise},write:function(t,o,n,i){var s=e.defer();return r(function(){s.resolve(!0)},100),s.promise},writeWithoutResponse:function(t,o,n,i){var s=e.defer();return r(function(){s.resolve(!0)},100),s.promise},writeCommand:function(e,r,t,n){return o.warning("writeCommand is deprecated, use writeWithoutResponse"),this.writeWithoutResponse(e,r,t,n)},startNotification:function(e,r,o,n,i){t(function(){var e=new Uint8Array([Math.round(255*Math.random())]);n(e)},200,10)},stopNotification:function(t,o,n){var i=e.defer();return r(function(){i.resolve()},100),i.promise},isConnected:function(r){var t=e.defer();return t.resolve(!0),t.promise},enable:function(){var t=e.defer();return r(function(){t.resolve()},1500),t.promise},isEnabled:function(){var r=e.defer();return r.resolve(!0),r.promise}}}]),e.factory("$cordovaBrightness",["$q",function(e){var r=100;return{get:function(){var t=e.defer();return t.resolve(r),t.promise},set:function(t){var o=e.defer();return r=t,o.resolve("OK"),o.promise},setKeepScreenOn:function(r){var t=e.defer();return t.resolve("OK"),t.promise}}}]),e.factory("$cordovaCamera",["$q",function(e){var r=!1,t="";return{throwsError:r,imageData:t,getPicture:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error getting the picture."):(r&&(r=r),t.resolve(this.imageData)),t.promise}}}]),e.factory("$cordovaCapture",["$q",function(e){var r=!1;return{throwsError:r,captureAudio:function(){var r=e.defer();return this.throwsError?r.reject("There was an error capturing the audio."):r.resolve(),r.promise},captureImage:function(){var r=e.defer();return this.throwsError?r.reject("There was an error capturing the image."):r.resolve(),r.promise},captureVideo:function(){var r=e.defer();return this.throwsError?r.reject("There was an error capturing the video."):r.resolve(),r.promise}}}]),e.factory("$cordovaContacts",["$q",function(e){var r=!1,t=[];return{throwsError:r,contacts:t,save:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error saving the contact.");else{for(var o=null,n=0;n<this.contacts.length;n++)if(this.contacts[n].id===r.id){o=n;break}null===o?(this.contacts.push(r),t.resolve()):t.reject("Contact already exists.")}return t.promise},remove:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error saving the contact.");else{for(var o=null,n=0;n<this.contacts.length;n++)if(this.contacts[n].id===r.id){o=n;break}null===o?t.reject("Unable to find contact."):(this.contacts.splice(o,1),t.resolve())}return t.promise},find:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error finding the contact.");else{var o=r.fields||["id","displayName"];if(delete r.fields,o)if("*"===o)t.resolve(this.contacts);else{for(var n=[],i=0;i<this.contacts.length;i++)for(var s in this.contacts[i])var a=this.contacts[i][s];t.resolve(n)}else t.reject("ContactError.INVALID_ARGUMENT_ERROR")}return t.promise}}}]),e.factory("$cordovaDatePicker",["$q",function(e){return{show:function(r){var t=e.defer();return r=r||{date:new Date,mode:"date"},t.resolve(r.date),t.promise}}}]),e.factory("$cordovaDevice",function(){var e="",r="",t="",o="",n="",i="";return{device:e,cordova:r,model:t,platform:o,uuid:n,version:i,version:i,getDevice:function(){return this.device},getCordova:function(){return this.cordova},getModel:function(){return this.model},getPlatform:function(){return this.platform},getUUID:function(){return this.uuid},getVersion:function(){return this.version},getManufacturer:function(){return this.manufacturer}}}),e.factory("$cordovaDeviceMotion",["$interval","$q",function(e,r){var t=null,o=!1,n=[],i=[];return{currentAcceleration:t,throwsError:o,positions:n,watchIntervals:i,getCurrentAcceleration:function(){var e=r.defer();return this.throwsError?e.reject("There was an error getting the current acceleration."):e.resolve(this.currentAcceleration),e.promise},watchAcceleration:function(t){var o=r.defer(),n=Math.floor(1e6*Math.random()+1);if(this.positions=[],self=this,this.throwsError)o.reject("There was an error watching the current acceleration.");else{var i=1e4;t&&t.frequency&&(i=t.frequency),this.watchIntervals.push(e(function(){self.throwsError&&o.reject("There was an error watching the acceleration.");var e=Math.floor(100*Math.random()+1),r=Math.floor(100*Math.random()+1),t=Math.floor(100*Math.random()+1),n={x:e,y:r,z:t,timestamp:Date.now()};self.positions.push(n),o.notify(n)},i))}return{watchId:n,promise:o.promise}},clearWatch:function(t){var o=r.defer();if(t)if(this.throwsError)o.reject("Unable to clear watch.");else{for(var n=-1,s=0;s<this.watchIntervals.length;s++)if(this.watchIntervals[s].watchId===t){e.cancel(i[s].interval),n=s;break}-1!==n&&this.watchIntervals.splice(n,1)}else o.reject("Unable to clear watch. No watch ID provided.");return o.promise}}}]),e.factory("$cordovaDeviceOrientation",["$interval","$q",function(e,r){var t=null,o=!1,n=[],i=[];return{currentHeading:t,throwsError:o,readings:n,watchIntervals:i,getCurrentHeading:function(){var e=r.defer();return this.throwsError?e.reject("There was an error getting the current heading."):e.resolve(this.currentHeading),e.promise},watchHeading:function(t){var o=r.defer(),n=Math.floor(1e6*Math.random()+1),s=this;if(s.readings=[],s.throwsError)o.reject("There was an error getting the compass heading.");else{var a=100;t&&t.frequency&&(a=t.frequency),s.watchIntervals.push({watchID:n,interval:e(function(){s.throwsError&&o.reject("There was an error watching the acceleration.");var e=359.99*Math.random()+1,r=359.99*Math.random()+1,t=Math.floor(360*Math.random()+1),n={magneticHeading:e,trueHeading:r,headingAccuracy:t,timestamp:Date.now()};s.readings.push(n),o.notify(n)},a)})}var c=function(r){for(var t=-1,o=0;o<s.watchIntervals.length;o++)if(s.watchIntervals[o].watchID===r){e.cancel(i[o].interval),t=o;break}-1!==t&&s.watchIntervals.splice(t,1)};return o.promise.cancel=function(){c(n)},o.promise.clearWatch=function(e){c(e||n)},o.promise.watchID=n,o.promise},clearWatch:function(t){var o=r.defer();if(t)if(this.throwsError)o.reject("Unable to clear watch.");else{for(var n=-1,s=0;s<this.watchIntervals.length;s++)if(this.watchIntervals[s].watchId===t){e.cancel(i[s].interval),n=s;break}-1!==n&&this.watchIntervals.splice(n,1)}else o.reject("Unable to clear watch. No watch ID provided.");return o.promise}}}]),e.factory("$cordovaDialogs",["$q",function(e){var r=!1,t="",o="",n="",i=0,s=!0;return{dialogText:r,dialogTitle:t,defaultValue:o,promptResponse:n,buttonLabels:[],beepCount:i,useHostAbilities:s,alert:function(r,t,o){var n=e.defer();return this.useHostAbilities?(alert(r),n.resolve()):(this.dialogText=r,this.dialogTitle=t,this.buttonLabels.push(o),n.resolve()),n.promise},confirm:function(r,t,o){var n=e.defer();if(this.useHostAbilities){var i=confirm(r);n.resolve(i?2:1)}else this.dialogText=r,this.dialogTitle=t,this.buttonLabels.push(o),n.resolve(0);return n.promise},prompt:function(r,t,o,n){var i=e.defer();if(this.useHostAbilities){var s=prompt(r,n);i.resolve(s)}else{this.dialogText=r,this.dialogTitle=t,this.defaultValue=n;for(var a=0;a<o.length;a++)this.buttonLabels.push(o[a]);i.resolve(this.promptResponse)}return i.promise},beep:function(e){this.beepCount=e}}}]),e.factory("$cordovaFacebook",["$q",function(e){return{loginShouldSucceedWith:null,showDialogShouldSucceedWith:null,apiShouldSucceedWith:null,getAccessTokenShouldSucceedWith:null,getLoginStatusShouldSucceedWith:null,logoutShouldSuceedWith:null,login:function(r){return null!==this.loginShouldSucceedWith?e.when(this.loginShouldSucceedWith):e.reject()},showDialog:function(r){return null!==this.showDialogShouldSucceedWith?e.when(this.showDialogShouldSucceedWith):e.reject()},api:function(r,t){return null!==this.apiShouldSucceedWith?e.when(this.apiShouldSucceedWith):e.reject()},getAccessToken:function(){return null!==this.getAccessTokenShouldSucceedWith?e.when(this.getAccessTokenShouldSucceedWith):e.reject()},getLoginStatus:function(){return null!==this.getLoginStatusShouldSucceedWith?e.when(this.getLoginStatusShouldSucceedWith):e.reject()},logout:function(){return null!==this.logoutShouldSuceedWith?e.when(this.logoutShouldSuceedWith):e.reject()}}}]),e.factory("$cordovaFile",["$q",function(e){var r=!1,t={},o=!1,n={},i=function(r){var t=e.defer();return this.throwsError?t.reject(r):t.resolve(),t.promise};return{throwsError:r,fileSystem:t,shouldMockFiles:o,files:n,checkDir:function(r){if(this.shouldMockFiles){var t=e.defer();return this.files[r]&&!this.files[r].isFile?t.resolve():t.reject(),t.promise}return i.call(this,"There was an error checking the directory.")},createDir:function(r,t){if(this.shouldMockFiles){var o=e.defer();return this.files[r]={isFile:!1},o.resolve(),o.promise}return i.call(this,"There was an error creating the directory.")},listDir:function(e){return i.call(this,"There was an error listing the directory")},checkFile:function(r){if(this.shouldMockFiles){var t=e.defer();return this.files[r]&&this.files[r].isFile?t.resolve():t.reject(),t.promise}return i.call(this,"There was an error checking for the file.")},createFile:function(r,t){if(this.shouldMockFiles){var o=e.defer();return this.files[r]={isFile:!0,fileContent:""},o.resolve(),o.promise}return i.call(this,"There was an error creating the file.")},removeFile:function(e,r){return i.call(this,"There was an error removng the file.")},writeFile:function(e,r,t){return this.shouldMockFiles&&e&&r&&(this.files[e]={isFile:!0,fileContent:r}),i.call(this,"There was an error writing the file.")},readFile:function(e){return this.readAsText(e)},readAsText:function(r){if(this.shouldMockFiles){var t=e.defer();return n[r]&&n[r].isFile?t.resolve(n[r].fileContent):t.reject(),t.promise}return i.call(this,"There was an error reading the file as text.")},readAsDataURL:function(e){return i.call(this,"There was an error reading the file as a data url.")},readAsBinaryString:function(e){return i.call(this,"There was an error reading the file as a binary string.")},readAsArrayBuffer:function(e){return i.call(this,"There was an error reading the file as an array buffer.")},readFileMetadata:function(e){return i.call(this,"There was an error reading the file metadata")},readFileAbsolute:function(e){return i.call(this,"There was an error reading the file from the absolute path")},readFileMetadataAbsolute:function(e){return i.call(this,"There was an error reading the file metadta from the absolute path")}}}]),e.factory("$cordovaFileOpener2",["$q",function(e){var r=!1;return{throwsError:r,open:function(r,t){var o=e.defer();return this.throwError?o.reject({status:0,message:"There was an error capturing the file."}):o.resolve(),o.promise},uninstall:function(r){var t=e.defer();return this.throwError?t.reject({status:0,message:"There was an error capturing the packageId."}):t.resolve(),t.promise},appIsInstalled:function(r){var t=e.defer();return this.throwError?t.reject({status:0,message:"There was an error capturing the packageId."}):t.resolve(),t.promise}}}]),e.factory("$cordovaFileTransfer",["$q",function(e){var r=!1,t=function(r){var t=e.defer();return this.throwsError?t.reject(r):t.resolve(),t.promise};return{throwsError:r,download:function(e,r,o,n){return t.call(this,"There was an error downloading the file.")},upload:function(e,r,o){return t.call(this,"There was an error uploading the file.")}}}]),e.factory("$cordovaGeolocation",["$interval","$q",function(e,r){var t=!1,o=!0,n=[],i=[],s=null,a=null;return{throwsError:t,watchIntervals:n,locations:i,currentPosition:s,nextPosition:a,useHostAbilities:o,getCurrentPosition:function(e){var t=r.defer();return this.throwsError?t.reject("There was an error getting the location."):(e&&(e=e),this.useHostAbilities?navigator.geolocation?navigator.geolocation.getCurrentPosition(function(e){this.currentPosition=e,t.resolve(this.currentPosition)},function(e){t.reject(e)}):t.reject("Geolocation is not supported by this browser."):t.resolve(this.currentPosition)),t.promise},watchPosition:function(t){var o=r.defer(),i=Math.floor(1e6*Math.random()+1),s=this;if(s.locations=[],s.throwsError)o.reject("There was an error getting the geolocation.");else{var a=1e3;t&&t.timeout&&(a=t.timeout),s.watchIntervals.push({watchID:i,interval:e(function(){s.throwsError&&o.reject("There was an error watching the geolocation.");var e=s.nextPosition;null===e&&(s.useHostAbilities?navigator.geolocation?navigator.geolocation.getCurrentPosition(function(e){s.currentPosition=e,s.locations.push(e),o.resolve(e)},function(e){o.reject(e)}):o.reject("Geolocation is not supported by this browser."):(e={coords:{latitude:180*Math.random()+1-90,longitude:360*Math.random()+1-180,altitude:100*Math.random()+1,accuracy:10*Math.random()+1,altitudeAccuracy:10*Math.random()+1,heading:360*Math.random()+1,speed:100*Math.random()+1},timestamp:Date.now()},s.currentPosition=e,s.locations.push(e),o.notify(e)))},a)})}var c=function(r){for(var t=-1,o=0;o<s.watchIntervals.length;o++)if(s.watchIntervals[o].watchID===r){e.cancel(n[o].interval),t=o;break}-1!==t&&s.watchIntervals.splice(t,1)};return o.promise.cancel=function(){c(i)},o.promise.clearWatch=function(e){c(e||i)},o.promise.watchID=i,o.promise},clearWatch:function(t){var o=r.defer();if(t)if(this.throwsError)o.reject("Unable to clear watch.");else{for(var i=-1,s=0;s<this.watchIntervals.length;s++)if(this.watchIntervals[s].watchID===t){e.cancel(n[s].interval),i=s;break}-1!==i&&this.watchIntervals.splice(i,1)}else o.reject("Unable to clear watch. No watch ID provided.");return o.promise}}}]),e.factory("$cordovaGlobalization",["$q",function(e){var r=!1,t=navigator.language?navigator.language:"en-US",o={value:t},n="Sunday",i={value:t};return{throwsError:r,preferredLanguage:o,localeName:i,firstDayOfWeek:n,getPreferredLanguage:function(){var r=e.defer();return this.throwsError?r.reject("There was an error getting the preferred language."):r.resolve(this.preferredLanguage),r.promise},getLocaleName:function(){var r=e.defer();return this.throwsError?r.reject("There was an error getting the locale name."):r.resolve(this.localeName),r.promise},getFirstDayOfWeek:function(){var r=e.defer();return this.throwsError?r.reject("There was an error getting the first day of week."):r.resolve(this.firstDayOfWeek),r.promise},dateToString:function(r,t){var o=e.defer();if(this.throwsError)o.reject("There was an error getting the string from the date.");else{var n="";r=r,t=t,o.resolve(n)}return o.promise},stringToDate:function(r,t){var o=e.defer();if(this.throwsError)o.reject("There was an error getting the date from the string.");else{var n="";r=r,t=t,o.resolve(n)}return o.promise},getDatePattern:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error getting the date pattern.");else{var o="";r=r,t.resolve(o)}return t.promise},getDateNames:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error getting the date names.");else{var o="";r=r,t.resolve(o)}return t.promise},isDayLightSavingsTime:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error getting if this is in daylight savings time mode.");else{var o="";r=r,t.resolve(o)}return t.promise},numberToString:function(r,t){var o=e.defer();if(this.throwsError)o.reject("There was an error convertng the number to a string.");else{var n="";r=r,t=t,o.resolve(n)}return o.promise},stringToNumber:function(r,t){var o=e.defer();if(this.throwsError)o.reject("There was an error convertng the string to a number.");else{var n="";t=t,o.resolve(n)}return o.promise},getNumberPattern:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error convertng the string to a number.");else{var o="";r=r,t.resolve(o)}return t.promise},getCurrencyPattern:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error convertng the string to a number.");else{var o="";r=r,t.resolve(o)}return t.promise}}}]),e.factory("$cordovaGoogleAnalytics",["$q",function(e){var r=!1,t={};t.throwsError=r;var o=["startTrackerWithId","setUserId","debugMode","trackView","addCustomDimension","trackEvent","trackException","trackTiming","addTransaction","addTransactionItem"];return o.forEach(function(r){t[r]=function(){var r=e.defer();return this.throwsError?r.reject():r.resolve(),r.promise}}),t}]),e.factory("$cordovaGooglePlayGame",["$q",function(e){var r=!1,t=!1,o="";return{_throwsError:r,_isSignedIn:t,_displayName:o,auth:function(){var r=e.defer();return this._throwsError?r.reject("There was a auth error."):(this.isSignedIn=!0,r.resolve("SIGN IN SUCCESS")),r.promise},signout:function(){var r=e.defer();return this.throwsError?r.reject("There was a signout error."):r.resolve(),r.promise},isSignedIn:function(){var r=e.defer();return this._throwsError?r.reject("There was a isSignedIn error."):r.resolve({isSignedIn:this._isSignedIn}),r.promise},showPlayer:function(){var r=e.defer();return this.throwsError?r.reject("There was a showPlayer error."):r.resolve({displayName:this._displayName}),r.promise},submitScore:function(r){var t=e.defer();return this._throwsError?t.reject("There was a submitScore error."):t.resolve("OK"),t.promise},showAllLeaderboards:function(){var r=e.defer();return this.throwsError?r.reject("There was a showAllLeaderboards error."):r.resolve("OK"),r.promise},showLeaderboard:function(r){var t=e.defer();return this._throwsError?t.reject("There was a showLeaderboard error."):t.resolve("OK"),t.promise},unlockAchievement:function(r){var t=e.defer();return this.throwsError?t.reject("There was a unlockAchievement error."):t.resolve("OK"),t.promise},incrementAchievement:function(r){var t=e.defer();return this._throwsError?t.reject("There was a incrementAchievement error."):t.resolve("OK"),t.promise},showAchievements:function(){var r=e.defer();return this.throwsError?r.reject("There was a showAchievements error."):r.resolve("OK"),r.promise}}}]),e.factory("$cordovaKeyboard",function(){var e=!1;return{hideAccessoryBar:function(e){},close:function(){e=!1},show:function(){e=!0},disableScroll:function(e){},isVisible:function(){return e}}}),e.factory("$cordovaKeychain",["$q",function(e){var r={};return{keychains:r,getForKey:function(r,t){var o=e.defer();return this.keychains[t]?o.resolve(this.keychains[t][r]):o.reject(),o.promise},setForKey:function(r,t,o){var n=e.defer();return this.keychains[t]||(this.keychains[t]={}),this.keychains[t][r]=o,n.resolve(),n.promise},removeForKey:function(r,t){var o=e.defer();return this.keychains[t]&&delete this.keychains[t][r],o.resolve(),o.promise}}}]),e.factory("$cordovaLocalNotification",["$q",function(e){function r(e){return o+e}function t(){for(var r=e.defer(),t=[],n=0,i=localStorage.length;i>n;++n)localStorage.key(n).indexOf(o)>-1&&t.push(parseInt(localStorage.key(n).split("-")[1]));return r.resolve(t),r.promise}var o="ngCordLocNotif-";return{cancel:function(t){var o=e.defer();return"number"==typeof t&&(t=[t]),t.forEach(function(e){localStorage.removeItem([r(e)])}),o.resolve(),o.promise},cancelAll:function(){var r=e.defer();return r.resolve(),r.promise},clear:function(t){"number"==typeof t&&(t=[t]);var o=e.defer();return t.forEach(function(e){localStorage.removeItem([r(e)])}),o.resolve(),o.promise},clearAll:function(){var r=e.defer();return r.promise},isScheduled:function(t){var o=e.defer();return localStorage[r(t)]?o.resolve(!0):o.resolve(!1),o.promise},isPresent:function(t){var o=e.defer();return localStorage[r(t)]?o.resolve(!0):o.resolve(!1),o.promise},isTriggered:function(t){var o=e.defer();return localStorage[r(t)]?o.resolve(!1):o.resolve(!0),o.promise},getAllIds:function(){return t()},getIds:function(){return t()},getScheduledIds:function(){return t()},getTriggeredIds:function(){var r=e.defer();return r.resolve([]),r.promise},hasPermission:function(r){var t=e.defer();return t.resolve(!0),t.promise},schedule:function(t){var o=e.defer(),n=r(t.id);return localStorage[n]=JSON.stringify(t),o.resolve(),o.promise},update:function(t){var o=e.defer(),n=r(t.id);return localStorage[n]=JSON.stringify(t),o.resolve(),o.promise}}}]),e.factory("$cordovaNetwork",["$rootScope",function(e){var r="WiFi connection",t=!0;return{connectionType:r,isConnected:t,switchToOnline:function(){this.isConnected=!0,e.$broadcast("$cordovaNetwork:online")},switchToOffline:function(){this.isConnected=!1,e.$broadcast("$cordovaNetwork:offline")},getNetwork:function(){return this.connectionType},isOnline:function(){return this.isConnected},isOffline:function(){return!this.isConnected}}}]),e.factory("$cordovaProgress",["$timeout",function(e){return{show:function(e){var r=e||"Please wait...";console.info("$cordovaProgress.message",r)},showSimple:function(e){var r=e||!1;console.info("$cordovaProgress.dim",r)},showSimpleWithLabel:function(e,r){var t=e||!1,o=r||"Loading...";console.group(),console.info("$cordovaProgress.dim",t),console.info("$cordovaProgress.label",o),console.groupEnd()},showSimpleWithLabelDetail:function(e,r,t){var o=e||!1,n=r||"Loading...",i=t||"Please wait";console.group(),console.info("$cordovaProgress.dim",o),console.info("$cordovaProgress.label",n),console.info("$cordovaProgress.detail",i),console.groupEnd()},showDeterminate:function(r,t){var o=r||!1,n=t||5e4;console.group(),console.info("$cordovaProgress.dim show",o),console.info("$cordovaProgress.timeout",n),console.groupEnd(),e(function(){console.info("$cordovaProgress.dim timeout",o)},n)},showDeterminateWithLabel:function(r,t,o){var n=r||!1,i=t||5e4,s=o||"Loading...";console.group(),console.info("$cordovaProgress.dim",n),console.info("$cordovaProgress.timeout",i),console.info("$cordovaProgress.label",s),console.groupEnd(),e(function(){console.info("$cordovaProgress[dim, label] timeout",[n,s])},i)},showAnnular:function(r,t){var o=r||!1,n=t||5e4;console.group(),console.info("$cordovaProgress.dim",o),console.info("$cordovaProgress.timeout",n),console.groupEnd(),e(function(){console.info("$cordovaProgress.dim timeout",o)},n)},showAnnularWithLabel:function(r,t,o){var n=r||!1,i=t||5e4,s=o||"Loading...";console.group(),console.info("$cordovaProgress.dim",n),console.info("$cordovaProgress.timeout",i),console.info("$cordovaProgress.label",s),console.groupEnd(),e(function(){console.info("$cordovaProgress[dim, label] timeout",[n,s])},i)},showBar:function(r,t){var o=r||!1,n=t||5e4;console.group(),console.info("$cordovaProgress.dim",o),console.info("$cordovaProgress.timeout",n),console.groupEnd(),e(function(){console.info("$cordovaProgress.dim timeout",o)},n)},showBarWithLabel:function(r,t,o){var n=r||!1,i=t||5e4,s=o||"Loading...";console.group(),console.info("$cordovaProgress.dim",n),console.info("$cordovaProgress.label",s),console.info("$cordovaProgress.timeout",i),console.groupEnd(),e(function(){console.info("$cordovaProgress[dim, label] timeout",[n,s])},i)},showSuccess:function(e,r){var t=e||!1,o=r||"Success";console.group(),console.info("$cordovaProgress.dim",t),console.info("$cordovaProgress.label",o),console.groupEnd()},showText:function(e,r,t){var o=e||!1,n=r||"Warning",i=t||"center";console.group(),console.info("$cordovaProgress.dim",o),console.info("$cordovaProgress.text",n),console.info("$cordovaProgress.position",i),console.groupEnd()},hide:function(){console.info("$cordovaProgress.hide")}}}]),e.factory("$cordovaPush",["$q","$timeout","$rootScope",function(e,r,t){var o=!1,n="";return{throwsError:o,deviceToken:n,onNotification:function(e){r(function(){t.$broadcast("$cordovaPush:notificationReceived",e)})},register:function(r){var t=this,o=e.defer();return void 0!==r&&void 0===r.ecb&&(r.ecb=this.onNotification),this.throwsError?o.reject("There was a register error."):(o.resolve(this.deviceToken),r&&r.ecb&&r.ecb({event:"registered",regid:t.deviceToken})),o.promise},unregister:function(r){var t=e.defer();return this.throwsError?t.reject("There was a register error."):t.resolve(),t.promise}}}]),e.factory("$cordovaScreenshot",["$q",function(e){var r=!1;return{throwsError:r,captureToFile:function(){var r=e.defer();return this.throwsError?r.reject("There was an error capturing the screenshot."):r.resolve("path"),r.promise},captureToUri:function(){var r=e.defer();return this.throwsError?r.reject("There was an error capturing the screenshot."):r.resolve(),r.promise}}}]),e.factory("$cordovaSocialSharing",["$q",function(e){var r=!1,t="",o="",n="",i="",s="",a="",c=[],h=[],u=[];return{throwsError:r,message:t,image:o,link:n,number:i,subject:a,toAddresses:c,bccAddresses:h,socialService:s,attachments:u,shareViaTwitter:function(r,t,o){var n=e.defer();return this.throwsError?n.reject("There was an error sharing via Twitter."):(this.message=r,this.image=t,this.link=o,n.resolve()),n.promise},shareViaWhatsApp:function(r,t,o){var n=e.defer();return this.throwsError?n.reject("There was an error sharing via WhatsApp."):(this.message=r,this.image=t,this.link=o,n.resolve()),n.promise},shareViaFacebook:function(r,t,o){var n=e.defer();return this.throwsError?n.reject("There was an error sharing via Facebook."):(this.message=r,this.image=t,this.link=o,n.resolve()),n.promise},shareViaSMS:function(r,t){var o=e.defer();return this.throwsError?o.reject("There was an error sharing via SMS."):(this.message=r,this.number=t,o.resolve()),o.promise},shareViaEmail:function(r,t,o,n,i){var s=e.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.message=r,this.subject=t,this.toAddresses=o,this.bccAddressesc=n,this.attachments=i,s.resolve()),s.promise},canShareViaEmail:function(){var r=e.defer();return this.throwsError?r.reject(!1):r.resolve(!0),r.promise},canShareVia:function(r,t,o,n,i){var s=e.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.message=t,this.socialService=r,this.subject=o,this.attachments=n,this.link=i,s.resolve()),s.promise},shareVia:function(r,t,o,n,i){var s=e.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.socialService=r,this.message=t,this.subject=o,this.attachments=n,this.link=i,s.resolve()),s.promise},share:function(r,t,o,n){var i=e.defer();return this.throwsError?i.reject("There was an error sharing via SMS."):(this.message=r,this.subject=t,this.attachments=o,this.link=n,i.resolve()),i.promise},shareWithOptions:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error sharing via SMS."):(this.message=r.message,this.subject=r.subject,this.attachments=r.files,this.link=r.url,t.resolve()),t.promise}}}]),e.factory("$cordovaSplashscreen",function(){var e=!1;return{isVisible:e,hide:function(){return this.isVisible=!1,!0},show:function(){return this.isVisible=!0,!0}}}),e.factory("$cordovaSQLite",["$q",function(e){return{openDBShouldSucceedWith:null,executeShouldSucceedWith:null,insertCollectionShouldSucceedWith:null,nestedExecuteShouldSucceedWith:null,deleteDBShouldSucceedWith:null,openDB:function(r,t){null!==this.openDBShouldSucceedWith?e.when(this.openDBShouldSucceedWith):e.reject()},execute:function(r,t,o){null!==this.executeShouldSucceedWith?e.when(this.executeShouldSucceedWith):e.reject()},insertCollection:function(r,t,o){null!==this.insertCollectionShouldSucceedWith?e.when(this.insertCollectionShouldSucceedWith):e.reject()},nestedExecute:function(r,t,o,n,i){null!==this.nestedExecuteShouldSucceedWith?e.when(this.nestedExecuteShouldSucceedWith):e.reject()},deleteDB:function(r){null!==this.deleteDBShouldSucceedWith?e.when(this.deleteDBShouldSucceedWith):e.reject()}}}]),e.factory("$cordovaStatusbar",function(){var e=!0,r=!0;return{isStatusBarVisible:e,canOverlayWebView:r,overlaysWebView:function(e){this.canOverlayWebView=e},style:function(e){return e},styleHex:function(e){return e},styleColor:function(e){return e},hide:function(){this.isStatusBarVisible=!1},show:function(){this.isStatusBarVisible=!0},isVisible:function(){return this.isStatusBarVisible}}}),e.factory("$cordovaToast",["$q",function(e){var r=!1;return{throwsError:r,showShortTop:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},showShortCenter:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},showShortBottom:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},showLongTop:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},showLongCenter:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},showLongBottom:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},showWithOptions:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},show:function(r,t,o){var n=e.defer();return this.throwsError?n.reject("There was an error showing the toast."):n.resolve(),n.promise},hide:function(){var r=e.defer();return this.throwsError?r.reject("There was an error hiding the toast."):r.resolve(),r.promise}}}]),e.factory("$cordovaVibration",["$timeout",function(e){var r=!1,t=null;return{vibrateTimer:t,isVibrating:r,vibrate:function(r){r>0&&(this.isVibrating=!0,self=this,r instanceof Array?this.vibrateTimer=e(function(){self.isVibrating=!1,self.vibrateTimer=null},r[0]):this.vibrateTimer=e(function(){self.isVibrating=!1,self.vibrateTimer=null},r))},vibrateWithPattern:function(e,r){},cancelVibration:function(){null!==this.vibrateTimer&&this.isVibrating===!0&&(e.cancel(this.vibrateTimer),this.isVibrating=!1)}}}])}();