diff --git a/README.md b/README.md index 2be771525..2eef5366c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The Facebook plugin for [Apache Cordova](http://incubator.apache.org/cordova/) a ## << --- Cordova Registry Warning [iOS] -****Installing this plugin directly from Cordova Registry results in Xcode using a broken `Facebook.framework`, this is because the current publish procedure to NPM breaks symlinks [CB-6092](https://issues.apache.org/jira/browse/CB-6092). Please re-add facebook.framework to Xcode.**** +****Installing this plugin directly from Cordova Registry results in Xcode using a broken `FacebookSDK.framework`, this is because the current publish procedure to NPM breaks symlinks [CB-6092](https://issues.apache.org/jira/browse/CB-6092). Please install the plugin through a locally cloned copy or re-add the `FacebookSDK.framework` to Xcode after installation.**** ## ------------------------------------------ >> @@ -30,6 +30,8 @@ To use this plugin you will need to make sure you've registered your Facebook ap - [Web App Guide](platforms/web/README.md) +- [PhoneGap Build](platforms/pg-build/README.md) + #### Example Apps `platforms/android` and `platforms/ios` contain example projects and all the native code for the plugin for both Android and iOS platforms. They also include versions of the Android and iOS Facebook SDKs. These are used during automatic installation. @@ -109,7 +111,7 @@ Allows access to the Facebook Graph API. This API allows for additional permissi Example permissions: - ["public_info", "user_birthday"] + ["public_profile", "user_birthday"] Success function returns an Object. @@ -159,7 +161,7 @@ In your `onDeviceReady` event add the following alert("UserInfo: " + JSON.stringify(userData)); } - facebookConnectPlugin.login(["public_info"], + facebookConnectPlugin.login(["public_profile"], fbLoginSuccess, function (error) { alert("" + error) } ); @@ -177,7 +179,7 @@ If you need the Facebook access token (for example, for validating the login on }); } - facebookConnectPlugin.login(["public_info"], + facebookConnectPlugin.login(["public_profile"], fbLoginSuccess, function (error) { alert("" + error) } ); diff --git a/platforms/android/FacebookLib/AndroidManifest.xml b/platforms/android/FacebookLib/AndroidManifest.xml index 2f9284fb0..1c7e0766a 100644 --- a/platforms/android/FacebookLib/AndroidManifest.xml +++ b/platforms/android/FacebookLib/AndroidManifest.xml @@ -18,5 +18,5 @@ - + diff --git a/platforms/android/FacebookLib/build.gradle b/platforms/android/FacebookLib/build.gradle index 43154cb22..d043dcea0 100644 --- a/platforms/android/FacebookLib/build.gradle +++ b/platforms/android/FacebookLib/build.gradle @@ -1,8 +1,8 @@ apply plugin: 'android-library' dependencies { - compile 'com.android.support:support-v4:19.1.+' - compile files('../libs/bolts.jar') + compile 'com.android.support:support-v4:20.0.+' + compile 'com.parse.bolts:bolts-android:1.1.2' } android { diff --git a/platforms/android/FacebookLib/libs/bolts-android-1.1.2.jar b/platforms/android/FacebookLib/libs/bolts-android-1.1.2.jar new file mode 100644 index 000000000..88a01a30b Binary files /dev/null and b/platforms/android/FacebookLib/libs/bolts-android-1.1.2.jar differ diff --git a/platforms/android/FacebookLib/libs/bolts.jar b/platforms/android/FacebookLib/libs/bolts.jar deleted file mode 100644 index 9a9a1e94b..000000000 Binary files a/platforms/android/FacebookLib/libs/bolts.jar and /dev/null differ diff --git a/platforms/android/FacebookLib/project.properties b/platforms/android/FacebookLib/project.properties index cd0ca122a..131a55407 100644 --- a/platforms/android/FacebookLib/project.properties +++ b/platforms/android/FacebookLib/project.properties @@ -12,4 +12,4 @@ android.library=true # Project target. -target=android-8 +target=android-9 diff --git a/platforms/android/FacebookLib/src/com/facebook/AccessToken.java b/platforms/android/FacebookLib/src/com/facebook/AccessToken.java index 392d677e3..898abb5ce 100644 --- a/platforms/android/FacebookLib/src/com/facebook/AccessToken.java +++ b/platforms/android/FacebookLib/src/com/facebook/AccessToken.java @@ -27,11 +27,7 @@ import java.io.InvalidObjectException; import java.io.ObjectInputStream; import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; +import java.util.*; /** * This class represents an access token returned by the Facebook Login service, along with associated @@ -240,9 +236,11 @@ static AccessToken createFromWebBundle(List requestedPermissions, Bundle static AccessToken createFromRefresh(AccessToken current, Bundle bundle) { // Only tokens obtained via SSO support refresh. Token refresh returns the expiration date in // seconds from the epoch rather than seconds from now. - assert (current.source == AccessTokenSource.FACEBOOK_APPLICATION_WEB || - current.source == AccessTokenSource.FACEBOOK_APPLICATION_NATIVE || - current.source == AccessTokenSource.FACEBOOK_APPLICATION_SERVICE); + if (current.source != AccessTokenSource.FACEBOOK_APPLICATION_WEB && + current.source != AccessTokenSource.FACEBOOK_APPLICATION_NATIVE && + current.source != AccessTokenSource.FACEBOOK_APPLICATION_SERVICE) { + throw new FacebookException("Invalid token source: " + current.source); + } Date expires = getBundleLongAsDate(bundle, EXPIRES_IN_KEY, new Date(0)); String token = bundle.getString(ACCESS_TOKEN_KEY); diff --git a/platforms/android/FacebookLib/src/com/facebook/AppEventsConstants.java b/platforms/android/FacebookLib/src/com/facebook/AppEventsConstants.java index 24fd13872..19031644b 100644 --- a/platforms/android/FacebookLib/src/com/facebook/AppEventsConstants.java +++ b/platforms/android/FacebookLib/src/com/facebook/AppEventsConstants.java @@ -28,6 +28,12 @@ public class AppEventsConstants { /** Log this event when an app is being activated. */ public static final String EVENT_NAME_ACTIVATED_APP = "fb_mobile_activate_app"; + public static final String EVENT_NAME_DEACTIVATED_APP = "fb_mobile_deactivate_app"; + + public static final String EVENT_NAME_SESSION_INTERRUPTIONS = "fb_mobile_app_interruptions"; + + public static final String EVENT_NAME_TIME_BETWEEN_SESSIONS = "fb_mobile_time_between_sessions"; + /** Log this event when a user has completed registration with the app. */ public static final String EVENT_NAME_COMPLETED_REGISTRATION = "fb_mobile_complete_registration"; @@ -156,6 +162,10 @@ public class AppEventsConstants { public static final String EVENT_PARAM_DESCRIPTION = "fb_description"; + /** + * Parameter key used to specify source application package + */ + public static final String EVENT_PARAM_SOURCE_APPLICATION = "fb_mobile_launch_source"; // Parameter values @@ -164,5 +174,4 @@ public class AppEventsConstants { /** No-valued parameter value to be used with parameter keys that need a Yes/No value */ public static final String EVENT_PARAM_VALUE_NO = "0"; - } diff --git a/platforms/android/FacebookLib/src/com/facebook/AppEventsLogger.java b/platforms/android/FacebookLib/src/com/facebook/AppEventsLogger.java index e35789a62..c4f7ed61e 100644 --- a/platforms/android/FacebookLib/src/com/facebook/AppEventsLogger.java +++ b/platforms/android/FacebookLib/src/com/facebook/AppEventsLogger.java @@ -16,21 +16,41 @@ package com.facebook; +import android.app.Activity; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.content.LocalBroadcastManager; import android.util.Log; -import com.facebook.internal.*; +import bolts.AppLinks; +import com.facebook.internal.AttributionIdentifiers; +import com.facebook.internal.Logger; +import com.facebook.internal.Utility; +import com.facebook.internal.Validate; import com.facebook.model.GraphObject; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; -import java.io.*; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.FileNotFoundException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.io.UnsupportedEncodingException; import java.math.BigDecimal; -import java.util.*; +import java.util.ArrayList; +import java.util.Currency; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; /** @@ -45,6 +65,7 @@ *

*

* The AppEventsLogger class has a few related roles: + *

*