/*! * ngCordova * v0.1.27-alpha * Copyright 2015 Drifty Co. http://drifty.com/ * See LICENSE in this repository for license information */ !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;nn;++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)}}}])}();