Skip to content

Commit

Permalink
Move assertion for intent FbReactFragment's onActivityResult
Browse files Browse the repository at this point in the history
Summary:
Changelog:
[Android][Changed] - Mark intent as nullable

Reviewed By: rahulraj

Differential Revision: D35058290

fbshipit-source-id: 3025de8b01660358a010c6886893d860ed4573fb
  • Loading branch information
luluwu2032 authored and facebook-github-bot committed Mar 29, 2022
1 parent 7e993a7 commit 5ffa0b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import android.app.Activity;
import android.content.Intent;
import androidx.annotation.Nullable;

/**
* Listener for receiving activity events. Consider using {@link BaseActivityEventListener} if
Expand All @@ -17,7 +18,7 @@
public interface ActivityEventListener {

/** Called when host (activity/service) receives an {@link Activity#onActivityResult} call. */
void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data);
void onActivityResult(Activity activity, int requestCode, int resultCode, @Nullable Intent data);

/** Called when a new intent is passed to the activity */
void onNewIntent(Intent intent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import android.app.Activity;
import android.content.Intent;
import androidx.annotation.Nullable;

/** An empty implementation of {@link ActivityEventListener} */
public class BaseActivityEventListener implements ActivityEventListener {
Expand All @@ -18,7 +19,8 @@ public class BaseActivityEventListener implements ActivityEventListener {
public void onActivityResult(int requestCode, int resultCode, Intent data) {}

@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {}
public void onActivityResult(
Activity activity, int requestCode, int resultCode, @Nullable Intent data) {}

@Override
public void onNewIntent(Intent intent) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ public void destroy() {
}

/** Should be called by the hosting Fragment in {@link Fragment#onActivityResult} */
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
public void onActivityResult(
Activity activity, int requestCode, int resultCode, @Nullable Intent data) {
for (ActivityEventListener listener : mActivityEventListeners) {
try {
listener.onActivityResult(activity, requestCode, resultCode, data);
Expand Down

0 comments on commit 5ffa0b0

Please sign in to comment.