Skip to content

Commit

Permalink
Facebook Android SDK 4.25
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Goldman-Kirst committed Jul 27, 2017
2 parents 26c9292 + 5759e65 commit bec7d78
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
package com.facebook;

final class FacebookSdkVersion {
public static final String BUILD = "4.24.0";
public static final String BUILD = "4.25.0";
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public final class ServerProtocol {
// URL components
private static final String GRAPH_VIDEO_URL_FORMAT = "https://graph-video.%s";
private static final String GRAPH_URL_FORMAT = "https://graph.%s";
private static final String GRAPH_API_VERSION = "v2.9";
private static final String GRAPH_API_VERSION = "v2.10";

public static final Collection<String> errorsProxyAuthDisabled =
Utility.unmodifiableCollection("service_disabled", "AndroidAuthKillSwitchException");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ public static JSONObject toJSONObjectForWeb(
@Override
public JSONObject toJSONObject(SharePhoto photo) {
Uri photoUri = photo.getImageUrl();
if (!Utility.isWebUri(photoUri)) {
throw new FacebookException("Only web images may be used in OG" +
" objects shared via the web dialog");
}
JSONObject photoJSONObject = new JSONObject();
try {
photoJSONObject.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;

import com.facebook.AccessToken;
import com.facebook.FacebookCallback;
Expand Down Expand Up @@ -89,6 +90,8 @@ public enum Mode {
FEED
}

private static final String TAG = ShareDialog.class.getSimpleName();

private static final String FEED_DIALOG = "feed";
public static final String WEB_SHARE_DIALOG = "share";
private static final String WEB_OG_SHARE_DIALOG = "share_open_graph";
Expand Down Expand Up @@ -179,6 +182,27 @@ private static boolean canShowWebTypeCheck(Class<? extends ShareContent> content
|| (SharePhotoContent.class.isAssignableFrom(contentType) && haveUserAccessToken);
}

private static boolean canShowWebCheck(ShareContent content) {
if (!canShowWebTypeCheck(content.getClass())) {
return false;
}

if (content instanceof ShareOpenGraphContent) {
final ShareOpenGraphContent ogContent = ((ShareOpenGraphContent) content);
try {
ShareInternalUtility.toJSONObjectForWeb(ogContent);
} catch (Exception e) {
Log.d(
TAG,
"canShow returned false because the content of the Opem Graph object" +
" can't be shared via the web dialog",
e);
return false;
}
}
return true;
}

/**
* Constructs a new ShareDialog.
* @param activity Activity to use to share the provided content.
Expand Down Expand Up @@ -362,7 +386,7 @@ public Object getMode() {

@Override
public boolean canShow(final ShareContent content, boolean isBestEffort) {
return (content != null) && ShareDialog.canShowWebTypeCheck(content.getClass());
return (content != null) && ShareDialog.canShowWebCheck(content);
}

@Override
Expand Down

0 comments on commit bec7d78

Please sign in to comment.