@react-native-ohos/react-native-haptic-feedback 2.3.4-rc.1 → 2.4.0-beta.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.
- package/LICENSE +21 -21
- package/README.OpenSource +10 -10
- package/README.md +12 -12
- package/RNReactNativeHapticFeedback.podspec +29 -29
- package/harmony/haptic_feedback/BuildProfile.ets +1 -1
- package/harmony/haptic_feedback/build-profile.json5 +27 -27
- package/harmony/haptic_feedback/hvigorfile.ts +6 -6
- package/harmony/haptic_feedback/index.ets +27 -25
- package/harmony/haptic_feedback/obfuscation-rules.txt +17 -17
- package/harmony/haptic_feedback/oh-package.json5 +12 -12
- package/harmony/haptic_feedback/src/main/cpp/CMakeLists.txt +6 -6
- package/harmony/haptic_feedback/src/main/cpp/RNHapticFeedback.cpp +21 -21
- package/harmony/haptic_feedback/src/main/cpp/RNHapticFeedback.h +21 -21
- package/harmony/haptic_feedback/src/main/cpp/RNHapticFeedbackPackage.h +37 -37
- package/harmony/haptic_feedback/src/main/ets/Logger.ts +45 -45
- package/harmony/haptic_feedback/src/main/ets/{RNHapticFeedbackPackage.ts → RNHapticFeedbackPackage.ets} +29 -28
- package/harmony/haptic_feedback/src/main/ets/RNHapticFeedbackTurboModule.ts +151 -151
- package/harmony/haptic_feedback/src/main/ets/generated/components/ts.ts +8 -8
- package/harmony/haptic_feedback/src/main/ets/generated/index.ets +8 -8
- package/harmony/haptic_feedback/src/main/ets/generated/ts.ts +9 -9
- package/harmony/haptic_feedback/src/main/ets/generated/turboModules/RNHapticFeedback.ts +16 -16
- package/harmony/haptic_feedback/src/main/ets/generated/turboModules/ts.ts +8 -8
- package/harmony/haptic_feedback/src/main/module.json5 +11 -11
- package/harmony/haptic_feedback/src/main/resources/base/element/color.json +7 -7
- package/harmony/haptic_feedback/src/main/resources/base/element/string.json +15 -15
- package/harmony/haptic_feedback/src/main/resources/base/media/layered_image.json +6 -6
- package/harmony/haptic_feedback/src/main/resources/base/profile/main_pages.json +5 -5
- package/harmony/haptic_feedback/src/main/resources/en_US/element/string.json +15 -15
- package/harmony/haptic_feedback/src/main/resources/rawfile/effectClick.json +27 -27
- package/harmony/haptic_feedback/src/main/resources/rawfile/effectDoubleClick.json +37 -37
- package/harmony/haptic_feedback/src/main/resources/rawfile/effectHeavyClick.json +27 -27
- package/harmony/haptic_feedback/src/main/resources/rawfile/effectTick.json +27 -27
- package/harmony/haptic_feedback/src/main/resources/rawfile/impactHeavy.json +27 -27
- package/harmony/haptic_feedback/src/main/resources/rawfile/impactLight.json +27 -27
- package/harmony/haptic_feedback/src/main/resources/rawfile/impactMedium.json +27 -27
- package/harmony/haptic_feedback/src/main/resources/rawfile/notificationError.json +57 -57
- package/harmony/haptic_feedback/src/main/resources/rawfile/notificationSuccess.json +37 -37
- package/harmony/haptic_feedback/src/main/resources/rawfile/notificationWarning.json +37 -37
- package/harmony/haptic_feedback/src/main/resources/rawfile/rigid.json +27 -27
- package/harmony/haptic_feedback/src/main/resources/rawfile/selection.json +27 -27
- package/harmony/haptic_feedback/src/main/resources/rawfile/soft.json +27 -27
- package/harmony/haptic_feedback/src/main/resources/zh_CN/element/string.json +15 -15
- package/harmony/haptic_feedback/{ts.ts → ts.ets} +25 -25
- package/harmony/haptic_feedback.har +0 -0
- package/package.json +121 -117
- package/src/codegenSpec/NativeHapticFeedback.ts +14 -14
- package/src/index.ts +31 -31
- package/src/types.ts +29 -29
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
-
* Use of this source code is governed by a MIT license that can be
|
|
4
|
-
* found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
|
|
8
|
-
import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
9
|
-
import { TM } from "./generated/ts";
|
|
10
|
-
import { RNHapticFeedbackTurboModule } from './RNHapticFeedbackTurboModule';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
|
|
8
|
+
import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
9
|
+
import { TM } from "./generated/ts";
|
|
10
|
+
import { RNHapticFeedbackTurboModule } from './RNHapticFeedbackTurboModule';
|
|
11
|
+
import { RNOHPackage } from "@rnoh/react-native-openharmony";
|
|
12
|
+
|
|
13
|
+
class RNHapticFeedbackTurboModuleFactory extends TurboModulesFactory {
|
|
14
|
+
createTurboModule(name: string): TurboModule | null {
|
|
15
|
+
if (this.hasTurboModule(name)) {
|
|
16
|
+
return new RNHapticFeedbackTurboModule(this.ctx);
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
hasTurboModule(name: string): boolean {
|
|
22
|
+
return name === TM.RNHapticFeedback.NAME;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class RNHapticFeedbackPackage extends RNOHPackage {
|
|
27
|
+
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
|
|
28
|
+
return new RNHapticFeedbackTurboModuleFactory(ctx);
|
|
29
|
+
}
|
|
29
30
|
}
|
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
-
* Use of this source code is governed by a MIT license that can be
|
|
4
|
-
* found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
8
|
-
import { TM } from "./generated/ts";
|
|
9
|
-
import Logger from './Logger';
|
|
10
|
-
import vibrator from '@ohos.vibrator';
|
|
11
|
-
import audio from '@ohos.multimedia.audio';
|
|
12
|
-
import { BusinessError } from '@ohos.base';
|
|
13
|
-
import common from '@ohos.app.ability.common';
|
|
14
|
-
|
|
15
|
-
export class RNHapticFeedbackTurboModule extends TurboModule implements TM.RNHapticFeedback.Spec {
|
|
16
|
-
private context: common.UIAbilityContext
|
|
17
|
-
constructor(ctx: TurboModuleContext) {
|
|
18
|
-
super(ctx);
|
|
19
|
-
this.context = ctx.uiAbilityContext
|
|
20
|
-
}
|
|
21
|
-
public trigger(type: string, options?: { enableVibrateFallback: boolean,ignoreAndroidSystemSettings:boolean }): void {
|
|
22
|
-
let ignoreHOSSystemSettingsVal = options?.ignoreAndroidSystemSettings || false
|
|
23
|
-
let singleObj = {
|
|
24
|
-
impactLight: { type: 'preset', effectId: 'haptic.effect.hard', intensity: 30 },
|
|
25
|
-
impactMedium: { type: 'preset', effectId: 'haptic.effect.hard', intensity: 60 },
|
|
26
|
-
impactHeavy: { type: 'preset', effectId: 'haptic.effect.hard' },
|
|
27
|
-
rigid: { type: 'preset', effectId: 'haptic.effect.sharp' },
|
|
28
|
-
soft: { type: 'preset', effectId: 'haptic.effect.soft' },
|
|
29
|
-
selection: { type: 'preset', effectId: 'haptic.effect.sharp', intensity: 50 },
|
|
30
|
-
effectClick: { type: 'preset', effectId: 'haptic.effect.soft', intensity: 60 },
|
|
31
|
-
effectHeavyClick: { type: 'preset', effectId: 'haptic.effect.soft', intensity: 80 },
|
|
32
|
-
effectTick: { type: 'preset', effectId: 'haptic.effect.soft', intensity: 70 },
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let constantObj={
|
|
36
|
-
clockTick:{type: 'time',duration:4},
|
|
37
|
-
contextClick:{type: 'time',duration:6},
|
|
38
|
-
keyboardPress:{type: 'time',duration:3},
|
|
39
|
-
keyboardRelease:{type: 'time',duration:7},
|
|
40
|
-
keyboardTap:{type: 'time',duration:3},
|
|
41
|
-
longPress:{type: 'time',duration:0},
|
|
42
|
-
textHandleMove:{type: 'time',duration:9},
|
|
43
|
-
virtualKey:{type: 'time',duration:1},
|
|
44
|
-
virtualKeyRelease:{type: 'time',duration:8},
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
let multipleObj = {
|
|
48
|
-
notificationSuccess: { type: 'file' },
|
|
49
|
-
notificationWarning: { type: 'file' },
|
|
50
|
-
notificationError: { type: 'file' },
|
|
51
|
-
effectDoubleClick: { type: 'file' },
|
|
52
|
-
}
|
|
53
|
-
let audioManager = audio.getAudioManager();
|
|
54
|
-
let audioVolumeManager: audio.AudioVolumeManager = audioManager.getVolumeManager();
|
|
55
|
-
try {
|
|
56
|
-
let audioVolumeGroupManager: audio.AudioVolumeGroupManager =
|
|
57
|
-
audioVolumeManager.getVolumeGroupManagerSync(audio.DEFAULT_VOLUME_GROUP_ID);
|
|
58
|
-
Logger.info(`Get audioVolumeGroupManager success.`);
|
|
59
|
-
let value: audio.AudioRingMode = audioVolumeGroupManager.getRingerModeSync()
|
|
60
|
-
let isVolumeOn = value != 0
|
|
61
|
-
let isVibrateMode = value == 1
|
|
62
|
-
Logger.info(`Indicate that the ringer mode is obtained ${value}. finalBollen:${ignoreHOSSystemSettingsVal ==
|
|
63
|
-
false && !(isVolumeOn || isVibrateMode)} isVolumeOn:${isVolumeOn} isVibrateMode:${isVibrateMode}`);
|
|
64
|
-
if (ignoreHOSSystemSettingsVal == false && !(isVolumeOn || isVibrateMode)) {
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
|
-
if (singleObj[type]) {
|
|
68
|
-
try {
|
|
69
|
-
vibrator.startVibration({
|
|
70
|
-
type: singleObj[type].type,
|
|
71
|
-
effectId: singleObj[type].effectId,
|
|
72
|
-
count: 1,
|
|
73
|
-
intensity: singleObj[type].intensity || 100
|
|
74
|
-
}, {
|
|
75
|
-
id: 0,
|
|
76
|
-
usage: 'unknown'
|
|
77
|
-
}, (error: BusinessError) => {
|
|
78
|
-
if (error) {
|
|
79
|
-
Logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
Logger.info('Succeed in starting vibration');
|
|
83
|
-
});
|
|
84
|
-
} catch (err) {
|
|
85
|
-
let e: BusinessError = err as BusinessError;
|
|
86
|
-
Logger.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`);
|
|
87
|
-
}
|
|
88
|
-
} else if (multipleObj[type]) {
|
|
89
|
-
let rawFd = this.context.resourceManager.getRawFdSync(`${type}.json`);
|
|
90
|
-
try {
|
|
91
|
-
vibrator.startVibration({
|
|
92
|
-
type: multipleObj[type].type,
|
|
93
|
-
hapticFd: { fd: rawFd.fd, offset: rawFd.offset, length: rawFd.length }
|
|
94
|
-
}, {
|
|
95
|
-
id: 0,
|
|
96
|
-
usage: 'unknown'
|
|
97
|
-
}).then(() => {
|
|
98
|
-
Logger.info(`Succeed in starting vibration!!!!!! type:${type}.json fd:${rawFd.fd} offset: ${rawFd.offset} length: ${rawFd.length}`);
|
|
99
|
-
}, (error: BusinessError) => {
|
|
100
|
-
Logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
|
|
101
|
-
});
|
|
102
|
-
} catch (err) {
|
|
103
|
-
let e: BusinessError = err as BusinessError;
|
|
104
|
-
Logger.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`);
|
|
105
|
-
}
|
|
106
|
-
this.context.resourceManager.closeRawFdSync(`${type}.json`)
|
|
107
|
-
}else if(constantObj[type]){
|
|
108
|
-
try {
|
|
109
|
-
vibrator.startVibration({
|
|
110
|
-
type: constantObj[type].type,
|
|
111
|
-
duration: constantObj[type].duration
|
|
112
|
-
}, {
|
|
113
|
-
id: 0,
|
|
114
|
-
usage: 'unknown'
|
|
115
|
-
}).then(() => {
|
|
116
|
-
Logger.info('Succeed in starting vibration');
|
|
117
|
-
}, (error: BusinessError) => {
|
|
118
|
-
Logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
|
|
119
|
-
});
|
|
120
|
-
} catch (err) {
|
|
121
|
-
let e: BusinessError = err as BusinessError;
|
|
122
|
-
Logger.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`);
|
|
123
|
-
}
|
|
124
|
-
}else{
|
|
125
|
-
try {
|
|
126
|
-
vibrator.startVibration({
|
|
127
|
-
type: 'preset',
|
|
128
|
-
effectId: 'haptic.effect.sharp',
|
|
129
|
-
count: 1,
|
|
130
|
-
intensity: 50
|
|
131
|
-
}, {
|
|
132
|
-
id: 0,
|
|
133
|
-
usage: 'unknown'
|
|
134
|
-
}, (error: BusinessError) => {
|
|
135
|
-
if (error) {
|
|
136
|
-
Logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
Logger.info('Succeed in starting vibration');
|
|
140
|
-
});
|
|
141
|
-
} catch (err) {
|
|
142
|
-
let e: BusinessError = err as BusinessError;
|
|
143
|
-
Logger.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
} catch (err) {
|
|
147
|
-
let error = err as BusinessError;
|
|
148
|
-
Logger.error(`Failed to get audioVolumeGroupManager, error: ${error}`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
8
|
+
import { TM } from "./generated/ts";
|
|
9
|
+
import Logger from './Logger';
|
|
10
|
+
import vibrator from '@ohos.vibrator';
|
|
11
|
+
import audio from '@ohos.multimedia.audio';
|
|
12
|
+
import { BusinessError } from '@ohos.base';
|
|
13
|
+
import common from '@ohos.app.ability.common';
|
|
14
|
+
|
|
15
|
+
export class RNHapticFeedbackTurboModule extends TurboModule implements TM.RNHapticFeedback.Spec {
|
|
16
|
+
private context: common.UIAbilityContext
|
|
17
|
+
constructor(ctx: TurboModuleContext) {
|
|
18
|
+
super(ctx);
|
|
19
|
+
this.context = ctx.uiAbilityContext
|
|
20
|
+
}
|
|
21
|
+
public trigger(type: string, options?: { enableVibrateFallback: boolean,ignoreAndroidSystemSettings:boolean }): void {
|
|
22
|
+
let ignoreHOSSystemSettingsVal = options?.ignoreAndroidSystemSettings || false
|
|
23
|
+
let singleObj = {
|
|
24
|
+
impactLight: { type: 'preset', effectId: 'haptic.effect.hard', intensity: 30 },
|
|
25
|
+
impactMedium: { type: 'preset', effectId: 'haptic.effect.hard', intensity: 60 },
|
|
26
|
+
impactHeavy: { type: 'preset', effectId: 'haptic.effect.hard' },
|
|
27
|
+
rigid: { type: 'preset', effectId: 'haptic.effect.sharp' },
|
|
28
|
+
soft: { type: 'preset', effectId: 'haptic.effect.soft' },
|
|
29
|
+
selection: { type: 'preset', effectId: 'haptic.effect.sharp', intensity: 50 },
|
|
30
|
+
effectClick: { type: 'preset', effectId: 'haptic.effect.soft', intensity: 60 },
|
|
31
|
+
effectHeavyClick: { type: 'preset', effectId: 'haptic.effect.soft', intensity: 80 },
|
|
32
|
+
effectTick: { type: 'preset', effectId: 'haptic.effect.soft', intensity: 70 },
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let constantObj={
|
|
36
|
+
clockTick:{type: 'time',duration:4},
|
|
37
|
+
contextClick:{type: 'time',duration:6},
|
|
38
|
+
keyboardPress:{type: 'time',duration:3},
|
|
39
|
+
keyboardRelease:{type: 'time',duration:7},
|
|
40
|
+
keyboardTap:{type: 'time',duration:3},
|
|
41
|
+
longPress:{type: 'time',duration:0},
|
|
42
|
+
textHandleMove:{type: 'time',duration:9},
|
|
43
|
+
virtualKey:{type: 'time',duration:1},
|
|
44
|
+
virtualKeyRelease:{type: 'time',duration:8},
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let multipleObj = {
|
|
48
|
+
notificationSuccess: { type: 'file' },
|
|
49
|
+
notificationWarning: { type: 'file' },
|
|
50
|
+
notificationError: { type: 'file' },
|
|
51
|
+
effectDoubleClick: { type: 'file' },
|
|
52
|
+
}
|
|
53
|
+
let audioManager = audio.getAudioManager();
|
|
54
|
+
let audioVolumeManager: audio.AudioVolumeManager = audioManager.getVolumeManager();
|
|
55
|
+
try {
|
|
56
|
+
let audioVolumeGroupManager: audio.AudioVolumeGroupManager =
|
|
57
|
+
audioVolumeManager.getVolumeGroupManagerSync(audio.DEFAULT_VOLUME_GROUP_ID);
|
|
58
|
+
Logger.info(`Get audioVolumeGroupManager success.`);
|
|
59
|
+
let value: audio.AudioRingMode = audioVolumeGroupManager.getRingerModeSync()
|
|
60
|
+
let isVolumeOn = value != 0
|
|
61
|
+
let isVibrateMode = value == 1
|
|
62
|
+
Logger.info(`Indicate that the ringer mode is obtained ${value}. finalBollen:${ignoreHOSSystemSettingsVal ==
|
|
63
|
+
false && !(isVolumeOn || isVibrateMode)} isVolumeOn:${isVolumeOn} isVibrateMode:${isVibrateMode}`);
|
|
64
|
+
if (ignoreHOSSystemSettingsVal == false && !(isVolumeOn || isVibrateMode)) {
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
if (singleObj[type]) {
|
|
68
|
+
try {
|
|
69
|
+
vibrator.startVibration({
|
|
70
|
+
type: singleObj[type].type,
|
|
71
|
+
effectId: singleObj[type].effectId,
|
|
72
|
+
count: 1,
|
|
73
|
+
intensity: singleObj[type].intensity || 100
|
|
74
|
+
}, {
|
|
75
|
+
id: 0,
|
|
76
|
+
usage: 'unknown'
|
|
77
|
+
}, (error: BusinessError) => {
|
|
78
|
+
if (error) {
|
|
79
|
+
Logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
Logger.info('Succeed in starting vibration');
|
|
83
|
+
});
|
|
84
|
+
} catch (err) {
|
|
85
|
+
let e: BusinessError = err as BusinessError;
|
|
86
|
+
Logger.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`);
|
|
87
|
+
}
|
|
88
|
+
} else if (multipleObj[type]) {
|
|
89
|
+
let rawFd = this.context.resourceManager.getRawFdSync(`${type}.json`);
|
|
90
|
+
try {
|
|
91
|
+
vibrator.startVibration({
|
|
92
|
+
type: multipleObj[type].type,
|
|
93
|
+
hapticFd: { fd: rawFd.fd, offset: rawFd.offset, length: rawFd.length }
|
|
94
|
+
}, {
|
|
95
|
+
id: 0,
|
|
96
|
+
usage: 'unknown'
|
|
97
|
+
}).then(() => {
|
|
98
|
+
Logger.info(`Succeed in starting vibration!!!!!! type:${type}.json fd:${rawFd.fd} offset: ${rawFd.offset} length: ${rawFd.length}`);
|
|
99
|
+
}, (error: BusinessError) => {
|
|
100
|
+
Logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
|
|
101
|
+
});
|
|
102
|
+
} catch (err) {
|
|
103
|
+
let e: BusinessError = err as BusinessError;
|
|
104
|
+
Logger.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`);
|
|
105
|
+
}
|
|
106
|
+
this.context.resourceManager.closeRawFdSync(`${type}.json`)
|
|
107
|
+
}else if(constantObj[type]){
|
|
108
|
+
try {
|
|
109
|
+
vibrator.startVibration({
|
|
110
|
+
type: constantObj[type].type,
|
|
111
|
+
duration: constantObj[type].duration
|
|
112
|
+
}, {
|
|
113
|
+
id: 0,
|
|
114
|
+
usage: 'unknown'
|
|
115
|
+
}).then(() => {
|
|
116
|
+
Logger.info('Succeed in starting vibration');
|
|
117
|
+
}, (error: BusinessError) => {
|
|
118
|
+
Logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
|
|
119
|
+
});
|
|
120
|
+
} catch (err) {
|
|
121
|
+
let e: BusinessError = err as BusinessError;
|
|
122
|
+
Logger.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`);
|
|
123
|
+
}
|
|
124
|
+
}else{
|
|
125
|
+
try {
|
|
126
|
+
vibrator.startVibration({
|
|
127
|
+
type: 'preset',
|
|
128
|
+
effectId: 'haptic.effect.sharp',
|
|
129
|
+
count: 1,
|
|
130
|
+
intensity: 50
|
|
131
|
+
}, {
|
|
132
|
+
id: 0,
|
|
133
|
+
usage: 'unknown'
|
|
134
|
+
}, (error: BusinessError) => {
|
|
135
|
+
if (error) {
|
|
136
|
+
Logger.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
Logger.info('Succeed in starting vibration');
|
|
140
|
+
});
|
|
141
|
+
} catch (err) {
|
|
142
|
+
let e: BusinessError = err as BusinessError;
|
|
143
|
+
Logger.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
} catch (err) {
|
|
147
|
+
let error = err as BusinessError;
|
|
148
|
+
Logger.error(`Failed to get audioVolumeGroupManager, error: ${error}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by "react-native codegen-harmony"
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
-
* lost once the code is regenerated.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export {}
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export {}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by "react-native codegen-harmony"
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
-
* lost once the code is regenerated.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export * from "./ts"
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export * from "./ts"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by "react-native codegen-harmony"
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
-
* lost once the code is regenerated.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export * as RNC from "./components/ts"
|
|
9
|
-
export * as TM from "./turboModules/ts"
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export * as RNC from "./components/ts"
|
|
9
|
+
export * as TM from "./turboModules/ts"
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by "react-native codegen-harmony"
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
-
* lost once the code is regenerated.
|
|
6
|
-
*
|
|
7
|
-
* @generatorVersion: 1
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export namespace RNHapticFeedback {
|
|
11
|
-
export const NAME = 'RNHapticFeedback' as const
|
|
12
|
-
|
|
13
|
-
export interface Spec {
|
|
14
|
-
trigger(type: string, options: {enableVibrateFallback?: boolean, ignoreAndroidSystemSettings?: boolean}): void;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generatorVersion: 1
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export namespace RNHapticFeedback {
|
|
11
|
+
export const NAME = 'RNHapticFeedback' as const
|
|
12
|
+
|
|
13
|
+
export interface Spec {
|
|
14
|
+
trigger(type: string, options: {enableVibrateFallback?: boolean, ignoreAndroidSystemSettings?: boolean}): void;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by "react-native codegen-harmony"
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
-
* lost once the code is regenerated.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export * from "./RNHapticFeedback"
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export * from "./RNHapticFeedback"
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
{
|
|
3
|
-
"module": {
|
|
4
|
-
"name": "haptic_feedback",
|
|
5
|
-
"type": "har",
|
|
6
|
-
"deviceTypes": [
|
|
7
|
-
"default",
|
|
8
|
-
"tablet",
|
|
9
|
-
"2in1"
|
|
10
|
-
]
|
|
11
|
-
}
|
|
1
|
+
|
|
2
|
+
{
|
|
3
|
+
"module": {
|
|
4
|
+
"name": "haptic_feedback",
|
|
5
|
+
"type": "har",
|
|
6
|
+
"deviceTypes": [
|
|
7
|
+
"default",
|
|
8
|
+
"tablet",
|
|
9
|
+
"2in1"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
12
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"color": [
|
|
3
|
-
{
|
|
4
|
-
"name": "start_window_background",
|
|
5
|
-
"value": "#FFFFFF"
|
|
6
|
-
}
|
|
7
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"color": [
|
|
3
|
+
{
|
|
4
|
+
"name": "start_window_background",
|
|
5
|
+
"value": "#FFFFFF"
|
|
6
|
+
}
|
|
7
|
+
]
|
|
8
8
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "module_desc",
|
|
5
|
-
"value": "module description"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"name": "Haptic_feedbackAbility_desc",
|
|
9
|
-
"value": "description"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"name": "Haptic_feedbackAbility_label",
|
|
13
|
-
"value": "label"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "module_desc",
|
|
5
|
+
"value": "module description"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"name": "Haptic_feedbackAbility_desc",
|
|
9
|
+
"value": "description"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "Haptic_feedbackAbility_label",
|
|
13
|
+
"value": "label"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"layered-image":
|
|
3
|
-
{
|
|
4
|
-
"background" : "$media:background",
|
|
5
|
-
"foreground" : "$media:foreground"
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"layered-image":
|
|
3
|
+
{
|
|
4
|
+
"background" : "$media:background",
|
|
5
|
+
"foreground" : "$media:foreground"
|
|
6
|
+
}
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"src": [
|
|
3
|
-
"pages/Index"
|
|
4
|
-
]
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"src": [
|
|
3
|
+
"pages/Index"
|
|
4
|
+
]
|
|
5
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "module_desc",
|
|
5
|
-
"value": "module description"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"name": "Haptic_feedbackAbility_desc",
|
|
9
|
-
"value": "description"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"name": "Haptic_feedbackAbility_label",
|
|
13
|
-
"value": "label"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "module_desc",
|
|
5
|
+
"value": "module description"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"name": "Haptic_feedbackAbility_desc",
|
|
9
|
+
"value": "description"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "Haptic_feedbackAbility_label",
|
|
13
|
+
"value": "label"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
16
|
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"MetaData": {
|
|
3
|
-
"Create": "2024-05-29",
|
|
4
|
-
"Description": "a haptic case",
|
|
5
|
-
"Version": 1.0,
|
|
6
|
-
"ChannelNumber": 1
|
|
7
|
-
},
|
|
8
|
-
"Channels": [
|
|
9
|
-
{
|
|
10
|
-
"Parameters": {
|
|
11
|
-
"Index": 0
|
|
12
|
-
},
|
|
13
|
-
"Pattern": [
|
|
14
|
-
{
|
|
15
|
-
"Event": {
|
|
16
|
-
"Type": "transient",
|
|
17
|
-
"StartTime": 0,
|
|
18
|
-
"Parameters": {
|
|
19
|
-
"Frequency": 90,
|
|
20
|
-
"Intensity": 40
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"MetaData": {
|
|
3
|
+
"Create": "2024-05-29",
|
|
4
|
+
"Description": "a haptic case",
|
|
5
|
+
"Version": 1.0,
|
|
6
|
+
"ChannelNumber": 1
|
|
7
|
+
},
|
|
8
|
+
"Channels": [
|
|
9
|
+
{
|
|
10
|
+
"Parameters": {
|
|
11
|
+
"Index": 0
|
|
12
|
+
},
|
|
13
|
+
"Pattern": [
|
|
14
|
+
{
|
|
15
|
+
"Event": {
|
|
16
|
+
"Type": "transient",
|
|
17
|
+
"StartTime": 0,
|
|
18
|
+
"Parameters": {
|
|
19
|
+
"Frequency": 90,
|
|
20
|
+
"Intensity": 40
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
28
|
}
|