Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

Commit

Permalink
Fix sharing callback doesn't get called on Android. (#617)
Browse files Browse the repository at this point in the history
  • Loading branch information
HelloCore authored and janicduplessis committed Aug 25, 2019
1 parent 87fba70 commit e7e87f1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@
import java.util.List;

public class FBSDKPackage implements ReactPackage {

private FBActivityEventListener mActivityEventListener = new FBActivityEventListener();

@Override
public List<NativeModule> createNativeModules(
ReactApplicationContext reactContext) {
return Arrays.<NativeModule>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)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e7e87f1

Please sign in to comment.