From 9dcbb28ac3b2c986db079789558a2e90d3a4d9ee Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Wed, 20 Nov 2024 16:26:38 +0100 Subject: [PATCH] refactor(haptics)!: remove unused and deprecated code --- .../capacitorjs/plugins/haptics/Haptics.java | 8 +++---- haptics/src/definitions.ts | 24 ------------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/haptics/android/src/main/java/com/capacitorjs/plugins/haptics/Haptics.java b/haptics/android/src/main/java/com/capacitorjs/plugins/haptics/Haptics.java index e9f182e68..392aa4190 100644 --- a/haptics/android/src/main/java/com/capacitorjs/plugins/haptics/Haptics.java +++ b/haptics/android/src/main/java/com/capacitorjs/plugins/haptics/Haptics.java @@ -10,12 +10,10 @@ public class Haptics { - private Context context; private boolean selectionStarted = false; private final Vibrator vibrator; Haptics(Context context) { - this.context = context; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { VibratorManager vibratorManager = (VibratorManager) context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE); this.vibrator = vibratorManager.getDefaultVibrator(); @@ -43,8 +41,8 @@ private void vibratePre26(int duration) { } @SuppressWarnings({ "deprecation" }) - private void vibratePre26(long[] pattern, int repeat) { - vibrator.vibrate(pattern, repeat); + private void vibratePre26(long[] pattern) { + vibrator.vibrate(pattern, -1); } public void selectionStart() { @@ -65,7 +63,7 @@ public void performHaptics(HapticsVibrationType type) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { vibrator.vibrate(VibrationEffect.createWaveform(type.getTimings(), type.getAmplitudes(), -1)); } else { - vibratePre26(type.getOldSDKPattern(), -1); + vibratePre26(type.getOldSDKPattern()); } } } diff --git a/haptics/src/definitions.ts b/haptics/src/definitions.ts index 01389a6d6..aa9f61b8f 100644 --- a/haptics/src/definitions.ts +++ b/haptics/src/definitions.ts @@ -124,27 +124,3 @@ export interface VibrateOptions { */ duration: number; } - -/** - * @deprecated Use `ImpactOptions`. - * @since 1.0.0 - */ -export type HapticsImpactOptions = ImpactOptions; - -/** - * @deprecated Use `NotificationOptions`. - * @since 1.0.0 - */ -export type HapticsNotificationOptions = NotificationOptions; - -/** - * @deprecated Use `NotificationType`. - * @since 1.0.0 - */ -export const HapticsNotificationType = NotificationType; - -/** - * @deprecated Use `ImpactStyle`. - * @since 1.0.0 - */ -export const HapticsImpactStyle = ImpactStyle;