@capacitor/haptics 6.0.2 → 7.0.0-alpha.2

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-plugins.git', :tag => package['name'] + '@' + 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 = '13.0'
14
+ s.ios.deployment_target = '14.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
  end
package/Package.swift CHANGED
@@ -3,14 +3,14 @@ import PackageDescription
3
3
 
4
4
  let package = Package(
5
5
  name: "CapacitorHaptics",
6
- platforms: [.iOS(.v13)],
6
+ platforms: [.iOS(.v14)],
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: "6.0.0")
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main")
14
14
  ],
15
15
  targets: [
16
16
  .target(
@@ -1,9 +1,9 @@
1
1
  ext {
2
2
  capacitorVersion = System.getenv('CAPACITOR_VERSION')
3
3
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
4
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
5
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
6
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
4
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
5
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
6
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
7
7
  }
8
8
 
9
9
  buildscript {
@@ -15,7 +15,7 @@ buildscript {
15
15
  }
16
16
  }
17
17
  dependencies {
18
- classpath 'com.android.tools.build:gradle:8.2.1'
18
+ classpath 'com.android.tools.build:gradle:8.7.2'
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,10 @@ 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 : 34
34
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
35
35
  defaultConfig {
36
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
37
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
36
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
37
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
38
38
  versionCode 1
39
39
  versionName "1.0"
40
40
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -49,8 +49,8 @@ android {
49
49
  abortOnError false
50
50
  }
51
51
  compileOptions {
52
- sourceCompatibility JavaVersion.VERSION_17
53
- targetCompatibility JavaVersion.VERSION_17
52
+ sourceCompatibility JavaVersion.VERSION_21
53
+ targetCompatibility JavaVersion.VERSION_21
54
54
  }
55
55
  publishing {
56
56
  singleVariant("release")
@@ -10,12 +10,10 @@ import com.capacitorjs.plugins.haptics.arguments.HapticsVibrationType;
10
10
 
11
11
  public class Haptics {
12
12
 
13
- private Context context;
14
13
  private boolean selectionStarted = false;
15
14
  private final Vibrator vibrator;
16
15
 
17
16
  Haptics(Context context) {
18
- this.context = context;
19
17
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
20
18
  VibratorManager vibratorManager = (VibratorManager) context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE);
21
19
  this.vibrator = vibratorManager.getDefaultVibrator();
@@ -43,8 +41,8 @@ public class Haptics {
43
41
  }
44
42
 
45
43
  @SuppressWarnings({ "deprecation" })
46
- private void vibratePre26(long[] pattern, int repeat) {
47
- vibrator.vibrate(pattern, repeat);
44
+ private void vibratePre26(long[] pattern) {
45
+ vibrator.vibrate(pattern, -1);
48
46
  }
49
47
 
50
48
  public void selectionStart() {
@@ -65,7 +63,7 @@ public class Haptics {
65
63
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
66
64
  vibrator.vibrate(VibrationEffect.createWaveform(type.getTimings(), type.getAmplitudes(), -1));
67
65
  } else {
68
- vibratePre26(type.getOldSDKPattern(), -1);
66
+ vibratePre26(type.getOldSDKPattern());
69
67
  }
70
68
  }
71
69
  }
@@ -110,23 +110,3 @@ export interface VibrateOptions {
110
110
  */
111
111
  duration: number;
112
112
  }
113
- /**
114
- * @deprecated Use `ImpactOptions`.
115
- * @since 1.0.0
116
- */
117
- export declare type HapticsImpactOptions = ImpactOptions;
118
- /**
119
- * @deprecated Use `NotificationOptions`.
120
- * @since 1.0.0
121
- */
122
- export declare type HapticsNotificationOptions = NotificationOptions;
123
- /**
124
- * @deprecated Use `NotificationType`.
125
- * @since 1.0.0
126
- */
127
- export declare const HapticsNotificationType: typeof NotificationType;
128
- /**
129
- * @deprecated Use `ImpactStyle`.
130
- * @since 1.0.0
131
- */
132
- export declare const HapticsImpactStyle: typeof ImpactStyle;
@@ -40,14 +40,4 @@ export var NotificationType;
40
40
  */
41
41
  NotificationType["Error"] = "ERROR";
42
42
  })(NotificationType || (NotificationType = {}));
43
- /**
44
- * @deprecated Use `NotificationType`.
45
- * @since 1.0.0
46
- */
47
- export const HapticsNotificationType = NotificationType;
48
- /**
49
- * @deprecated Use `ImpactStyle`.
50
- * @since 1.0.0
51
- */
52
- export const HapticsImpactStyle = ImpactStyle;
53
43
  //# sourceMappingURL=definitions.js.map
@@ -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;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
+ {"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","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"]}
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var core = require('@capacitor/core');
6
4
 
7
5
  exports.ImpactStyle = void 0;
@@ -46,16 +44,6 @@ exports.NotificationType = void 0;
46
44
  */
47
45
  NotificationType["Error"] = "ERROR";
48
46
  })(exports.NotificationType || (exports.NotificationType = {}));
49
- /**
50
- * @deprecated Use `NotificationType`.
51
- * @since 1.0.0
52
- */
53
- const HapticsNotificationType = exports.NotificationType;
54
- /**
55
- * @deprecated Use `ImpactStyle`.
56
- * @since 1.0.0
57
- */
58
- const HapticsImpactStyle = exports.ImpactStyle;
59
47
 
60
48
  const Haptics = core.registerPlugin('Haptics', {
61
49
  web: () => Promise.resolve().then(function () { return web; }).then(m => new m.HapticsWeb()),
@@ -123,6 +111,4 @@ var web = /*#__PURE__*/Object.freeze({
123
111
  });
124
112
 
125
113
  exports.Haptics = Haptics;
126
- exports.HapticsImpactStyle = HapticsImpactStyle;
127
- exports.HapticsNotificationType = HapticsNotificationType;
128
114
  //# sourceMappingURL=plugin.cjs.js.map
@@ -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 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,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,GAAG,EAAE,CAAC,CAAC,CAAC;AAC3BC,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Y,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//# 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;AACX,CAAC,UAAU,WAAW,EAAE;AACxB;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,QAAQ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ClD,YAAY,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAC/B;AACA,QAAQ,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAC3B;AACA,IAAI,kBAAkB,CAAC,OAAO,EAAE;AAChC,QAAQ,IAAI,SAAS,CAAC,OAAO,EAAE;AAC/B,YAAY,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;AACtC;AACA,aAAa;AACb,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC;AAC9E;AACA;AACA;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -43,16 +43,6 @@ var capacitorHaptics = (function (exports, core) {
43
43
  */
44
44
  NotificationType["Error"] = "ERROR";
45
45
  })(exports.NotificationType || (exports.NotificationType = {}));
46
- /**
47
- * @deprecated Use `NotificationType`.
48
- * @since 1.0.0
49
- */
50
- const HapticsNotificationType = exports.NotificationType;
51
- /**
52
- * @deprecated Use `ImpactStyle`.
53
- * @since 1.0.0
54
- */
55
- const HapticsImpactStyle = exports.ImpactStyle;
56
46
 
57
47
  const Haptics = core.registerPlugin('Haptics', {
58
48
  web: () => Promise.resolve().then(function () { return web; }).then(m => new m.HapticsWeb()),
@@ -120,10 +110,6 @@ var capacitorHaptics = (function (exports, core) {
120
110
  });
121
111
 
122
112
  exports.Haptics = Haptics;
123
- exports.HapticsImpactStyle = HapticsImpactStyle;
124
- exports.HapticsNotificationType = HapticsNotificationType;
125
-
126
- Object.defineProperty(exports, '__esModule', { value: true });
127
113
 
128
114
  return exports;
129
115
 
@@ -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 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;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,EAAE,CAAC,CAAC,CAAC;IAChD;IACA;IACA;IACA;AACY,UAAC,uBAAuB,GAAGA,yBAAiB;IACxD;IACA;IACA;IACA;AACY,UAAC,kBAAkB,GAAGD;;AClD7B,UAAC,OAAO,GAAGE,mBAAc,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W,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//# 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;IACX,CAAC,UAAU,WAAW,EAAE;IACxB;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;IAClC;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACpC;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;IAClC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;AAC1BC;IACX,CAAC,UAAU,gBAAgB,EAAE;IAC7B;IACA;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS;IAC3C;IACA;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS;IAC3C;IACA;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO;IACvC,CAAC,EAAEA,wBAAgB,KAAKA,wBAAgB,GAAG,EAAE,CAAC,CAAC;;ACxC1C,UAAC,OAAO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ics 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",
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "scripts": {
33
33
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
34
- "verify:ios": "xcodebuild build -scheme CapacitorHaptics -sdk iphonesimulator17.0 -destination 'OS=17.0,name=iPhone 15'",
34
+ "verify:ios": "xcodebuild build -scheme CapacitorHaptics -destination generic/platform=iOS",
35
35
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
36
36
  "verify:web": "npm run build",
37
37
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
@@ -40,30 +40,30 @@
40
40
  "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
41
41
  "swiftlint": "node-swiftlint",
42
42
  "docgen": "docgen --api HapticsPlugin --output-readme README.md --output-json dist/docs.json",
43
- "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
43
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
44
44
  "clean": "rimraf ./dist",
45
45
  "watch": "tsc --watch",
46
46
  "prepublishOnly": "npm run build",
47
47
  "publish:cocoapod": "pod trunk push ./CapacitorHaptics.podspec --allow-warnings"
48
48
  },
49
49
  "devDependencies": {
50
- "@capacitor/android": "^6.0.0",
51
- "@capacitor/core": "^6.0.0",
50
+ "@capacitor/android": "next",
51
+ "@capacitor/core": "next",
52
52
  "@capacitor/docgen": "0.2.2",
53
- "@capacitor/ios": "^6.0.0",
53
+ "@capacitor/ios": "next",
54
54
  "@ionic/eslint-config": "^0.4.0",
55
55
  "@ionic/prettier-config": "~1.0.1",
56
56
  "@ionic/swiftlint-config": "^1.1.2",
57
57
  "eslint": "^8.57.0",
58
58
  "prettier": "~2.3.0",
59
59
  "prettier-plugin-java": "~1.0.2",
60
- "rimraf": "^3.0.0",
61
- "rollup": "^2.29.0",
60
+ "rimraf": "^6.0.1",
61
+ "rollup": "^4.26.0",
62
62
  "swiftlint": "^1.0.1",
63
63
  "typescript": "~4.1.5"
64
64
  },
65
65
  "peerDependencies": {
66
- "@capacitor/core": "^6.0.0"
66
+ "@capacitor/core": "next"
67
67
  },
68
68
  "prettier": "@ionic/prettier-config",
69
69
  "swiftlint": "@ionic/swiftlint-config",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "6e94aa5bf785e957d0cfac83b62b5355bcf7d1ed"
84
+ "gitHead": "023f53b42a81049b7cdef6c7b0102b85b4df1c01"
85
85
  }