Skip to content

Commit

Permalink
Stable API - Make VibrationModule internal (#47414)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #47414

This class should not be accessed directly, therefore I'm making it internal.
Technically breaking but I verified that there are no meaningful usages in OSS:
https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+com.facebook.react.modules.vibration.VibrationModule

Changelog:
[Android] [Breaking] - Stable API - Make ClipboardModule internal

Reviewed By: mdvacca

Differential Revision: D65479292

fbshipit-source-id: 383790e6432c3c8c6f47289d2156099d263cc8ca
  • Loading branch information
cortinico authored and facebook-github-bot committed Nov 5, 2024
1 parent c4f58d2 commit a72c35f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
12 changes: 0 additions & 12 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -3662,18 +3662,6 @@ public final class com/facebook/react/modules/toast/ToastModule : com/facebook/f
public final class com/facebook/react/modules/toast/ToastModule$Companion {
}

public final class com/facebook/react/modules/vibration/VibrationModule : com/facebook/fbreact/specs/NativeVibrationSpec {
public static final field Companion Lcom/facebook/react/modules/vibration/VibrationModule$Companion;
public static final field NAME Ljava/lang/String;
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;)V
public fun cancel ()V
public fun vibrate (D)V
public fun vibrateByPattern (Lcom/facebook/react/bridge/ReadableArray;D)V
}

public final class com/facebook/react/modules/vibration/VibrationModule$Companion {
}

public final class com/facebook/react/modules/websocket/WebSocketModule : com/facebook/fbreact/specs/NativeWebSocketModuleSpec {
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;)V
public fun addListener (Ljava/lang/String;)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import com.facebook.react.module.annotations.ReactModule

@SuppressLint("MissingPermission")
@ReactModule(name = NativeVibrationSpec.NAME)
public class VibrationModule(reactContext: ReactApplicationContext) :
internal class VibrationModule(reactContext: ReactApplicationContext) :
NativeVibrationSpec(reactContext) {

public override fun vibrate(durationDouble: Double) {
override fun vibrate(durationDouble: Double) {
val duration = durationDouble.toInt()
val v = getVibrator() ?: return
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Expand All @@ -33,7 +33,7 @@ public class VibrationModule(reactContext: ReactApplicationContext) :
}
}

public override fun vibrateByPattern(pattern: ReadableArray, repeatDouble: Double) {
override fun vibrateByPattern(pattern: ReadableArray, repeatDouble: Double) {
val repeat = repeatDouble.toInt()
val v = getVibrator() ?: return
val patternLong = LongArray(pattern.size())
Expand All @@ -47,7 +47,7 @@ public class VibrationModule(reactContext: ReactApplicationContext) :
}
}

public override fun cancel() {
override fun cancel() {
getVibrator()?.cancel()
}

Expand All @@ -62,7 +62,7 @@ public class VibrationModule(reactContext: ReactApplicationContext) :
getReactApplicationContext().getSystemService(Context.VIBRATOR_SERVICE) as Vibrator?
}

public companion object {
public const val NAME: String = NativeVibrationSpec.NAME
companion object {
const val NAME: String = NativeVibrationSpec.NAME
}
}

0 comments on commit a72c35f

Please sign in to comment.