Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
elijah-semyonov committed Aug 21, 2024
1 parent 364c7a0 commit 71b6e10
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,36 +45,36 @@ sealed interface UIKitInteropInteractionMode {
* This mode is useful when the interop view is inside a scrollable container and the user might
* want to scroll the container despite the first touch being landed on the interop view.
*
* @property delayMs Indicates how much time in milliseconds is given for Compose to intercept
* the touches before delivering them to the interop view. The default value is [DefaultDelayMs].
* @property delayMillis Indicates how much time in milliseconds is given for Compose to intercept
* the touches before delivering them to the interop view. The default value is [DefaultDelayMillis].
*/
@ExperimentalComposeUiApi
class Cooperative(
val delayMs: Int = DefaultDelayMs
val delayMillis: Int = DefaultDelayMillis
) : UIKitInteropInteractionMode {
init {
require(delayMs > 0) { "Delay must be a positive value" }
require(delayMillis > 0) { "Delay must be a positive value" }
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is Cooperative) return false

if (delayMs != other.delayMs) return false
if (delayMillis != other.delayMillis) return false

return true
}

override fun hashCode(): Int {
return delayMs.hashCode()
return delayMillis.hashCode()
}

companion object {
/**
* The default delay in milliseconds before the touch is delivered to the interop view.
* Same as the default delay in [UIScrollView].
*/
const val DefaultDelayMs = 150
const val DefaultDelayMillis = 150
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ private sealed interface InteractionUIViewHitTestResult {
data object NonCooperativeChildView : InteractionUIViewHitTestResult

/**
* Hit test result is Cooperative child view, that allows a delay of [delayInMilliseconds] milliseconds.
* Hit test result is Cooperative child view, that allows a delay of [delayMillis] milliseconds.
*/
class CooperativeChildView(
val delayInMilliseconds: Int
val delayMillis: Int
) : InteractionUIViewHitTestResult {
val delayInSeconds: Double
get() = delayInMilliseconds.toDouble() / 1000.0
val delaySeconds: Double
get() = delayMillis.toDouble() / 1000.0
}
}

Expand Down Expand Up @@ -272,7 +272,7 @@ private class GestureRecognizerHandlerImpl(
when (val cooperativeChildView = hitTestResult) {
is InteractionUIViewHitTestResult.CooperativeChildView ->
gestureRecognizer?.scheduleFailure(
cooperativeChildView.delayInSeconds
cooperativeChildView.delaySeconds
)
else -> {}
}
Expand Down Expand Up @@ -608,7 +608,7 @@ internal class InteractionUIView(
when (interactionMode) {
is UIKitInteropInteractionMode.Cooperative -> {
InteractionUIViewHitTestResult.CooperativeChildView(
delayInMilliseconds = interactionMode.delayMs
delayMillis = interactionMode.delayMillis
)
}

Expand Down

0 comments on commit 71b6e10

Please sign in to comment.