@capacitor/haptics 8.0.2 → 9.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { :git => 'https://github.com/ionic-team/capacitor-haptics.git', :tag => 'v' + package['version'] }
13
13
  s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}', 'haptics/ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '15.0'
14
+ s.ios.deployment_target = '16.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
  end
package/Package.swift CHANGED
@@ -3,21 +3,20 @@ import PackageDescription
3
3
 
4
4
  let package = Package(
5
5
  name: "CapacitorHaptics",
6
- platforms: [.iOS(.v15)],
6
+ platforms: [.iOS(.v16)],
7
7
  products: [
8
8
  .library(
9
9
  name: "CapacitorHaptics",
10
10
  targets: ["HapticsPlugin"])
11
11
  ],
12
12
  dependencies: [
13
- .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "9.0.0-alpha.5")
14
14
  ],
15
15
  targets: [
16
16
  .target(
17
17
  name: "HapticsPlugin",
18
18
  dependencies: [
19
- .product(name: "Capacitor", package: "capacitor-swift-pm"),
20
- .product(name: "Cordova", package: "capacitor-swift-pm")
19
+ .product(name: "Capacitor", package: "capacitor-swift-pm")
21
20
  ],
22
21
  path: "ios/Sources/HapticsPlugin"),
23
22
  .testTarget(
@@ -15,7 +15,7 @@ buildscript {
15
15
  }
16
16
  }
17
17
  dependencies {
18
- classpath 'com.android.tools.build:gradle:8.13.0'
18
+ classpath 'com.android.tools.build:gradle:9.2.1'
19
19
  if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
20
20
  classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
21
21
  }
@@ -31,10 +31,9 @@ if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
31
31
 
32
32
  android {
33
33
  namespace = "com.capacitorjs.plugins.haptics"
34
- compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
34
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 37
35
35
  defaultConfig {
36
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
37
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
36
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 26
38
37
  versionCode 1
39
38
  versionName "1.0"
40
39
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -28,21 +28,7 @@ public class Haptics {
28
28
  }
29
29
 
30
30
  public void vibrate(int duration) {
31
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
32
- vibrator.vibrate(VibrationEffect.createOneShot(duration, VibrationEffect.DEFAULT_AMPLITUDE));
33
- } else {
34
- vibratePre26(duration);
35
- }
36
- }
37
-
38
- @SuppressWarnings({ "deprecation" })
39
- private void vibratePre26(int duration) {
40
- vibrator.vibrate(duration);
41
- }
42
-
43
- @SuppressWarnings({ "deprecation" })
44
- private void vibratePre26(long[] pattern) {
45
- vibrator.vibrate(pattern, -1);
31
+ vibrator.vibrate(VibrationEffect.createOneShot(duration, VibrationEffect.DEFAULT_AMPLITUDE));
46
32
  }
47
33
 
48
34
  public void selectionStart() {
@@ -60,10 +46,6 @@ public class Haptics {
60
46
  }
61
47
 
62
48
  public void performHaptics(HapticsVibrationType type) {
63
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
64
- vibrator.vibrate(VibrationEffect.createWaveform(type.getTimings(), type.getAmplitudes(), -1));
65
- } else {
66
- vibratePre26(type.getOldSDKPattern());
67
- }
49
+ vibrator.vibrate(VibrationEffect.createWaveform(type.getTimings(), type.getAmplitudes(), -1));
68
50
  }
69
51
  }
@@ -1,20 +1,18 @@
1
1
  package com.capacitorjs.plugins.haptics.arguments;
2
2
 
3
3
  public enum HapticsImpactType implements HapticsVibrationType {
4
- LIGHT("LIGHT", new long[] { 0, 50 }, new int[] { 0, 110 }, new long[] { 0, 20 }),
5
- MEDIUM("MEDIUM", new long[] { 0, 43 }, new int[] { 0, 180 }, new long[] { 0, 43 }),
6
- HEAVY("HEAVY", new long[] { 0, 60 }, new int[] { 0, 255 }, new long[] { 0, 61 });
4
+ LIGHT("LIGHT", new long[] { 0, 50 }, new int[] { 0, 110 }),
5
+ MEDIUM("MEDIUM", new long[] { 0, 43 }, new int[] { 0, 180 }),
6
+ HEAVY("HEAVY", new long[] { 0, 60 }, new int[] { 0, 255 });
7
7
 
8
8
  private final String type;
9
9
  private final long[] timings;
10
10
  private final int[] amplitudes;
11
- private final long[] oldSDKPattern;
12
11
 
13
- HapticsImpactType(String type, long[] timings, int[] amplitudes, long[] oldSDKPattern) {
12
+ HapticsImpactType(String type, long[] timings, int[] amplitudes) {
14
13
  this.type = type;
15
14
  this.timings = timings;
16
15
  this.amplitudes = amplitudes;
17
- this.oldSDKPattern = oldSDKPattern;
18
16
  }
19
17
 
20
18
  public static HapticsImpactType fromString(String style) {
@@ -35,9 +33,4 @@ public enum HapticsImpactType implements HapticsVibrationType {
35
33
  public int[] getAmplitudes() {
36
34
  return amplitudes;
37
35
  }
38
-
39
- @Override
40
- public long[] getOldSDKPattern() {
41
- return oldSDKPattern;
42
- }
43
36
  }
@@ -1,25 +1,18 @@
1
1
  package com.capacitorjs.plugins.haptics.arguments;
2
2
 
3
3
  public enum HapticsNotificationType implements HapticsVibrationType {
4
- SUCCESS("SUCCESS", new long[] { 0, 35, 65, 21 }, new int[] { 0, 250, 0, 180 }, new long[] { 0, 35, 65, 21 }),
5
- WARNING(
6
- "WARNING",
7
- new long[] { 0, 30, 40, 30, 50, 60 },
8
- new int[] { 255, 255, 255, 255, 255, 255 },
9
- new long[] { 0, 30, 40, 30, 50, 60 }
10
- ),
11
- ERROR("ERROR", new long[] { 0, 27, 45, 50 }, new int[] { 0, 120, 0, 250 }, new long[] { 0, 27, 45, 50 });
4
+ SUCCESS("SUCCESS", new long[] { 0, 35, 65, 21 }, new int[] { 0, 250, 0, 180 }),
5
+ WARNING("WARNING", new long[] { 0, 30, 40, 30, 50, 60 }, new int[] { 255, 255, 255, 255, 255, 255 }),
6
+ ERROR("ERROR", new long[] { 0, 27, 45, 50 }, new int[] { 0, 120, 0, 250 });
12
7
 
13
8
  private final String type;
14
9
  private final long[] timings;
15
10
  private final int[] amplitudes;
16
- private final long[] oldSDKPattern;
17
11
 
18
- HapticsNotificationType(String type, long[] timings, int[] amplitudes, long[] oldSDKPattern) {
12
+ HapticsNotificationType(String type, long[] timings, int[] amplitudes) {
19
13
  this.type = type;
20
14
  this.timings = timings;
21
15
  this.amplitudes = amplitudes;
22
- this.oldSDKPattern = oldSDKPattern;
23
16
  }
24
17
 
25
18
  public static HapticsNotificationType fromString(String type) {
@@ -40,9 +33,4 @@ public enum HapticsNotificationType implements HapticsVibrationType {
40
33
  public int[] getAmplitudes() {
41
34
  return amplitudes;
42
35
  }
43
-
44
- @Override
45
- public long[] getOldSDKPattern() {
46
- return oldSDKPattern;
47
- }
48
36
  }
@@ -4,7 +4,6 @@ public class HapticsSelectionType implements HapticsVibrationType {
4
4
 
5
5
  private static final long[] timings = { 0, 100 };
6
6
  private static final int[] amplitudes = { 0, 100 };
7
- private static final long[] oldSDKPattern = { 0, 70 };
8
7
 
9
8
  @Override
10
9
  public long[] getTimings() {
@@ -15,9 +14,4 @@ public class HapticsSelectionType implements HapticsVibrationType {
15
14
  public int[] getAmplitudes() {
16
15
  return amplitudes;
17
16
  }
18
-
19
- @Override
20
- public long[] getOldSDKPattern() {
21
- return oldSDKPattern;
22
- }
23
17
  }
@@ -4,6 +4,4 @@ public interface HapticsVibrationType {
4
4
  long[] getTimings();
5
5
 
6
6
  int[] getAmplitudes();
7
-
8
- long[] getOldSDKPattern();
9
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/haptics",
3
- "version": "8.0.2",
3
+ "version": "9.0.0-next.1",
4
4
  "description": "The Haptics API provides physical feedback to the user through touch or vibration.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -47,10 +47,10 @@
47
47
  "publish:cocoapod": "pod trunk push ./CapacitorHaptics.podspec --allow-warnings"
48
48
  },
49
49
  "devDependencies": {
50
- "@capacitor/android": "^8.0.0",
51
- "@capacitor/core": "^8.0.0",
50
+ "@capacitor/android": "next",
51
+ "@capacitor/core": "next",
52
52
  "@capacitor/docgen": "^0.3.0",
53
- "@capacitor/ios": "^8.0.0",
53
+ "@capacitor/ios": "next",
54
54
  "@ionic/eslint-config": "^0.4.0",
55
55
  "@ionic/prettier-config": "^4.0.0",
56
56
  "@ionic/swiftlint-config": "^2.0.0",
@@ -70,7 +70,7 @@
70
70
  "typescript": "^5.9.3"
71
71
  },
72
72
  "peerDependencies": {
73
- "@capacitor/core": ">=8.0.0"
73
+ "@capacitor/core": ">=9.0.0-alpha.0"
74
74
  },
75
75
  "prettier": "@ionic/prettier-config",
76
76
  "swiftlint": "@ionic/swiftlint-config",