Skip to content

Commit

Permalink
Merge pull request #861 from aogilvie/update/android-sdk-3.21.1
Browse files Browse the repository at this point in the history
update android sdk to 3.21.1
  • Loading branch information
aogilvie committed Dec 19, 2014
2 parents ba4944a + 5adb5fa commit 5b70d97
Show file tree
Hide file tree
Showing 99 changed files with 269 additions and 64 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The Facebook plugin for [Apache Cordova](http://incubator.apache.org/cordova/) a
* Supported on PhoneGap (Cordova) v3.5.0 and above.
* This plugin is built for
* iOS FacebookSDK 3.21.1
* Android FacebookSDK 3.20.0
* Android FacebookSDK 3.21.1
* GitHub URL : [https://github.com/Wizcorp/phonegap-facebook-plugin/](https://github.com/Wizcorp/phonegap-facebook-plugin/)

## << --- Cordova Registry Warning [iOS]
Expand Down
4 changes: 2 additions & 2 deletions platforms/android/FacebookLib/.classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
2 changes: 1 addition & 1 deletion platforms/android/FacebookLib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repositories {
project.group = 'com.facebook.android'

dependencies {
compile 'com.android.support:support-v4:20.0.+'
compile 'com.android.support:support-v4:[20,21)'
compile 'com.parse.bolts:bolts-android:1.1.2'
}

Expand Down
Binary file modified platforms/android/FacebookLib/libs/android-support-v4.jar
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified platforms/android/FacebookLib/res/drawable/com_facebook_logo.png
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
package com.facebook;

final class FacebookSdkVersion {
public static final String BUILD = "3.20.0";
public static final String BUILD = "3.21.1";
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,22 @@ public void processAttachment(Bitmap attachment, File outputFile) throws IOExcep
}

/**
* Adds a number of bitmap attachment files associated with a native app call. The attachments will be
* Adds a number of bitmap/video attachment files associated with a native app call. The attachments will be
* served via {@link NativeAppCallContentProvider#openFile(android.net.Uri, String) openFile}.
*
* @param context the Context the call is being made from
* @param callId the unique ID of the call
* @param imageAttachments a Map of attachment names to Files containing the bitmaps; the attachment names will be
* part of the URI processed by openFile
* @param mediaAttachmentFiles a Map of attachment names to Files containing the bitmaps/videos; the attachment
* names will be part of the URI processed by openFile
* @throws java.io.IOException
*/
public void addAttachmentFilesForCall(Context context, UUID callId, Map<String, File> imageAttachmentFiles) {
public void addAttachmentFilesForCall(Context context, UUID callId, Map<String, File> mediaAttachmentFiles) {
Validate.notNull(context, "context");
Validate.notNull(callId, "callId");
Validate.containsNoNulls(imageAttachmentFiles.values(), "imageAttachmentFiles");
Validate.containsNoNullOrEmpty(imageAttachmentFiles.keySet(), "imageAttachmentFiles");
Validate.containsNoNulls(mediaAttachmentFiles.values(), "mediaAttachmentFiles");
Validate.containsNoNullOrEmpty(mediaAttachmentFiles.keySet(), "mediaAttachmentFiles");

addAttachments(context, callId, imageAttachmentFiles, new ProcessAttachment<File>() {
addAttachments(context, callId, mediaAttachmentFiles, new ProcessAttachment<File>() {
@Override
public void processAttachment(File attachment, File outputFile) throws IOException {
FileOutputStream outputStream = new FileOutputStream(outputFile);
Expand Down
8 changes: 6 additions & 2 deletions platforms/android/FacebookLib/src/com/facebook/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -446,18 +446,22 @@ static Response publishInstallAndWaitForResponse(
* @return returns null if the facebook app is not present on the phone.
*/
public static String getAttributionId(ContentResolver contentResolver) {
Cursor c = null;
try {
String [] projection = {ATTRIBUTION_ID_COLUMN_NAME};
Cursor c = contentResolver.query(ATTRIBUTION_ID_CONTENT_URI, projection, null, null, null);
c = contentResolver.query(ATTRIBUTION_ID_CONTENT_URI, projection, null, null, null);
if (c == null || !c.moveToFirst()) {
return null;
}
String attributionId = c.getString(c.getColumnIndex(ATTRIBUTION_ID_COLUMN_NAME));
c.close();
return attributionId;
} catch (Exception e) {
Log.d(TAG, "Caught unexpected exception in getAttributionId(): " + e.toString());
return null;
} finally {
if (c != null) {
c.close();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class AnalyticsEvents {
public static final String EVENT_NATIVE_DIALOG_TYPE_OG_MESSAGE = "fb_dialogs_present_message_og";
public static final String EVENT_NATIVE_DIALOG_TYPE_PHOTO_SHARE = "fb_dialogs_present_share_photo";
public static final String EVENT_NATIVE_DIALOG_TYPE_PHOTO_MESSAGE = "fb_dialogs_present_message_photo";
public static final String EVENT_NATIVE_DIALOG_TYPE_VIDEO_SHARE = "fb_dialogs_present_share_video";
public static final String EVENT_NATIVE_DIALOG_TYPE_LIKE = "fb_dialogs_present_like";

public static final String EVENT_LIKE_VIEW_CANNOT_PRESENT_DIALOG = "fb_like_control_cannot_present_dialog";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ public static AttributionIdentifiers getAttributionIdentifiers(Context context)
}

AttributionIdentifiers identifiers = getAndroidId(context);

Cursor c = null;
try {
String [] projection = {ATTRIBUTION_ID_COLUMN_NAME, ANDROID_ID_COLUMN_NAME, LIMIT_TRACKING_COLUMN_NAME};
Cursor c = context.getContentResolver().query(ATTRIBUTION_ID_CONTENT_URI, projection, null, null, null);
c = context.getContentResolver().query(ATTRIBUTION_ID_CONTENT_URI, projection, null, null, null);
if (c == null || !c.moveToFirst()) {
return identifiers;
}
Expand All @@ -127,10 +127,13 @@ public static AttributionIdentifiers getAttributionIdentifiers(Context context)
identifiers.androidAdvertiserId = c.getString(androidIdColumnIndex);
identifiers.limitTracking = Boolean.parseBoolean(c.getString(limitTrackingColumnIndex));
}
c.close();
} catch (Exception e) {
Log.d(TAG, "Caught unexpected exception in getAttributionId(): " + e.toString());
return null;
} finally {
if (c != null) {
c.close();
}
}

identifiers.fetchTime = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@
import android.os.Looper;
import android.webkit.WebView;
import com.facebook.FacebookException;
import com.facebook.android.Util;
import com.facebook.widget.FacebookDialog;
import com.facebook.widget.WebDialog;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.EnumSet;

/**
* com.facebook.internal is solely for the use of other packages within the Facebook SDK for Android. Use of
* any of the classes in this package is unsupported, and they may be modified or removed without warning at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,26 +683,42 @@ private FacebookDialog.Callback getFacebookDialogCallback(final Bundle analytics
return new FacebookDialog.Callback() {
@Override
public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) {
if (!data.containsKey(LIKE_DIALOG_RESPONSE_OBJECT_IS_LIKED_KEY)) {
// This is an empty result that we can't handle. Don't lose like state.
if (data == null || !data.containsKey(LIKE_DIALOG_RESPONSE_OBJECT_IS_LIKED_KEY)) {
// This is an empty result that we can't handle.
return;
}

boolean isObjectLiked = data.getBoolean(LIKE_DIALOG_RESPONSE_OBJECT_IS_LIKED_KEY);
String likeCountString = data.getString(LIKE_DIALOG_RESPONSE_LIKE_COUNT_STRING_KEY);
String socialSentence = data.getString(LIKE_DIALOG_RESPONSE_SOCIAL_SENTENCE_KEY);
String unlikeToken = data.getString(LIKE_DIALOG_RESPONSE_UNLIKE_TOKEN_KEY);

// Default to known/cached state, if properties are missing.
String likeCountStringWithLike = LikeActionController.this.likeCountStringWithLike;
String likeCountStringWithoutLike = LikeActionController.this.likeCountStringWithoutLike;
if (data.containsKey(LIKE_DIALOG_RESPONSE_LIKE_COUNT_STRING_KEY)) {
likeCountStringWithLike = data.getString(LIKE_DIALOG_RESPONSE_LIKE_COUNT_STRING_KEY);
likeCountStringWithoutLike = likeCountStringWithLike;
}

String socialSentenceWithLike = LikeActionController.this.socialSentenceWithLike;
String socialSentenceWithoutWithoutLike = LikeActionController.this.socialSentenceWithoutLike;
if (data.containsKey(LIKE_DIALOG_RESPONSE_SOCIAL_SENTENCE_KEY)) {
socialSentenceWithLike = data.getString(LIKE_DIALOG_RESPONSE_SOCIAL_SENTENCE_KEY);
socialSentenceWithoutWithoutLike = socialSentenceWithLike;
}

String unlikeToken = data.containsKey(LIKE_DIALOG_RESPONSE_OBJECT_IS_LIKED_KEY)
? data.getString(LIKE_DIALOG_RESPONSE_UNLIKE_TOKEN_KEY)
: LikeActionController.this.unlikeToken;

Bundle logParams = (analyticsParameters == null) ? new Bundle() : analyticsParameters;
logParams.putString(AnalyticsEvents.PARAMETER_CALL_ID, pendingCall.getCallId().toString());
appEventsLogger.logSdkEvent(AnalyticsEvents.EVENT_LIKE_VIEW_DIALOG_DID_SUCCEED, null, logParams);

updateState(
isObjectLiked,
likeCountString,
likeCountString,
socialSentence,
socialSentence,
likeCountStringWithLike,
likeCountStringWithoutLike,
socialSentenceWithLike,
socialSentenceWithoutWithoutLike,
unlikeToken);
}

Expand Down Expand Up @@ -918,17 +934,37 @@ private void refreshStatusViaService() {
LikeStatusClient.CompletedListener callback = new LikeStatusClient.CompletedListener() {
@Override
public void completed(Bundle result) {
// Don't lose old state if the service response is incomplete.
if (result == null || !result.containsKey(NativeProtocol.EXTRA_OBJECT_IS_LIKED)) {
// Don't lose old state if the service response is incomplete.
return;
}

boolean objectIsLiked = result.getBoolean(NativeProtocol.EXTRA_OBJECT_IS_LIKED);
String likeCountWithLike = result.getString(NativeProtocol.EXTRA_LIKE_COUNT_STRING_WITH_LIKE);
String likeCountWithoutLike = result.getString(NativeProtocol.EXTRA_LIKE_COUNT_STRING_WITHOUT_LIKE);
String socialSentenceWithLike = result.getString(NativeProtocol.EXTRA_SOCIAL_SENTENCE_WITH_LIKE);
String socialSentenceWithoutLike = result.getString(NativeProtocol.EXTRA_SOCIAL_SENTENCE_WITHOUT_LIKE);
String unlikeToken = result.getString(NativeProtocol.EXTRA_UNLIKE_TOKEN);

String likeCountWithLike =
result.containsKey(NativeProtocol.EXTRA_LIKE_COUNT_STRING_WITH_LIKE)
? result.getString(NativeProtocol.EXTRA_LIKE_COUNT_STRING_WITH_LIKE)
: LikeActionController.this.likeCountStringWithLike;

String likeCountWithoutLike =
result.containsKey(NativeProtocol.EXTRA_LIKE_COUNT_STRING_WITHOUT_LIKE)
? result.getString(NativeProtocol.EXTRA_LIKE_COUNT_STRING_WITHOUT_LIKE)
: LikeActionController.this.likeCountStringWithoutLike;

String socialSentenceWithLike =
result.containsKey(NativeProtocol.EXTRA_SOCIAL_SENTENCE_WITH_LIKE)
? result.getString(NativeProtocol.EXTRA_SOCIAL_SENTENCE_WITH_LIKE)
: LikeActionController.this.socialSentenceWithLike;

String socialSentenceWithoutLike =
result.containsKey(NativeProtocol.EXTRA_SOCIAL_SENTENCE_WITHOUT_LIKE)
? result.getString(NativeProtocol.EXTRA_SOCIAL_SENTENCE_WITHOUT_LIKE)
: LikeActionController.this.socialSentenceWithoutLike;

String unlikeToken =
result.containsKey(NativeProtocol.EXTRA_UNLIKE_TOKEN)
? result.getString(NativeProtocol.EXTRA_UNLIKE_TOKEN)
: LikeActionController.this.unlikeToken;

updateState(
objectIsLiked,
Expand Down Expand Up @@ -1162,7 +1198,9 @@ protected void processError(FacebookRequestError error) {
}

private class GetOGObjectLikesRequestWrapper extends AbstractRequestWrapper {
boolean objectIsLiked;
// Initialize the like status to what we currently have. This way, empty/error responses don't end
// up clearing out the state.
boolean objectIsLiked = LikeActionController.this.isObjectLiked;
String unlikeToken;

GetOGObjectLikesRequestWrapper(String objectId) {
Expand Down Expand Up @@ -1204,10 +1242,12 @@ protected void processError(FacebookRequestError error) {
}

private class GetEngagementRequestWrapper extends AbstractRequestWrapper {
String likeCountStringWithLike;
String likeCountStringWithoutLike;
String socialSentenceStringWithLike;
String socialSentenceStringWithoutLike;
// Initialize the like status to what we currently have. This way, empty/error responses don't end
// up clearing out the state.
String likeCountStringWithLike = LikeActionController.this.likeCountStringWithLike;
String likeCountStringWithoutLike = LikeActionController.this.likeCountStringWithoutLike;
String socialSentenceStringWithLike = LikeActionController.this.socialSentenceWithLike;
String socialSentenceStringWithoutLike = LikeActionController.this.socialSentenceWithoutLike;

GetEngagementRequestWrapper(String objectId) {
super(objectId);
Expand All @@ -1228,10 +1268,18 @@ private class GetEngagementRequestWrapper extends AbstractRequestWrapper {
protected void processSuccess(Response response) {
JSONObject engagementResults = Utility.tryGetJSONObjectFromResponse(response.getGraphObject(), "engagement");
if (engagementResults != null) {
likeCountStringWithLike = engagementResults.optString("count_string_with_like");
likeCountStringWithoutLike = engagementResults.optString("count_string_without_like");
socialSentenceStringWithLike = engagementResults.optString("social_sentence_with_like");
socialSentenceStringWithoutLike = engagementResults.optString("social_sentence_without_like");
// Missing properties in the response should default to cached like status
likeCountStringWithLike =
engagementResults.optString("count_string_with_like", likeCountStringWithLike);

likeCountStringWithoutLike =
engagementResults.optString("count_string_without_like", likeCountStringWithoutLike);

socialSentenceStringWithLike =
engagementResults.optString("social_sentence_with_like", socialSentenceStringWithLike);

socialSentenceStringWithoutLike =
engagementResults.optString("social_sentence_without_like", socialSentenceStringWithoutLike);
}
}

Expand Down

0 comments on commit 5b70d97

Please sign in to comment.