[tuxdroid-svn] r5755 - software_suite_v3/software/plugin/plugin-facebook/branches/october_release/s
Status: Beta
Brought to you by:
ks156
|
From: jerome <c2m...@c2...> - 2009-10-20 15:42:57
|
Author: jerome
Date: 2009-10-20 17:42:29 +0200 (Tue, 20 Oct 2009)
New Revision: 5755
Modified:
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookConnection.java
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookFunctions.java
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookPlugin.java
Log:
* Updated promptAuthorizations function.
* Removed two unused constants.
Modified: software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookConnection.java
===================================================================
--- software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookConnection.java 2009-10-20 15:29:04 UTC (rev 5754)
+++ software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookConnection.java 2009-10-20 15:42:29 UTC (rev 5755)
@@ -23,6 +23,7 @@
package com.kysoh.plugins.facebook;
import java.io.IOException;
+import java.util.List;
import com.google.code.facebookapi.FacebookException;
import com.google.code.facebookapi.FacebookJsonRestClient;
@@ -33,7 +34,11 @@
private FacebookJsonRestClient client;
+ //Auth options.
+ public static final byte AUTH_PUBLISH_FEEDS = 0;
+ public static final byte AUTH_READ_MAILBOX = 1;
+
public boolean Connect(String username, String password)
{
FacebookSessionUtils.setMail(username);
@@ -103,15 +108,28 @@
/**
* Prompt for plugin facebook authorizations.
*/
- public static void promptAuthorizations()
+ public static void promptAuthorizations(List<Byte> options)
{
+ //Adding default.
+ String rights = "read_stream,offline_access";
+
+ if(options.contains(FacebookConnection.AUTH_PUBLISH_FEEDS))
+ {
+ rights += "," + "read_mailbox";
+ }
+
+ if(options.contains(FacebookConnection.AUTH_READ_MAILBOX))
+ {
+ rights += "," + "publish_stream";
+ }
+
String url = "http://www.facebook.com/login.php?api_key=+" +
FacebookSessionUtils.api_key +
"&connect_display=popup&v=1.0" +
"&next=http://www.facebook.com/connect/login_success.html" +
"&cancel_url=http://www.facebook.com/connect/login_failure.html" +
"&fbconnect=true&return_session=true" +
- "&req_perms=read_stream,publish_stream,offline_access,read_mailbox";
+ "&req_perms=" + rights;
BareBonesBrowserLaunch.openURL(url);
}
Modified: software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookFunctions.java
===================================================================
--- software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookFunctions.java 2009-10-20 15:29:04 UTC (rev 5754)
+++ software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookFunctions.java 2009-10-20 15:42:29 UTC (rev 5755)
@@ -37,10 +37,6 @@
public class FacebookFunctions {
-
- //Messages constants.
- public static final byte MESSAGE = 0;
- public static final byte RESPONSE = 1;
private FacebookJsonRestClient client;
private JSONObject notifications = null;
Modified: software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookPlugin.java
===================================================================
--- software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookPlugin.java 2009-10-20 15:29:04 UTC (rev 5754)
+++ software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookPlugin.java 2009-10-20 15:42:29 UTC (rev 5755)
@@ -23,7 +23,9 @@
package com.kysoh.plugins.facebook;
+import java.util.ArrayList;
import java.util.Hashtable;
+import java.util.List;
import java.util.Vector;
import com.kysoh.tuxdroid.plugin.framework.plugin.SimplePlugin;
@@ -71,8 +73,22 @@
*/
public void doConfigure()
{
+ List<Byte> options = new ArrayList<Byte>();
+
+ //Adding publish stream auth if needed.
+ if(this.configuration().getUpdateStatus())
+ {
+ options.add(FacebookConnection.AUTH_PUBLISH_FEEDS);
+ }
+
+ //Adding read mailbox auth if needed.
+ if(this.configuration().getNotifyEmail())
+ {
+ options.add(FacebookConnection.AUTH_READ_MAILBOX);
+ }
+
//Prompt web browser for facebook permissions.
- FacebookConnection.promptAuthorizations();
+ FacebookConnection.promptAuthorizations(options);
//TODO check actual permissions.
}
|