Kotlinify DispatchStringCommandMountItem (#43870)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43870

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: alanleedev

Differential Revision: D55752447

fbshipit-source-id: 1965cc39601f514d0664d4d73bff4546f7c0f170
This commit is contained in:
Fabrizio Cucci
2024-04-05 13:47:44 -07:00
committed by Facebook GitHub Bot
parent 3f05ad6e8e
commit d5dcaf3c1e
2 changed files with 27 additions and 47 deletions
@@ -1,47 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.fabric.mounting.mountitems;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.fabric.mounting.MountingManager;
@Nullsafe(Nullsafe.Mode.LOCAL)
final class DispatchStringCommandMountItem extends DispatchCommandMountItem {
private final int mSurfaceId;
private final int mReactTag;
private final @NonNull String mCommandId;
private final @Nullable ReadableArray mCommandArgs;
DispatchStringCommandMountItem(
int surfaceId, int reactTag, @NonNull String commandId, @Nullable ReadableArray commandArgs) {
mSurfaceId = surfaceId;
mReactTag = reactTag;
mCommandId = commandId;
mCommandArgs = commandArgs;
}
@Override
public int getSurfaceId() {
return mSurfaceId;
}
@Override
public void execute(@NonNull MountingManager mountingManager) {
mountingManager.receiveCommand(mSurfaceId, mReactTag, mCommandId, mCommandArgs);
}
@Override
@NonNull
public String toString() {
return "DispatchStringCommandMountItem [" + mReactTag + "] " + mCommandId;
}
}
@@ -0,0 +1,27 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.fabric.mounting.mountitems
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.fabric.mounting.MountingManager
internal class DispatchStringCommandMountItem(
private val surfaceId: Int,
private val reactTag: Int,
private val commandId: String,
private val commandArgs: ReadableArray?
) : DispatchCommandMountItem() {
override public fun getSurfaceId(): Int = surfaceId
override public fun execute(mountingManager: MountingManager) {
mountingManager.receiveCommand(surfaceId, reactTag, commandId, commandArgs)
}
override public fun toString(): String = "DispatchStringCommandMountItem [$reactTag] $commandId"
}