use of com.facebook.share.model.ShareMediaContent in project facebook-android-sdk by facebook.
the class NativeDialogParameters method create.
public static Bundle create(UUID callId, ShareContent shareContent, boolean shouldFailOnDataError) {
Validate.notNull(shareContent, "shareContent");
Validate.notNull(callId, "callId");
Bundle nativeParams = null;
if (shareContent instanceof ShareLinkContent) {
final ShareLinkContent linkContent = (ShareLinkContent) shareContent;
nativeParams = create(linkContent, shouldFailOnDataError);
} else if (shareContent instanceof SharePhotoContent) {
final SharePhotoContent photoContent = (SharePhotoContent) shareContent;
List<String> photoUrls = ShareInternalUtility.getPhotoUrls(photoContent, callId);
nativeParams = create(photoContent, photoUrls, shouldFailOnDataError);
} else if (shareContent instanceof ShareVideoContent) {
final ShareVideoContent videoContent = (ShareVideoContent) shareContent;
String videoUrl = ShareInternalUtility.getVideoUrl(videoContent, callId);
nativeParams = create(videoContent, videoUrl, shouldFailOnDataError);
} else if (shareContent instanceof ShareOpenGraphContent) {
final ShareOpenGraphContent openGraphContent = (ShareOpenGraphContent) shareContent;
try {
JSONObject openGraphActionJSON = ShareInternalUtility.toJSONObjectForCall(callId, openGraphContent);
openGraphActionJSON = ShareInternalUtility.removeNamespacesFromOGJsonObject(openGraphActionJSON, false);
nativeParams = create(openGraphContent, openGraphActionJSON, shouldFailOnDataError);
} catch (final JSONException e) {
throw new FacebookException("Unable to create a JSON Object from the provided ShareOpenGraphContent: " + e.getMessage());
}
} else if (shareContent instanceof ShareMediaContent) {
final ShareMediaContent mediaContent = (ShareMediaContent) shareContent;
List<Bundle> mediaInfos = ShareInternalUtility.getMediaInfos(mediaContent, callId);
nativeParams = create(mediaContent, mediaInfos, shouldFailOnDataError);
}
return nativeParams;
}
Aggregations