Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share open graph android #747

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,45 @@ public void run() {
}
};
cordova.getActivity().runOnUiThread(runnable);
} else if (this.method.equalsIgnoreCase("share") || this.method.equalsIgnoreCase("share_open_graph")) {
} else if (this.method.equalsIgnoreCase("share_open_graph")) {
if (FacebookDialog.canPresentOpenGraphActionDialog(me.cordova.getActivity(), FacebookDialog.OpenGraphActionDialogFeature.OG_ACTION_DIALOG)) {
Runnable runnable = new Runnable() {
public void run() {
OpenGraphAction ogAction = GraphObject.Factory.create(OpenGraphAction.class);
ogAction.setType(paramBundle.getString("action_type"));
String previewPropertyName = null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previewPropertyName = null; extra space at the end of this line

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

try{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space try {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

JSONObject ogActionProperties = new JSONObject(paramBundle.getString("action_properties"));
Iterator<?> iter = ogActionProperties.keys();
while (iter.hasNext()) {
String key = (String) iter.next();
if(previewPropertyName==null){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space if (

space ) {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

previewPropertyName = key;
}
ogAction.setProperty(key.toString(), ogActionProperties.getString(key).toString());
}
} catch (JSONException e) {
e.printStackTrace();
}

FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(me.cordova.getActivity(),ogAction,previewPropertyName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces (me.cordova.getActivity(), ogAction, previewPropertyName)

.build();
uiHelper.trackPendingDialogCall(shareDialog.present());
}
};
this.trackingPendingCall = true;
cordova.getActivity().runOnUiThread(runnable);
} else {
// Fallback. For example, publish the post using the Feed Dialog
Runnable runnable = new Runnable() {
public void run() {
WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(me.cordova.getActivity(), Session.getActiveSession(), paramBundle)).setOnCompleteListener(dialogCallback).build();
feedDialog.show();
}
};
cordova.getActivity().runOnUiThread(runnable);
}
} else if (this.method.equalsIgnoreCase("share")) {
if (FacebookDialog.canPresentShareDialog(me.cordova.getActivity(), FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
Runnable runnable = new Runnable() {
public void run() {
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.phonegap.plugins.facebookconnect"
version="0.8.0">
version="0.8.1">

<name>Facebook Connect</name>

Expand Down