diff --git a/android/src/main/java/com/facebook/reactnative/androidsdk/FBGameRequestDialogModule.java b/android/src/main/java/com/facebook/reactnative/androidsdk/FBGameRequestDialogModule.java index db05a297..c7c2616c 100644 --- a/android/src/main/java/com/facebook/reactnative/androidsdk/FBGameRequestDialogModule.java +++ b/android/src/main/java/com/facebook/reactnative/androidsdk/FBGameRequestDialogModule.java @@ -57,8 +57,8 @@ public void onSuccess(GameRequestDialog.Result result) { } } - public FBGameRequestDialogModule(ReactApplicationContext reactContext) { - super(reactContext); + public FBGameRequestDialogModule(ReactApplicationContext reactContext, FBActivityEventListener activityEventListener) { + super(reactContext, activityEventListener); } @Override diff --git a/android/src/main/java/com/facebook/reactnative/androidsdk/FBLoginManagerModule.java b/android/src/main/java/com/facebook/reactnative/androidsdk/FBLoginManagerModule.java index 89602fc0..ce6da614 100644 --- a/android/src/main/java/com/facebook/reactnative/androidsdk/FBLoginManagerModule.java +++ b/android/src/main/java/com/facebook/reactnative/androidsdk/FBLoginManagerModule.java @@ -70,8 +70,8 @@ public void onSuccess(LoginResult loginResult) { } } - public FBLoginManagerModule(ReactApplicationContext reactContext) { - super(reactContext); + public FBLoginManagerModule(ReactApplicationContext reactContext, FBActivityEventListener activityEventListener) { + super(reactContext, activityEventListener); } @Override diff --git a/android/src/main/java/com/facebook/reactnative/androidsdk/FBMessageDialogModule.java b/android/src/main/java/com/facebook/reactnative/androidsdk/FBMessageDialogModule.java index d37b0289..06b70f72 100644 --- a/android/src/main/java/com/facebook/reactnative/androidsdk/FBMessageDialogModule.java +++ b/android/src/main/java/com/facebook/reactnative/androidsdk/FBMessageDialogModule.java @@ -56,8 +56,8 @@ public void onSuccess(MessageDialog.Result result) { private boolean mShouldFailOnDataError; - public FBMessageDialogModule(ReactApplicationContext reactContext) { - super(reactContext); + public FBMessageDialogModule(ReactApplicationContext reactContext, FBActivityEventListener activityEventListener) { + super(reactContext, activityEventListener); } @Override diff --git a/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKCallbackManagerBaseJavaModule.java b/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKCallbackManagerBaseJavaModule.java index 54742fd8..8aafc346 100644 --- a/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKCallbackManagerBaseJavaModule.java +++ b/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKCallbackManagerBaseJavaModule.java @@ -26,15 +26,16 @@ public abstract class FBSDKCallbackManagerBaseJavaModule extends ReactContextBaseJavaModule { - private FBActivityEventListener mActivityEventListener = new FBActivityEventListener(); + private final FBActivityEventListener mActivityEventListener; protected CallbackManager getCallbackManager() { return mActivityEventListener.getCallbackManager(); } - protected FBSDKCallbackManagerBaseJavaModule(ReactApplicationContext reactContext) { + protected FBSDKCallbackManagerBaseJavaModule(ReactApplicationContext reactContext, FBActivityEventListener activityEventListener) { super(reactContext); + mActivityEventListener = activityEventListener; reactContext.addActivityEventListener(mActivityEventListener); } } diff --git a/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java b/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java index 86a3af46..a87e1d44 100644 --- a/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java +++ b/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java @@ -29,18 +29,21 @@ import java.util.List; public class FBSDKPackage implements ReactPackage { + + private FBActivityEventListener mActivityEventListener = new FBActivityEventListener(); + @Override public List createNativeModules( ReactApplicationContext reactContext) { return Arrays.asList( new FBAccessTokenModule(reactContext), new FBAppEventsLoggerModule(reactContext), - new FBGameRequestDialogModule(reactContext), + new FBGameRequestDialogModule(reactContext, mActivityEventListener), new FBGraphRequestModule(reactContext), - new FBLoginManagerModule(reactContext), - new FBMessageDialogModule(reactContext), + new FBLoginManagerModule(reactContext, mActivityEventListener), + new FBMessageDialogModule(reactContext, mActivityEventListener), new FBShareAPIModule(reactContext), - new FBShareDialogModule(reactContext) + new FBShareDialogModule(reactContext, mActivityEventListener) ); } diff --git a/android/src/main/java/com/facebook/reactnative/androidsdk/FBShareDialogModule.java b/android/src/main/java/com/facebook/reactnative/androidsdk/FBShareDialogModule.java index b578daaf..42a3bc81 100644 --- a/android/src/main/java/com/facebook/reactnative/androidsdk/FBShareDialogModule.java +++ b/android/src/main/java/com/facebook/reactnative/androidsdk/FBShareDialogModule.java @@ -55,8 +55,8 @@ public void onSuccess(Sharer.Result result) { private ShareDialog.Mode mShareDialogMode; private boolean mShouldFailOnError; - public FBShareDialogModule(ReactApplicationContext reactContext) { - super(reactContext); + public FBShareDialogModule(ReactApplicationContext reactContext, FBActivityEventListener activityEventListener) { + super(reactContext, activityEventListener); } @Override