@capacitor/haptics 1.1.3 → 4.0.0-nightly-f0c6414.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,45 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 4.0.0-beta.0 (2022-06-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * add es2017 lib to tsconfig ([#180](https://github.com/ionic-team/capacitor-plugins/issues/180)) ([2c3776c](https://github.com/ionic-team/capacitor-plugins/commit/2c3776c38ca025c5ee965dec10ccf1cdb6c02e2f))
12
+ * better ignore rules for npm distribution ([#32](https://github.com/ionic-team/capacitor-plugins/issues/32)) ([b8d55b9](https://github.com/ionic-team/capacitor-plugins/commit/b8d55b9233e4ad7b8a1cd41110b4e580fc2a059f))
13
+ * correct addListeners links ([#655](https://github.com/ionic-team/capacitor-plugins/issues/655)) ([f9871e7](https://github.com/ionic-team/capacitor-plugins/commit/f9871e7bd53478addb21155e148829f550c0e457))
14
+ * inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
15
+ * remove postpublish scripts ([#656](https://github.com/ionic-team/capacitor-plugins/issues/656)) ([ed6ac49](https://github.com/ionic-team/capacitor-plugins/commit/ed6ac499ebf4a47525071ccbfc36c27503e11f60))
16
+ * support deprecated types from Capacitor 2 ([#139](https://github.com/ionic-team/capacitor-plugins/issues/139)) ([2d7127a](https://github.com/ionic-team/capacitor-plugins/commit/2d7127a488e26f0287951921a6db47c49d817336))
17
+ * use correct package in manifest files ([#22](https://github.com/ionic-team/capacitor-plugins/issues/22)) ([ab62987](https://github.com/ionic-team/capacitor-plugins/commit/ab629877e1951f944594f1b23e1bffefcbc783dd))
18
+
19
+
20
+ ### Features
21
+
22
+ * add commonjs output format ([#179](https://github.com/ionic-team/capacitor-plugins/issues/179)) ([8e9e098](https://github.com/ionic-team/capacitor-plugins/commit/8e9e09862064b3f6771d7facbc4008e995d9b463))
23
+ * Haptics plugin ([#5](https://github.com/ionic-team/capacitor-plugins/issues/5)) ([95322d3](https://github.com/ionic-team/capacitor-plugins/commit/95322d385c855cff50582a7d3daff83fe4fe9e90))
24
+ * set targetSDK default value to 31 ([#824](https://github.com/ionic-team/capacitor-plugins/issues/824)) ([3ee10de](https://github.com/ionic-team/capacitor-plugins/commit/3ee10de98067984c1a4e75295d001c5a895c47f4))
25
+ * set targetSDK default value to 32 ([#970](https://github.com/ionic-team/capacitor-plugins/issues/970)) ([fa70d96](https://github.com/ionic-team/capacitor-plugins/commit/fa70d96f141af751aae53ceb5642c46b204f5958))
26
+ * Upgrade gradle to 7.4 ([#826](https://github.com/ionic-team/capacitor-plugins/issues/826)) ([5db0906](https://github.com/ionic-team/capacitor-plugins/commit/5db0906f6264287c4f8e69dbaecf19d4d387824b))
27
+ * Use java 11 ([#910](https://github.com/ionic-team/capacitor-plugins/issues/910)) ([5acb2a2](https://github.com/ionic-team/capacitor-plugins/commit/5acb2a288a413492b163e4e97da46a085d9e4be0))
28
+ * **haptics:** Implement duration for vibration ([#618](https://github.com/ionic-team/capacitor-plugins/issues/618)) ([78e6b68](https://github.com/ionic-team/capacitor-plugins/commit/78e6b6886fa50318b1bfbe229e7318e521e3c245))
29
+
30
+
31
+
32
+
33
+
34
+ ## [1.1.4](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/haptics@1.1.3...@capacitor/haptics@1.1.4) (2022-01-19)
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
40
+
41
+
42
+
43
+
44
+
6
45
  ## [1.1.3](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/haptics@1.1.2...@capacitor/haptics@1.1.3) (2021-11-03)
7
46
 
8
47
  **Note:** Version bump only for package @capacitor/haptics
@@ -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-plugins.git', :tag => package['name'] + '@' + package['version'] }
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'haptics/ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '12.0'
14
+ s.ios.deployment_target = '13.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
  end
package/README.md CHANGED
@@ -171,9 +171,9 @@ For example, call this when a user has lifted their finger from a control
171
171
 
172
172
  #### VibrateOptions
173
173
 
174
- | Prop | Type | Description | Default | Since |
175
- | -------------- | ------------------- | ----------------------------------------------------------------------------- | ---------------- | ----- |
176
- | **`duration`** | <code>number</code> | Duration of the vibration in milliseconds. Not supported in iOS 12 and older. | <code>300</code> | 1.0.0 |
174
+ | Prop | Type | Description | Default | Since |
175
+ | -------------- | ------------------- | ------------------------------------------ | ---------------- | ----- |
176
+ | **`duration`** | <code>number</code> | Duration of the vibration in milliseconds. | <code>300</code> | 1.0.0 |
177
177
 
178
178
 
179
179
  ### Enums
@@ -183,7 +183,7 @@ For example, call this when a user has lifted their finger from a control
183
183
 
184
184
  | Members | Value | Description | Since |
185
185
  | ------------ | --------------------- | ------------------------------------------------------------ | ----- |
186
- | **`Heavy`** | <code>'HEAVY'</code> | A collision between small, light user interface elements | 1.0.0 |
186
+ | **`Heavy`** | <code>'HEAVY'</code> | A collision between large, heavy user interface elements | 1.0.0 |
187
187
  | **`Medium`** | <code>'MEDIUM'</code> | A collision between moderately sized user interface elements | 1.0.0 |
188
188
  | **`Light`** | <code>'LIGHT'</code> | A collision between small, light user interface elements | 1.0.0 |
189
189
 
@@ -1,8 +1,8 @@
1
1
  ext {
2
- junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2.0'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.2'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.3.0'
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6
6
  }
7
7
 
8
8
  buildscript {
@@ -11,17 +11,17 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:4.2.1'
14
+ classpath 'com.android.tools.build:gradle:7.2.1'
15
15
  }
16
16
  }
17
17
 
18
18
  apply plugin: 'com.android.library'
19
19
 
20
20
  android {
21
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30
21
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
22
  defaultConfig {
23
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30
23
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
24
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
25
25
  versionCode 1
26
26
  versionName "1.0"
27
27
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -36,14 +36,13 @@ android {
36
36
  abortOnError false
37
37
  }
38
38
  compileOptions {
39
- sourceCompatibility JavaVersion.VERSION_1_8
40
- targetCompatibility JavaVersion.VERSION_1_8
39
+ sourceCompatibility JavaVersion.VERSION_11
40
+ targetCompatibility JavaVersion.VERSION_11
41
41
  }
42
42
  }
43
43
 
44
44
  repositories {
45
45
  google()
46
- jcenter()
47
46
  mavenCentral()
48
47
  }
49
48
 
@@ -4,6 +4,7 @@ import android.content.Context;
4
4
  import android.os.Build;
5
5
  import android.os.VibrationEffect;
6
6
  import android.os.Vibrator;
7
+ import android.os.VibratorManager;
7
8
  import com.capacitorjs.plugins.haptics.arguments.HapticsSelectionType;
8
9
  import com.capacitorjs.plugins.haptics.arguments.HapticsVibrationType;
9
10
 
@@ -15,11 +16,21 @@ public class Haptics {
15
16
 
16
17
  Haptics(Context context) {
17
18
  this.context = context;
18
- this.vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
19
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
20
+ VibratorManager vibratorManager = (VibratorManager) context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE);
21
+ this.vibrator = vibratorManager.getDefaultVibrator();
22
+ } else {
23
+ this.vibrator = getDeprecatedVibrator(context);
24
+ }
25
+ }
26
+
27
+ @SuppressWarnings("deprecation")
28
+ private Vibrator getDeprecatedVibrator(Context context) {
29
+ return (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
19
30
  }
20
31
 
21
32
  public void vibrate(int duration) {
22
- if (Build.VERSION.SDK_INT >= 26) {
33
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
23
34
  vibrator.vibrate(VibrationEffect.createOneShot(duration, VibrationEffect.DEFAULT_AMPLITUDE));
24
35
  } else {
25
36
  vibratePre26(duration);
@@ -51,7 +62,7 @@ public class Haptics {
51
62
  }
52
63
 
53
64
  public void performHaptics(HapticsVibrationType type) {
54
- if (Build.VERSION.SDK_INT >= 26) {
65
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
55
66
  vibrator.vibrate(VibrationEffect.createWaveform(type.getTimings(), type.getAmplitudes(), -1));
56
67
  } else {
57
68
  vibratePre26(type.getOldSDKPattern(), -1);
package/dist/docs.json CHANGED
@@ -196,7 +196,7 @@
196
196
  "name": "since"
197
197
  }
198
198
  ],
199
- "docs": "Duration of the vibration in milliseconds.\n\nNot supported in iOS 12 and older.",
199
+ "docs": "Duration of the vibration in milliseconds.",
200
200
  "complexTypes": [],
201
201
  "type": "number"
202
202
  }
@@ -217,7 +217,7 @@
217
217
  "name": "since"
218
218
  }
219
219
  ],
220
- "docs": "A collision between small, light user interface elements"
220
+ "docs": "A collision between large, heavy user interface elements"
221
221
  },
222
222
  {
223
223
  "name": "Medium",
@@ -52,7 +52,7 @@ export interface ImpactOptions {
52
52
  }
53
53
  export declare enum ImpactStyle {
54
54
  /**
55
- * A collision between small, light user interface elements
55
+ * A collision between large, heavy user interface elements
56
56
  *
57
57
  * @since 1.0.0
58
58
  */
@@ -105,8 +105,6 @@ export interface VibrateOptions {
105
105
  /**
106
106
  * Duration of the vibration in milliseconds.
107
107
  *
108
- * Not supported in iOS 12 and older.
109
- *
110
108
  * @default 300
111
109
  * @since 1.0.0
112
110
  */
@@ -1,7 +1,7 @@
1
1
  export var ImpactStyle;
2
2
  (function (ImpactStyle) {
3
3
  /**
4
- * A collision between small, light user interface elements
4
+ * A collision between large, heavy user interface elements
5
5
  *
6
6
  * @since 1.0.0
7
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA2DA,MAAM,CAAN,IAAY,WAqBX;AArBD,WAAY,WAAW;IACrB;;;;OAIG;IACH,8BAAe,CAAA;IAEf;;;;OAIG;IACH,gCAAiB,CAAA;IAEjB;;;;OAIG;IACH,8BAAe,CAAA;AACjB,CAAC,EArBW,WAAW,KAAX,WAAW,QAqBtB;AAcD,MAAM,CAAN,IAAY,gBAqBX;AArBD,WAAY,gBAAgB;IAC1B;;;;OAIG;IACH,uCAAmB,CAAA;IAEnB;;;;OAIG;IACH,uCAAmB,CAAA;IAEnB;;;;OAIG;IACH,mCAAe,CAAA;AACjB,CAAC,EArBW,gBAAgB,KAAhB,gBAAgB,QAqB3B;AA0BD;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAgB,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC"}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA2DA,MAAM,CAAN,IAAY,WAqBX;AArBD,WAAY,WAAW;IACrB;;;;OAIG;IACH,8BAAe,CAAA;IAEf;;;;OAIG;IACH,gCAAiB,CAAA;IAEjB;;;;OAIG;IACH,8BAAe,CAAA;AACjB,CAAC,EArBW,WAAW,KAAX,WAAW,QAqBtB;AAcD,MAAM,CAAN,IAAY,gBAqBX;AArBD,WAAY,gBAAgB;IAC1B;;;;OAIG;IACH,uCAAmB,CAAA;IAEnB;;;;OAIG;IACH,uCAAmB,CAAA;IAEnB;;;;OAIG;IACH,mCAAe,CAAA;AACjB,CAAC,EArBW,gBAAgB,KAAhB,gBAAgB,QAqB3B;AAwBD;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAgB,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC","sourcesContent":["export interface HapticsPlugin {\n /**\n * Trigger a haptics \"impact\" feedback\n *\n * @since 1.0.0\n */\n impact(options?: ImpactOptions): Promise<void>;\n\n /**\n * Trigger a haptics \"notification\" feedback\n *\n * @since 1.0.0\n */\n notification(options?: NotificationOptions): Promise<void>;\n\n /**\n * Vibrate the device\n *\n * @since 1.0.0\n */\n vibrate(options?: VibrateOptions): Promise<void>;\n\n /**\n * Trigger a selection started haptic hint\n *\n * @since 1.0.0\n */\n selectionStart(): Promise<void>;\n\n /**\n * Trigger a selection changed haptic hint. If a selection was\n * started already, this will cause the device to provide haptic\n * feedback\n *\n * @since 1.0.0\n */\n selectionChanged(): Promise<void>;\n\n /**\n * If selectionStart() was called, selectionEnd() ends the selection.\n * For example, call this when a user has lifted their finger from a control\n *\n * @since 1.0.0\n */\n selectionEnd(): Promise<void>;\n}\n\nexport interface ImpactOptions {\n /**\n * Impact Feedback Style\n *\n * The mass of the objects in the collision simulated by a [UIImpactFeedbackGenerator](https://developer.apple.com/documentation/uikit/uiimpactfeedbackstyle) object.\n *\n * @default ImpactStyle.Heavy\n * @since 1.0.0\n */\n style: ImpactStyle;\n}\n\nexport enum ImpactStyle {\n /**\n * A collision between large, heavy user interface elements\n *\n * @since 1.0.0\n */\n Heavy = 'HEAVY',\n\n /**\n * A collision between moderately sized user interface elements\n *\n * @since 1.0.0\n */\n Medium = 'MEDIUM',\n\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n Light = 'LIGHT',\n}\n\nexport interface NotificationOptions {\n /**\n * Notification Feedback Type\n *\n * The type of notification feedback generated by a [UINotificationFeedbackGenerator](https://developer.apple.com/documentation/uikit/uinotificationfeedbacktype) object.\n *\n * @default NotificationType.SUCCESS\n * @since 1.0.0\n */\n type: NotificationType;\n}\n\nexport enum NotificationType {\n /**\n * A notification feedback type indicating that a task has completed successfully\n *\n * @since 1.0.0\n */\n Success = 'SUCCESS',\n\n /**\n * A notification feedback type indicating that a task has produced a warning\n *\n * @since 1.0.0\n */\n Warning = 'WARNING',\n\n /**\n * A notification feedback type indicating that a task has failed\n *\n * @since 1.0.0\n */\n Error = 'ERROR',\n}\n\nexport interface VibrateOptions {\n /**\n * Duration of the vibration in milliseconds.\n *\n * @default 300\n * @since 1.0.0\n */\n duration: number;\n}\n\n/**\n * @deprecated Use `ImpactOptions`.\n * @since 1.0.0\n */\nexport type HapticsImpactOptions = ImpactOptions;\n\n/**\n * @deprecated Use `NotificationOptions`.\n * @since 1.0.0\n */\nexport type HapticsNotificationOptions = NotificationOptions;\n\n/**\n * @deprecated Use `NotificationType`.\n * @since 1.0.0\n */\nexport const HapticsNotificationType = NotificationType;\n\n/**\n * @deprecated Use `ImpactStyle`.\n * @since 1.0.0\n */\nexport const HapticsImpactStyle = ImpactStyle;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,OAAO,GAAG,cAAc,CAAgB,SAAS,EAAE;IACvD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;CACzD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,OAAO,GAAG,cAAc,CAAgB,SAAS,EAAE;IACvD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;CACzD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { HapticsPlugin } from './definitions';\n\nconst Haptics = registerPlugin<HapticsPlugin>('Haptics', {\n web: () => import('./web').then(m => new m.HapticsWeb()),\n});\n\nexport * from './definitions';\nexport { Haptics };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src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gBAAgB,CAAC,KAAK,EAAE;YAC1C,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;SACrB;QACD,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACtB,CAAC;IAEO,kBAAkB,CAAC,OAAiB;QAC1C,IAAI,SAAS,CAAC,OAAO,EAAE;YACrB,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SAC5B;aAAM;YACL,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;SACpE;IACH,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport { ImpactStyle, NotificationType } from './definitions';\nimport type {\n HapticsPlugin,\n ImpactOptions,\n NotificationOptions,\n VibrateOptions,\n} from './definitions';\n\nexport class HapticsWeb extends WebPlugin implements HapticsPlugin {\n selectionStarted = false;\n\n async impact(options?: ImpactOptions): Promise<void> {\n const pattern = this.patternForImpact(options?.style);\n this.vibrateWithPattern(pattern);\n }\n\n async notification(options?: NotificationOptions): Promise<void> {\n const pattern = this.patternForNotification(options?.type);\n this.vibrateWithPattern(pattern);\n }\n\n async vibrate(options?: VibrateOptions): Promise<void> {\n const duration = options?.duration || 300;\n this.vibrateWithPattern([duration]);\n }\n\n async selectionStart(): Promise<void> {\n this.selectionStarted = true;\n }\n\n async selectionChanged(): Promise<void> {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n\n async selectionEnd(): Promise<void> {\n this.selectionStarted = false;\n }\n\n private patternForImpact(style: ImpactStyle = ImpactStyle.Heavy): number[] {\n if (style === ImpactStyle.Medium) {\n return [43];\n } else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n\n private patternForNotification(\n type: NotificationType = NotificationType.Success,\n ): number[] {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n } else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n\n private vibrateWithPattern(pattern: number[]) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n } else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n"]}
@@ -7,7 +7,7 @@ var core = require('@capacitor/core');
7
7
  exports.ImpactStyle = void 0;
8
8
  (function (ImpactStyle) {
9
9
  /**
10
- * A collision between small, light user interface elements
10
+ * A collision between large, heavy user interface elements
11
11
  *
12
12
  * @since 1.0.0
13
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ImpactStyle;\n(function (ImpactStyle) {\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Heavy\"] = \"HEAVY\";\n /**\n * A collision between moderately sized user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Medium\"] = \"MEDIUM\";\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Light\"] = \"LIGHT\";\n})(ImpactStyle || (ImpactStyle = {}));\nexport var NotificationType;\n(function (NotificationType) {\n /**\n * A notification feedback type indicating that a task has completed successfully\n *\n * @since 1.0.0\n */\n NotificationType[\"Success\"] = \"SUCCESS\";\n /**\n * A notification feedback type indicating that a task has produced a warning\n *\n * @since 1.0.0\n */\n NotificationType[\"Warning\"] = \"WARNING\";\n /**\n * A notification feedback type indicating that a task has failed\n *\n * @since 1.0.0\n */\n NotificationType[\"Error\"] = \"ERROR\";\n})(NotificationType || (NotificationType = {}));\n/**\n * @deprecated Use `NotificationType`.\n * @since 1.0.0\n */\nexport const HapticsNotificationType = NotificationType;\n/**\n * @deprecated Use `ImpactStyle`.\n * @since 1.0.0\n */\nexport const HapticsImpactStyle = ImpactStyle;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Haptics = registerPlugin('Haptics', {\n web: () => import('./web').then(m => new m.HapticsWeb()),\n});\nexport * from './definitions';\nexport { Haptics };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { ImpactStyle, NotificationType } from './definitions';\nexport class HapticsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.selectionStarted = false;\n }\n async impact(options) {\n const pattern = this.patternForImpact(options === null || options === void 0 ? void 0 : options.style);\n this.vibrateWithPattern(pattern);\n }\n async notification(options) {\n const pattern = this.patternForNotification(options === null || options === void 0 ? void 0 : options.type);\n this.vibrateWithPattern(pattern);\n }\n async vibrate(options) {\n const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300;\n this.vibrateWithPattern([duration]);\n }\n async selectionStart() {\n this.selectionStarted = true;\n }\n async selectionChanged() {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n async selectionEnd() {\n this.selectionStarted = false;\n }\n patternForImpact(style = ImpactStyle.Heavy) {\n if (style === ImpactStyle.Medium) {\n return [43];\n }\n else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n patternForNotification(type = NotificationType.Success) {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n }\n else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n vibrateWithPattern(pattern) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n }\n else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ImpactStyle","NotificationType","registerPlugin","WebPlugin"],"mappings":";;;;;;AAAWA,6BAAY;AACvB,CAAC,UAAU,WAAW,EAAE;AACxB;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACrC;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACnC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW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A,wBAAgB,CAAC,OAAO,EAAE;AAC/C,YAAY,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACxC,SAAS;AACT,aAAa,IAAI,IAAI,KAAKA,wBAAgB,CAAC,KAAK,EAAE;AAClD,YAAY,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAChC,SAAS;AACT,QAAQ,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC5B,KAAK;AACL,IAAI,kBAAkB,CAAC,OAAO,EAAE;AAChC,QAAQ,IAAI,SAAS,CAAC,OAAO,EAAE;AAC/B,YAAY,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACvC,SAAS;AACT,aAAa;AACb,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;AAC/E,SAAS;AACT,KAAK;AACL;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ImpactStyle;\n(function (ImpactStyle) {\n /**\n * A collision between large, heavy user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Heavy\"] = \"HEAVY\";\n /**\n * A collision between moderately sized user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Medium\"] = \"MEDIUM\";\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Light\"] = \"LIGHT\";\n})(ImpactStyle || (ImpactStyle = {}));\nexport var NotificationType;\n(function (NotificationType) {\n /**\n * A notification feedback type indicating that a task has completed successfully\n *\n * @since 1.0.0\n */\n NotificationType[\"Success\"] = \"SUCCESS\";\n /**\n * A notification feedback type indicating that a task has produced a warning\n *\n * @since 1.0.0\n */\n NotificationType[\"Warning\"] = \"WARNING\";\n /**\n * A notification feedback type indicating that a task has failed\n *\n * @since 1.0.0\n */\n NotificationType[\"Error\"] = \"ERROR\";\n})(NotificationType || (NotificationType = {}));\n/**\n * @deprecated Use `NotificationType`.\n * @since 1.0.0\n */\nexport const HapticsNotificationType = NotificationType;\n/**\n * @deprecated Use `ImpactStyle`.\n * @since 1.0.0\n */\nexport const HapticsImpactStyle = ImpactStyle;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Haptics = registerPlugin('Haptics', {\n web: () => import('./web').then(m => new m.HapticsWeb()),\n});\nexport * from './definitions';\nexport { Haptics };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { ImpactStyle, NotificationType } from './definitions';\nexport class HapticsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.selectionStarted = false;\n }\n async impact(options) {\n const pattern = this.patternForImpact(options === null || options === void 0 ? void 0 : options.style);\n this.vibrateWithPattern(pattern);\n }\n async notification(options) {\n const pattern = this.patternForNotification(options === null || options === void 0 ? void 0 : options.type);\n this.vibrateWithPattern(pattern);\n }\n async vibrate(options) {\n const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300;\n this.vibrateWithPattern([duration]);\n }\n async selectionStart() {\n this.selectionStarted = true;\n }\n async selectionChanged() {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n async selectionEnd() {\n this.selectionStarted = false;\n }\n patternForImpact(style = ImpactStyle.Heavy) {\n if (style === ImpactStyle.Medium) {\n return [43];\n }\n else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n patternForNotification(type = NotificationType.Success) {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n }\n else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n vibrateWithPattern(pattern) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n }\n else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ImpactStyle","NotificationType","registerPlugin","WebPlugin"],"mappings":";;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AM,EAAE;AAC1C,YAAY,OAAO,CAAC,EAAE,CAAC,CAAC;AACxB,SAAS;AACT,aAAa,IAAI,KAAK,KAAKA,mBAAW,CAAC,KAAK,EAAE;AAC9C,YAAY,OAAO,CAAC,EAAE,CAAC,CAAC;AACxB,SAAS;AACT,QAAQ,OAAO,CAAC,EAAE,CAAC,CAAC;AACpB,KAAK;AACL,IAAI,sBAAsB,CAAC,IAAI,GAAGC,wBAAgB,CAAC,OAAO,EAAE;AAC5D,QAAQ,IAAI,IAAI,KAAKA,wBAAgB,CAAC,OAAO,EAAE;AAC/C,YAAY,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACxC,SAAS;AACT,aAAa,IAAI,IAAI,KAAKA,wBAAgB,CAAC,KAAK,EAAE;AAClD,YAAY,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAChC,SAAS;AACT,QAAQ,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC5B,KAAK;AACL,IAAI,kBAAkB,CAAC,OAAO,EAAE;AAChC,QAAQ,IAAI,SAAS,CAAC,OAAO,EAAE;AAC/B,YAAY,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACvC,SAAS;AACT,aAAa;AACb,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;AAC/E,SAAS;AACT,KAAK;AACL;;;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -4,7 +4,7 @@ var capacitorHaptics = (function (exports, core) {
4
4
  exports.ImpactStyle = void 0;
5
5
  (function (ImpactStyle) {
6
6
  /**
7
- * A collision between small, light user interface elements
7
+ * A collision between large, heavy user interface elements
8
8
  *
9
9
  * @since 1.0.0
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ImpactStyle;\n(function (ImpactStyle) {\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Heavy\"] = \"HEAVY\";\n /**\n * A collision between moderately sized user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Medium\"] = \"MEDIUM\";\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Light\"] = \"LIGHT\";\n})(ImpactStyle || (ImpactStyle = {}));\nexport var NotificationType;\n(function (NotificationType) {\n /**\n * A notification feedback type indicating that a task has completed successfully\n *\n * @since 1.0.0\n */\n NotificationType[\"Success\"] = \"SUCCESS\";\n /**\n * A notification feedback type indicating that a task has produced a warning\n *\n * @since 1.0.0\n */\n NotificationType[\"Warning\"] = \"WARNING\";\n /**\n * A notification feedback type indicating that a task has failed\n *\n * @since 1.0.0\n */\n NotificationType[\"Error\"] = \"ERROR\";\n})(NotificationType || (NotificationType = {}));\n/**\n * @deprecated Use `NotificationType`.\n * @since 1.0.0\n */\nexport const HapticsNotificationType = NotificationType;\n/**\n * @deprecated Use `ImpactStyle`.\n * @since 1.0.0\n */\nexport const HapticsImpactStyle = ImpactStyle;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Haptics = registerPlugin('Haptics', {\n web: () => import('./web').then(m => new m.HapticsWeb()),\n});\nexport * from './definitions';\nexport { Haptics };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { ImpactStyle, NotificationType } from './definitions';\nexport class HapticsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.selectionStarted = false;\n }\n async impact(options) {\n const pattern = this.patternForImpact(options === null || options === void 0 ? void 0 : options.style);\n this.vibrateWithPattern(pattern);\n }\n async notification(options) {\n const pattern = this.patternForNotification(options === null || options === void 0 ? void 0 : options.type);\n this.vibrateWithPattern(pattern);\n }\n async vibrate(options) {\n const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300;\n this.vibrateWithPattern([duration]);\n }\n async selectionStart() {\n this.selectionStarted = true;\n }\n async selectionChanged() {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n async selectionEnd() {\n this.selectionStarted = false;\n }\n patternForImpact(style = ImpactStyle.Heavy) {\n if (style === ImpactStyle.Medium) {\n return [43];\n }\n else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n patternForNotification(type = NotificationType.Success) {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n }\n else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n vibrateWithPattern(pattern) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n }\n else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ImpactStyle","NotificationType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA,iCAAY;IACvB,CAAC,UAAU,WAAW,EAAE;IACxB;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACnC;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IACrC;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACnC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC,CAAC;AAC3BC,sCAAiB;IAC5B,CAAC,UAAU,gBAAgB,EAAE;IAC7B;IACA;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAC5C;IACA;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAC5C;IACA;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACxC,CAAC,EAAEA,wBAAgB,KAAKA,wBAAgB,GAAG,EA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AAE;IAChC,QAAQ,IAAI,SAAS,CAAC,OAAO,EAAE;IAC/B,YAAY,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,SAAS;IACT,aAAa;IACb,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;IAC/E,SAAS;IACT,KAAK;IACL;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ImpactStyle;\n(function (ImpactStyle) {\n /**\n * A collision between large, heavy user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Heavy\"] = \"HEAVY\";\n /**\n * A collision between moderately sized user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Medium\"] = \"MEDIUM\";\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Light\"] = \"LIGHT\";\n})(ImpactStyle || (ImpactStyle = {}));\nexport var NotificationType;\n(function (NotificationType) {\n /**\n * A notification feedback type indicating that a task has completed successfully\n *\n * @since 1.0.0\n */\n NotificationType[\"Success\"] = \"SUCCESS\";\n /**\n * A notification feedback type indicating that a task has produced a warning\n *\n * @since 1.0.0\n */\n NotificationType[\"Warning\"] = \"WARNING\";\n /**\n * A notification feedback type indicating that a task has failed\n *\n * @since 1.0.0\n */\n NotificationType[\"Error\"] = \"ERROR\";\n})(NotificationType || (NotificationType = {}));\n/**\n * @deprecated Use `NotificationType`.\n * @since 1.0.0\n */\nexport const HapticsNotificationType = NotificationType;\n/**\n * @deprecated Use `ImpactStyle`.\n * @since 1.0.0\n */\nexport const HapticsImpactStyle = ImpactStyle;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Haptics = registerPlugin('Haptics', {\n web: () => import('./web').then(m => new m.HapticsWeb()),\n});\nexport * from './definitions';\nexport { Haptics };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { ImpactStyle, NotificationType } from './definitions';\nexport class HapticsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.selectionStarted = false;\n }\n async impact(options) {\n const pattern = this.patternForImpact(options === null || options === void 0 ? void 0 : options.style);\n this.vibrateWithPattern(pattern);\n }\n async notification(options) {\n const pattern = this.patternForNotification(options === null || options === void 0 ? void 0 : options.type);\n this.vibrateWithPattern(pattern);\n }\n async vibrate(options) {\n const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300;\n this.vibrateWithPattern([duration]);\n }\n async selectionStart() {\n this.selectionStarted = true;\n }\n async selectionChanged() {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n async selectionEnd() {\n this.selectionStarted = false;\n }\n patternForImpact(style = ImpactStyle.Heavy) {\n if (style === ImpactStyle.Medium) {\n return [43];\n }\n else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n patternForNotification(type = NotificationType.Success) {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n }\n else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n vibrateWithPattern(pattern) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n }\n else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ImpactStyle","NotificationType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA,iCAAY;IACvB,CAAC,UAAU,WAAW,EAAE;IACxB;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACnC;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IACrC;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACnC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC,CAAC;AAC3BC,sCAAiB;IAC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C,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACxC,SAAS;IACT,aAAa,IAAI,IAAI,KAAKA,wBAAgB,CAAC,KAAK,EAAE;IAClD,YAAY,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAChC,SAAS;IACT,QAAQ,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5B,KAAK;IACL,IAAI,kBAAkB,CAAC,OAAO,EAAE;IAChC,QAAQ,IAAI,SAAS,CAAC,OAAO,EAAE;IAC/B,YAAY,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,SAAS;IACT,aAAa;IACb,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;IAC/E,SAAS;IACT,KAAK;IACL;;;;;;;;;;;;;;;;;;;"}
@@ -37,33 +37,29 @@ import CoreHaptics
37
37
  }
38
38
 
39
39
  @objc public func vibrate(_ duration: Double) {
40
- if #available(iOS 13, *) {
41
- if CHHapticEngine.capabilitiesForHardware().supportsHaptics {
42
- do {
43
- let engine = try CHHapticEngine()
44
- try engine.start()
45
- engine.resetHandler = { [] in
46
- do {
47
- try engine.start()
48
- } catch {
49
- self.vibrate()
50
- }
40
+ if CHHapticEngine.capabilitiesForHardware().supportsHaptics {
41
+ do {
42
+ let engine = try CHHapticEngine()
43
+ try engine.start()
44
+ engine.resetHandler = { [] in
45
+ do {
46
+ try engine.start()
47
+ } catch {
48
+ self.vibrate()
51
49
  }
52
- let intensity = CHHapticEventParameter(parameterID: .hapticIntensity, value: 1.0)
53
- let sharpness = CHHapticEventParameter(parameterID: .hapticSharpness, value: 1.0)
50
+ }
51
+ let intensity = CHHapticEventParameter(parameterID: .hapticIntensity, value: 1.0)
52
+ let sharpness = CHHapticEventParameter(parameterID: .hapticSharpness, value: 1.0)
54
53
 
55
- let continuousEvent = CHHapticEvent(eventType: .hapticContinuous,
56
- parameters: [intensity, sharpness],
57
- relativeTime: 0.0,
58
- duration: duration)
59
- let pattern = try CHHapticPattern(events: [continuousEvent], parameters: [])
60
- let player = try engine.makePlayer(with: pattern)
54
+ let continuousEvent = CHHapticEvent(eventType: .hapticContinuous,
55
+ parameters: [intensity, sharpness],
56
+ relativeTime: 0.0,
57
+ duration: duration)
58
+ let pattern = try CHHapticPattern(events: [continuousEvent], parameters: [])
59
+ let player = try engine.makePlayer(with: pattern)
61
60
 
62
- try player.start(atTime: 0)
63
- } catch {
64
- vibrate()
65
- }
66
- } else {
61
+ try player.start(atTime: 0)
62
+ } catch {
67
63
  vibrate()
68
64
  }
69
65
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/haptics",
3
- "version": "1.1.3",
3
+ "version": "4.0.0-nightly-f0c6414.0",
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",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
32
- "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
32
+ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
33
33
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
34
34
  "verify:web": "npm run build",
35
35
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
@@ -45,10 +45,10 @@
45
45
  "publish:cocoapod": "pod trunk push ./CapacitorHaptics.podspec --allow-warnings"
46
46
  },
47
47
  "devDependencies": {
48
- "@capacitor/android": "^3.0.0",
49
- "@capacitor/core": "^3.0.0",
48
+ "@capacitor/android": "next",
49
+ "@capacitor/core": "next",
50
50
  "@capacitor/docgen": "0.0.18",
51
- "@capacitor/ios": "^3.0.0",
51
+ "@capacitor/ios": "next",
52
52
  "@ionic/eslint-config": "^0.3.0",
53
53
  "@ionic/prettier-config": "~1.0.1",
54
54
  "@ionic/swiftlint-config": "^1.1.2",
@@ -61,7 +61,7 @@
61
61
  "typescript": "~4.1.5"
62
62
  },
63
63
  "peerDependencies": {
64
- "@capacitor/core": "^3.0.0"
64
+ "@capacitor/core": "next"
65
65
  },
66
66
  "prettier": "@ionic/prettier-config",
67
67
  "swiftlint": "@ionic/swiftlint-config",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "64df93225736e9dfad336562f5e53e5a2243052b"
82
+ "gitHead": "f0c64141855ef34ddd32cfb217d4de195b0ad095"
83
83
  }