Skip to content

Commit

Permalink
refactor(haptics)!: remove unused and deprecated code (#2250)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Nov 22, 2024
1 parent fe1b05c commit 3002f53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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() {
Expand All @@ -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());
}
}
}
24 changes: 0 additions & 24 deletions haptics/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 3002f53

Please sign in to comment.