Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Start install script and rearrange things a bit

  • Loading branch information...
commit f0ae249257e0260d3b5f7b57745ed1cc5c19713f 1 parent e9cef3b
Dave Johnson authored
View
38 README.md
@@ -1,26 +1,40 @@
Facebook Connect PhoneGap Plugin
================================
-Offical plugin for Facebook Connect.
+This is the offical plugin for Facebook Connect in PhoneGap!
+
+The Facebook Connect plugin for PhoneGap allows you to use the same JavaScript code in your web application as you
+use in your native PhoneGap application, but your native PhoneGap application will use the Facebook native app to
+perform single sign on (SSO) for the user.
This is all licensed under MIT except for app/www/facebook_js_sdk.js which is the Facebook JS SDK and is Apache 2.0.
-Android (OS X)
------------
+Getting Started
+---------------
-Get the latest Android source from http://github.com/phonegap/phonegap-android and read the readme there about getting started with Android.
+Download the latest version of PhoneGap from www.phonegap.com.
-From terminal run the following command:
+Create an Android or iOS PhoneGap project -- those are the only platforms that the Facebook native application
+currently runs on :(
+
+On Android you will need to put the following in your phonegap.xml / plugins.xml file:
<pre>
-droidgap gen foobar
+&lt;plugin name="com.facebook.phonegap.Connect" value="com.phonegap.facebook.Connect" /&gt;
</pre>
-In foobar/res/xml/plugins.xml add the following element as a child of the root plugins element:
+http://wiki.phonegap.com/How%20to%20Install%20a%20PhoneGap%20Plugin%20for%20Android
+
+On iOS you will need to put the following in your PhoneGap.plist file:
+
+
+
+
+http://wiki.phonegap.com/How%20to%20Install%20a%20PhoneGap%20Plugin%20for%20iOS
+
+
+
-<pre>
-&lt;plugin name="com.facebook.phonegap.Connect" value="com.facebook.phonegap.Connect" /&gt;
-</pre>
From the PhoneGap Facebook Connect Plugin folder copy the contents of the native/android/ folder into foobar/
@@ -41,7 +55,7 @@ iOS (Mac OS X)
1. Get the latest iOS source from http://github.com/phonegap/phonegap-iphone and read the README there about getting started with iOS.
2. Create a new Xcode project from the PhoneGap template that you created and installed (you did that if you read the README on github I hope).
3. From the 'PhoneGap Facebook Connect Plugin' folder copy the contents of the native/ios folder into your app in Xcode (usually in the Plugins folder group).
-4. Find the PhoneGap.plist file in the project navigator, expand the "Plugins" sub-tree, and add a new entry. For the key, add "com.facebook.phonegap.Connect", and its value will be "FacebookConnectPlugin"
+4. Find the PhoneGap.plist file in the project navigator, expand the "Plugins" sub-tree, and add a new entry. For the key, add "com.phonegap.facebook.Connect", and its value will be "FacebookConnectPlugin"
5. From the' PhoneGap Facebook Connect Plugin' folder copy contents of the app/www folder into the www directory in Xcode overwriting the index.html and icon.png files but keeping the phonegap.*.js file
6. for Xcode 4, you will need to build it once, and heed the warning - this is an Xcode 4 template limitation. The warning instructions will tell you to drag copy the www folder into the project in Xcode.
7. Run the application in Xcode.
@@ -67,4 +81,4 @@ Make sure you add the scheme to your [PROJECTNAME]-Info.plist (located as one of
&lt;/array&gt;
&lt;/dict&gt;
&lt;/array&gt;
-</pre>
+</pre>
View
16 app/www/config.xml
@@ -1,16 +0,0 @@
-<widget id="com.phonegap.example" version="0.1.0">
- <name>Example App</name>
- <!--
- TODO feature
- http://api.phonegap.com/1.0/camera
- http://api.phonegap.com/1.0/contacts
- http://api.phonegap.com/1.0/file
- http://api.phonegap.com/1.0/geolocation
- http://api.phonegap.com/1.0/media
- http://api.phonegap.com/1.0/network
- http://api.phonegap.com/1.0/notification
- -->
-    <icon src="img/icon-57.png" width="57" height="57" />
-    <icon src="img/icon-72.png" width="72" height="72" />
-    <icon src="img/icon-114.png" width="114" height="114" />
-</widget>
View
BIN  app/www/icon.png
Deleted file not rendered
View
88 app/www/index.html
@@ -1,88 +0,0 @@
-<html>
- <head>
- <!-- phonegap -->
- <script src="phonegap-0.9.6.js"></script>
- <!-- phonegap facebook plugin -->
- <script src="pg-plugin-fb-connect.js"></script>
- <!-- facebook js sdk -->
- <script src="facebook_js_sdk.js"></script>
- </head>
- <body>
- <button onclick="init()">Init</button>
- <button onclick="login()">Login</button>
- <button onclick="me()">Me</button>
- <button onclick="getSession()">Get session</button>
- <button onclick="getLoginStatus()">Get login</button>
- <button onclick="logout()">Logout</button>
-
- <!-- TODO: have this written dynamically in init if phonegap -->
- <div id="fb-root"></div>
-
- <script>
-
- FB.Event.subscribe('auth.login', function(response) {
- alert('auth.login event');
- });
-
- FB.Event.subscribe('auth.logout', function(response) {
- alert('auth.logout event');
- });
-
- FB.Event.subscribe('auth.sessionChange', function(response) {
- alert('auth.sessionChange event');
- });
-
- FB.Event.subscribe('auth.statusChange', function(response) {
- alert('auth.statusChange event');
- });
-
- function getSession() {
- alert(JSON.stringify(FB.getSession()));
- }
-
- function getLoginStatus() {
- FB.getLoginStatus(function(response) {
- if (response.session) {
- alert('logged in');
- } else {
- alert('not logged in');
- }
- });
- }
-
- function me() {
- FB.api('/me/friends', function(response) {
- alert(JSON.stringify(response));
- });
- }
-
- function logout() {
- FB.logout(function(response) {
- alert('logged out');
- });
- }
-
- function login() {
- FB.login(
- function(e) {
- alert(e);
- },
- { perms: "email" }
- );
- }
-
- function init() {
- try {
- FB.init({ appId: "188240441228254", phonegap: PG.FB });
- } catch (e) {
- alert(e);
- }
- }
-
- document.addEventListener('deviceready', function() {
- navigator.app.addService("com.facebook.phonegap.Connect", "com.facebook.phonegap.ConnectPlugin");
- }, false);
- </script>
- <div id="log"></div>
- </body>
-</html>
View
4 example/iOS/PhoneGapFacebookConnect/PhoneGap.plist
@@ -14,6 +14,8 @@
<array/>
<key>Plugins</key>
<dict>
+ <key>com.phonegap.facebook.Connect</key>
+ <string>FacebookConnectPlugin</string>
<key>com.phonegap.accelerometer</key>
<string>PGAccelerometer</string>
<key>com.phonegap.camera</key>
@@ -36,8 +38,6 @@
<string>PGCapture</string>
<key>com.phonegap.notification</key>
<string>PGNotification</string>
- <key>com.facebook.phonegap.Connect</key>
- <string>FacebookConnectPlugin</string>
</dict>
<key>TopActivityIndicator</key>
View
38 example/iOS/www/facebook_js_sdk.js
@@ -1288,40 +1288,18 @@ FB.provide('', {
return;
}
-// if (FB._phonegap) {
-// if (a.method == 'permissions.request') {
-// // TODO: check wtf b arg is all about...
-// PhoneGap.exec(function(e) { // login
-// FB.Auth.setSession(e.session, 'connected');
-// if (b) b(e);
-// }, null, 'com.facebook.phonegap.Connect', 'login', a.perms.split(',') );
-// return;
-// } else if (a.method == 'auth.logout') { // logout
-// PhoneGap.exec(function(e) {
-// FB.Auth.setSession(null, 'notConnected');
-// if (b) b(e);
-// }, null, 'com.facebook.phonegap.Connect', 'logout', []);
-// return;
-// } else if (a.method == 'auth.status') { // getLoginStatus
-// PhoneGap.exec(function(e) {
-// if (b) b(e);
-// }, null, 'com.facebook.phonegap.Connect', 'getLoginStatus', []);
-// return;
-// }
-// }
-
- // If the phonegap arg is specified then call out to the phonegap plugin
+ // If the nativeInterface arg is specified then call out to the nativeInterface
// which uses the native app rather than using the iframe / popup web
- if (FB._phonegap) {
+ if (FB._nativeInterface) {
switch (f.method) {
case 'permissions.request':
- FB._phonegap.login(b, f);
+ FB._nativeInterface.login(b, f);
break;
case 'auth.logout':
- FB._phonegap.logout(b);
+ FB._nativeInterface.logout(b);
break;
case 'auth.status':
- FB._phonegap.getLoginStatus(b);
+ FB._nativeInterface.getLoginStatus(b);
break;
}
return;
@@ -1847,9 +1825,9 @@ FB.provide('', {
status: true
});
FB._apiKey = a.appId || a.apiKey;
- FB._phonegap = a.phonegap;
- if (FB._phonegap) {
- FB._phonegap.init(FB._apiKey);
+ FB._nativeInterface = a.nativeInterface;
+ if (FB._nativeInterface) {
+ FB._nativeInterface.init(FB._apiKey);
}
if (!a.logging && window.location.toString().indexOf('fb_debug=1') < 0) FB._logging = false;
FB.XD.init(a.channelUrl);
View
40 example/iOS/www/index.html
@@ -1,23 +1,25 @@
<html>
<head>
- <!-- phonegap -->
- <script src="phonegap-1.0.0rc1.min.js"></script>
- <!-- phonegap facebook plugin -->
- <script src="pg-plugin-fb-connect.js"></script>
- <!-- facebook js sdk -->
- <script src="facebook_js_sdk.js"></script>
</head>
<body>
- <button onclick="init()">Init</button>
<button onclick="login()">Login</button>
<button onclick="me()">Me</button>
<button onclick="getSession()">Get session</button>
<button onclick="getLoginStatus()">Get login</button>
<button onclick="logout()">Logout</button>
-
+
+ <div id="data"></div>
+
<!-- TODO: have this written dynamically in init if phonegap -->
<div id="fb-root"></div>
+ <!-- phonegap -->
+ <script src="phonegap-1.0.0rc1.min.js"></script>
+ <!-- phonegap facebook plugin -->
+ <script src="pg-plugin-fb-connect.js"></script>
+ <!-- facebook js sdk -->
+ <script src="facebook_js_sdk.js"></script>
+
<script>
FB.Event.subscribe('auth.login', function(response) {
@@ -52,7 +54,12 @@
function me() {
FB.api('/me/friends', function(response) {
- alert(JSON.stringify(response));
+ var data = document.getElementById('data');
+ response.data.forEach(function(item) {
+ var d = document.createElement('div');
+ d.innerHTML = item.name;
+ data.appendChild(d);
+ });
});
}
@@ -71,16 +78,13 @@
);
}
- function init() {
- try {
- FB.init({ appId: "188240441228254", phonegap: PG.FB });
- } catch (e) {
- alert(e);
- }
- }
-
document.addEventListener('deviceready', function() {
- navigator.app.addService("com.facebook.phonegap.Connect", "com.facebook.phonegap.ConnectPlugin");
+ try {
+ FB.init({ appId: "188240441228254", nativeInterface: PG.FB });
+ document.getElementById('data').innerHTML = "";
+ } catch (e) {
+ alert(e);
+ }
}, false);
</script>
<div id="log"></div>
View
8 example/iOS/www/pg-plugin-fb-connect.js
@@ -1,24 +1,24 @@
PG = ( typeof PG == 'undefined' ? {} : PG );
PG.FB = {
init: function(apiKey) {
- PhoneGap.exec(null, null, 'com.facebook.phonegap.Connect', 'init', [apiKey]);
+ PhoneGap.exec(null, null, 'com.phonegap.facebook.Connect', 'init', [apiKey]);
},
login: function(a, b) {
b = b || { perms: '' };
PhoneGap.exec(function(e) { // login
FB.Auth.setSession(e.session, 'connected');
if (a) a(e);
- }, null, 'com.facebook.phonegap.Connect', 'login', b.perms.split(',') );
+ }, null, 'com.phonegap.facebook.Connect', 'login', b.perms.split(',') );
},
logout: function(cb) {
PhoneGap.exec(function(e) {
FB.Auth.setSession(null, 'notConnected');
if (cb) cb(e);
- }, null, 'com.facebook.phonegap.Connect', 'logout', []);
+ }, null, 'com.phonegap.facebook.Connect', 'logout', []);
},
getLoginStatus: function(cb) {
PhoneGap.exec(function(e) {
if (cb) cb(e);
- }, null, 'com.facebook.phonegap.Connect', 'getLoginStatus', []);
+ }, null, 'com.phonegap.facebook.Connect', 'getLoginStatus', []);
}
};
View
3,666 example/iOS/www/phonegap-1.0.0rc1.js
0 additions, 3,666 deletions not shown
View
1  example/iOS/www/phonegap-1.0.0rc1.min.js
@@ -1 +0,0 @@
-var _anomFunkMap={};var _anomFunkMapNextId=0;function anomToNameFunk(fun){var funkId="f"+_anomFunkMapNextId++;var funk=function(){fun.apply(this,arguments);_anomFunkMap[funkId]=null;delete _anomFunkMap[funkId]};_anomFunkMap[funkId]=funk;return"_anomFunkMap."+funkId}function GetFunctionName(fn){if(typeof fn==="function"){var name=fn.name;if(!name){var m=fn.toString().match(/^\s*function\s+([^\s\(]+)/);name=m&&m[1]}if(name&&(window[name]===fn)){return name}else{return anomToNameFunk(fn)}}else{return null}}if(typeof PhoneGap==="undefined"){if(typeof(DeviceInfo)!=="object"){DeviceInfo={}}PhoneGap={queue:{ready:true,commands:[],timer:null},_constructors:[]};PhoneGap.resources={base:true};PhoneGap.hasResource=function(name){return PhoneGap.resources[name]};PhoneGap.addResource=function(name){PhoneGap.resources[name]=true};PhoneGap.available=DeviceInfo.uuid!=undefined;PhoneGap.addConstructor=function(func){var state=document.readyState;if((state=="loaded"||state=="complete")&&DeviceInfo.uuid!=null){func()}else{PhoneGap._constructors.push(func)}};(function(){var timer=setInterval(function(){var state=document.readyState;if((state=="loaded"||state=="complete")&&DeviceInfo.uuid!=null){clearInterval(timer);while(PhoneGap._constructors.length>0){var constructor=PhoneGap._constructors.shift();try{constructor()}catch(e){if(typeof(console.log)=="function"){console.log("Failed to run constructor: "+console.processMessage(e))}else{alert("Failed to run constructor: "+e.message)}}}var e=document.createEvent("Events");e.initEvent("deviceready");document.dispatchEvent(e)}},1)})();PhoneGap.callbackId=0;PhoneGap.callbacks={};PhoneGap.callbackStatus={NO_RESULT:0,OK:1,CLASS_NOT_FOUND_EXCEPTION:2,ILLEGAL_ACCESS_EXCEPTION:3,INSTANTIATION_EXCEPTION:4,MALFORMED_URL_EXCEPTION:5,IO_EXCEPTION:6,INVALID_ACTION:7,JSON_EXCEPTION:8,ERROR:9};PhoneGap.exec=function(){PhoneGap.queue.commands.push(arguments);if(PhoneGap.queue.timer==null){PhoneGap.queue.timer=setInterval(PhoneGap.run_command,10)}};PhoneGap.run_command=function(){if(!PhoneGap.available||!PhoneGap.queue.ready){return}PhoneGap.queue.ready=false;if(!this.gapBridge){this.gapBridge=document.createElement("iframe");this.gapBridge.setAttribute("style","display:none;");this.gapBridge.setAttribute("height","0px");this.gapBridge.setAttribute("width","0px");this.gapBridge.setAttribute("frameborder","0");document.documentElement.appendChild(this.gapBridge)}var args=PhoneGap.queue.commands.shift();if(PhoneGap.queue.commands.length==0){clearInterval(PhoneGap.queue.timer);PhoneGap.queue.timer=null}var service;var callbackId=null;var start=0;try{if(args[0]==null||typeof args[0]==="function"){var success=args[0];var fail=args[1];service=args[2]+"."+args[3];args=args[4];callbackId=service+PhoneGap.callbackId++;if(success||fail){PhoneGap.callbacks[callbackId]={success:success,fail:fail}}}else{service=args[0];start=1}var uri=[];var dict=null;for(var i=start;i<args.length;i++){var arg=args[i];if(arg==undefined||arg==null){continue}if(typeof(arg)=="object"){dict=arg}else{uri.push(encodeURIComponent(arg))}}var next=callbackId!=null?("/"+callbackId+"/"):"/";var url="gap://"+service+next+uri.join("/");if(dict!=null){url+="?"+encodeURIComponent(JSON.stringify(dict))}this.gapBridge.src=url}catch(e){console.log("PhoneGapExec Error: "+e)}};PhoneGap.callbackSuccess=function(callbackId,args){if(PhoneGap.callbacks[callbackId]){if(args.status==PhoneGap.callbackStatus.OK){try{if(PhoneGap.callbacks[callbackId].success){PhoneGap.callbacks[callbackId].success(args.message)}}catch(e){console.log("Error in success callback: "+callbackId+" = "+e)}}if(!args.keepCallback){delete PhoneGap.callbacks[callbackId]}}};PhoneGap.callbackError=function(callbackId,args){if(PhoneGap.callbacks[callbackId]){try{if(PhoneGap.callbacks[callbackId].fail){PhoneGap.callbacks[callbackId].fail(args.message)}}catch(e){console.log("Error in error callback: "+callbackId+" = "+e)}if(!args.keepCallback){delete PhoneGap.callbacks[callbackId]}}};PhoneGap.clone=function(obj){if(!obj){return obj}if(obj instanceof Array){var retVal=new Array();for(var i=0;i<obj.length;++i){retVal.push(PhoneGap.clone(obj[i]))}return retVal}if(obj instanceof Function){return obj}if(!(obj instanceof Object)){return obj}if(obj instanceof Date){return obj}retVal=new Object();for(i in obj){if(!(i in retVal)||retVal[i]!=obj[i]){retVal[i]=PhoneGap.clone(obj[i])}}return retVal};PhoneGap.m_document_addEventListener=document.addEventListener;document.addEventListener=function(evt,handler,capture){var e=evt.toLowerCase();if(e==="unload"){PhoneGap.onUnload=function(e){return handler(e)}}else{PhoneGap.m_document_addEventListener.call(document,evt,handler,capture)}};PhoneGap.m_document_removeEventListener=document.removeEventListener;document.removeEventListener=function(evt,handler,capture){var e=evt.toLowerCase();if(e==="unload"){PhoneGap.onUnload=null}PhoneGap.m_document_removeEventListener.call(document,evt,handler,capture)};PhoneGap.fireEvent=function(type,target){var e=document.createEvent("Events");e.initEvent(type);target=target||document;if(target.dispatchEvent===undefined){target=document}target.dispatchEvent(e)}}if(!PhoneGap.hasResource("debugconsole")){PhoneGap.addResource("debugconsole");DebugConsole=function(){this.logLevel=DebugConsole.INFO_LEVEL};DebugConsole.ALL_LEVEL=1;DebugConsole.INFO_LEVEL=1;DebugConsole.WARN_LEVEL=2;DebugConsole.ERROR_LEVEL=4;DebugConsole.NONE_LEVEL=8;DebugConsole.prototype.setLevel=function(level){this.logLevel=level};DebugConsole.prototype.processMessage=function(message,maxDepth){if(maxDepth===undefined){maxDepth=0}if(typeof(message)!="object"){return(this.isDeprecated?"WARNING: debug object is deprecated, please use console object \n"+message:message)}else{function indent(str){return str.replace(/^/mg," ")}function makeStructured(obj,depth){var str="";for(var i in obj){try{if(typeof(obj[i])=="object"&&depth<maxDepth){str+=i+":\n"+indent(makeStructured(obj[i]))+"\n"}else{str+=i+" = "+indent(String(obj[i])).replace(/^ /,"")+"\n"}}catch(e){str+=i+" = EXCEPTION: "+e.message+"\n"}}return str}return("Object:\n"+makeStructured(message,maxDepth))}};DebugConsole.prototype.log=function(message,maxDepth){if(PhoneGap.available&&this.logLevel<=DebugConsole.INFO_LEVEL){PhoneGap.exec(null,null,"com.phonegap.debugconsole","log",[this.processMessage(message,maxDepth),{logLevel:"INFO"}])}else{console.log(message)}};DebugConsole.prototype.warn=function(message,maxDepth){if(PhoneGap.available&&this.logLevel<=DebugConsole.WARN_LEVEL){PhoneGap.exec(null,null,"com.phonegap.debugconsole","log",[this.processMessage(message,maxDepth),{logLevel:"WARN"}])}else{console.error(message)}};DebugConsole.prototype.error=function(message,maxDepth){if(PhoneGap.available&&this.logLevel<=DebugConsole.ERROR_LEVEL){PhoneGap.exec(null,null,"com.phonegap.debugconsole","log",[this.processMessage(message,maxDepth),{logLevel:"ERROR"}])}else{console.error(message)}};PhoneGap.addConstructor(function(){window.console=new DebugConsole()})}if(!PhoneGap.hasResource("position")){PhoneGap.addResource("position");Position=function(coords,timestamp){this.coords=Coordinates.cloneFrom(coords);this.timestamp=timestamp||new Date().getTime()};Position.prototype.equals=function(other){return(this.coords&&other&&other.coords&&this.coords.latitude==other.coords.latitude&&this.coords.longitude==other.coords.longitude)};Position.prototype.clone=function(){return new Position(this.coords?this.coords.clone():null,this.timestamp?this.timestamp:new Date().getTime())};Coordinates=function(lat,lng,alt,acc,head,vel,altAcc){this.latitude=lat;this.longitude=lng;this.altitude=alt;this.accuracy=acc;this.heading=head;this.speed=vel;this.altitudeAccuracy=(altAcc!="undefined")?altAcc:null};Coordinates.prototype.clone=function(){return new Coordinates(this.latitude,this.longitude,this.altitude,this.accuracy,this.heading,this.speed,this.altitudeAccuracy)};Coordinates.cloneFrom=function(obj){return new Coordinates(obj.latitude,obj.longitude,obj.altitude,obj.accuracy,obj.heading,obj.speed,obj.altitudeAccuracy)};PositionOptions=function(enableHighAccuracy,timeout,maximumAge){this.enableHighAccuracy=enableHighAccuracy||false;this.timeout=timeout||10000;this.maximumAge=maximumAge||0};PositionError=function(code,message){this.code=code||0;this.message=message||""};PositionError.UNKNOWN_ERROR=0;PositionError.PERMISSION_DENIED=1;PositionError.POSITION_UNAVAILABLE=2;PositionError.TIMEOUT=3}if(!PhoneGap.hasResource("acceleration")){PhoneGap.addResource("acceleration");Acceleration=function(x,y,z){this.x=x;this.y=y;this.z=z;this.timestamp=new Date().getTime()};AccelerationOptions=function(){this.timeout=10000}}if(!PhoneGap.hasResource("accelerometer")){PhoneGap.addResource("accelerometer");Accelerometer=function(){this.lastAcceleration=new Acceleration(0,0,0)};Accelerometer.prototype.getCurrentAcceleration=function(successCallback,errorCallback,options){if(typeof successCallback=="function"){successCallback(this.lastAcceleration)}};Accelerometer.prototype._onAccelUpdate=function(x,y,z){this.lastAcceleration=new Acceleration(x,y,z)};Accelerometer.prototype.watchAcceleration=function(successCallback,errorCallback,options){var frequency=(options!=undefined&&options.frequency!=undefined)?options.frequency:10000;var updatedOptions={desiredFrequency:frequency};PhoneGap.exec(null,null,"com.phonegap.accelerometer","start",[options]);return setInterval(function(){navigator.accelerometer.getCurrentAcceleration(successCallback,errorCallback,options)},frequency)};Accelerometer.prototype.clearWatch=function(watchId){PhoneGap.exec(null,null,"com.phonegap.accelerometer","stop",[]);clearInterval(watchId)};Accelerometer.install=function(){if(typeof navigator.accelerometer=="undefined"){navigator.accelerometer=new Accelerometer()}};Accelerometer.installDeviceMotionHandler=function(){if(!(window.DeviceMotionEvent==undefined)){return}var self=this;var devicemotionEvent="devicemotion";self.deviceMotionWatchId=null;self.deviceMotionListenerCount=0;self.deviceMotionLastEventTimestamp=0;var _addEventListener=window.addEventListener;var _removeEventListener=window.removeEventListener;var windowDispatchAvailable=!(window.dispatchEvent===undefined);var accelWin=function(acceleration){var evt=document.createEvent("Events");evt.initEvent(devicemotionEvent);evt.acceleration=null;evt.rotationRate=null;evt.accelerationIncludingGravity=acceleration;var currentTime=new Date().getTime();evt.interval=(self.deviceMotionLastEventTimestamp==0)?0:(currentTime-self.deviceMotionLastEventTimestamp);self.deviceMotionLastEventTimestamp=currentTime;if(windowDispatchAvailable){window.dispatchEvent(evt)}else{document.dispatchEvent(evt)}};var accelFail=function(){};window.addEventListener=function(){if(arguments[0]===devicemotionEvent){++(self.deviceMotionListenerCount);if(self.deviceMotionListenerCount==1){self.deviceMotionWatchId=navigator.accelerometer.watchAcceleration(accelWin,accelFail,{frequency:500})}}if(!windowDispatchAvailable){return document.addEventListener.apply(this,arguments)}else{return _addEventListener.apply(this,arguments)}};window.removeEventListener=function(){if(arguments[0]===devicemotionEvent){--(self.deviceMotionListenerCount);if(self.deviceMotionListenerCount==0){navigator.accelerometer.clearWatch(self.deviceMotionWatchId)}}if(!windowDispatchAvailable){return document.removeEventListener.apply(this,arguments)}else{return _removeEventListener.apply(this,arguments)}}};PhoneGap.addConstructor(Accelerometer.install);PhoneGap.addConstructor(Accelerometer.installDeviceMotionHandler)}if(!PhoneGap.hasResource("camera")){PhoneGap.addResource("camera");Camera=function(){};Camera.DestinationType={DATA_URL:0,FILE_URI:1};Camera.prototype.DestinationType=Camera.DestinationType;Camera.PictureSourceType={PHOTOLIBRARY:0,CAMERA:1,SAVEDPHOTOALBUM:2};Camera.prototype.PictureSourceType=Camera.PictureSourceType;Camera.prototype.getPicture=function(successCallback,errorCallback,options){console.warn("Camera.getPicture is deprecated and will be removed in 1.0, and put in the plugins repo. Plese use the Media Capture API instead.");if(typeof successCallback!="function"){console.log("Camera Error: successCallback is not a function");return}if(errorCallback&&(typeof errorCallback!="function")){console.log("Camera Error: errorCallback is not a function");return}PhoneGap.exec(successCallback,errorCallback,"Camera","getPicture",[options])};PhoneGap.addConstructor(function(){if(typeof navigator.camera=="undefined"){navigator.camera=new Camera()}})}if(!PhoneGap.hasResource("capture")){PhoneGap.addResource("capture");function CaptureError(){this.code=null}CaptureError.CAPTURE_INTERNAL_ERR=0;CaptureError.CAPTURE_APPLICATION_BUSY=1;CaptureError.CAPTURE_INVALID_ARGUMENT=2;CaptureError.CAPTURE_NO_MEDIA_FILES=3;CaptureError.CAPTURE_NOT_SUPPORTED=20;function Capture(){this.supportedAudioModes=[];this.supportedImageModes=[];this.supportedVideoModes=[]}Capture.prototype.captureAudio=function(successCallback,errorCallback,options){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.mediacapture","captureAudio",[options])};Capture.prototype.captureImage=function(successCallback,errorCallback,options){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.mediacapture","captureImage",[options])};Capture.prototype._castMediaFile=function(pluginResult){var mediaFiles=[];var i;for(i=0;i<pluginResult.message.length;i++){var mediaFile=new MediaFile();mediaFile.name=pluginResult.message[i].name;mediaFile.fullPath=pluginResult.message[i].fullPath;mediaFile.type=pluginResult.message[i].type;mediaFile.lastModifiedDate=pluginResult.message[i].lastModifiedDate;mediaFile.size=pluginResult.message[i].size;mediaFiles.push(mediaFile)}pluginResult.message=mediaFiles;return pluginResult};Capture.prototype.captureVideo=function(successCallback,errorCallback,options){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.mediacapture","captureVideo",[options])};function ConfigurationData(){this.type;this.height=0;this.width=0}var CaptureImageOptions=function(){this.limit=1;this.mode=null};var CaptureVideoOptions=function(){this.limit=1;this.duration=0;this.mode=null};var CaptureAudioOptions=function(){this.limit=1;this.duration=0;this.mode=null};function MediaFile(name,fullPath,type,lastModifiedDate,size){this.name=name||null;this.fullPath=fullPath||null;this.type=type||null;this.lastModifiedDate=lastModifiedDate||null;this.size=size||0}MediaFile.prototype.getFormatData=function(successCallback,errorCallback){if(typeof this.fullPath==="undefined"||this.fullPath===null){errorCallback({code:CaptureError.CAPTURE_INVALID_ARGUMENT})}else{PhoneGap.exec(successCallback,errorCallback,"com.phonegap.mediacapture","getFormatData",[this.fullPath,this.type])}};function MediaFileData(codecs,bitrate,height,width,duration){this.codecs=codecs||null;this.bitrate=bitrate||0;this.height=height||0;this.width=width||0;this.duration=duration||0}PhoneGap.addConstructor(function(){if(typeof navigator.device==="undefined"){navigator.device=window.device=new Device()}if(typeof navigator.device.capture==="undefined"){navigator.device.capture=window.device.capture=new Capture()}})}if(!PhoneGap.hasResource("contact")){PhoneGap.addResource("contact");var Contact=function(id,displayName,name,nickname,phoneNumbers,emails,addresses,ims,organizations,birthday,note,photos,categories,urls){this.id=id||null;this.displayName=displayName||null;this.name=name||null;this.nickname=nickname||null;this.phoneNumbers=phoneNumbers||null;this.emails=emails||null;this.addresses=addresses||null;this.ims=ims||null;this.organizations=organizations||null;this.birthday=birthday||null;this.note=note||null;this.photos=photos||null;this.categories=categories||null;this.urls=urls||null};Contact.prototype.convertDatesOut=function(){var dates=new Array("birthday");for(var i=0;i<dates.length;i++){var value=this[dates[i]];if(value){if(!value instanceof Date){try{value=new Date(value)}catch(exception){value=null}}if(value instanceof Date){value=value.valueOf()}this[dates[i]]=value}}};Contact.prototype.convertDatesIn=function(){var dates=new Array("birthday");for(var i=0;i<dates.length;i++){var value=this[dates[i]];if(value){try{this[dates[i]]=new Date(parseFloat(value))}catch(exception){console.log("exception creating date")}}}};Contact.prototype.remove=function(successCB,errorCB){if(this.id==null){var errorObj=new ContactError();errorObj.code=ContactError.UNKNOWN_ERROR;errorCB(errorObj)}else{PhoneGap.exec(successCB,errorCB,"com.phonegap.contacts","remove",[{contact:this}])}};Contact.prototype.display=function(errorCB,options){if(this.id==null){if(typeof errorCB=="function"){var errorObj=new ContactError();errorObj.code=ContactError.UNKNOWN_ERROR;errorCB(errorObj)}}else{PhoneGap.exec(null,errorCB,"com.phonegap.contacts","displayContact",[this.id,options])}};Contact.prototype.clone=function(){var clonedContact=PhoneGap.clone(this);clonedContact.id=null;if(clonedContact.phoneNumbers){for(i=0;i<clonedContact.phoneNumbers.length;i++){clonedContact.phoneNumbers[i].id=null}}if(clonedContact.emails){for(i=0;i<clonedContact.emails.length;i++){clonedContact.emails[i].id=null}}if(clonedContact.addresses){for(i=0;i<clonedContact.addresses.length;i++){clonedContact.addresses[i].id=null}}if(clonedContact.ims){for(i=0;i<clonedContact.ims.length;i++){clonedContact.ims[i].id=null}}if(clonedContact.organizations){for(i=0;i<clonedContact.organizations.length;i++){clonedContact.organizations[i].id=null}}if(clonedContact.photos){for(i=0;i<clonedContact.photos.length;i++){clonedContact.photos[i].id=null}}if(clonedContact.urls){for(i=0;i<clonedContact.urls.length;i++){clonedContact.urls[i].id=null}}return clonedContact};Contact.prototype.save=function(successCB,errorCB){var cloned=PhoneGap.clone(this);cloned.convertDatesOut();PhoneGap.exec(successCB,errorCB,"com.phonegap.contacts","save",[{contact:cloned}])};var ContactName=function(formatted,familyName,givenName,middle,prefix,suffix){this.formatted=formatted!="undefined"?formatted:null;this.familyName=familyName!="undefined"?familyName:null;this.givenName=givenName!="undefined"?givenName:null;this.middleName=middle!="undefined"?middle:null;this.honorificPrefix=prefix!="undefined"?prefix:null;this.honorificSuffix=suffix!="undefined"?suffix:null};var ContactField=function(type,value,pref,id){this.type=type!="undefined"?type:null;this.value=value!="undefined"?value:null;this.pref=pref!="undefined"?pref:null;this.id=id!="undefined"?id:null};var ContactAddress=function(pref,type,formatted,streetAddress,locality,region,postalCode,country,id){this.pref=pref!="undefined"?pref:null;this.type=type!="undefined"?type:null;this.formatted=formatted!="undefined"?formatted:null;this.streetAddress=streetAddress!="undefined"?streetAddress:null;this.locality=locality!="undefined"?locality:null;this.region=region!="undefined"?region:null;this.postalCode=postalCode!="undefined"?postalCode:null;this.country=country!="undefined"?country:null;this.id=id!="undefined"?id:null};var ContactOrganization=function(pref,type,name,dept,title){this.pref=pref!="undefined"?pref:null;this.type=type!="undefined"?type:null;this.name=name!="undefined"?name:null;this.department=dept!="undefined"?dept:null;this.title=title!="undefined"?title:null};var Contacts=function(){this.inProgress=false;this.records=new Array()};Contacts.prototype.find=function(fields,successCB,errorCB,options){if(successCB===null){throw new TypeError("You must specify a success callback for the find command.")}if(fields===null||fields==="undefined"||fields.length==="undefined"||fields.length<=0){if(typeof errorCB==="function"){errorCB({code:ContactError.INVALID_ARGUMENT_ERROR})}}else{PhoneGap.exec(successCB,errorCB,"com.phonegap.contacts","search",[{fields:fields,findOptions:options}])}};Contacts.prototype._findCallback=function(pluginResult){var contacts=new Array();try{for(var i=0;i<pluginResult.message.length;i++){var newContact=navigator.contacts.create(pluginResult.message[i]);newContact.convertDatesIn();contacts.push(newContact)}pluginResult.message=contacts}catch(e){console.log("Error parsing contacts: "+e)}return pluginResult};Contacts.prototype._contactCallback=function(pluginResult){var newContact=null;if(pluginResult.message){try{newContact=navigator.contacts.create(pluginResult.message);newContact.convertDatesIn()}catch(e){console.log("Error parsing contact")}}pluginResult.message=newContact;return pluginResult};Contacts.prototype._errCallback=function(pluginResult){var errorObj=new ContactError();errorObj.code=pluginResult.message;pluginResult.message=errorObj;return pluginResult};Contacts.prototype.newContactUI=function(successCallback){PhoneGap.exec(successCallback,null,"com.phonegap.contacts","newContact",[])};Contacts.prototype.chooseContact=function(successCallback,options){PhoneGap.exec(successCallback,null,"com.phonegap.contacts","chooseContact",options)};Contacts.prototype.create=function(properties){var i;var contact=new Contact();for(i in properties){if(contact[i]!=="undefined"){contact[i]=properties[i]}}return contact};var ContactFindOptions=function(filter,multiple,updatedSince){this.filter=filter||"";this.multiple=multiple||false};var ContactError=function(){this.code=null};ContactError.UNKNOWN_ERROR=0;ContactError.INVALID_ARGUMENT_ERROR=1;ContactError.TIMEOUT_ERROR=2;ContactError.PENDING_OPERATION_ERROR=3;ContactError.IO_ERROR=4;ContactError.NOT_SUPPORTED_ERROR=5;ContactError.PERMISSION_DENIED_ERROR=20;PhoneGap.addConstructor(function(){if(typeof navigator.contacts=="undefined"){navigator.contacts=new Contacts()}})}if(!PhoneGap.hasResource("device")){PhoneGap.addResource("device");Device=function(){this.platform=null;this.version=null;this.name=null;this.phonegap=null;this.uuid=null;try{this.platform=DeviceInfo.platform;this.version=DeviceInfo.version;this.name=DeviceInfo.name;this.phonegap=DeviceInfo.gap;this.uuid=DeviceInfo.uuid}catch(e){}this.available=PhoneGap.available=this.uuid!=null};PhoneGap.addConstructor(function(){if(typeof navigator.device==="undefined"){navigator.device=window.device=new Device()}})}if(!PhoneGap.hasResource("file")){PhoneGap.addResource("file");FileProperties=function(filePath){this.filePath=filePath;this.size=0;this.lastModifiedDate=null};File=function(name,fullPath,type,lastModifiedDate,size){this.name=name||null;this.fullPath=fullPath||null;this.type=type||null;this.lastModifiedDate=lastModifiedDate||null;this.size=size||0};File._createEvent=function(type,target){var evt={type:type};evt.target=target;return evt};FileError=function(){this.code=null};FileError.NOT_FOUND_ERR=1;FileError.SECURITY_ERR=2;FileError.ABORT_ERR=3;FileError.NOT_READABLE_ERR=4;FileError.ENCODING_ERR=5;FileError.NO_MODIFICATION_ALLOWED_ERR=6;FileError.INVALID_STATE_ERR=7;FileError.SYNTAX_ERR=8;FileError.INVALID_MODIFICATION_ERR=9;FileError.QUOTA_EXCEEDED_ERR=10;FileError.TYPE_MISMATCH_ERR=11;FileError.PATH_EXISTS_ERR=12;FileMgr=function(){};FileMgr.prototype.testFileExists=function(fileName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","testFileExists",[fileName])};FileMgr.prototype.testDirectoryExists=function(dirName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","testDirectoryExists",[dirName])};FileMgr.prototype.getFreeDiskSpace=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","getFreeDiskSpace",[])};FileMgr.prototype.write=function(fileName,data,position,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","write",[fileName,data,position])};FileMgr.prototype.truncate=function(fileName,size,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","truncateFile",[fileName,size])};FileMgr.prototype.readAsText=function(fileName,encoding,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","readFile",[fileName,encoding])};FileMgr.prototype.readAsDataURL=function(fileName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","readAsDataURL",[fileName])};PhoneGap.addConstructor(function(){if(typeof navigator.fileMgr==="undefined"){navigator.fileMgr=new FileMgr()}});FileReader=function(){this.fileName="";this.readyState=0;this.result=null;this.error=null;this.onloadstart=null;this.onprogress=null;this.onload=null;this.onerror=null;this.onloadend=null;this.onabort=null};FileReader.EMPTY=0;FileReader.LOADING=1;FileReader.DONE=2;FileReader.prototype.abort=function(){var evt;this.readyState=FileReader.DONE;this.result=null;var error=new FileError();error.code=error.ABORT_ERR;this.error=error;if(typeof this.onerror==="function"){evt=File._createEvent("error",this);this.onerror(evt)}if(typeof this.onabort==="function"){evt=File._createEvent("abort",this);this.onabort(evt)}if(typeof this.onloadend==="function"){evt=File._createEvent("loadend",this);this.onloadend(evt)}};FileReader.prototype.readAsText=function(file,encoding){this.fileName="";if(typeof file.fullPath==="undefined"){this.fileName=file}else{this.fileName=file.fullPath}this.readyState=FileReader.LOADING;if(typeof this.onloadstart==="function"){var evt=File._createEvent("loadstart",this);this.onloadstart(evt)}var enc=encoding?encoding:"UTF-8";var me=this;navigator.fileMgr.readAsText(this.fileName,enc,function(r){var evt;if(me.readyState===FileReader.DONE){return}me.result=decodeURIComponent(r);if(typeof me.onload==="function"){evt=File._createEvent("load",me);me.onload(evt)}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){evt=File._createEvent("loadend",me);me.onloadend(evt)}},function(e){var evt;if(me.readyState===FileReader.DONE){return}me.error=e;if(typeof me.onerror==="function"){evt=File._createEvent("error",me);me.onerror(evt)}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){evt=File._createEvent("loadend",me);me.onloadend(evt)}})};FileReader.prototype.readAsDataURL=function(file){this.fileName="";if(typeof file.fullPath==="undefined"){this.fileName=file}else{this.fileName=file.fullPath}this.readyState=FileReader.LOADING;if(typeof this.onloadstart==="function"){var evt=File._createEvent("loadstart",this);this.onloadstart(evt)}var me=this;navigator.fileMgr.readAsDataURL(this.fileName,function(r){var evt;if(me.readyState===FileReader.DONE){return}me.result=r;if(typeof me.onload==="function"){evt=File._createEvent("load",me);me.onload(evt)}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){evt=File._createEvent("loadend",me);me.onloadend(evt)}},function(e){var evt;if(me.readyState===FileReader.DONE){return}me.error=e;if(typeof me.onerror==="function"){evt=File._createEvent("error",me);me.onerror(evt)}me.readyState=FileReader.DONE;if(typeof me.onloadend==="function"){evt=File._createEvent("loadend",me);me.onloadend(evt)}})};FileReader.prototype.readAsBinaryString=function(file){this.fileName=file};FileReader.prototype.readAsArrayBuffer=function(file){this.fileName=file};FileWriter=function(file){this.fileName="";this.length=0;if(file){this.fileName=file.fullPath||file;this.length=file.size||0}this.position=0;this.readyState=0;this.result=null;this.error=null;this.onwritestart=null;this.onprogress=null;this.onwrite=null;this.onwriteend=null;this.onabort=null;this.onerror=null};FileWriter.INIT=0;FileWriter.WRITING=1;FileWriter.DONE=2;FileWriter.prototype.abort=function(){if(this.readyState===FileWriter.DONE||this.readyState===FileWriter.INIT){throw FileError.INVALID_STATE_ERR}var error=new FileError(),evt;error.code=error.ABORT_ERR;this.error=error;if(typeof this.onerror==="function"){evt=File._createEvent("error",this);this.onerror(evt)}if(typeof this.onabort==="function"){evt=File._createEvent("abort",this);this.onabort(evt)}this.readyState=FileWriter.DONE;if(typeof this.onwriteend=="function"){evt=File._createEvent("writeend",this);this.onwriteend(evt)}};FileWriter.prototype.writeAsText=function(file,text,bAppend){if(this.readyState===FileWriter.WRITING){throw FileError.INVALID_STATE_ERR}if(bAppend!==true){bAppend=false}this.fileName=file;this.readyState=FileWriter.WRITING;var me=this;if(typeof me.onwritestart==="function"){var evt=File._createEvent("writestart",me);me.onwritestart(evt)}navigator.fileMgr.writeAsText(file,text,bAppend,function(r){var evt;if(me.readyState===FileWriter.DONE){return}me.result=r;if(typeof me.onwrite==="function"){evt=File._createEvent("write",me);me.onwrite(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}},function(e){var evt;if(me.readyState===FileWriter.DONE){return}me.error=e;if(typeof me.onerror==="function"){evt=File._createEvent("error",me);me.onerror(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}})};FileWriter.prototype.write=function(text){if(this.readyState===FileWriter.WRITING){throw FileError.INVALID_STATE_ERR}this.readyState=FileWriter.WRITING;var me=this;if(typeof me.onwritestart==="function"){var evt=File._createEvent("writestart",me);me.onwritestart(evt)}navigator.fileMgr.write(this.fileName,text,this.position,function(r){var evt;if(me.readyState===FileWriter.DONE){return}me.position+=r;me.length=me.position;if(typeof me.onwrite==="function"){evt=File._createEvent("write",me);me.onwrite(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}},function(e){var evt;if(me.readyState===FileWriter.DONE){return}me.error=e;if(typeof me.onerror==="function"){evt=File._createEvent("error",me);me.onerror(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}})};FileWriter.prototype.seek=function(offset){if(this.readyState===FileWriter.WRITING){throw FileError.INVALID_STATE_ERR}if(!offset){return}if(offset<0){this.position=Math.max(offset+this.length,0)}else{if(offset>this.length){this.position=this.length}else{this.position=offset}}};FileWriter.prototype.truncate=function(size){if(this.readyState===FileWriter.WRITING){throw FileError.INVALID_STATE_ERR}this.readyState=FileWriter.WRITING;var me=this;if(typeof me.onwritestart==="function"){var evt=File._createEvent("writestart",me);me.onwritestart(evt)}navigator.fileMgr.truncate(this.fileName,size,function(r){var evt;if(me.readyState===FileWriter.DONE){return}me.length=r;me.position=Math.min(me.position,r);if(typeof me.onwrite==="function"){evt=File._createEvent("write",me);me.onwrite(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}},function(e){var evt;if(me.readyState===FileWriter.DONE){return}me.error=e;if(typeof me.onerror==="function"){evt=File._createEvent("error",me);me.onerror(evt)}me.readyState=FileWriter.DONE;if(typeof me.onwriteend==="function"){evt=File._createEvent("writeend",me);me.onwriteend(evt)}})};LocalFileSystem=function(){};LocalFileSystem.TEMPORARY=0;LocalFileSystem.PERSISTENT=1;LocalFileSystem.RESOURCE=2;LocalFileSystem.APPLICATION=3;LocalFileSystem.prototype.requestFileSystem=function(type,size,successCallback,errorCallback){if(type<0||type>3){if(typeof errorCallback=="function"){errorCallback({code:FileError.SYNTAX_ERR})}}else{PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","requestFileSystem",[type,size])}};LocalFileSystem.prototype.resolveLocalFileSystemURI=function(uri,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","resolveLocalFileSystemURI",[uri])};LocalFileSystem.prototype._castFS=function(pluginResult){var entry=null;entry=new DirectoryEntry();entry.isDirectory=pluginResult.message.root.isDirectory;entry.isFile=pluginResult.message.root.isFile;entry.name=pluginResult.message.root.name;entry.fullPath=pluginResult.message.root.fullPath;pluginResult.message.root=entry;return pluginResult};LocalFileSystem.prototype._castEntry=function(pluginResult){var entry=null;if(pluginResult.message.isDirectory){entry=new DirectoryEntry()}else{if(pluginResult.message.isFile){entry=new FileEntry()}}entry.isDirectory=pluginResult.message.isDirectory;entry.isFile=pluginResult.message.isFile;entry.name=pluginResult.message.name;entry.fullPath=pluginResult.message.fullPath;pluginResult.message=entry;return pluginResult};LocalFileSystem.prototype._castEntries=function(pluginResult){var entries=pluginResult.message;var retVal=[];for(i=0;i<entries.length;i++){retVal.push(window.localFileSystem._createEntry(entries[i]))}pluginResult.message=retVal;return pluginResult};LocalFileSystem.prototype._createEntry=function(castMe){var entry=null;if(castMe.isDirectory){entry=new DirectoryEntry()}else{if(castMe.isFile){entry=new FileEntry()}}entry.isDirectory=castMe.isDirectory;entry.isFile=castMe.isFile;entry.name=castMe.name;entry.fullPath=castMe.fullPath;return entry};LocalFileSystem.prototype._castDate=function(pluginResult){if(pluginResult.message.modificationTime){var metadataObj=new Metadata();metadataObj.modificationTime=new Date(pluginResult.message.modificationTime);pluginResult.message=metadataObj}else{if(pluginResult.message.lastModifiedDate){var file=new File();file.size=pluginResult.message.size;file.type=pluginResult.message.type;file.name=pluginResult.message.name;file.fullPath=pluginResult.message.fullPath;file.lastModifiedDate=new Date(pluginResult.message.lastModifiedDate);pluginResult.message=file}}return pluginResult};LocalFileSystem.prototype._castError=function(pluginResult){var fileError=new FileError();fileError.code=pluginResult.message;pluginResult.message=fileError;return pluginResult};Metadata=function(){this.modificationTime=null};Flags=function(create,exclusive){this.create=create||false;this.exclusive=exclusive||false};FileSystem=function(){this.name=null;this.root=null};DirectoryEntry=function(){this.isFile=false;this.isDirectory=true;this.name=null;this.fullPath=null;this.filesystem=null};DirectoryEntry.prototype.copyTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","copyTo",[this.fullPath,parent,newName])};DirectoryEntry.prototype.getMetadata=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","getMetadata",[this.fullPath])};DirectoryEntry.prototype.getParent=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","getParent",[this.fullPath])};DirectoryEntry.prototype.moveTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","moveTo",[this.fullPath,parent,newName])};DirectoryEntry.prototype.remove=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","remove",[this.fullPath])};DirectoryEntry.prototype.toURI=function(mimeType,successCallback,errorCallback){return"file://localhost"+this.fullPath};DirectoryEntry.prototype.createReader=function(successCallback,errorCallback){return new DirectoryReader(this.fullPath)};DirectoryEntry.prototype.getDirectory=function(path,options,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","getDirectory",[this.fullPath,path,options])};DirectoryEntry.prototype.getFile=function(path,options,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","getFile",[this.fullPath,path,options])};DirectoryEntry.prototype.removeRecursively=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","removeRecursively",[this.fullPath])};DirectoryReader=function(fullPath){this.fullPath=fullPath||null};DirectoryReader.prototype.readEntries=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","readEntries",[this.fullPath])};FileEntry=function(){this.isFile=true;this.isDirectory=false;this.name=null;this.fullPath=null;this.filesystem=null};FileEntry.prototype.copyTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","copyTo",[this.fullPath,parent,newName])};FileEntry.prototype.getMetadata=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","getMetadata",[this.fullPath])};FileEntry.prototype.getParent=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","getParent",[this.fullPath])};FileEntry.prototype.moveTo=function(parent,newName,successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","moveTo",[this.fullPath,parent,newName])};FileEntry.prototype.remove=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","remove",[this.fullPath])};FileEntry.prototype.toURI=function(mimeType,successCallback,errorCallback){return"file://localhost"+this.fullPath};FileEntry.prototype.createWriter=function(successCallback,errorCallback){this.file(function(filePointer){var writer=new FileWriter(filePointer);if(writer.fileName==null||writer.fileName==""){if(typeof errorCallback=="function"){errorCallback({code:FileError.INVALID_STATE_ERR})}}if(typeof successCallback=="function"){successCallback(writer)}},errorCallback)};FileEntry.prototype.file=function(successCallback,errorCallback){PhoneGap.exec(successCallback,errorCallback,"com.phonegap.file","getFileMetadata",[this.fullPath])};PhoneGap.addConstructor(function(){var pgLocalFileSystem=new LocalFileSystem();if(typeof window.localFileSystem=="undefined"){window.localFileSystem=pgLocalFileSystem}if(typeof window.requestFileSystem=="undefined"){window.requestFileSystem=pgLocalFileSystem.requestFileSystem}if(typeof window.resolveLocalFileSystemURI=="undefined"){window.resolveLocalFileSystemURI=pgLocalFileSystem.resolveLocalFileSystemURI}})}if(!PhoneGap.hasResource("filetransfer")){PhoneGap.addResource("filetransfer");FileTransfer=function(){};FileUploadResult=function(){this.bytesSent=0;this.responseCode=null;this.response=null};FileTransferError=function(errorCode){this.code=errorCode||null};FileTransferError.FILE_NOT_FOUND_ERR=1;FileTransferError.INVALID_URL_ERR=2;FileTransferError.CONNECTION_ERR=3;FileTransfer.prototype.upload=function(filePath,server,successCallback,errorCallback,options){if(!options.params){options.params={}}options.filePath=filePath;options.server=server;if(!options.fileKey){options.fileKey="file"}if(!options.fileName){options.fileName="image.jpg"}if(!options.mimeType){options.mimeType="image/jpeg"}if(typeof successCallback!="function"){console.log("FileTransfer Error: successCallback is not a function");return}if(errorCallback&&(typeof errorCallback!="function")){console.log("FileTransfer Error: errorCallback is not a function");return}PhoneGap.exec(successCallback,errorCallback,"com.phonegap.filetransfer","upload",[options])};FileTransfer.prototype._castTransferError=function(pluginResult){var fileError=new FileTransferError(pluginResult.message);pluginResult.message=fileError;return pluginResult};FileTransfer.prototype._castUploadResult=function(pluginResult){var result=new FileUploadResult();result.bytesSent=pluginResult.message.bytesSent;result.responseCode=pluginResult.message.responseCode;result.response=decodeURIComponent(pluginResult.message.response);pluginResult.message=result;return pluginResult};FileUploadOptions=function(fileKey,fileName,mimeType,params){this.fileKey=fileKey||null;this.fileName=fileName||null;this.mimeType=mimeType||null;this.params=params||null};PhoneGap.addConstructor(function(){if(typeof navigator.fileTransfer=="undefined"){navigator.fileTransfer=new FileTransfer()}})}if(!PhoneGap.hasResource("geolocation")){PhoneGap.addResource("geolocation");Geolocation=function(){this.lastPosition=null;this.listener=null;this.timeoutTimerId=0};Geolocation.prototype.getCurrentPosition=function(successCallback,errorCallback,options){var win=successCallback;if(!win||typeof(win)!="function"){win=function(position){}}var fail=errorCallback;if(!fail||typeof(fail)!="function"){fail=function(positionError){}}var self=this;var totalTime=0;var timeoutTimerId;var params=new PositionOptions();if(options){if(options.maximumAge){if(this.lastPosition){var now=new Date().getTime();if(now-this.lastPosition.timestamp<options.maximumAge){win(this.lastPosition);return}}params.maximumAge=options.maximumAge}if(options.enableHighAccuracy){params.enableHighAccuracy=(options.enableHighAccuracy==true)}if(options.timeout){params.timeout=options.timeout}}this.listener={success:win,fail:fail};this.start(params);var onTimeout=function(){self.setError(new PositionError(PositionError.TIMEOUT,"Geolocation Error: Timeout."))};this.timeoutTimerId=setTimeout(onTimeout,params.timeout)};Geolocation.prototype.watchPosition=function(successCallback,errorCallback,options){var self=this;var params=new PositionOptions();if(options){if(options.maximumAge){params.maximumAge=options.maximumAge}if(options.enableHighAccuracy){params.enableHighAccuracy=options.enableHighAccuracy}if(options.timeout){params.timeout=options.timeout}}var that=this;var lastPos=that.lastPosition?that.lastPosition.clone():null;return setInterval(function(){var filterFun=function(position){if(lastPos==null||!position.equals(lastPos)){successCallback(position)}lastPos=position.clone()};that.getCurrentPosition(filterFun,errorCallback,params)},params.timeout)};Geolocation.prototype.clearWatch=function(watchId){clearInterval(watchId)};Geolocation.prototype.setLocation=function(position){var _position=new Position(position.coords,position.timestamp);if(this.timeoutTimerId){clearTimeout(this.timeoutTimerId);this.timeoutTimerId=0}this.lastError=null;this.lastPosition=_position;if(this.listener&&typeof(this.listener.success)=="function"){this.listener.success(_position)}this.listener=null};Geolocation.prototype.setError=function(error){var _error=new PositionError(error.code,error.message);if(this.timeoutTimerId){clearTimeout(this.timeoutTimerId);this.timeoutTimerId=0}this.lastError=_error;if(this.listener&&typeof(this.listener.fail)=="function"){this.listener.fail(_error)}this.listener=null};Geolocation.prototype.start=function(positionOptions){PhoneGap.exec(null,null,"com.phonegap.geolocation","startLocation",[positionOptions])};Geolocation.prototype.stop=function(){PhoneGap.exec(null,null,"com.phonegap.geolocation","stopLocation",[])};PhoneGap.addConstructor(function(){if(typeof navigator._geo=="undefined"){var __proxyObj=function(origObj,proxyObj,funkList){var replaceFunk=function(org,proxy,fName){org[fName]=function(){return proxy[fName].apply(proxy,arguments)}};for(var v in funkList){replaceFunk(origObj,proxyObj,funkList[v])}};navigator._geo=new Geolocation();__proxyObj(navigator.geolocation,navigator._geo,["setLocation","getCurrentPosition","watchPosition","clearWatch","setError","start","stop"])}})}if(!PhoneGap.hasResource("compass")){PhoneGap.addResource("compass");Compass=function(){this.lastHeading=null;this.lastError=null;this.callbacks={onHeadingChanged:[],onError:[]}};Compass.prototype.getCurrentHeading=function(successCallback,errorCallback,options){if(this.lastHeading==null){this.callbacks.onHeadingChanged.push(successCallback);this.callbacks.onError.push(errorCallback);this.start(options)}else{if(options.maximumAge){var now=new Date().getTime();if(now-this.lastHeading.timestamp>options.maximumAge){this.callbacks.onHeadingChanged.push(successCallback);this.callbacks.onError.push(errorCallback);this.start(options);return}}if(typeof successCallback=="function"){var returnHeading=-1;if(this.lastHeading.trueHeading>-1){returnHeading=this.lastHeading.trueHeading}else{if(this.lastHeading.magneticHeading){returnHeading=this.lastHeading.magneticHeading}}successCallback(returnHeading)}}};Compass.prototype.watchHeading=function(successCallback,errorCallback,options){var frequency=(options&&options.frequency)?options.frequency:1000;var self=this;var funk=function(){self.getCurrentHeading(successCallback,errorCallback,options)};funk();return setInterval(funk,frequency)};Compass.prototype.clearWatch=function(watchId){clearInterval(watchId)};Compass.prototype.setHeading=function(heading){this.lastHeading=heading;var returnHeading=-1;if(this.lastHeading.trueHeading>-1){returnHeading=this.lastHeading.trueHeading}else{if(this.lastHeading.magneticHeading){returnHeading=this.lastHeading.magneticHeading}}var arr=this.callbacks.onHeadingChanged;for(var i=0,len=arr.length;i<len;i++){arr[i](returnHeading)}this.callbacks.onHeadingChanged=[];this.callbacks.onError=[]};Compass.prototype.setError=function(message){this.lastError=message;var arr=this.callbacks.onError;for(var i=0,len=arr.length;i<len;i++){arr[i](message)}this.callbacks.onHeadingChanged=[];this.callbacks.onError=[];this.stop()};Compass.prototype.start=function(options){PhoneGap.exec(null,null,"com.phonegap.geolocation","startHeading",[options])};Compass.prototype.stop=function(){PhoneGap.exec(null,null,"com.phonegap.geolocation","stopHeading",[])};PhoneGap.addConstructor(function(){if(typeof navigator.compass=="undefined"){navigator.compass=new Compass()}})}if(!PhoneGap.hasResource("media")){PhoneGap.addResource("media");Media=function(src,successCallback,errorCallback,downloadCompleteCallback){if(!src){src="documents://"+String((new Date()).getTime()).replace(/\D/gi,"")}this.src=src;var successCB=(successCallback==undefined||successCallback==null)?null:GetFunctionName(successCallback);var errorCB=(errorCallback==undefined||errorCallback==null)?null:GetFunctionName(errorCallback);var downloadCB=(downloadCompleteCallback==undefined||downloadCompleteCallback==null)?null:GetFunctionName(downloadCompleteCallback);this.successCallback=successCallback||null;this.errorCallback=errorCallback||null;this.downloadCompleteCallback=downloadCompleteCallback||null;if(this.src!=null){PhoneGap.exec(null,null,"com.phonegap.media","prepare",[this.src,successCB,errorCB,downloadCB])}};Media.prototype.play=function(options){if(this.src!=null){PhoneGap.exec(null,null,"com.phonegap.media","play",[this.src,options])}};Media.prototype.pause=function(){if(this.src!=null){PhoneGap.exec(null,null,"com.phonegap.media","pause",[this.src])}};Media.prototype.stop=function(){if(this.src!=null){PhoneGap.exec(null,null,"com.phonegap.media","stop",[this.src])}};Media.prototype.startAudioRecord=function(options){if(this.src!=null){PhoneGap.exec(null,null,"com.phonegap.media","startAudioRecord",[this.src,options])}};Media.prototype.stopAudioRecord=function(){if(this.src!=null){PhoneGap.exec(null,null,"com.phonegap.media","stopAudioRecord",[this.src])}};MediaError=function(){this.code=null,this.message=""};MediaError.MEDIA_ERR_ABORTED=1;MediaError.MEDIA_ERR_NETWORK=2;MediaError.MEDIA_ERR_DECODE=3;MediaError.MEDIA_ERR_NONE_SUPPORTED=4}if(!PhoneGap.hasResource("notification")){PhoneGap.addResource("notification");Notification=function(){};Notification.prototype.alert=function(message,completeCallback,title,buttonLabel){var _title=(title||"Alert");var _buttonLabel=(buttonLabel||"OK");PhoneGap.exec(completeCallback,null,"com.phonegap.notification","alert",[message,{title:_title,buttonLabel:_buttonLabel}])};Notification.prototype.confirm=function(message,resultCallback,title,buttonLabels){var _title=(title||"Confirm");var _buttonLabels=(buttonLabels||"OK,Cancel");this.alert(message,resultCallback,_title,_buttonLabels)};Notification.prototype.blink=function(count,colour){};Notification.prototype.vibrate=function(mills){PhoneGap.exec(null,null,"com.phonegap.notification","vibrate",[])};Notification.prototype.beep=function(count,volume){new Media("beep.wav").play()};PhoneGap.addConstructor(function(){if(typeof navigator.notification=="undefined"){navigator.notification=new Notification()}})}if(!PhoneGap.hasResource("orientation")){PhoneGap.addResource("orientation");Orientation=function(){this.currentOrientation=null};Orientation.prototype.setOrientation=function(orientation){Orientation.currentOrientation=orientation;var e=document.createEvent("Events");e.initEvent("orientationChanged","false","false");e.orientation=orientation;document.dispatchEvent(e)};Orientation.prototype.getCurrentOrientation=function(successCallback,errorCallback){};Orientation.prototype.watchOrientation=function(successCallback,errorCallback){this.getCurrentPosition(successCallback,errorCallback);return setInterval(function(){navigator.orientation.getCurrentOrientation(successCallback,errorCallback)},10000)};Orientation.prototype.clearWatch=function(watchId){clearInterval(watchId)};Orientation.install=function(){if(typeof navigator.orientation=="undefined"){navigator.orientation=new Orientation()}var windowDispatchAvailable=!(window.dispatchEvent===undefined);if(windowDispatchAvailable){return}var self=this;var orientationchangeEvent="orientationchange";var newOrientationchangeEvent="orientationchange_pg";var _addEventListener=window.addEventListener;var _removeEventListener=window.removeEventListener;window.onorientationchange=function(){PhoneGap.fireEvent(newOrientationchangeEvent,window)};window.addEventListener=function(){if(arguments[0]===orientationchangeEvent){arguments[0]=newOrientationchangeEvent}if(!windowDispatchAvailable){return document.addEventListener.apply(this,arguments)}else{return _addEventListener.apply(this,arguments)}};window.removeEventListener=function(){if(arguments[0]===orientationchangeEvent){arguments[0]=newOrientationchangeEvent}if(!windowDispatchAvailable){return document.removeEventListener.apply(this,arguments)}else{return _removeEventListener.apply(this,arguments)}}};PhoneGap.addConstructor(Orientation.install)}if(!PhoneGap.hasResource("sms")){PhoneGap.addResource("sms");Sms=function(){};Sms.prototype.send=function(number,message,successCallback,errorCallback,options){};PhoneGap.addConstructor(function(){if(typeof navigator.sms=="undefined"){navigator.sms=new Sms()}})}if(!PhoneGap.hasResource("telephony")){PhoneGap.addResource("telephony");Telephony=function(){};Telephony.prototype.call=function(number){};PhoneGap.addConstructor(function(){if(typeof navigator.telephony=="undefined"){navigator.telephony=new Telephony()}})}if(!PhoneGap.hasResource("network")){PhoneGap.addResource("network");Connection=function(){this.type=Connection.UNKNOWN;try{this.type=DeviceInfo.connection.type}catch(e){}};Connection.UNKNOWN="unknown";Connection.ETHERNET="ethernet";Connection.WIFI="wifi";Connection.CELL_2G="2g";Connection.CELL_3G="3g";Connection.CELL_4G="4g";Connection.NONE="none";PhoneGap.addConstructor(function(){if(typeof navigator.network=="undefined"){navigator.network={}}if(typeof navigator.network.connection=="undefined"){navigator.network.connection=new Connection()}})};
View
28 install
@@ -0,0 +1,28 @@
+#!/usr/bin/env ruby
+
+def replace_in_file(filepath, regexp, *args, &block)
+ content = File.read(filepath).gsub(regexp, *args, &block)
+ File.open(filepath, 'wb') { |file| file.write(content) }
+end
+
+file = File.expand_path(ARGV[0])
+platform = ( File.extension(file) == ".plist" ? "ios" : "android" )
+
+if (platform == "ios")
+ replace_in_file(file, /\s*<key>com.phonegap.facebook.Connect<\/key>\n/mi) do |match|
+ ""
+ end
+ replace_in_file(file, /\s*<string>FacebookConnectPlugin<\/string>\n/mi) do |match|
+ ""
+ end
+ replace_in_file(file, /<key>Plugins<\/key>\n\s*<dict>/mi) do |match|
+ "<key>Plugins</key>\n\t<dict>\n\t\t<key>com.phonegap.facebook.Connect</key>\n\t\t<string>FacebookConnectPlugin</string>"
+ end
+elsif (platform == "android")
+ replace_in_file(file, /<plugin name="com.phonegap.facebook.Connect" value="com.phonegap.facebook.ConnectPlugin" \/>\n/mi) do |match|
+ ""
+ end
+ replace_in_file(file, /\s*<\/plugins>/mi) do |match|
+ "\t<plugin name=\"com.phonegap.facebook.Connect\" value=\"com.phonegap.facebook.ConnectPlugin\" />\n</plugins>"
+ end
+end
View
1  install.bat
@@ -0,0 +1 @@
+cscript install.js
View
13 install.js
@@ -0,0 +1,13 @@
+function replaceInFile(filename, regexp, replacement) {
+ var fso = WScript.CreateObject("Scripting.FileSystemObject");
+ var s = fso.OpenTextFile(filename, 1, true).ReadAll();
+ s = s.replace(regexp, replacement);
+ var f = fso.OpenTextFile(filename, 2, true);
+ f.Write(s);
+ f.Close();
+}
+
+file = File.expand_path(ARGV[0])
+
+replaceInFile(file, /<plugin name="com.phonegap.facebook.Connect" value="com.phonegap.facebook.ConnectPlugin" \/>\n/gm, "");
+replaceInFile(file, /\s*<\/plugins>/gm, "\t<plugin name=\"com.phonegap.facebook.Connect\" value=\"com.phonegap.facebook.ConnectPlugin\" />\n</plugins>");
View
46 app/www/facebook.js → lib/facebook_js_sdk.js
@@ -1,10 +1,4 @@
-/*
-This is the facebook js sdk and I am putting it here for convenience.
-
-This content is licensed Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)
-
-The Copyright belongs to whomever wrote this code ... probably Facebook :)
-*/
+/*1307080162,169588329,JIT Construction: v386815,en_US*/
if (!window.FB) window.FB = {
_apiKey: null,
_session: null,
@@ -1294,40 +1288,18 @@ FB.provide('', {
return;
}
-// if (FB._phonegap) {
-// if (a.method == 'permissions.request') {
-// // TODO: check wtf b arg is all about...
-// PhoneGap.exec(function(e) { // login
-// FB.Auth.setSession(e.session, 'connected');
-// if (b) b(e);
-// }, null, 'com.facebook.phonegap.Connect', 'login', a.perms.split(',') );
-// return;
-// } else if (a.method == 'auth.logout') { // logout
-// PhoneGap.exec(function(e) {
-// FB.Auth.setSession(null, 'notConnected');
-// if (b) b(e);
-// }, null, 'com.facebook.phonegap.Connect', 'logout', []);
-// return;
-// } else if (a.method == 'auth.status') { // getLoginStatus
-// PhoneGap.exec(function(e) {
-// if (b) b(e);
-// }, null, 'com.facebook.phonegap.Connect', 'getLoginStatus', []);
-// return;
-// }
-// }
-
- // If the phonegap arg is specified then call out to the phonegap plugin
+ // If the nativeInterface arg is specified then call out to the nativeInterface
// which uses the native app rather than using the iframe / popup web
- if (FB._phonegap) {
+ if (FB._nativeInterface) {
switch (f.method) {
case 'permissions.request':
- FB._phonegap.login(b, f);
+ FB._nativeInterface.login(b, f);
break;
case 'auth.logout':
- FB._phonegap.logout(b);
+ FB._nativeInterface.logout(b);
break;
case 'auth.status':
- FB._phonegap.getLoginStatus(b);
+ FB._nativeInterface.getLoginStatus(b);
break;
}
return;
@@ -1853,9 +1825,9 @@ FB.provide('', {
status: true
});
FB._apiKey = a.appId || a.apiKey;
- FB._phonegap = a.phonegap;
- if (FB._phonegap) {
- FB._phonegap.init(FB._apiKey);
+ FB._nativeInterface = a.nativeInterface;
+ if (FB._nativeInterface) {
+ FB._nativeInterface.init(FB._apiKey);
}
if (!a.logging && window.location.toString().indexOf('fb_debug=1') < 0) FB._logging = false;
FB.XD.init(a.channelUrl);
View
10 package.json
@@ -1,15 +1,15 @@
{
"author": "Jesse MacFadyen, Brian LeRoux",
- "name": "com.facebook.phonegap",
- "description": "Facebook Connect PhoneGap Plugin",
+ "name": "com.phonegap.facebook",
+ "description": "PhoneGap Facebook Connect Plugin",
"version": "0.0.1",
"repository": {
"type": "git",
- "url": "git://github.com/brianleroux/FacebookConnectPhoneGapPlug.git"
+ "url": "git://github.com/davejohnson/phonegap-plugin-facebook-connect.git"
},
"engines": {
- "phonegap": "0.9.5"
+ "phonegap": "1.0.0"
},
"dependencies": {},
- "devDependencies": {}
+ "development_dependencies": {}
}
View
0  test/facebook-connect-tests.js → test/pg-plugin-fb-connect-tests.js
File renamed without changes
View
8 www/pg-plugin-fb-connect.js
@@ -1,24 +1,24 @@
PG = ( typeof PG == 'undefined' ? {} : PG );
PG.FB = {
init: function(apiKey) {
- PhoneGap.exec(null, null, 'com.facebook.phonegap.Connect', 'init', [apiKey]);
+ PhoneGap.exec(null, null, 'com.phonegap.facebook.Connect', 'init', [apiKey]);
},
login: function(a, b) {
b = b || { perms: '' };
PhoneGap.exec(function(e) { // login
FB.Auth.setSession(e.session, 'connected');
if (a) a(e);
- }, null, 'com.facebook.phonegap.Connect', 'login', b.perms.split(',') );
+ }, null, 'com.phonegap.facebook.Connect', 'login', b.perms.split(',') );
},
logout: function(cb) {
PhoneGap.exec(function(e) {
FB.Auth.setSession(null, 'notConnected');
if (cb) cb(e);
- }, null, 'com.facebook.phonegap.Connect', 'logout', []);
+ }, null, 'com.phonegap.facebook.Connect', 'logout', []);
},
getLoginStatus: function(cb) {
PhoneGap.exec(function(e) {
if (cb) cb(e);
- }, null, 'com.facebook.phonegap.Connect', 'getLoginStatus', []);
+ }, null, 'com.phonegap.facebook.Connect', 'getLoginStatus', []);
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.