mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Kotlin: redundant unit return type [1/2] (#52993)
Summary: Fixing some warnings from static code analysis regarding [redundant unit return type](https://www.jetbrains.com/help/inspectopedia/RedundantUnitReturnType.html). ## Changelog: [INTERNAL] - Kotlin: redundant unit return type [1/2] Pull Request resolved: https://github.com/facebook/react-native/pull/52993 Test Plan: ```sh yarn test-android yarn android ``` Reviewed By: cortinico Differential Revision: D79546007 Pulled By: rshest fbshipit-source-id: 017cb3b70333fe652ecb1bdca751fa4f56f737fd
This commit is contained in:
1 parent
e39fd8f79c
commit
d547d9e56e
32 files changed
+100
-114
No files matched your search
+1
-1
@@ -21,7 +21,7 @@ public class MemoryPressureRouter(context: Context) : ComponentCallbacks2 {
|
||||
context.applicationContext.registerComponentCallbacks(this)
|
||||
}
|
||||
|
||||
public fun destroy(context: Context): Unit {
|
||||
public fun destroy(context: Context) {
|
||||
context.applicationContext.unregisterComponentCallbacks(this)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity {
|
||||
permissions: Array<String>,
|
||||
requestCode: Int,
|
||||
listener: PermissionListener?
|
||||
): Unit {
|
||||
) {
|
||||
permissionListener = listener
|
||||
requestPermissions(permissions, requestCode)
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
|
||||
@Deprecated("This class is deprecated and will be removed in the next major release.")
|
||||
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
|
||||
internal interface ReactPackageLogger {
|
||||
fun startProcessPackage(): Unit
|
||||
fun startProcessPackage()
|
||||
|
||||
fun endProcessPackage(): Unit
|
||||
fun endProcessPackage()
|
||||
}
|
||||
+1
-1
@@ -27,7 +27,7 @@ public abstract class AnimatedNode {
|
||||
@JvmField internal var BFSColor: Int = INITIAL_BFS_COLOR
|
||||
@JvmField internal var tag: Int = -1
|
||||
|
||||
internal fun addChild(child: AnimatedNode): Unit {
|
||||
internal fun addChild(child: AnimatedNode) {
|
||||
val currentChildren =
|
||||
children
|
||||
?: ArrayList<AnimatedNode>(DEFAULT_ANIMATED_NODE_CHILD_COUNT).also { children = it }
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ internal class DecayAnimation(config: ReadableMap) : AnimationDriver() {
|
||||
resetConfig(config)
|
||||
}
|
||||
|
||||
override fun resetConfig(config: ReadableMap): Unit {
|
||||
override fun resetConfig(config: ReadableMap) {
|
||||
velocity = config.getDouble("velocity")
|
||||
deceleration = config.getDouble("deceleration")
|
||||
startFrameTimeMillis = -1
|
||||
|
||||
+1
-1
@@ -219,7 +219,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) :
|
||||
*
|
||||
* @param viewTag The tag of the scroll view that has stopped scrolling
|
||||
*/
|
||||
public fun userDrivenScrollEnded(viewTag: Int): Unit {
|
||||
public fun userDrivenScrollEnded(viewTag: Int) {
|
||||
// ask to the Node Manager for all the native nodes listening to OnScroll event
|
||||
val nodeManager = nodesManagerRef.get() ?: return
|
||||
|
||||
|
||||
+21
-24
@@ -72,7 +72,7 @@ public class NativeAnimatedNodesManager(
|
||||
*
|
||||
* @param uiManagerType
|
||||
*/
|
||||
public fun initializeEventListenerForUIManagerType(@UIManagerType uiManagerType: Int): Unit {
|
||||
public fun initializeEventListenerForUIManagerType(@UIManagerType uiManagerType: Int) {
|
||||
val isEventListenerInitialized =
|
||||
when (uiManagerType) {
|
||||
UIManagerType.FABRIC -> eventListenerInitializedForFabric
|
||||
@@ -100,7 +100,7 @@ public class NativeAnimatedNodesManager(
|
||||
public fun hasActiveAnimations(): Boolean = activeAnimations.size() > 0 || updatedNodes.size() > 0
|
||||
|
||||
@UiThread
|
||||
public fun createAnimatedNode(tag: Int, config: ReadableMap): Unit {
|
||||
public fun createAnimatedNode(tag: Int, config: ReadableMap) {
|
||||
if (animatedNodes.get(tag) != null) {
|
||||
throw JSApplicationIllegalArgumentException(
|
||||
"createAnimatedNode: Animated node [$tag] already exists")
|
||||
@@ -129,7 +129,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun updateAnimatedNodeConfig(tag: Int, config: ReadableMap?): Unit {
|
||||
public fun updateAnimatedNodeConfig(tag: Int, config: ReadableMap?) {
|
||||
val node =
|
||||
animatedNodes.get(tag)
|
||||
?: throw JSApplicationIllegalArgumentException(
|
||||
@@ -143,16 +143,13 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun dropAnimatedNode(tag: Int): Unit {
|
||||
public fun dropAnimatedNode(tag: Int) {
|
||||
animatedNodes.remove(tag)
|
||||
updatedNodes.remove(tag)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun startListeningToAnimatedNodeValue(
|
||||
tag: Int,
|
||||
listener: AnimatedNodeValueListener?
|
||||
): Unit {
|
||||
public fun startListeningToAnimatedNodeValue(tag: Int, listener: AnimatedNodeValueListener?) {
|
||||
val node = animatedNodes[tag]
|
||||
if (node == null || node !is ValueAnimatedNode) {
|
||||
throw JSApplicationIllegalArgumentException(
|
||||
@@ -162,7 +159,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun stopListeningToAnimatedNodeValue(tag: Int): Unit {
|
||||
public fun stopListeningToAnimatedNodeValue(tag: Int) {
|
||||
val node = animatedNodes.get(tag)
|
||||
if (node == null || node !is ValueAnimatedNode) {
|
||||
throw JSApplicationIllegalArgumentException(
|
||||
@@ -172,7 +169,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun setAnimatedNodeValue(tag: Int, value: Double): Unit {
|
||||
public fun setAnimatedNodeValue(tag: Int, value: Double) {
|
||||
val node = animatedNodes.get(tag)
|
||||
if (node == null || node !is ValueAnimatedNode) {
|
||||
throw JSApplicationIllegalArgumentException(
|
||||
@@ -184,7 +181,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun setAnimatedNodeOffset(tag: Int, offset: Double): Unit {
|
||||
public fun setAnimatedNodeOffset(tag: Int, offset: Double) {
|
||||
val node = animatedNodes.get(tag)
|
||||
if (node == null || node !is ValueAnimatedNode) {
|
||||
throw JSApplicationIllegalArgumentException(
|
||||
@@ -195,7 +192,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun flattenAnimatedNodeOffset(tag: Int): Unit {
|
||||
public fun flattenAnimatedNodeOffset(tag: Int) {
|
||||
val node = animatedNodes.get(tag)
|
||||
if (node == null || node !is ValueAnimatedNode) {
|
||||
throw JSApplicationIllegalArgumentException(
|
||||
@@ -205,7 +202,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun extractAnimatedNodeOffset(tag: Int): Unit {
|
||||
public fun extractAnimatedNodeOffset(tag: Int) {
|
||||
val node = animatedNodes.get(tag)
|
||||
if (node == null || node !is ValueAnimatedNode) {
|
||||
throw JSApplicationIllegalArgumentException(
|
||||
@@ -220,7 +217,7 @@ public class NativeAnimatedNodesManager(
|
||||
animatedNodeTag: Int,
|
||||
animationConfig: ReadableMap,
|
||||
endCallback: Callback?
|
||||
): Unit {
|
||||
) {
|
||||
val node =
|
||||
animatedNodes.get(animatedNodeTag)
|
||||
?: throw JSApplicationIllegalArgumentException(
|
||||
@@ -298,7 +295,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun stopAnimation(animationId: Int): Unit {
|
||||
public fun stopAnimation(animationId: Int) {
|
||||
// in most of the cases there should never be more than a few active animations running at the
|
||||
// same time. Therefore it does not make much sense to create an animationId -> animation
|
||||
// object map that would require additional memory just to support the use-case of stopping
|
||||
@@ -342,7 +339,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun connectAnimatedNodes(parentNodeTag: Int, childNodeTag: Int): Unit {
|
||||
public fun connectAnimatedNodes(parentNodeTag: Int, childNodeTag: Int) {
|
||||
val parentNode =
|
||||
animatedNodes.get(parentNodeTag)
|
||||
?: throw JSApplicationIllegalArgumentException(
|
||||
@@ -355,7 +352,7 @@ public class NativeAnimatedNodesManager(
|
||||
updatedNodes.put(childNodeTag, childNode)
|
||||
}
|
||||
|
||||
public fun disconnectAnimatedNodes(parentNodeTag: Int, childNodeTag: Int): Unit {
|
||||
public fun disconnectAnimatedNodes(parentNodeTag: Int, childNodeTag: Int) {
|
||||
val parentNode =
|
||||
animatedNodes.get(parentNodeTag)
|
||||
?: throw JSApplicationIllegalArgumentException(
|
||||
@@ -369,7 +366,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun connectAnimatedNodeToView(animatedNodeTag: Int, viewTag: Int): Unit {
|
||||
public fun connectAnimatedNodeToView(animatedNodeTag: Int, viewTag: Int) {
|
||||
val node =
|
||||
animatedNodes.get(animatedNodeTag)
|
||||
?: throw JSApplicationIllegalArgumentException(
|
||||
@@ -396,7 +393,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun disconnectAnimatedNodeFromView(animatedNodeTag: Int, viewTag: Int): Unit {
|
||||
public fun disconnectAnimatedNodeFromView(animatedNodeTag: Int, viewTag: Int) {
|
||||
val node =
|
||||
animatedNodes.get(animatedNodeTag)
|
||||
?: throw JSApplicationIllegalArgumentException(
|
||||
@@ -409,7 +406,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun getValue(tag: Int, callback: Callback?): Unit {
|
||||
public fun getValue(tag: Int, callback: Callback?) {
|
||||
val node = animatedNodes.get(tag)
|
||||
if (node == null || node !is ValueAnimatedNode) {
|
||||
throw JSApplicationIllegalArgumentException(
|
||||
@@ -436,7 +433,7 @@ public class NativeAnimatedNodesManager(
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public fun restoreDefaultValues(animatedNodeTag: Int): Unit {
|
||||
public fun restoreDefaultValues(animatedNodeTag: Int) {
|
||||
val node = animatedNodes.get(animatedNodeTag) ?: return
|
||||
// Restoring default values needs to happen before UIManager operations so it is
|
||||
// possible the node hasn't been created yet if it is being connected and
|
||||
@@ -454,7 +451,7 @@ public class NativeAnimatedNodesManager(
|
||||
viewTag: Int,
|
||||
eventHandlerName: String,
|
||||
eventMapping: ReadableMap
|
||||
): Unit {
|
||||
) {
|
||||
val nodeTag = eventMapping.getInt("animatedValueTag")
|
||||
val node =
|
||||
animatedNodes.get(nodeTag)
|
||||
@@ -487,7 +484,7 @@ public class NativeAnimatedNodesManager(
|
||||
viewTag: Int,
|
||||
eventHandlerName: String,
|
||||
animatedValueTag: Int
|
||||
): Unit {
|
||||
) {
|
||||
val eventName = normalizeEventName(eventHandlerName)
|
||||
|
||||
eventDrivers
|
||||
@@ -550,7 +547,7 @@ public class NativeAnimatedNodesManager(
|
||||
* have already been visited.
|
||||
*/
|
||||
@UiThread
|
||||
public fun runUpdates(frameTimeNanos: Long): Unit {
|
||||
public fun runUpdates(frameTimeNanos: Long) {
|
||||
UiThreadUtil.assertOnUiThread()
|
||||
var hasFinishedAnimations = false
|
||||
|
||||
|
||||
+4
-4
@@ -27,21 +27,21 @@ internal open class ValueAnimatedNode(config: ReadableMap? = null) : AnimatedNod
|
||||
|
||||
open fun getAnimatedObject(): Any? = null
|
||||
|
||||
fun flattenOffset(): Unit {
|
||||
fun flattenOffset() {
|
||||
nodeValue += offset
|
||||
offset = 0.0
|
||||
}
|
||||
|
||||
fun extractOffset(): Unit {
|
||||
fun extractOffset() {
|
||||
offset += nodeValue
|
||||
nodeValue = 0.0
|
||||
}
|
||||
|
||||
fun onValueUpdate(): Unit {
|
||||
fun onValueUpdate() {
|
||||
valueListener?.onValueUpdate(getValue() - offset, offset)
|
||||
}
|
||||
|
||||
fun setValueListener(listener: AnimatedNodeValueListener?): Unit {
|
||||
fun setValueListener(listener: AnimatedNodeValueListener?) {
|
||||
valueListener = listener
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -28,5 +28,5 @@ public interface Dynamic {
|
||||
|
||||
public fun asString(): String?
|
||||
|
||||
public fun recycle(): Unit
|
||||
public fun recycle()
|
||||
}
|
||||
+4
-9
@@ -78,7 +78,7 @@ public object ReactMarker {
|
||||
instanceKey: Int,
|
||||
timestamp: Long,
|
||||
counter: Int
|
||||
): Unit {
|
||||
) {
|
||||
for (listener in fabricMarkerListeners) {
|
||||
listener.logFabricMarker(name, tag, instanceKey, timestamp, counter)
|
||||
}
|
||||
@@ -145,12 +145,7 @@ public object ReactMarker {
|
||||
@JvmStatic
|
||||
@DoNotStrip
|
||||
@AnyThread
|
||||
public fun logMarker(
|
||||
name: ReactMarkerConstants,
|
||||
tag: String?,
|
||||
instanceKey: Int,
|
||||
time: Long?
|
||||
): Unit {
|
||||
public fun logMarker(name: ReactMarkerConstants, tag: String?, instanceKey: Int, time: Long?) {
|
||||
logFabricMarker(name, tag, instanceKey)
|
||||
for (listener in listeners) {
|
||||
listener.logMarker(name, tag, instanceKey)
|
||||
@@ -161,7 +156,7 @@ public object ReactMarker {
|
||||
|
||||
@JvmStatic
|
||||
@DoNotStrip
|
||||
private fun notifyNativeMarker(name: ReactMarkerConstants, time: Long?): Unit {
|
||||
private fun notifyNativeMarker(name: ReactMarkerConstants, time: Long?) {
|
||||
if (!name.hasMatchingNameMarker) {
|
||||
return
|
||||
}
|
||||
@@ -199,7 +194,7 @@ public object ReactMarker {
|
||||
tag: String?,
|
||||
instanceKey: Int,
|
||||
timestamp: Long
|
||||
): Unit
|
||||
)
|
||||
|
||||
public fun logFabricMarker(
|
||||
name: ReactMarkerConstants,
|
||||
|
||||
+4
-4
@@ -44,24 +44,24 @@ internal object ReactSoftExceptionLogger {
|
||||
private val listeners: MutableList<ReactSoftExceptionListener> = CopyOnWriteArrayList()
|
||||
|
||||
@JvmStatic
|
||||
fun addListener(listener: ReactSoftExceptionListener): Unit {
|
||||
fun addListener(listener: ReactSoftExceptionListener) {
|
||||
if (!listeners.contains(listener)) {
|
||||
listeners.add(listener)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun removeListener(listener: ReactSoftExceptionListener): Unit {
|
||||
fun removeListener(listener: ReactSoftExceptionListener) {
|
||||
listeners.remove(listener)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun logSoftExceptionVerbose(@CategoryMode category: String, cause: Throwable): Unit {
|
||||
fun logSoftExceptionVerbose(@CategoryMode category: String, cause: Throwable) {
|
||||
logSoftException("${category}|${cause.javaClass.simpleName}:${cause.message}", cause)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun logSoftException(@CategoryMode category: String, cause: Throwable): Unit {
|
||||
fun logSoftException(@CategoryMode category: String, cause: Throwable) {
|
||||
if (listeners.isNotEmpty()) {
|
||||
for (listener in listeners) {
|
||||
listener.logSoftException(category, cause)
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ internal object SoftAssertions {
|
||||
* throw.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun assertUnreachable(message: String): Unit {
|
||||
fun assertUnreachable(message: String) {
|
||||
ReactSoftExceptionLogger.logSoftException(SOFT_ASSERTIONS, AssertionException(message))
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ internal object SoftAssertions {
|
||||
* throw.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun assertCondition(condition: Boolean, message: String): Unit {
|
||||
fun assertCondition(condition: Boolean, message: String) {
|
||||
if (!condition) {
|
||||
ReactSoftExceptionLogger.logSoftException(SOFT_ASSERTIONS, AssertionException(message))
|
||||
}
|
||||
|
||||
+5
-5
@@ -18,21 +18,21 @@ public interface UIManagerListener {
|
||||
*
|
||||
* <p>This is called by Paper only.
|
||||
*/
|
||||
public fun willDispatchViewUpdates(uiManager: UIManager): Unit
|
||||
public fun willDispatchViewUpdates(uiManager: UIManager)
|
||||
|
||||
/**
|
||||
* Called on UIThread right before view updates are executed.
|
||||
*
|
||||
* <p>This is called by Fabric only.
|
||||
*/
|
||||
public fun willMountItems(uiManager: UIManager): Unit
|
||||
public fun willMountItems(uiManager: UIManager)
|
||||
|
||||
/**
|
||||
* Called on UIThread right after view updates are executed.
|
||||
*
|
||||
* <p>This is called by Fabric only.
|
||||
*/
|
||||
public fun didMountItems(uiManager: UIManager): Unit
|
||||
public fun didMountItems(uiManager: UIManager)
|
||||
|
||||
/**
|
||||
* Called on UIThread right after view updates are dispatched for a frame. Note that this will be
|
||||
@@ -40,12 +40,12 @@ public interface UIManagerListener {
|
||||
*
|
||||
* <p>This is called by Fabric only.
|
||||
*/
|
||||
public fun didDispatchMountItems(uiManager: UIManager): Unit
|
||||
public fun didDispatchMountItems(uiManager: UIManager)
|
||||
|
||||
/**
|
||||
* Called right after scheduleMountItems is called in Fabric, after a new tree is committed.
|
||||
*
|
||||
* <p>This is called by Fabric only.
|
||||
*/
|
||||
public fun didScheduleMountItems(uiManager: UIManager): Unit
|
||||
public fun didScheduleMountItems(uiManager: UIManager)
|
||||
}
|
||||
+1
-1
@@ -11,5 +11,5 @@ package com.facebook.react.bridge
|
||||
* Listener for receiving window focus events.
|
||||
*/
|
||||
public interface WindowFocusChangeListener {
|
||||
public fun onWindowFocusChange(hasFocus: Boolean): Unit
|
||||
public fun onWindowFocusChange(hasFocus: Boolean)
|
||||
}
|
||||
+1
-1
@@ -25,5 +25,5 @@ public object DefaultComponentsRegistry {
|
||||
DefaultSoLoader.maybeLoadSoLibrary()
|
||||
}
|
||||
|
||||
@JvmStatic @DoNotStrip public external fun register(componentFactory: ComponentFactory): Unit
|
||||
@JvmStatic @DoNotStrip public external fun register(componentFactory: ComponentFactory)
|
||||
}
|
||||
+1
-1
@@ -39,7 +39,7 @@ internal class PackagerStatusCheck {
|
||||
this.client = client
|
||||
}
|
||||
|
||||
fun run(host: String, callback: PackagerStatusCallback): Unit {
|
||||
fun run(host: String, callback: PackagerStatusCallback) {
|
||||
val statusURL = createPackagerStatusURL(host)
|
||||
val request = Request.Builder().url(statusURL).build()
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
package com.facebook.react.devsupport.interfaces
|
||||
|
||||
public fun interface BundleLoadCallback {
|
||||
public fun onSuccess(): Unit
|
||||
public fun onSuccess()
|
||||
|
||||
public fun onError(cause: Exception): Unit = Unit
|
||||
}
|
||||
+1
-1
@@ -296,7 +296,7 @@ public class BlobModule(reactContext: ReactApplicationContext) :
|
||||
}
|
||||
}
|
||||
|
||||
public override fun createFromParts(parts: ReadableArray, blobId: String): Unit {
|
||||
public override fun createFromParts(parts: ReadableArray, blobId: String) {
|
||||
var totalBlobSize = 0
|
||||
val partList = ArrayList<ByteArray>(parts.size())
|
||||
|
||||
|
||||
+2
-2
@@ -45,13 +45,13 @@ public class ForwardingCookieHandler() : CookieHandler() {
|
||||
}
|
||||
}
|
||||
|
||||
public fun clearCookies(callback: Callback): Unit {
|
||||
public fun clearCookies(callback: Callback) {
|
||||
cookieManager?.removeAllCookies { value -> callback.invoke(value) }
|
||||
}
|
||||
|
||||
public fun destroy(): Unit = Unit
|
||||
|
||||
public fun addCookies(url: String, cookies: List<String>): Unit {
|
||||
public fun addCookies(url: String, cookies: List<String>) {
|
||||
for (cookie in cookies) {
|
||||
addCookieAsync(url, cookie)
|
||||
}
|
||||
|
||||
+9
-9
@@ -181,27 +181,27 @@ public class NetworkingModule(
|
||||
uriHandlers.clear()
|
||||
}
|
||||
|
||||
internal fun addUriHandler(handler: UriHandler): Unit {
|
||||
internal fun addUriHandler(handler: UriHandler) {
|
||||
uriHandlers.add(handler)
|
||||
}
|
||||
|
||||
internal fun addRequestBodyHandler(handler: RequestBodyHandler): Unit {
|
||||
internal fun addRequestBodyHandler(handler: RequestBodyHandler) {
|
||||
requestBodyHandlers.add(handler)
|
||||
}
|
||||
|
||||
internal fun addResponseHandler(handler: ResponseHandler): Unit {
|
||||
internal fun addResponseHandler(handler: ResponseHandler) {
|
||||
responseHandlers.add(handler)
|
||||
}
|
||||
|
||||
internal fun removeUriHandler(handler: UriHandler): Unit {
|
||||
internal fun removeUriHandler(handler: UriHandler) {
|
||||
uriHandlers.remove(handler)
|
||||
}
|
||||
|
||||
internal fun removeRequestBodyHandler(handler: RequestBodyHandler): Unit {
|
||||
internal fun removeRequestBodyHandler(handler: RequestBodyHandler) {
|
||||
requestBodyHandlers.remove(handler)
|
||||
}
|
||||
|
||||
internal fun removeResponseHandler(handler: ResponseHandler): Unit {
|
||||
internal fun removeResponseHandler(handler: ResponseHandler) {
|
||||
responseHandlers.remove(handler)
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class NetworkingModule(
|
||||
useIncrementalUpdates: Boolean,
|
||||
timeout: Int,
|
||||
withCredentials: Boolean
|
||||
): Unit {
|
||||
) {
|
||||
val reactApplicationContext = getReactApplicationContextIfActiveOrWarn()
|
||||
try {
|
||||
val uri = Uri.parse(url)
|
||||
@@ -688,7 +688,7 @@ public class NetworkingModule(
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public override fun clearCookies(callback: com.facebook.react.bridge.Callback): Unit {
|
||||
public override fun clearCookies(callback: com.facebook.react.bridge.Callback) {
|
||||
cookieHandler.clearCookies(callback)
|
||||
}
|
||||
|
||||
@@ -833,7 +833,7 @@ public class NetworkingModule(
|
||||
@JvmStatic
|
||||
public fun setCustomClientBuilder(
|
||||
ccb: com.facebook.react.modules.network.CustomClientBuilder?
|
||||
): Unit {
|
||||
) {
|
||||
customClientBuilder = ccb
|
||||
}
|
||||
|
||||
|
||||
+4
-10
@@ -37,7 +37,7 @@ public class PermissionsModule(reactContext: ReactApplicationContext?) :
|
||||
* Check if the app has the permission given. successCallback is called with true if the
|
||||
* permission had been granted, false otherwise. See [Activity.checkSelfPermission].
|
||||
*/
|
||||
public override fun checkPermission(permission: String, promise: Promise): Unit {
|
||||
public override fun checkPermission(permission: String, promise: Promise) {
|
||||
val context = reactApplicationContext.baseContext
|
||||
promise.resolve(context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED)
|
||||
}
|
||||
@@ -50,10 +50,7 @@ public class PermissionsModule(reactContext: ReactApplicationContext?) :
|
||||
* again). For devices before Android M, this always returns false. See
|
||||
* [PermissionAwareActivity.shouldShowRequestPermissionRationale].
|
||||
*/
|
||||
public override fun shouldShowRequestPermissionRationale(
|
||||
permission: String,
|
||||
promise: Promise
|
||||
): Unit {
|
||||
public override fun shouldShowRequestPermissionRationale(permission: String, promise: Promise) {
|
||||
try {
|
||||
promise.resolve(permissionAwareActivity.shouldShowRequestPermissionRationale(permission))
|
||||
} catch (e: IllegalStateException) {
|
||||
@@ -67,7 +64,7 @@ public class PermissionsModule(reactContext: ReactApplicationContext?) :
|
||||
* user has the permission given or not and resolves with GRANTED or DENIED. See
|
||||
* [Activity.checkSelfPermission].
|
||||
*/
|
||||
public override fun requestPermission(permission: String, promise: Promise): Unit {
|
||||
public override fun requestPermission(permission: String, promise: Promise) {
|
||||
val context = reactApplicationContext.baseContext
|
||||
if (context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) {
|
||||
promise.resolve(GRANTED)
|
||||
@@ -99,10 +96,7 @@ public class PermissionsModule(reactContext: ReactApplicationContext?) :
|
||||
}
|
||||
}
|
||||
|
||||
public override fun requestMultiplePermissions(
|
||||
permissions: ReadableArray,
|
||||
promise: Promise
|
||||
): Unit {
|
||||
public override fun requestMultiplePermissions(permissions: ReadableArray, promise: Promise) {
|
||||
val grantedPermissions = WritableNativeMap()
|
||||
val permissionsToCheck = ArrayList<String>()
|
||||
var checkedPermissionsCount = 0
|
||||
|
||||
+3
-3
@@ -64,7 +64,7 @@ public class WebSocketModule(context: ReactApplicationContext) :
|
||||
}
|
||||
}
|
||||
|
||||
public fun setContentHandler(id: Int, contentHandler: ContentHandler?): Unit {
|
||||
public fun setContentHandler(id: Int, contentHandler: ContentHandler?) {
|
||||
if (contentHandler != null) {
|
||||
contentHandlers[id] = contentHandler
|
||||
} else {
|
||||
@@ -274,7 +274,7 @@ public class WebSocketModule(context: ReactApplicationContext) :
|
||||
}
|
||||
}
|
||||
|
||||
public fun sendBinary(byteString: ByteString, id: Int): Unit {
|
||||
public fun sendBinary(byteString: ByteString, id: Int) {
|
||||
val client = webSocketConnections[id]
|
||||
if (client == null) {
|
||||
// This is a programmer error -- display development warning
|
||||
@@ -367,7 +367,7 @@ public class WebSocketModule(context: ReactApplicationContext) :
|
||||
private var customClientBuilder: CustomClientBuilder? = null
|
||||
|
||||
@JvmStatic
|
||||
public fun setCustomClientBuilder(ccb: CustomClientBuilder?): Unit {
|
||||
public fun setCustomClientBuilder(ccb: CustomClientBuilder?) {
|
||||
customClientBuilder = ccb
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -50,7 +50,7 @@ public class ReconnectingWebSocket(
|
||||
private var suppressConnectionErrors = false
|
||||
private var webSocket: WebSocket? = null
|
||||
|
||||
public fun connect(): Unit {
|
||||
public fun connect() {
|
||||
check(!closed) { "Can't connect closed client" }
|
||||
|
||||
val request = Request.Builder().url(url).build()
|
||||
@@ -76,7 +76,7 @@ public class ReconnectingWebSocket(
|
||||
handler.postDelayed({ delayedReconnect() }, RECONNECT_DELAY_MS)
|
||||
}
|
||||
|
||||
public fun closeQuietly(): Unit {
|
||||
public fun closeQuietly() {
|
||||
closed = true
|
||||
closeWebSocketQuietly()
|
||||
messageCallback = null
|
||||
@@ -138,13 +138,13 @@ public class ReconnectingWebSocket(
|
||||
|
||||
@Synchronized
|
||||
@Throws(IOException::class)
|
||||
public fun sendMessage(message: String): Unit {
|
||||
public fun sendMessage(message: String) {
|
||||
webSocket?.send(message) ?: throw ClosedChannelException()
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
@Throws(IOException::class)
|
||||
public fun sendMessage(message: ByteString): Unit {
|
||||
public fun sendMessage(message: ByteString) {
|
||||
webSocket?.send(message) ?: throw ClosedChannelException()
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -664,7 +664,7 @@ public class ReactHostImpl(
|
||||
}
|
||||
}
|
||||
|
||||
internal fun handleHostException(e: Exception): Unit {
|
||||
internal fun handleHostException(e: Exception) {
|
||||
val method = "handleHostException(message = \"${e.message}\")"
|
||||
log(method)
|
||||
|
||||
@@ -1450,7 +1450,7 @@ public class ReactHostImpl(
|
||||
}
|
||||
|
||||
@ThreadConfined(ThreadConfined.UI)
|
||||
internal fun unregisterInstanceFromInspector(reactInstance: ReactInstance?): Unit {
|
||||
internal fun unregisterInstanceFromInspector(reactInstance: ReactInstance?) {
|
||||
if (reactInstance != null) {
|
||||
if (InspectorFlags.getFuseboxEnabled()) {
|
||||
Assertions.assertCondition(
|
||||
|
||||
+3
-3
@@ -28,21 +28,21 @@ internal class TaskCompletionSource<TResult> {
|
||||
fun trySetError(error: Exception?): Boolean = task.trySetError(error)
|
||||
|
||||
/** Sets the cancelled flag on the task, throwing if the Task has already been completed. */
|
||||
fun setCancelled(): Unit {
|
||||
fun setCancelled() {
|
||||
if (!trySetCancelled()) {
|
||||
throw IllegalStateException("Cannot cancel a completed task.")
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets the result of the Task, throwing if the Task has already been completed. */
|
||||
fun setResult(result: TResult?): Unit {
|
||||
fun setResult(result: TResult?) {
|
||||
if (!trySetResult(result)) {
|
||||
throw IllegalStateException("Cannot set the result of a completed task.")
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets the error of the Task, throwing if the Task has already been completed. */
|
||||
fun setError(error: Exception?): Unit {
|
||||
fun setError(error: Exception?) {
|
||||
if (!trySetError(error)) {
|
||||
throw IllegalStateException("Cannot set the error on a completed task.")
|
||||
}
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public object OpenSourceMergedSoMapping : ExternalSoMapping {
|
||||
else -> input
|
||||
}
|
||||
|
||||
public override fun invokeJniOnload(libraryName: String): Unit {
|
||||
public override fun invokeJniOnload(libraryName: String) {
|
||||
when (libraryName) {
|
||||
"fabricjni" -> libfabricjni_so()
|
||||
"hermes_executor" -> libhermes_executor_so()
|
||||
|
||||
+8
-8
@@ -197,7 +197,7 @@ public object BackgroundStyleApplicator {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun setBorderStyle(view: View, borderStyle: BorderStyle?): Unit {
|
||||
public fun setBorderStyle(view: View, borderStyle: BorderStyle?) {
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
ensureBorderDrawable(view).borderStyle = borderStyle
|
||||
} else {
|
||||
@@ -215,7 +215,7 @@ public object BackgroundStyleApplicator {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun setOutlineColor(view: View, @ColorInt outlineColor: Int?): Unit {
|
||||
public fun setOutlineColor(view: View, @ColorInt outlineColor: Int?) {
|
||||
if (ViewUtil.getUIManagerType(view) != UIManagerType.FABRIC) {
|
||||
return
|
||||
}
|
||||
@@ -255,7 +255,7 @@ public object BackgroundStyleApplicator {
|
||||
public fun getOutlineStyle(view: View): OutlineStyle? = getOutlineDrawable(view)?.outlineStyle
|
||||
|
||||
@JvmStatic
|
||||
public fun setOutlineWidth(view: View, width: Float): Unit {
|
||||
public fun setOutlineWidth(view: View, width: Float) {
|
||||
if (ViewUtil.getUIManagerType(view) != UIManagerType.FABRIC) {
|
||||
return
|
||||
}
|
||||
@@ -267,7 +267,7 @@ public object BackgroundStyleApplicator {
|
||||
public fun getOutlineWidth(view: View): Float? = getOutlineDrawable(view)?.outlineOffset
|
||||
|
||||
@JvmStatic
|
||||
public fun setBoxShadow(view: View, shadows: List<BoxShadow>): Unit {
|
||||
public fun setBoxShadow(view: View, shadows: List<BoxShadow>) {
|
||||
if (ViewUtil.getUIManagerType(view) != UIManagerType.FABRIC) {
|
||||
return
|
||||
}
|
||||
@@ -321,7 +321,7 @@ public object BackgroundStyleApplicator {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun setBoxShadow(view: View, shadows: ReadableArray?): Unit {
|
||||
public fun setBoxShadow(view: View, shadows: ReadableArray?) {
|
||||
if (shadows == null) {
|
||||
BackgroundStyleApplicator.setBoxShadow(view, emptyList())
|
||||
return
|
||||
@@ -335,7 +335,7 @@ public object BackgroundStyleApplicator {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun setFeedbackUnderlay(view: View, drawable: Drawable?): Unit {
|
||||
public fun setFeedbackUnderlay(view: View, drawable: Drawable?) {
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
|
||||
ensureCompositeBackgroundDrawable(view).withNewFeedbackUnderlay(drawable)
|
||||
@@ -345,7 +345,7 @@ public object BackgroundStyleApplicator {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun clipToPaddingBox(view: View, canvas: Canvas): Unit {
|
||||
public fun clipToPaddingBox(view: View, canvas: Canvas) {
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
val drawingRect = Rect()
|
||||
view.getDrawingRect(drawingRect)
|
||||
@@ -405,7 +405,7 @@ public object BackgroundStyleApplicator {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun reset(view: View): Unit {
|
||||
public fun reset(view: View) {
|
||||
if (view.background is CompositeBackgroundDrawable) {
|
||||
view.background = (view.background as CompositeBackgroundDrawable).originalBackground
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ public object ReactClippingViewGroupHelper {
|
||||
* @param outputRect where the calculated rectangle will be written
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun calculateClippingRect(view: View, outputRect: Rect): Unit {
|
||||
public fun calculateClippingRect(view: View, outputRect: Rect) {
|
||||
when (val parent = view.parent) {
|
||||
null -> {
|
||||
outputRect.setEmpty()
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ package com.facebook.react.uimanager
|
||||
|
||||
/** A task to execute on the UI View for third party libraries. */
|
||||
public fun interface UIBlock {
|
||||
public fun execute(nativeViewHierarchyManager: NativeViewHierarchyManager): Unit
|
||||
public fun execute(nativeViewHierarchyManager: NativeViewHierarchyManager)
|
||||
}
|
||||
+2
-2
@@ -34,7 +34,7 @@ public object ViewManagerPropertyUpdater {
|
||||
private val SHADOW_NODE_SETTER_MAP: MutableMap<Class<*>, ShadowNodeSetter<*>> = HashMap()
|
||||
|
||||
@JvmStatic
|
||||
public fun clear(): Unit {
|
||||
public fun clear() {
|
||||
ViewManagersPropertyCache.clear()
|
||||
VIEW_MANAGER_SETTER_MAP.clear()
|
||||
SHADOW_NODE_SETTER_MAP.clear()
|
||||
@@ -180,7 +180,7 @@ public object ViewManagerPropertyUpdater {
|
||||
private val setter = findManagerSetter(manager.javaClass)
|
||||
|
||||
@Suppress("ACCIDENTAL_OVERRIDE")
|
||||
override fun setProperty(view: T, propName: String, value: Any?): Unit {
|
||||
override fun setProperty(view: T, propName: String, value: Any?) {
|
||||
setter.setProperty(manager, view, propName, value)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,5 +20,5 @@ internal interface SynchronousEventReceiver {
|
||||
params: WritableMap?,
|
||||
@EventCategoryDef eventCategory: Int,
|
||||
experimentalIsSynchronous: Boolean
|
||||
): Unit
|
||||
)
|
||||
}
|
||||
+6
-6
@@ -70,7 +70,7 @@ public object ReactFindViewUtil {
|
||||
* @param root root of the view hierarchy from which to find the view
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun findView(root: View, onViewFoundListener: OnViewFoundListener): Unit {
|
||||
public fun findView(root: View, onViewFoundListener: OnViewFoundListener) {
|
||||
val view = findView(root, onViewFoundListener.getNativeId())
|
||||
if (view != null) {
|
||||
onViewFoundListener.onViewFound(view)
|
||||
@@ -83,29 +83,29 @@ public object ReactFindViewUtil {
|
||||
* Remove this listener using removeViewListener() if it's no longer needed.
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun addViewListener(onViewFoundListener: OnViewFoundListener): Unit {
|
||||
public fun addViewListener(onViewFoundListener: OnViewFoundListener) {
|
||||
onViewFoundListeners.add(onViewFoundListener)
|
||||
}
|
||||
|
||||
/** Removes an OnViewFoundListener previously registered with addViewListener(). */
|
||||
@JvmStatic
|
||||
public fun removeViewListener(onViewFoundListener: OnViewFoundListener): Unit {
|
||||
public fun removeViewListener(onViewFoundListener: OnViewFoundListener) {
|
||||
onViewFoundListeners.remove(onViewFoundListener)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun addViewsListener(listener: OnMultipleViewsFoundListener, ids: Set<String>): Unit {
|
||||
public fun addViewsListener(listener: OnMultipleViewsFoundListener, ids: Set<String>) {
|
||||
onMultipleViewsFoundListener[listener] = ids
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun removeViewsListener(listener: OnMultipleViewsFoundListener): Unit {
|
||||
public fun removeViewsListener(listener: OnMultipleViewsFoundListener) {
|
||||
onMultipleViewsFoundListener.remove(listener)
|
||||
}
|
||||
|
||||
/** Invokes any listeners that are listening on this {@param view}'s native id */
|
||||
@JvmStatic
|
||||
public fun notifyViewRendered(view: View): Unit {
|
||||
public fun notifyViewRendered(view: View) {
|
||||
val nativeId = getNativeId(view) ?: return
|
||||
val iterator = onViewFoundListeners.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
|
||||
Reference in new issue
Block a user