Skip to content

Commit 43fe9f3

Browse files
mateoguzmanafacebook-github-bot
authored andcommitted
Migrate ActivityEventListener & BaseActivityEventListener to Kotlin (facebook#49910)
Summary: Migrate com.facebook.react.bridge ActivityEventListener & BaseActivityEventListener to Kotlin. ## Changelog: [INTERNAL] - Migrate com.facebook.react.bridge ActivityEventListener & BaseActivityEventListener to Kotlin Pull Request resolved: facebook#49910 Test Plan: ```bash yarn test-android yarn android ``` Reviewed By: alanleedev Differential Revision: D70871037 Pulled By: Abbondanzo fbshipit-source-id: ebb784db5ea58598f483f9775629666716de39f0
1 parent 6c5a9e8 commit 43fe9f3

File tree

4 files changed

+55
-58
lines changed

4 files changed

+55
-58
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ActivityEventListener.java

-29
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
package com.facebook.react.bridge
9+
10+
import android.app.Activity
11+
import android.content.Intent
12+
13+
/**
14+
* Listener for receiving activity events. Consider using [BaseActivityEventListener] if you're not
15+
* interested in all the events sent to this interface.
16+
*/
17+
public interface ActivityEventListener {
18+
/** Called when host (activity/service) receives an [Activity.onActivityResult] call. */
19+
public fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?)
20+
21+
/** Called when a new intent is passed to the activity. */
22+
public fun onNewIntent(intent: Intent)
23+
24+
/** Called when host activity receives an [Activity.onUserLeaveHint] call. */
25+
public fun onUserLeaveHint(activity: Activity): Unit = Unit
26+
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseActivityEventListener.java

-29
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
package com.facebook.react.bridge
9+
10+
import android.app.Activity
11+
import android.content.Intent
12+
13+
/** An empty implementation of [ActivityEventListener]. */
14+
public open class BaseActivityEventListener : ActivityEventListener {
15+
@Suppress("UNUSED_PARAMETER")
16+
@Deprecated(
17+
"Use onActivityResult(Activity, Int, Int, Intent) instead.",
18+
ReplaceWith("onActivityResult(activity, requestCode, resultCode, data)"))
19+
public open fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent): Unit = Unit
20+
21+
override public fun onActivityResult(
22+
activity: Activity,
23+
requestCode: Int,
24+
resultCode: Int,
25+
data: Intent?
26+
): Unit = Unit
27+
28+
override public fun onNewIntent(intent: Intent): Unit = Unit
29+
}

0 commit comments

Comments
 (0)