Skip to content

Commit

Permalink
Back out "Add onUserLeaveHint support to ReactActivityDelegate facebo…
Browse files Browse the repository at this point in the history
…ok#43488"

Summary:
Original commit changeset: 144a1d84b691

Original Phabricator Diff: D55123632

Differential Revision: D55218594
  • Loading branch information
RSNara authored and facebook-github-bot committed Mar 22, 2024
1 parent b13e9f8 commit 9f2d14e
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 85 deletions.
10 changes: 0 additions & 10 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public abstract class com/facebook/react/ReactActivity : androidx/appcompat/app/
protected fun onPause ()V
public fun onRequestPermissionsResult (I[Ljava/lang/String;[I)V
protected fun onResume ()V
public fun onUserLeaveHint ()V
public fun onWindowFocusChanged (Z)V
public fun requestPermissions ([Ljava/lang/String;ILcom/facebook/react/modules/core/PermissionListener;)V
}
Expand Down Expand Up @@ -132,7 +131,6 @@ public class com/facebook/react/ReactActivityDelegate {
public fun onPause ()V
public fun onRequestPermissionsResult (I[Ljava/lang/String;[I)V
public fun onResume ()V
public fun onUserLeaveHint ()V
public fun onWindowFocusChanged (Z)V
public fun requestPermissions ([Ljava/lang/String;ILcom/facebook/react/modules/core/PermissionListener;)V
}
Expand Down Expand Up @@ -161,7 +159,6 @@ public class com/facebook/react/ReactDelegate {
public fun onKeyDown (ILandroid/view/KeyEvent;)Z
public fun onKeyLongPress (I)Z
public fun onNewIntent (Landroid/content/Intent;)Z
public fun onUserLeaveHint ()V
public fun onWindowFocusChanged (Z)V
public fun reload ()V
public fun shouldShowDevMenuOrReload (ILandroid/view/KeyEvent;)Z
Expand Down Expand Up @@ -212,7 +209,6 @@ public abstract interface class com/facebook/react/ReactHost {
public abstract fun onConfigurationChanged (Landroid/content/Context;)V
public abstract fun onHostDestroy ()V
public abstract fun onHostDestroy (Landroid/app/Activity;)V
public abstract fun onHostLeaveHint (Landroid/app/Activity;)V
public abstract fun onHostPause ()V
public abstract fun onHostPause (Landroid/app/Activity;)V
public abstract fun onHostResume (Landroid/app/Activity;)V
Expand Down Expand Up @@ -256,7 +252,6 @@ public class com/facebook/react/ReactInstanceManager {
public fun onHostResume (Landroid/app/Activity;)V
public fun onHostResume (Landroid/app/Activity;Lcom/facebook/react/modules/core/DefaultHardwareBackBtnHandler;)V
public fun onNewIntent (Landroid/content/Intent;)V
public fun onUserLeaveHint (Landroid/app/Activity;)V
public fun onWindowFocusChange (Z)V
public fun recreateReactContextInBackground ()V
public fun removeReactInstanceEventListener (Lcom/facebook/react/ReactInstanceEventListener;)V
Expand Down Expand Up @@ -491,7 +486,6 @@ public class com/facebook/react/animated/NativeAnimatedNodesManager : com/facebo
public abstract interface class com/facebook/react/bridge/ActivityEventListener {
public abstract fun onActivityResult (Landroid/app/Activity;IILandroid/content/Intent;)V
public abstract fun onNewIntent (Landroid/content/Intent;)V
public fun onUserLeaveHint (Landroid/app/Activity;)V
}

public class com/facebook/react/bridge/Arguments {
Expand Down Expand Up @@ -1118,7 +1112,6 @@ public class com/facebook/react/bridge/ReactContext : android/content/ContextWra
public fun onHostPause ()V
public fun onHostResume (Landroid/app/Activity;)V
public fun onNewIntent (Landroid/app/Activity;Landroid/content/Intent;)V
public fun onUserLeaveHint (Landroid/app/Activity;)V
public fun onWindowFocusChange (Z)V
public fun registerSegment (ILjava/lang/String;Lcom/facebook/react/bridge/Callback;)V
public fun removeActivityEventListener (Lcom/facebook/react/bridge/ActivityEventListener;)V
Expand Down Expand Up @@ -1268,8 +1261,6 @@ public final class com/facebook/react/bridge/ReactMarkerConstants : java/lang/En
public static final field ON_HOST_PAUSE_START Lcom/facebook/react/bridge/ReactMarkerConstants;
public static final field ON_HOST_RESUME_END Lcom/facebook/react/bridge/ReactMarkerConstants;
public static final field ON_HOST_RESUME_START Lcom/facebook/react/bridge/ReactMarkerConstants;
public static final field ON_USER_LEAVE_HINT_END Lcom/facebook/react/bridge/ReactMarkerConstants;
public static final field ON_USER_LEAVE_HINT_START Lcom/facebook/react/bridge/ReactMarkerConstants;
public static final field PRE_REACT_CONTEXT_END Lcom/facebook/react/bridge/ReactMarkerConstants;
public static final field PRE_RUN_JS_BUNDLE_START Lcom/facebook/react/bridge/ReactMarkerConstants;
public static final field PRE_SETUP_REACT_CONTEXT_END Lcom/facebook/react/bridge/ReactMarkerConstants;
Expand Down Expand Up @@ -3657,7 +3648,6 @@ public class com/facebook/react/runtime/ReactHostImpl : com/facebook/react/React
public fun onConfigurationChanged (Landroid/content/Context;)V
public fun onHostDestroy ()V
public fun onHostDestroy (Landroid/app/Activity;)V
public fun onHostLeaveHint (Landroid/app/Activity;)V
public fun onHostPause ()V
public fun onHostPause (Landroid/app/Activity;)V
public fun onHostResume (Landroid/app/Activity;)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,6 @@ public void onNewIntent(Intent intent) {
}
}

@Override
public void onUserLeaveHint() {
super.onUserLeaveHint();
mDelegate.onUserLeaveHint();
}

@Override
public void requestPermissions(
String[] permissions, int requestCode, PermissionListener listener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ protected void loadApp(String appKey) {
getPlainActivity().setContentView(mReactDelegate.getReactRootView());
}

public void onUserLeaveHint() {
mReactDelegate.onUserLeaveHint();
}

public void onPause() {
mReactDelegate.onHostPause();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,6 @@ public void onHostResume() {
}
}

public void onUserLeaveHint() {
if (ReactFeatureFlags.enableBridgelessArchitecture) {
mReactHost.onHostLeaveHint(mActivity);
} else {
if (getReactNativeHost().hasInstance()) {
getReactNativeHost().getReactInstanceManager().onUserLeaveHint(mActivity);
}
}
}

public void onHostPause() {
if (ReactFeatureFlags.enableBridgelessArchitecture) {
mReactHost.onHostPause(mActivity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ public interface ReactHost {
/** To be called when the host activity is resumed. */
public fun onHostResume(activity: Activity?)

/**
* To be called when the host activity is about to go into the background as the result of user
* choice.
*/
public fun onHostLeaveHint(activity: Activity?)

/** To be called when the host activity is paused. */
public fun onHostPause(activity: Activity?)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,25 +583,6 @@ public void onHostPause() {
moveToBeforeResumeLifecycleState();
}

/**
* This method should be called from {@link Activity#onUserLeaveHint()}. It notifies all listening
* modules that the user is about to leave the activity. The passed Activity is has to be the
* current Activity.
*
* @param activity the activity being backgrounded as a result of user action
*/
@ThreadConfined(UI)
public void onUserLeaveHint(@Nullable Activity activity) {
if (mCurrentActivity != null && activity == mCurrentActivity) {
UiThreadUtil.assertOnUiThread();

ReactContext currentContext = getCurrentReactContext();
if (currentContext != null) {
currentContext.onUserLeaveHint(activity);
}
}
}

/**
* Call this from {@link Activity#onPause()}. This notifies any listening modules so they can do
* any necessary cleanup. The passed Activity is the current Activity being paused. This will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,4 @@ public interface ActivityEventListener {

/** Called when a new intent is passed to the activity */
void onNewIntent(Intent intent);

/** Called when host activity receives an {@link Activity#onUserLeaveHint()} call. */
default void onUserLeaveHint(Activity activity) {};
}
Original file line number Diff line number Diff line change
Expand Up @@ -331,19 +331,6 @@ public void onHostResume(@Nullable Activity activity) {
ReactMarker.logMarker(ReactMarkerConstants.ON_HOST_RESUME_END);
}

@ThreadConfined(UI)
public void onUserLeaveHint(@Nullable Activity activity) {
ReactMarker.logMarker(ReactMarkerConstants.ON_USER_LEAVE_HINT_START);
for (ActivityEventListener listener : mActivityEventListeners) {
try {
listener.onUserLeaveHint(activity);
} catch (RuntimeException e) {
handleException(e);
}
}
ReactMarker.logMarker(ReactMarkerConstants.ON_USER_LEAVE_HINT_END);
}

@ThreadConfined(UI)
public void onNewIntent(@Nullable Activity activity, Intent intent) {
UiThreadUtil.assertOnUiThread();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public enum ReactMarkerConstants {
INITIALIZE_MODULE_END,
ON_HOST_RESUME_START,
ON_HOST_RESUME_END,
ON_USER_LEAVE_HINT_START,
ON_USER_LEAVE_HINT_END,
ON_HOST_PAUSE_START,
ON_HOST_PAUSE_END,
CONVERT_CONSTANTS_START,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,6 @@ public void onHostResume(final @Nullable Activity activity) {
mReactLifecycleStateManager.moveToOnHostResume(currentContext, getCurrentActivity());
}

@ThreadConfined(UI)
@Override
public void onHostLeaveHint(final @Nullable Activity activity) {
final String method = "onUserLeaveHint(activity)";
log(method);

ReactContext currentContext = getCurrentReactContext();
if (currentContext != null) {
currentContext.onUserLeaveHint(activity);
}
}

@ThreadConfined(UI)
@Override
public void onHostPause(final @Nullable Activity activity) {
Expand Down

0 comments on commit 9f2d14e

Please sign in to comment.