105 lines
4.6 KiB
Java
105 lines
4.6 KiB
Java
package com.facebook.share.internal;
|
|
|
|
import android.os.Bundle;
|
|
import com.facebook.FacebookException;
|
|
import com.facebook.internal.Utility;
|
|
import com.facebook.internal.Validate;
|
|
import com.facebook.share.model.ShareContent;
|
|
import com.facebook.share.model.ShareHashtag;
|
|
import com.facebook.share.model.ShareLinkContent;
|
|
import com.facebook.share.model.ShareMediaContent;
|
|
import com.facebook.share.model.ShareOpenGraphContent;
|
|
import com.facebook.share.model.SharePhotoContent;
|
|
import com.facebook.share.model.ShareVideoContent;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class NativeDialogParameters {
|
|
public static Bundle a(UUID uuid, ShareContent shareContent, boolean z) {
|
|
Validate.a(shareContent, "shareContent");
|
|
Validate.a(uuid, "callId");
|
|
if (shareContent instanceof ShareLinkContent) {
|
|
return a((ShareLinkContent) shareContent, z);
|
|
}
|
|
if (shareContent instanceof SharePhotoContent) {
|
|
SharePhotoContent sharePhotoContent = (SharePhotoContent) shareContent;
|
|
return a(sharePhotoContent, ShareInternalUtility.a(sharePhotoContent, uuid), z);
|
|
}
|
|
if (shareContent instanceof ShareVideoContent) {
|
|
ShareVideoContent shareVideoContent = (ShareVideoContent) shareContent;
|
|
return a(shareVideoContent, ShareInternalUtility.a(shareVideoContent, uuid), z);
|
|
}
|
|
if (!(shareContent instanceof ShareOpenGraphContent)) {
|
|
if (!(shareContent instanceof ShareMediaContent)) {
|
|
return null;
|
|
}
|
|
ShareMediaContent shareMediaContent = (ShareMediaContent) shareContent;
|
|
return a(shareMediaContent, ShareInternalUtility.a(shareMediaContent, uuid), z);
|
|
}
|
|
ShareOpenGraphContent shareOpenGraphContent = (ShareOpenGraphContent) shareContent;
|
|
try {
|
|
return a(shareOpenGraphContent, ShareInternalUtility.a(ShareInternalUtility.a(uuid, shareOpenGraphContent), false), z);
|
|
} catch (JSONException e) {
|
|
throw new FacebookException("Unable to create a JSON Object from the provided ShareOpenGraphContent: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
private static Bundle a(ShareLinkContent shareLinkContent, boolean z) {
|
|
Bundle a = a((ShareContent) shareLinkContent, z);
|
|
Utility.a(a, "TITLE", shareLinkContent.getContentTitle());
|
|
Utility.a(a, "DESCRIPTION", shareLinkContent.getContentDescription());
|
|
Utility.a(a, "IMAGE", shareLinkContent.getImageUrl());
|
|
Utility.a(a, "QUOTE", shareLinkContent.getQuote());
|
|
return a;
|
|
}
|
|
|
|
private static Bundle a(SharePhotoContent sharePhotoContent, List<String> list, boolean z) {
|
|
Bundle a = a(sharePhotoContent, z);
|
|
a.putStringArrayList("PHOTOS", new ArrayList<>(list));
|
|
return a;
|
|
}
|
|
|
|
private static Bundle a(ShareVideoContent shareVideoContent, String str, boolean z) {
|
|
Bundle a = a(shareVideoContent, z);
|
|
Utility.a(a, "TITLE", shareVideoContent.getContentTitle());
|
|
Utility.a(a, "DESCRIPTION", shareVideoContent.getContentDescription());
|
|
Utility.a(a, "VIDEO", str);
|
|
return a;
|
|
}
|
|
|
|
private static Bundle a(ShareMediaContent shareMediaContent, List<Bundle> list, boolean z) {
|
|
Bundle a = a(shareMediaContent, z);
|
|
a.putParcelableArrayList("MEDIA", new ArrayList<>(list));
|
|
return a;
|
|
}
|
|
|
|
private static Bundle a(ShareOpenGraphContent shareOpenGraphContent, JSONObject jSONObject, boolean z) {
|
|
Bundle a = a(shareOpenGraphContent, z);
|
|
Utility.a(a, "PREVIEW_PROPERTY_NAME", (String) ShareInternalUtility.a(shareOpenGraphContent.getPreviewPropertyName()).second);
|
|
Utility.a(a, "ACTION_TYPE", shareOpenGraphContent.getAction().getActionType());
|
|
Utility.a(a, "ACTION", jSONObject.toString());
|
|
return a;
|
|
}
|
|
|
|
private static Bundle a(ShareContent shareContent, boolean z) {
|
|
Bundle bundle = new Bundle();
|
|
Utility.a(bundle, "LINK", shareContent.getContentUrl());
|
|
Utility.a(bundle, "PLACE", shareContent.getPlaceId());
|
|
Utility.a(bundle, "REF", shareContent.getRef());
|
|
bundle.putBoolean("DATA_FAILURES_FATAL", z);
|
|
List<String> peopleIds = shareContent.getPeopleIds();
|
|
if (!Utility.a(peopleIds)) {
|
|
bundle.putStringArrayList("FRIENDS", new ArrayList<>(peopleIds));
|
|
}
|
|
ShareHashtag shareHashtag = shareContent.getShareHashtag();
|
|
if (shareHashtag != null) {
|
|
Utility.a(bundle, "HASHTAG", shareHashtag.getHashtag());
|
|
}
|
|
return bundle;
|
|
}
|
|
}
|