-
Notifications
You must be signed in to change notification settings - Fork 2k
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
base: develop
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
try{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space There was a problem hiding this comment. Choose a reason for hiding this commentThe 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){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space space There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spaces |
||
.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() { | ||
|
There was a problem hiding this comment.
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 lineThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed