@react-native-ohos/react-native-system-setting 1.8.0-rc.1 → 1.8.0-rc.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.
- package/harmony/react_native_system_setting/BuildProfile.ets +16 -16
- package/harmony/react_native_system_setting/oh-package.json5 +1 -1
- package/harmony/react_native_system_setting/src/main/ets/RNSystemSettingTurboModule.ts +19 -12
- package/harmony/react_native_system_setting.har +0 -0
- package/package.json +1 -1
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/.ts_checker_cache +0 -3265
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/.tsbuildinfo +0 -1
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/.tsbuildinfo.linter +0 -1
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/compileInfo.json +0 -1
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/Index.ets-2fddbfa85232e8c40c1136f190876ccc.msgpack +0 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/Logger.ts-8e34cf7fa6426785b8ad5585899ed6b1.msgpack +0 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/RNSystemSettingPackage.ts-30c76849c83af152019669e58dba3868.msgpack +0 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/RNSystemSettingTurboModule.ts-7a1b45b73925f478da2aa3d03fb615f7.msgpack +0 -1140
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/ReactNativeSystemSetting.ts-8877d7ca6db401765ea2eea734a446fa.msgpack +0 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/index.ets-bee9eb0a0c5d135a91e741ea4b9a65c8.msgpack +0 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/ts.ts-3cbe49cf5f58ba5b139d5dfafe202b93.msgpack +0 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/ts.ts-4dbe8955872e62aac8fffa74b038b1db.msgpack +0 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/ts.ts-9f780c638fd01ebe14b69a7714c4c148.msgpack +0 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/modules/ts.ts-b18f20d502073e5ca84a0eac4a01ef96.msgpack +0 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/other/pkgName2SourceRoots.msgpack +0 -1
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/compiler.cache/plugins/plugins.msgpack +0 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/debug/dep_info.json +0 -1
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/BuildProfile.ets +0 -17
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/Index.ets +0 -27
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/ResourceTable.txt +0 -1
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/build-profile.json5 +0 -31
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/consumer-rules.txt +0 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/hvigorfile.ts +0 -6
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/obfuscation-rules.txt +0 -18
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/oh-package-lock.json5 +0 -19
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/oh-package.json5 +0 -1
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/cpp/CMakeLists.txt +0 -7
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/cpp/RNSystemSettingPackage.h +0 -76
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/cpp/ReactNativeSystemSetting.cpp +0 -54
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/cpp/ReactNativeSystemSetting.h +0 -21
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/Logger.ts +0 -64
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/RNSystemSettingPackage.ts +0 -52
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/RNSystemSettingTurboModule.ts +0 -362
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/generated/components/ts.ts +0 -5
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/generated/index.ets +0 -8
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/generated/ts.ts +0 -9
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/generated/turboModules/ReactNativeSystemSetting.ts +0 -86
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/generated/turboModules/ts.ts +0 -8
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/module.json +0 -28
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/resources/base/element/string.json +0 -8
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/resources/en_US/element/string.json +0 -8
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/resources/zh_CN/element/string.json +0 -8
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/ts.ts +0 -25
- package/harmony/react_native_system_setting/build/default/generated/pm/default/oh-package.json5 +0 -1
- package/harmony/react_native_system_setting/build/default/generated/r/default/ResourceTable.h +0 -24
- package/harmony/react_native_system_setting/build/default/intermediates/loader/default/loader.json +0 -30
- package/harmony/react_native_system_setting/build/default/intermediates/merge_profile/default/module.json +0 -25
- package/harmony/react_native_system_setting/build/default/intermediates/patch/default/base_native_libs.json +0 -1
- package/harmony/react_native_system_setting/build/default/intermediates/process_profile/default/module.json +0 -28
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/ResourceTable.txt +0 -1
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/ark_module.json +0 -1
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/ids_map/id_defined.json +0 -7
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/module.json +0 -26
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/opt-compression.json +0 -1
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/resConfig.json +0 -1
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/resources/rawfile/rnoh.profdata +0 -0
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/resources.index +0 -0
- package/harmony/react_native_system_setting/build/default/outputs/default/react_native_system_setting.har +0 -0
- package/harmony/react_native_system_setting/oh-package-lock.json5 +0 -19
|
@@ -1,1139 +0,0 @@
|
|
|
1
|
-
�r@��assertions�code�customTransformCache�dependencies�id�meta�moduleSideEffects�originalCode�originalSourcemap�resolvedIds�sourcemapChain�syntheticNamedExports�transformDependencies�transformFiles�cacheAst�rA��1�/*
|
|
2
|
-
* MIT License
|
|
3
|
-
*
|
|
4
|
-
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
import { TurboModule } from '@rnoh/react-native-openharmony/ts';
|
|
25
|
-
import window from '@ohos.window';
|
|
26
|
-
import access from "@ohos.bluetooth.access";
|
|
27
|
-
import audio from "@ohos.multimedia.audio";
|
|
28
|
-
import wifiManager from '@ohos.wifiManager';
|
|
29
|
-
import geoLocationManager from '@ohos.geoLocationManager';
|
|
30
|
-
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
|
31
|
-
export class RNSystemSettingTurboModule extends TurboModule {
|
|
32
|
-
constructor(ctx) {
|
|
33
|
-
super(ctx);
|
|
34
|
-
this.ctx = ctx;
|
|
35
|
-
this._windowClass = undefined;
|
|
36
|
-
this._context = undefined;
|
|
37
|
-
this.setWindowClass();
|
|
38
|
-
this.reqBluetoothPermissions();
|
|
39
|
-
}
|
|
40
|
-
async reqBluetoothPermissions() {
|
|
41
|
-
const permissions = ['ohos.permission.ACCESS_BLUETOOTH'];
|
|
42
|
-
let atManager = abilityAccessCtrl.createAtManager();
|
|
43
|
-
atManager.requestPermissionsFromUser(this.ctx.uiAbilityContext, permissions).catch((err) => {
|
|
44
|
-
console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);
|
|
45
|
-
});
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
async setWindowClass() {
|
|
49
|
-
let context = this.ctx.uiAbilityContext;
|
|
50
|
-
let promise = await window.getLastWindow(context);
|
|
51
|
-
this._windowClass = promise;
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
startSettingsAppInfoAbilityExplicit(action, complete) {
|
|
55
|
-
let context = this.ctx.uiAbilityContext;
|
|
56
|
-
let want = {
|
|
57
|
-
bundleName: 'com.huawei.hmos.settings',
|
|
58
|
-
abilityName: 'com.huawei.hmos.settings.MainAbility',
|
|
59
|
-
action: 'action.settings',
|
|
60
|
-
uri: action
|
|
61
|
-
};
|
|
62
|
-
context.startAbility(want)
|
|
63
|
-
.then(() => {
|
|
64
|
-
let applicationContext = context.getApplicationContext();
|
|
65
|
-
let callback = {
|
|
66
|
-
onWindowStageCreate: (ability, windowStage) => {
|
|
67
|
-
},
|
|
68
|
-
onWindowStageActive: (ability, windowStage) => {
|
|
69
|
-
},
|
|
70
|
-
onWindowStageInactive: (ability, windowStage) => {
|
|
71
|
-
},
|
|
72
|
-
onWindowStageDestroy: (ability, windowStage) => {
|
|
73
|
-
},
|
|
74
|
-
onAbilityDestroy: (ability) => {
|
|
75
|
-
applicationContext.off('abilityLifecycle', lis);
|
|
76
|
-
},
|
|
77
|
-
onAbilityForeground: (ability) => {
|
|
78
|
-
console.log('111');
|
|
79
|
-
if (complete) {
|
|
80
|
-
complete();
|
|
81
|
-
}
|
|
82
|
-
console.log('222');
|
|
83
|
-
applicationContext.off('abilityLifecycle', lis);
|
|
84
|
-
},
|
|
85
|
-
onAbilityBackground: (ability) => {
|
|
86
|
-
},
|
|
87
|
-
onAbilityContinue: (ability) => {
|
|
88
|
-
},
|
|
89
|
-
onAbilityCreate: (ability) => {
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
const lis = applicationContext.on('abilityLifecycle', callback);
|
|
93
|
-
})
|
|
94
|
-
.catch((err) => {
|
|
95
|
-
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
getBrightness() {
|
|
99
|
-
// 待实现
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
setBrightness(val) {
|
|
103
|
-
// 待实现
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
setBrightnessForce(val) {
|
|
107
|
-
// 无需实现
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
getAppBrightness() {
|
|
111
|
-
let properties = this._windowClass.getWindowProperties();
|
|
112
|
-
if (properties.brightness === -1) {
|
|
113
|
-
return Promise.resolve(properties.brightness);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
return Promise.resolve(Math.round(255 * properties.brightness));
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
setAppBrightness(val) {
|
|
120
|
-
if (val === -1) {
|
|
121
|
-
this._windowClass.setWindowBrightness(val)
|
|
122
|
-
.then(() => {
|
|
123
|
-
return Promise.resolve(true);
|
|
124
|
-
})
|
|
125
|
-
.catch(() => {
|
|
126
|
-
return Promise.resolve(false);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
const value = val / 255;
|
|
131
|
-
this._windowClass.setWindowBrightness(Math.round(value * 1000) / 1000)
|
|
132
|
-
.then(() => {
|
|
133
|
-
return Promise.resolve(true);
|
|
134
|
-
})
|
|
135
|
-
.catch(() => {
|
|
136
|
-
return Promise.resolve(false);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
return Promise.resolve(false);
|
|
140
|
-
}
|
|
141
|
-
grantWriteSettingPremission() {
|
|
142
|
-
// 待实现
|
|
143
|
-
}
|
|
144
|
-
getScreenMode() {
|
|
145
|
-
// 待实现
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
setScreenMode(val) {
|
|
149
|
-
this.startSettingsAppInfoAbilityExplicit('display_settings');
|
|
150
|
-
return Promise.resolve(true);
|
|
151
|
-
}
|
|
152
|
-
saveBrightness() {
|
|
153
|
-
// js层实现
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
restoreBrightness() {
|
|
157
|
-
// js层实现
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
getVolume(type) {
|
|
161
|
-
let groupid = audio.DEFAULT_VOLUME_GROUP_ID;
|
|
162
|
-
let audioManager = audio.getAudioManager();
|
|
163
|
-
let audioVolumeManager = audioManager.getVolumeManager();
|
|
164
|
-
let audioVolumeGroupManager;
|
|
165
|
-
const getVolumeGroupManager = async () => {
|
|
166
|
-
audioVolumeGroupManager = await audioVolumeManager.getVolumeGroupManager(groupid);
|
|
167
|
-
let promise;
|
|
168
|
-
if (type === 'music' || type === 'system') {
|
|
169
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.MEDIA);
|
|
170
|
-
}
|
|
171
|
-
else if (type === 'ring' || type === 'notification') {
|
|
172
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.RINGTONE);
|
|
173
|
-
}
|
|
174
|
-
else if (type === 'call') {
|
|
175
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.VOICE_CALL);
|
|
176
|
-
}
|
|
177
|
-
else if (type === 'alarm') {
|
|
178
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.ALARM);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
promise = Promise.reject('Argument must be one of "music,system,ring,notification,call,alarm"');
|
|
182
|
-
}
|
|
183
|
-
return promise;
|
|
184
|
-
};
|
|
185
|
-
return getVolumeGroupManager();
|
|
186
|
-
}
|
|
187
|
-
setVolume(value, config) {
|
|
188
|
-
// 待实现
|
|
189
|
-
}
|
|
190
|
-
addVolumeListener() {
|
|
191
|
-
let audioManager = audio.getAudioManager();
|
|
192
|
-
let audioVolumeManager = audioManager.getVolumeManager();
|
|
193
|
-
audioVolumeManager.on('volumeChange', (volumeEvent) => {
|
|
194
|
-
if (volumeEvent.volumeType === audio.AudioVolumeType.MEDIA) {
|
|
195
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
196
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
197
|
-
system: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
198
|
-
music: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
else if (volumeEvent.volumeType === audio.AudioVolumeType.RINGTONE) {
|
|
202
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
203
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
204
|
-
ring: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
205
|
-
notification: Math.round(volumeEvent.volume / 15 * 100) / 100
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
else if (volumeEvent.volumeType === audio.AudioVolumeType.VOICE_CALL) {
|
|
209
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
210
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
211
|
-
call: Math.round(volumeEvent.volume / 15 * 100) / 100
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
else if (volumeEvent.volumeType === audio.AudioVolumeType.ALARM) {
|
|
215
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
216
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
217
|
-
alarm: Math.round(volumeEvent.volume / 15 * 100) / 100
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
removeVolumeListener(listener) {
|
|
223
|
-
let audioManager = audio.getAudioManager();
|
|
224
|
-
let audioVolumeManager = audioManager.getVolumeManager();
|
|
225
|
-
audioVolumeManager.on('volumeChange', (volumeEvent) => {
|
|
226
|
-
// 暂未支持该接口
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
isWifiEnabled() {
|
|
230
|
-
try {
|
|
231
|
-
let isWifiActive = wifiManager.isWifiActive();
|
|
232
|
-
return Promise.resolve(isWifiActive);
|
|
233
|
-
}
|
|
234
|
-
catch (error) {
|
|
235
|
-
console.error("failed:" + JSON.stringify(error));
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
switchWifiSilence(onComplete) {
|
|
239
|
-
// 待实现
|
|
240
|
-
}
|
|
241
|
-
switchWifi(onComplete) {
|
|
242
|
-
if (onComplete) {
|
|
243
|
-
this.startSettingsAppInfoAbilityExplicit('wifi_entry', onComplete);
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
this.startSettingsAppInfoAbilityExplicit('wifi_entry');
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
isLocationEnabled() {
|
|
250
|
-
let locationEnabled = geoLocationManager.isLocationEnabled();
|
|
251
|
-
return Promise.resolve(locationEnabled);
|
|
252
|
-
}
|
|
253
|
-
getLocationMode() {
|
|
254
|
-
throw new Error('Method not implemented.');
|
|
255
|
-
}
|
|
256
|
-
switchLocation(onComplete) {
|
|
257
|
-
if (onComplete) {
|
|
258
|
-
this.startSettingsAppInfoAbilityExplicit('location_manager_settings', onComplete);
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
this.startSettingsAppInfoAbilityExplicit('location_manager_settings');
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
isBluetoothEnabled() {
|
|
265
|
-
try {
|
|
266
|
-
return Promise.resolve(access.getState() === 0 ? false : true);
|
|
267
|
-
}
|
|
268
|
-
catch (exception) {
|
|
269
|
-
return Promise.reject('Failed to get bluetooth enabled. Cause: ' + JSON.stringify(exception));
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
switchBluetooth(onComplete) {
|
|
273
|
-
if (onComplete) {
|
|
274
|
-
this.startSettingsAppInfoAbilityExplicit('bluetooth_entry', onComplete);
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
this.startSettingsAppInfoAbilityExplicit('bluetooth_entry');
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
switchBluetoothSilence(onComplete) {
|
|
281
|
-
const bluetoothState = access.getState();
|
|
282
|
-
if (bluetoothState === 0 || bluetoothState === 3) {
|
|
283
|
-
access.enableBluetooth();
|
|
284
|
-
}
|
|
285
|
-
else if (bluetoothState === 2 || bluetoothState === 1) {
|
|
286
|
-
access.disableBluetooth();
|
|
287
|
-
}
|
|
288
|
-
if (onComplete) {
|
|
289
|
-
onComplete();
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
isAirplaneEnabled() {
|
|
293
|
-
throw new Error('Method not implemented.');
|
|
294
|
-
}
|
|
295
|
-
switchAirplane(onComplete) {
|
|
296
|
-
if (onComplete) {
|
|
297
|
-
this.startSettingsAppInfoAbilityExplicit('mobile_network_entry', onComplete);
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
this.startSettingsAppInfoAbilityExplicit('mobile_network_entry');
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
openAppSystemSettings() {
|
|
304
|
-
this.startSettingsAppInfoAbilityExplicit('application_info_entry');
|
|
305
|
-
}
|
|
306
|
-
addBluetoothListener() {
|
|
307
|
-
access.on('stateChange', e => {
|
|
308
|
-
if (e === 0) {
|
|
309
|
-
this.ctx.rnInstance.emitDeviceEvent("EventBluetooth", false);
|
|
310
|
-
}
|
|
311
|
-
else if (e === 2) {
|
|
312
|
-
this.ctx.rnInstance.emitDeviceEvent("EventBluetooth", true);
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
addWifiListener(callback) {
|
|
317
|
-
throw new Error('Method not implemented.');
|
|
318
|
-
}
|
|
319
|
-
addLocationListener(callback) {
|
|
320
|
-
throw new Error('Method not implemented.');
|
|
321
|
-
}
|
|
322
|
-
addLocationModeListener(callback) {
|
|
323
|
-
throw new Error('Method not implemented.');
|
|
324
|
-
}
|
|
325
|
-
addAirplaneListener(callback) {
|
|
326
|
-
throw new Error('Method not implemented.');
|
|
327
|
-
}
|
|
328
|
-
removeListener(type) {
|
|
329
|
-
if (type === 'bluetooth') {
|
|
330
|
-
access.off('stateChange');
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
addListener(eventName) { }
|
|
334
|
-
removeListeners(count) { }
|
|
335
|
-
}
|
|
336
|
-
//# sourceMappingURL=RNSystemSettingTurboModule.js.map�!@rnoh/react-native-openharmony/ts�`hvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.window.d.ts�jhvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.bluetooth.access.d.ts�jhvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.multimedia.audio.d.ts�ehvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.wifiManager.d.ts�lhvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.geoLocationManager.d.ts�khvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.abilityAccessCtrl.d.ts�D:\77republish\rntpc_react-native-system-setting\harmony\react_native_system_setting\src\main\ets\RNSystemSettingTurboModule.ts�rB��moduleName�isLocalDependency�isNodeEntryFile�pkgPath�belongProjectPath�pkgName�pkgVersion�dependencyPkgInfo�belongModulePath�shouldEmitJs�hostModulesInfo�react_native_system_setting���TD:\77republish\rntpc_react-native-system-setting\harmony\react_native_system_setting�8D:\77republish\rntpc_react-native-system-setting\harmony�.@react-native-ohos/react-native-system-setting�1.8.0-rc.1��TD:\77republish\rntpc_react-native-system-setting\harmony\react_native_system_setting�rC��hostDependencyName�hostModuleName�./RNSystemSettingTurboModule�react_native_system_settingC�)./src/main/ets/RNSystemSettingTurboModule�react_native_system_setting��2�/*
|
|
337
|
-
* MIT License
|
|
338
|
-
*
|
|
339
|
-
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
340
|
-
*
|
|
341
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
342
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
343
|
-
* in the Software without restriction, including without limitation the rights
|
|
344
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
345
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
346
|
-
* furnished to do so, subject to the following conditions:
|
|
347
|
-
*
|
|
348
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
349
|
-
* copies or substantial portions of the Software.
|
|
350
|
-
*
|
|
351
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
352
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
353
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
354
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
355
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
356
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
357
|
-
* SOFTWARE.
|
|
358
|
-
*/
|
|
359
|
-
|
|
360
|
-
import { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
361
|
-
import { TM } from "./generated/ts"
|
|
362
|
-
import window from '@ohos.window';
|
|
363
|
-
import { access } from '@kit.ConnectivityKit';
|
|
364
|
-
import { AbilityLifecycleCallback, common, UIAbility, Want } from '@kit.AbilityKit';
|
|
365
|
-
import { BusinessError } from '@kit.BasicServicesKit';
|
|
366
|
-
import { audio } from '@kit.AudioKit';
|
|
367
|
-
import wifiManager from '@ohos.wifiManager';
|
|
368
|
-
import geoLocationManager from '@ohos.geoLocationManager';
|
|
369
|
-
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
|
370
|
-
|
|
371
|
-
export class RNSystemSettingTurboModule extends TurboModule implements TM.ReactNativeSystemSetting.Spec {
|
|
372
|
-
constructor(protected ctx: TurboModuleContext) {
|
|
373
|
-
super(ctx)
|
|
374
|
-
this.setWindowClass()
|
|
375
|
-
this.reqBluetoothPermissions()
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
private _windowClass: window.Window | undefined = undefined
|
|
379
|
-
private _context: window.Window | undefined = undefined
|
|
380
|
-
|
|
381
|
-
private async reqBluetoothPermissions(): Promise<void> {
|
|
382
|
-
const permissions: Array<Permissions> = ['ohos.permission.ACCESS_BLUETOOTH'];
|
|
383
|
-
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
|
|
384
|
-
atManager.requestPermissionsFromUser(this.ctx.uiAbilityContext, permissions).catch((err: BusinessError) => {
|
|
385
|
-
console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);
|
|
386
|
-
})
|
|
387
|
-
return
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
private async setWindowClass(): Promise<void> {
|
|
391
|
-
let context = this.ctx.uiAbilityContext;
|
|
392
|
-
let promise = await window.getLastWindow(context);
|
|
393
|
-
this._windowClass = promise
|
|
394
|
-
return
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
private startSettingsAppInfoAbilityExplicit(action: string, complete?: () => void) {
|
|
398
|
-
let context = this.ctx.uiAbilityContext;
|
|
399
|
-
let want: Want = {
|
|
400
|
-
bundleName: 'com.huawei.hmos.settings',
|
|
401
|
-
abilityName: 'com.huawei.hmos.settings.MainAbility',
|
|
402
|
-
action: 'action.settings',
|
|
403
|
-
uri: action
|
|
404
|
-
};
|
|
405
|
-
context.startAbility(want)
|
|
406
|
-
.then(() => {
|
|
407
|
-
let applicationContext = context.getApplicationContext();
|
|
408
|
-
let callback: AbilityLifecycleCallback = {
|
|
409
|
-
onWindowStageCreate: (ability: UIAbility, windowStage: window.WindowStage): void => {
|
|
410
|
-
},
|
|
411
|
-
onWindowStageActive: (ability: UIAbility, windowStage: window.WindowStage): void => {
|
|
412
|
-
},
|
|
413
|
-
onWindowStageInactive: (ability: UIAbility, windowStage: window.WindowStage): void => {
|
|
414
|
-
},
|
|
415
|
-
onWindowStageDestroy: (ability: UIAbility, windowStage: window.WindowStage): void => {
|
|
416
|
-
},
|
|
417
|
-
onAbilityDestroy: (ability: UIAbility): void => {
|
|
418
|
-
applicationContext.off('abilityLifecycle', lis)
|
|
419
|
-
},
|
|
420
|
-
onAbilityForeground: (ability: UIAbility): void => {
|
|
421
|
-
console.log('111')
|
|
422
|
-
if (complete) {
|
|
423
|
-
complete()
|
|
424
|
-
}
|
|
425
|
-
console.log('222')
|
|
426
|
-
applicationContext.off('abilityLifecycle', lis)
|
|
427
|
-
},
|
|
428
|
-
onAbilityBackground: (ability: UIAbility): void => {
|
|
429
|
-
},
|
|
430
|
-
onAbilityContinue: (ability: UIAbility): void => {
|
|
431
|
-
},
|
|
432
|
-
onAbilityCreate: (ability: UIAbility): void => {
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
const lis = applicationContext.on('abilityLifecycle', callback)
|
|
436
|
-
})
|
|
437
|
-
.catch((err: BusinessError) => {
|
|
438
|
-
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
getBrightness(): Promise<number> {
|
|
443
|
-
// 待实现
|
|
444
|
-
return
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
setBrightness(val: number): Promise<boolean> {
|
|
448
|
-
// 待实现
|
|
449
|
-
return
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
setBrightnessForce(val: number): Promise<boolean> {
|
|
453
|
-
// 无需实现
|
|
454
|
-
return
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
getAppBrightness(): Promise<number> {
|
|
458
|
-
let properties = this._windowClass.getWindowProperties();
|
|
459
|
-
if (properties.brightness === -1) {
|
|
460
|
-
return Promise.resolve(properties.brightness)
|
|
461
|
-
} else {
|
|
462
|
-
return Promise.resolve(Math.round(255 * properties.brightness))
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
setAppBrightness(val: number): Promise<boolean> {
|
|
467
|
-
if (val === -1) {
|
|
468
|
-
this._windowClass.setWindowBrightness(val)
|
|
469
|
-
.then(() => {
|
|
470
|
-
return Promise.resolve(true)
|
|
471
|
-
})
|
|
472
|
-
.catch(() => {
|
|
473
|
-
return Promise.resolve(false)
|
|
474
|
-
})
|
|
475
|
-
} else {
|
|
476
|
-
const value = val / 255
|
|
477
|
-
this._windowClass.setWindowBrightness(Math.round(value * 1000) / 1000)
|
|
478
|
-
.then(() => {
|
|
479
|
-
return Promise.resolve(true)
|
|
480
|
-
})
|
|
481
|
-
.catch(() => {
|
|
482
|
-
return Promise.resolve(false)
|
|
483
|
-
})
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
return Promise.resolve(false)
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
grantWriteSettingPremission(): void {
|
|
490
|
-
// 待实现
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
getScreenMode(): Promise<number> {
|
|
494
|
-
// 待实现
|
|
495
|
-
return
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
setScreenMode(val: number): Promise<boolean> {
|
|
499
|
-
this.startSettingsAppInfoAbilityExplicit('display_settings')
|
|
500
|
-
return Promise.resolve(true)
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
saveBrightness(): Promise<void> {
|
|
504
|
-
// js层实现
|
|
505
|
-
return
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
restoreBrightness(): number {
|
|
509
|
-
// js层实现
|
|
510
|
-
return
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
getVolume(type: string): Promise<number> {
|
|
514
|
-
let groupid = audio.DEFAULT_VOLUME_GROUP_ID;
|
|
515
|
-
let audioManager = audio.getAudioManager();
|
|
516
|
-
let audioVolumeManager = audioManager.getVolumeManager();
|
|
517
|
-
let audioVolumeGroupManager: audio.AudioVolumeGroupManager;
|
|
518
|
-
const getVolumeGroupManager = async () => {
|
|
519
|
-
audioVolumeGroupManager = await audioVolumeManager.getVolumeGroupManager(groupid);
|
|
520
|
-
let promise
|
|
521
|
-
if (type === 'music' || type === 'system') {
|
|
522
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.MEDIA)
|
|
523
|
-
} else if (type === 'ring' || type === 'notification') {
|
|
524
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.RINGTONE);
|
|
525
|
-
} else if (type === 'call') {
|
|
526
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.VOICE_CALL)
|
|
527
|
-
} else if (type === 'alarm') {
|
|
528
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.ALARM)
|
|
529
|
-
} else {
|
|
530
|
-
promise = Promise.reject('Argument must be one of "music,system,ring,notification,call,alarm"')
|
|
531
|
-
}
|
|
532
|
-
return promise
|
|
533
|
-
}
|
|
534
|
-
return getVolumeGroupManager();
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
setVolume(value: number, config: Object): void {
|
|
538
|
-
// 待实现
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
addVolumeListener(): void {
|
|
542
|
-
let audioManager = audio.getAudioManager();
|
|
543
|
-
let audioVolumeManager = audioManager.getVolumeManager();
|
|
544
|
-
audioVolumeManager.on('volumeChange', (volumeEvent: audio.VolumeEvent) => {
|
|
545
|
-
if (volumeEvent.volumeType === audio.AudioVolumeType.MEDIA) {
|
|
546
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
547
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
548
|
-
system: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
549
|
-
music: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
550
|
-
})
|
|
551
|
-
} else if (volumeEvent.volumeType === audio.AudioVolumeType.RINGTONE) {
|
|
552
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
553
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
554
|
-
ring: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
555
|
-
notification: Math.round(volumeEvent.volume / 15 * 100) / 100
|
|
556
|
-
})
|
|
557
|
-
} else if (volumeEvent.volumeType === audio.AudioVolumeType.VOICE_CALL) {
|
|
558
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
559
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
560
|
-
call: Math.round(volumeEvent.volume / 15 * 100) / 100
|
|
561
|
-
})
|
|
562
|
-
} else if (volumeEvent.volumeType === audio.AudioVolumeType.ALARM) {
|
|
563
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
564
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
565
|
-
alarm: Math.round(volumeEvent.volume / 15 * 100) / 100
|
|
566
|
-
})
|
|
567
|
-
}
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
removeVolumeListener(listener: TM.ReactNativeSystemSetting.EmitterSubscription): void {
|
|
572
|
-
let audioManager = audio.getAudioManager();
|
|
573
|
-
let audioVolumeManager = audioManager.getVolumeManager();
|
|
574
|
-
audioVolumeManager.on('volumeChange', (volumeEvent: audio.VolumeEvent) => {
|
|
575
|
-
// 暂未支持该接口
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
isWifiEnabled(): Promise<boolean> {
|
|
580
|
-
try {
|
|
581
|
-
let isWifiActive = wifiManager.isWifiActive();
|
|
582
|
-
return Promise.resolve(isWifiActive)
|
|
583
|
-
} catch (error) {
|
|
584
|
-
console.error("failed:" + JSON.stringify(error));
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
switchWifiSilence(onComplete: () => void): void {
|
|
590
|
-
// 待实现
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
switchWifi(onComplete: () => void): void {
|
|
594
|
-
if (onComplete) {
|
|
595
|
-
this.startSettingsAppInfoAbilityExplicit('wifi_entry', onComplete)
|
|
596
|
-
} else {
|
|
597
|
-
this.startSettingsAppInfoAbilityExplicit('wifi_entry')
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
isLocationEnabled(): Promise<boolean> {
|
|
602
|
-
let locationEnabled = geoLocationManager.isLocationEnabled();
|
|
603
|
-
return Promise.resolve(locationEnabled)
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
getLocationMode(): Promise<number> {
|
|
607
|
-
throw new Error('Method not implemented.');
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
switchLocation(onComplete: () => void): void {
|
|
611
|
-
if (onComplete) {
|
|
612
|
-
this.startSettingsAppInfoAbilityExplicit('location_manager_settings', onComplete)
|
|
613
|
-
} else {
|
|
614
|
-
this.startSettingsAppInfoAbilityExplicit('location_manager_settings')
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
isBluetoothEnabled(): Promise<boolean> {
|
|
619
|
-
try {
|
|
620
|
-
return Promise.resolve<boolean>(access.getState() === 0 ? false : true)
|
|
621
|
-
} catch (exception) {
|
|
622
|
-
return Promise.reject('Failed to get bluetooth enabled. Cause: ' + JSON.stringify(exception))
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
switchBluetooth(onComplete?: () => void): void {
|
|
627
|
-
if (onComplete) {
|
|
628
|
-
this.startSettingsAppInfoAbilityExplicit('bluetooth_entry', onComplete)
|
|
629
|
-
} else {
|
|
630
|
-
this.startSettingsAppInfoAbilityExplicit('bluetooth_entry')
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
switchBluetoothSilence(onComplete?: () => void): void {
|
|
635
|
-
const bluetoothState = access.getState()
|
|
636
|
-
if (bluetoothState === 0 || bluetoothState === 3) {
|
|
637
|
-
access.enableBluetooth()
|
|
638
|
-
} else if (bluetoothState === 2 || bluetoothState === 1) {
|
|
639
|
-
access.disableBluetooth()
|
|
640
|
-
}
|
|
641
|
-
if (onComplete) {
|
|
642
|
-
onComplete()
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
isAirplaneEnabled(): Promise<boolean> {
|
|
647
|
-
throw new Error('Method not implemented.');
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
switchAirplane(onComplete: () => void): void {
|
|
651
|
-
if (onComplete) {
|
|
652
|
-
this.startSettingsAppInfoAbilityExplicit('mobile_network_entry', onComplete);
|
|
653
|
-
} else {
|
|
654
|
-
this.startSettingsAppInfoAbilityExplicit('mobile_network_entry');
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
openAppSystemSettings(): void {
|
|
659
|
-
this.startSettingsAppInfoAbilityExplicit('application_info_entry');
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
addBluetoothListener(): void {
|
|
663
|
-
access.on('stateChange', e => {
|
|
664
|
-
if (e === 0) {
|
|
665
|
-
this.ctx.rnInstance.emitDeviceEvent("EventBluetooth", false);
|
|
666
|
-
} else if (e === 2) {
|
|
667
|
-
this.ctx.rnInstance.emitDeviceEvent("EventBluetooth", true);
|
|
668
|
-
}
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
addWifiListener(callback: (wifiEnabled: boolean) => void): Promise<TM.ReactNativeSystemSetting.EmitterSubscription | null> {
|
|
673
|
-
throw new Error('Method not implemented.');
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
addLocationListener(callback: (locationEnabled: boolean) => void): Promise<TM.ReactNativeSystemSetting.EmitterSubscription | null> {
|
|
677
|
-
throw new Error('Method not implemented.');
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
addLocationModeListener(callback: (locationMode: number) => void): Promise<TM.ReactNativeSystemSetting.EmitterSubscription | null> {
|
|
681
|
-
throw new Error('Method not implemented.');
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
addAirplaneListener(callback: (airplaneModeEnabled: boolean) => void): Promise<TM.ReactNativeSystemSetting.EmitterSubscription | null> {
|
|
685
|
-
throw new Error('Method not implemented.');
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
removeListener(type): void {
|
|
689
|
-
if (type === 'bluetooth') {
|
|
690
|
-
access.off('stateChange');
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
addListener(eventName: string): void {}
|
|
695
|
-
|
|
696
|
-
removeListeners(count: number): void {}
|
|
697
|
-
}�rD��version�mappings�names�sources�sourcesContent�P������������������������������������� ��!��#��$���������-
|
|
698
|
-
��.��/��0��1��2����6
|
|
699
|
-
��7���9�����>��?���@���A���B���C����E����G���H���I
|
|
700
|
-
����K
|
|
701
|
-
����M
|
|
702
|
-
����O
|
|
703
|
-
����Q
|
|
704
|
-
���R����T
|
|
705
|
-
���U���V���W���X
|
|
706
|
-
����^
|
|
707
|
-
����`
|
|
708
|
-
������d���e���f���g��������o������t��������{����}���}���~������̂��̃��̄���̆
|
|
709
|
-
��̇���̉
|
|
710
|
-
��̊��̋��̋��̌��̍���̏
|
|
711
|
-
��̐���̒
|
|
712
|
-
��̓��̔��̖����������̢��̣��̤�����������̱��̲��̳��̴��̵��̶���̸��̹���̻��̻
|
|
713
|
-
����
|
|
714
|
-
����
|
|
715
|
-
���� ����������
|
|
716
|
-
����
|
|
717
|
-
����
|
|
718
|
-
���� ����������
|
|
719
|
-
����
|
|
720
|
-
���� ����������
|
|
721
|
-
����
|
|
722
|
-
���� ���������������������������������������������������������������������������������������
|
|
723
|
-
����������������������������������������������������"���#���$���%���%���&���'����*���+���,����.���.����0���1���2���3�����7����:���;���<���=���=���>���?�����C�����G�����J�����L���M����P���Q����T���U����X���Y����\���]����`����b���c������i����D:\77republish\rntpc_react-native-system-setting\harmony\react_native_system_setting\src\main\ets\RNSystemSettingTurboModule.ts��2�/*
|
|
724
|
-
* MIT License
|
|
725
|
-
*
|
|
726
|
-
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
727
|
-
*
|
|
728
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
729
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
730
|
-
* in the Software without restriction, including without limitation the rights
|
|
731
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
732
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
733
|
-
* furnished to do so, subject to the following conditions:
|
|
734
|
-
*
|
|
735
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
736
|
-
* copies or substantial portions of the Software.
|
|
737
|
-
*
|
|
738
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
739
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
740
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
741
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
742
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
743
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
744
|
-
* SOFTWARE.
|
|
745
|
-
*/
|
|
746
|
-
|
|
747
|
-
import { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
748
|
-
import { TM } from "./generated/ts"
|
|
749
|
-
import window from '@ohos.window';
|
|
750
|
-
import { access } from '@kit.ConnectivityKit';
|
|
751
|
-
import { AbilityLifecycleCallback, common, UIAbility, Want } from '@kit.AbilityKit';
|
|
752
|
-
import { BusinessError } from '@kit.BasicServicesKit';
|
|
753
|
-
import { audio } from '@kit.AudioKit';
|
|
754
|
-
import wifiManager from '@ohos.wifiManager';
|
|
755
|
-
import geoLocationManager from '@ohos.geoLocationManager';
|
|
756
|
-
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
|
757
|
-
|
|
758
|
-
export class RNSystemSettingTurboModule extends TurboModule implements TM.ReactNativeSystemSetting.Spec {
|
|
759
|
-
constructor(protected ctx: TurboModuleContext) {
|
|
760
|
-
super(ctx)
|
|
761
|
-
this.setWindowClass()
|
|
762
|
-
this.reqBluetoothPermissions()
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
private _windowClass: window.Window | undefined = undefined
|
|
766
|
-
private _context: window.Window | undefined = undefined
|
|
767
|
-
|
|
768
|
-
private async reqBluetoothPermissions(): Promise<void> {
|
|
769
|
-
const permissions: Array<Permissions> = ['ohos.permission.ACCESS_BLUETOOTH'];
|
|
770
|
-
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
|
|
771
|
-
atManager.requestPermissionsFromUser(this.ctx.uiAbilityContext, permissions).catch((err: BusinessError) => {
|
|
772
|
-
console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);
|
|
773
|
-
})
|
|
774
|
-
return
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
private async setWindowClass(): Promise<void> {
|
|
778
|
-
let context = this.ctx.uiAbilityContext;
|
|
779
|
-
let promise = await window.getLastWindow(context);
|
|
780
|
-
this._windowClass = promise
|
|
781
|
-
return
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
private startSettingsAppInfoAbilityExplicit(action: string, complete?: () => void) {
|
|
785
|
-
let context = this.ctx.uiAbilityContext;
|
|
786
|
-
let want: Want = {
|
|
787
|
-
bundleName: 'com.huawei.hmos.settings',
|
|
788
|
-
abilityName: 'com.huawei.hmos.settings.MainAbility',
|
|
789
|
-
action: 'action.settings',
|
|
790
|
-
uri: action
|
|
791
|
-
};
|
|
792
|
-
context.startAbility(want)
|
|
793
|
-
.then(() => {
|
|
794
|
-
let applicationContext = context.getApplicationContext();
|
|
795
|
-
let callback: AbilityLifecycleCallback = {
|
|
796
|
-
onWindowStageCreate: (ability: UIAbility, windowStage: window.WindowStage): void => {
|
|
797
|
-
},
|
|
798
|
-
onWindowStageActive: (ability: UIAbility, windowStage: window.WindowStage): void => {
|
|
799
|
-
},
|
|
800
|
-
onWindowStageInactive: (ability: UIAbility, windowStage: window.WindowStage): void => {
|
|
801
|
-
},
|
|
802
|
-
onWindowStageDestroy: (ability: UIAbility, windowStage: window.WindowStage): void => {
|
|
803
|
-
},
|
|
804
|
-
onAbilityDestroy: (ability: UIAbility): void => {
|
|
805
|
-
applicationContext.off('abilityLifecycle', lis)
|
|
806
|
-
},
|
|
807
|
-
onAbilityForeground: (ability: UIAbility): void => {
|
|
808
|
-
console.log('111')
|
|
809
|
-
if (complete) {
|
|
810
|
-
complete()
|
|
811
|
-
}
|
|
812
|
-
console.log('222')
|
|
813
|
-
applicationContext.off('abilityLifecycle', lis)
|
|
814
|
-
},
|
|
815
|
-
onAbilityBackground: (ability: UIAbility): void => {
|
|
816
|
-
},
|
|
817
|
-
onAbilityContinue: (ability: UIAbility): void => {
|
|
818
|
-
},
|
|
819
|
-
onAbilityCreate: (ability: UIAbility): void => {
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
const lis = applicationContext.on('abilityLifecycle', callback)
|
|
823
|
-
})
|
|
824
|
-
.catch((err: BusinessError) => {
|
|
825
|
-
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
getBrightness(): Promise<number> {
|
|
830
|
-
// 待实现
|
|
831
|
-
return
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
setBrightness(val: number): Promise<boolean> {
|
|
835
|
-
// 待实现
|
|
836
|
-
return
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
setBrightnessForce(val: number): Promise<boolean> {
|
|
840
|
-
// 无需实现
|
|
841
|
-
return
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
getAppBrightness(): Promise<number> {
|
|
845
|
-
let properties = this._windowClass.getWindowProperties();
|
|
846
|
-
if (properties.brightness === -1) {
|
|
847
|
-
return Promise.resolve(properties.brightness)
|
|
848
|
-
} else {
|
|
849
|
-
return Promise.resolve(Math.round(255 * properties.brightness))
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
setAppBrightness(val: number): Promise<boolean> {
|
|
854
|
-
if (val === -1) {
|
|
855
|
-
this._windowClass.setWindowBrightness(val)
|
|
856
|
-
.then(() => {
|
|
857
|
-
return Promise.resolve(true)
|
|
858
|
-
})
|
|
859
|
-
.catch(() => {
|
|
860
|
-
return Promise.resolve(false)
|
|
861
|
-
})
|
|
862
|
-
} else {
|
|
863
|
-
const value = val / 255
|
|
864
|
-
this._windowClass.setWindowBrightness(Math.round(value * 1000) / 1000)
|
|
865
|
-
.then(() => {
|
|
866
|
-
return Promise.resolve(true)
|
|
867
|
-
})
|
|
868
|
-
.catch(() => {
|
|
869
|
-
return Promise.resolve(false)
|
|
870
|
-
})
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
return Promise.resolve(false)
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
grantWriteSettingPremission(): void {
|
|
877
|
-
// 待实现
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
getScreenMode(): Promise<number> {
|
|
881
|
-
// 待实现
|
|
882
|
-
return
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
setScreenMode(val: number): Promise<boolean> {
|
|
886
|
-
this.startSettingsAppInfoAbilityExplicit('display_settings')
|
|
887
|
-
return Promise.resolve(true)
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
saveBrightness(): Promise<void> {
|
|
891
|
-
// js层实现
|
|
892
|
-
return
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
restoreBrightness(): number {
|
|
896
|
-
// js层实现
|
|
897
|
-
return
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
getVolume(type: string): Promise<number> {
|
|
901
|
-
let groupid = audio.DEFAULT_VOLUME_GROUP_ID;
|
|
902
|
-
let audioManager = audio.getAudioManager();
|
|
903
|
-
let audioVolumeManager = audioManager.getVolumeManager();
|
|
904
|
-
let audioVolumeGroupManager: audio.AudioVolumeGroupManager;
|
|
905
|
-
const getVolumeGroupManager = async () => {
|
|
906
|
-
audioVolumeGroupManager = await audioVolumeManager.getVolumeGroupManager(groupid);
|
|
907
|
-
let promise
|
|
908
|
-
if (type === 'music' || type === 'system') {
|
|
909
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.MEDIA)
|
|
910
|
-
} else if (type === 'ring' || type === 'notification') {
|
|
911
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.RINGTONE);
|
|
912
|
-
} else if (type === 'call') {
|
|
913
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.VOICE_CALL)
|
|
914
|
-
} else if (type === 'alarm') {
|
|
915
|
-
promise = audioVolumeGroupManager.getVolume(audio.AudioVolumeType.ALARM)
|
|
916
|
-
} else {
|
|
917
|
-
promise = Promise.reject('Argument must be one of "music,system,ring,notification,call,alarm"')
|
|
918
|
-
}
|
|
919
|
-
return promise
|
|
920
|
-
}
|
|
921
|
-
return getVolumeGroupManager();
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
setVolume(value: number, config: Object): void {
|
|
925
|
-
// 待实现
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
addVolumeListener(): void {
|
|
929
|
-
let audioManager = audio.getAudioManager();
|
|
930
|
-
let audioVolumeManager = audioManager.getVolumeManager();
|
|
931
|
-
audioVolumeManager.on('volumeChange', (volumeEvent: audio.VolumeEvent) => {
|
|
932
|
-
if (volumeEvent.volumeType === audio.AudioVolumeType.MEDIA) {
|
|
933
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
934
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
935
|
-
system: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
936
|
-
music: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
937
|
-
})
|
|
938
|
-
} else if (volumeEvent.volumeType === audio.AudioVolumeType.RINGTONE) {
|
|
939
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
940
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
941
|
-
ring: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
942
|
-
notification: Math.round(volumeEvent.volume / 15 * 100) / 100
|
|
943
|
-
})
|
|
944
|
-
} else if (volumeEvent.volumeType === audio.AudioVolumeType.VOICE_CALL) {
|
|
945
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
946
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
947
|
-
call: Math.round(volumeEvent.volume / 15 * 100) / 100
|
|
948
|
-
})
|
|
949
|
-
} else if (volumeEvent.volumeType === audio.AudioVolumeType.ALARM) {
|
|
950
|
-
this.ctx.rnInstance.emitDeviceEvent("EventVolume", {
|
|
951
|
-
value: Math.round(volumeEvent.volume / 15 * 100) / 100,
|
|
952
|
-
alarm: Math.round(volumeEvent.volume / 15 * 100) / 100
|
|
953
|
-
})
|
|
954
|
-
}
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
removeVolumeListener(listener: TM.ReactNativeSystemSetting.EmitterSubscription): void {
|
|
959
|
-
let audioManager = audio.getAudioManager();
|
|
960
|
-
let audioVolumeManager = audioManager.getVolumeManager();
|
|
961
|
-
audioVolumeManager.on('volumeChange', (volumeEvent: audio.VolumeEvent) => {
|
|
962
|
-
// 暂未支持该接口
|
|
963
|
-
});
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
isWifiEnabled(): Promise<boolean> {
|
|
967
|
-
try {
|
|
968
|
-
let isWifiActive = wifiManager.isWifiActive();
|
|
969
|
-
return Promise.resolve(isWifiActive)
|
|
970
|
-
} catch (error) {
|
|
971
|
-
console.error("failed:" + JSON.stringify(error));
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
switchWifiSilence(onComplete: () => void): void {
|
|
977
|
-
// 待实现
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
switchWifi(onComplete: () => void): void {
|
|
981
|
-
if (onComplete) {
|
|
982
|
-
this.startSettingsAppInfoAbilityExplicit('wifi_entry', onComplete)
|
|
983
|
-
} else {
|
|
984
|
-
this.startSettingsAppInfoAbilityExplicit('wifi_entry')
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
isLocationEnabled(): Promise<boolean> {
|
|
989
|
-
let locationEnabled = geoLocationManager.isLocationEnabled();
|
|
990
|
-
return Promise.resolve(locationEnabled)
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
getLocationMode(): Promise<number> {
|
|
994
|
-
throw new Error('Method not implemented.');
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
switchLocation(onComplete: () => void): void {
|
|
998
|
-
if (onComplete) {
|
|
999
|
-
this.startSettingsAppInfoAbilityExplicit('location_manager_settings', onComplete)
|
|
1000
|
-
} else {
|
|
1001
|
-
this.startSettingsAppInfoAbilityExplicit('location_manager_settings')
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
isBluetoothEnabled(): Promise<boolean> {
|
|
1006
|
-
try {
|
|
1007
|
-
return Promise.resolve<boolean>(access.getState() === 0 ? false : true)
|
|
1008
|
-
} catch (exception) {
|
|
1009
|
-
return Promise.reject('Failed to get bluetooth enabled. Cause: ' + JSON.stringify(exception))
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
switchBluetooth(onComplete?: () => void): void {
|
|
1014
|
-
if (onComplete) {
|
|
1015
|
-
this.startSettingsAppInfoAbilityExplicit('bluetooth_entry', onComplete)
|
|
1016
|
-
} else {
|
|
1017
|
-
this.startSettingsAppInfoAbilityExplicit('bluetooth_entry')
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
switchBluetoothSilence(onComplete?: () => void): void {
|
|
1022
|
-
const bluetoothState = access.getState()
|
|
1023
|
-
if (bluetoothState === 0 || bluetoothState === 3) {
|
|
1024
|
-
access.enableBluetooth()
|
|
1025
|
-
} else if (bluetoothState === 2 || bluetoothState === 1) {
|
|
1026
|
-
access.disableBluetooth()
|
|
1027
|
-
}
|
|
1028
|
-
if (onComplete) {
|
|
1029
|
-
onComplete()
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
isAirplaneEnabled(): Promise<boolean> {
|
|
1034
|
-
throw new Error('Method not implemented.');
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
switchAirplane(onComplete: () => void): void {
|
|
1038
|
-
if (onComplete) {
|
|
1039
|
-
this.startSettingsAppInfoAbilityExplicit('mobile_network_entry', onComplete);
|
|
1040
|
-
} else {
|
|
1041
|
-
this.startSettingsAppInfoAbilityExplicit('mobile_network_entry');
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
openAppSystemSettings(): void {
|
|
1046
|
-
this.startSettingsAppInfoAbilityExplicit('application_info_entry');
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
addBluetoothListener(): void {
|
|
1050
|
-
access.on('stateChange', e => {
|
|
1051
|
-
if (e === 0) {
|
|
1052
|
-
this.ctx.rnInstance.emitDeviceEvent("EventBluetooth", false);
|
|
1053
|
-
} else if (e === 2) {
|
|
1054
|
-
this.ctx.rnInstance.emitDeviceEvent("EventBluetooth", true);
|
|
1055
|
-
}
|
|
1056
|
-
});
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
addWifiListener(callback: (wifiEnabled: boolean) => void): Promise<TM.ReactNativeSystemSetting.EmitterSubscription | null> {
|
|
1060
|
-
throw new Error('Method not implemented.');
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
addLocationListener(callback: (locationEnabled: boolean) => void): Promise<TM.ReactNativeSystemSetting.EmitterSubscription | null> {
|
|
1064
|
-
throw new Error('Method not implemented.');
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
addLocationModeListener(callback: (locationMode: number) => void): Promise<TM.ReactNativeSystemSetting.EmitterSubscription | null> {
|
|
1068
|
-
throw new Error('Method not implemented.');
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
addAirplaneListener(callback: (airplaneModeEnabled: boolean) => void): Promise<TM.ReactNativeSystemSetting.EmitterSubscription | null> {
|
|
1072
|
-
throw new Error('Method not implemented.');
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
removeListener(type): void {
|
|
1076
|
-
if (type === 'bluetooth') {
|
|
1077
|
-
access.off('stateChange');
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
addListener(eventName: string): void {}
|
|
1082
|
-
|
|
1083
|
-
removeListeners(count: number): void {}
|
|
1084
|
-
}�rE��@ohos.window�@ohos.bluetooth.access�@ohos.multimedia.audio�@ohos.wifiManager�@ohos.geoLocationManager�@ohos.abilityAccessCtrl�!@rnoh/react-native-openharmony/ts�rF��assertions�external�id�meta�moduleSideEffects�resolvedBy�syntheticNamedExportsA��`hvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.window.d.ts�rG��hostModulesInfo�C�@ohos.window�react_native_system_settingêoh-resolve�FA��jhvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.bluetooth.access.d.tsG�C�@ohos.bluetooth.access�react_native_system_settingêoh-resolve�FA��jhvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.multimedia.audio.d.tsG�C�@ohos.multimedia.audio�react_native_system_settingêoh-resolve�FA��ehvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.wifiManager.d.tsG�C�@ohos.wifiManager�react_native_system_settingêoh-resolve�FA��lhvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.geoLocationManager.d.tsG�C�@ohos.geoLocationManager�react_native_system_settingêoh-resolve�FA��khvigor_ignore_D:_devEcho_Studio_DevEco Studio_sdk_default_openharmony_ets_api_@ohos.abilityAccessCtrl.d.tsG�C�@ohos.abilityAccessCtrl�react_native_system_settingêoh-resolve�FA��!@rnoh/react-native-openharmony/tsAêoh-resolve�rH��missing�pluginægenAbc��rI��dynamicImportCache�exportAllDeclarationCache�exportNamedDeclarationCache�importCache����rJ��type�start�end�declaration�specifiers�source�ExportNamedDeclaration���1e�rK��type�start�end�id�superClass�body�ClassDeclaration���1e�rL��type�start�end�name�Identifier���RNSystemSettingTurboModuleL�Identifier�&�1�TurboModule�rM��type�start�end�body�ClassBody�2�1e�&�rN��type�start�end�static�computed�key�kind�value�MethodDefinition�9���L�Identifier�9�D�constructor�constructor�rO��type�start�end�id�expression�generator�async�params�body�FunctionExpression�D����L�Identifier�E�H�ctxM�BlockStatement�J���rP��type�start�end�expression�ExpressionStatement�U�`�rQ��type�start�end�callee�arguments�optional�CallExpression�U�_�rR��type�start�end�Super�U�Z�L�Identifier�[�^�ctx�P�ExpressionStatement�j�y�rS��type�start�end�operator�left�right�AssignmentExpression�j�x�=�rT��type�start�end�object�property�computed�optional�MemberExpression�j�rR�ThisExpression�j�nL�Identifier�o�r�ctx��L�Identifier�u�x�ctxP�ExpressionStatement����S�AssignmentExpression�����=T�MemberExpression����R�ThisExpression����L�Identifier�����_windowClass��L�Identifier�����undefinedP�ExpressionStatement����S�AssignmentExpression���ġ=T�MemberExpression����R�ThisExpression����L�Identifier�����_context��L�Identifier���ĩundefinedP�ExpressionStatement����Q�CallExpression����T�MemberExpression����R�ThisExpression����L�Identifier����setWindowClass��P�ExpressionStatement���Q�CallExpression���
|
|
1085
|
-
�
|
|
1086
|
-
ӑV�VariableDeclarator�
|
|
1087
|
-
�
|
|
1088
|
-
�L�Identifier�
|
|
1089
|
-
�
|
|
1090
|
-
�want�r]��type�start�end�properties�ObjectExpression�
|
|
1091
|
-
�
|
|
1092
|
-
Ҕ�r^��type�start�end�method�shorthand�computed�key�value�kind�Property�
|
|
1093
|
-
�
|
|
1094
|
-
C���L�Identifier�
|
|
1095
|
-
�
|
|
1096
|
-
'�bundleNameX�Literal�
|
|
1097
|
-
)�
|
|
1098
|
-
C�com.huawei.hmos.settings�'com.huawei.hmos.settings'�init^�Property�
|
|
1099
|
-
R�
|
|
1100
|
-
����L�Identifier�
|
|
1101
|
-
R�
|
|
1102
|
-
]�abilityNameX�Literal�
|
|
1103
|
-
_�
|
|
1104
|
-
��$com.huawei.hmos.settings.MainAbility�&'com.huawei.hmos.settings.MainAbility'�init^�Property�
|
|
1105
|
-
��
|
|
1106
|
-
����L�Identifier�
|
|
1107
|
-
��
|
|
1108
|
-
��actionX�Literal�
|
|
1109
|
-
��
|
|
1110
|
-
��action.settings�'action.settings'�init^�Property�
|
|
1111
|
-
��
|
|
1112
|
-
����L�Identifier�
|
|
1113
|
-
��
|
|
1114
|
-
��uriL�Identifier�
|
|
1115
|
-
��
|
|
1116
|
-
Ǧaction�init�letP�ExpressionStatement�
|
|
1117
|
-
��lQ�CallExpression�
|
|
1118
|
-
��kT�MemberExpression�
|
|
1119
|
-
���Q�CallExpression�
|
|
1120
|
-
���T�MemberExpression�
|
|
1121
|
-
��
|
|
1122
|
-
Q�CallExpression�
|
|
1123
|
-
��
|
|
1124
|
-
�T�MemberExpression�
|
|
1125
|
-
��
|
|
1126
|
-
�L�Identifier�
|
|
1127
|
-
��
|
|
1128
|
-
�contextL�Identifier�
|
|
1129
|
-
��
|
|
1130
|
-
�startAbility�L�Identifier�
|
|
1131
|
-
��
|
|
1132
|
-
��want�L�Identifier��
|
|
1133
|
-
�then�O�ArrowFunctionExpression������M�BlockStatement��ݓU�VariableDeclaration� �Y�V�VariableDeclarator�$�XL�Identifier�$�6�applicationContextQ�CallExpression�9�XT�MemberExpression�9�VL�Identifier�9�@�contextL�Identifier�A�V�getApplicationContext�£letU�VariableDeclaration�g���V�VariableDeclarator�k��L�Identifier�k�s�callback]�ObjectExpression�v���^�Property�������L�Identifier�����onWindowStageCreateO�ArrowFunctionExpression�������L�Identifier�����abilityL�Identifier�����windowStageM�BlockStatement���̐�init^�Property���"���L�Identifier����onWindowStageActiveO�ArrowFunctionExpression���"���L�Identifier�����abilityL�Identifier��� �windowStageM�BlockStatement��"��init^�Property�5�z���L�Identifier�5�J�onWindowStageInactiveO�ArrowFunctionExpression�L�z���L�Identifier�M�T�abilityL�Identifier�V�a�windowStageM�BlockStatement�f�z��init^�Property�������L�Identifier�����onWindowStageDestroyO�ArrowFunctionExpression�������L�Identifier�����abilityL�Identifier�����windowStageM�BlockStatement���ѐ�init^�Property���
|
|
1134
|
-
�
|
|
1135
|
-
�!
|
|
1136
|
-
�-KQ�CallExpression�-
|
|
1137
|
-
�-JT�MemberExpression�-
|
|
1138
|
-
�-2R�ThisExpression�-
|
|
1139
|
-
�-L�Identifier�-�-2�#startSettingsAppInfoAbilityExplicit�X�Literal�-3�-I�mobile_network_entry�'mobile_network_entry'�N�MethodDefinition�-c�-���L�Identifier�-c�-x�openAppSystemSettings�methodO�FunctionExpression�-x�-����M�BlockStatement�-{�-БP�ExpressionStatement�-��-�Q�CallExpression�-��-�T�MemberExpression�-��-�R�ThisExpression�-��-�L�Identifier�-��-��#startSettingsAppInfoAbilityExplicit�X�Literal�-��-Ƕapplication_info_entry�'application_info_entry'�N�MethodDefinition�-��/#��L�Identifier�-��-�addBluetoothListener�methodO�FunctionExpression�-��/#���M�BlockStatement�-��/#�P�ExpressionStatement�-��/Q�CallExpression�-��/T�MemberExpression�-��.L�Identifier�-��-��accessL�Identifier�-��.�on�X�Literal�.�.�stateChange�'stateChange'O�ArrowFunctionExpression�.�/���L�Identifier�.�.�eM�BlockStatement�.�/�_�IfStatement�.%�/`�BinaryExpression�.)�.0L�Identifier�.)�.*�e�===X�Literal�./�.0�0M�BlockStatement�.2�.��P�ExpressionStatement�.E�.�Q�CallExpression�.E�.�T�MemberExpression�.E�.hT�MemberExpression�.E�.XT�MemberExpression�.E�.MR�ThisExpression�.E�.IL�Identifier�.J�.M�ctx��L�Identifier�.N�.X�rnInstance��L�Identifier�.Y�.h�emitDeviceEvent�X�Literal�.i�.y�EventBluetooth�"EventBluetooth"X�Literal�.{�.�¥false�_�IfStatement�.��/`�BinaryExpression�.��.�L�Identifier�.��.��e�===X�Literal�.��.��2M�BlockStatement�.��/�P�ExpressionStatement�.��/Q�CallExpression�.��.�T�MemberExpression�.��.�T�MemberExpression�.��.�T�MemberExpression�.��.�R�ThisExpression�.��.�L�Identifier�.��.̣ctx��L�Identifier�.��.תrnInstance��L�Identifier�.��.�emitDeviceEvent�X�Literal�.��.��EventBluetooth�"EventBluetooth"X�Literal�.��.�ätrue���N�MethodDefinition�/)�/���L�Identifier�/)�/8�addWifiListener�methodO�FunctionExpression�/8�/����L�Identifier�/9�/A�callbackM�BlockStatement�/C�/��\�ThrowStatement�/N�/yd�NewExpression�/T�/xL�Identifier�/X�/]�Error�X�Literal�/^�/w�Method not implemented.�'Method not implemented.'N�MethodDefinition�/��/���L�Identifier�/��/��addLocationListener�methodO�FunctionExpression�/��/����L�Identifier�/��/��callbackM�BlockStatement�/��/�\�ThrowStatement�/��/�d�NewExpression�/��/�L�Identifier�/��/��Error�X�Literal�/��/طMethod not implemented.�'Method not implemented.'N�MethodDefinition�/��0F��L�Identifier�/��/��addLocationModeListener�methodO�FunctionExpression�/��0F���L�Identifier�/��0�callbackM�BlockStatement�0 �0F�\�ThrowStatement�0�0?d�NewExpression�0�0>L�Identifier�0�0#�Error�X�Literal�0$�0=�Method not implemented.�'Method not implemented.'N�MethodDefinition�0L�0���L�Identifier�0L�0_�addAirplaneListener�methodO�FunctionExpression�0_�0����L�Identifier�0`�0h�callbackM�BlockStatement�0j�0��\�ThrowStatement�0u�0�d�NewExpression�0{�0�L�Identifier�0�0��Error�X�Literal�0��0��Method not implemented.�'Method not implemented.'N�MethodDefinition�0��1"��L�Identifier�0��0��removeListener�methodO�FunctionExpression�0��1"���L�Identifier�0��0��typeM�BlockStatement�0��1"�_�IfStatement�0��1`�BinaryExpression�0��0�L�Identifier�0��0դtype�===X�Literal�0��0�bluetooth�'bluetooth'M�BlockStatement�0��1�P�ExpressionStatement�0��1Q�CallExpression�0��1T�MemberExpression�0��1L�Identifier�0��0��accessL�Identifier�0��1�off�X�Literal�1�1�stateChange�'stateChange'��N�MethodDefinition�1(�1B��L�Identifier�1(�13�addListener�methodO�FunctionExpression�13�1B���L�Identifier�14�1=�eventNameM�BlockStatement�1?�1B�N�MethodDefinition�1H�1b��L�Identifier�1H�1W�removeListeners�methodO�FunctionExpression�1W�1b���L�Identifier�1X�1]�countM�BlockStatement�1_�1b�����re��type�start�end�specifiers�source�ImportDeclaration���ё�rf��type�start�end�imported�local�ImportSpecifier����L�Identifier�����TurboModuleL�Identifier�����TurboModuleX�Literal�����!@rnoh/react-native-openharmony/ts�#'@rnoh/react-native-openharmony/ts'e�ImportDeclaration������rg��type�start�end�local�ImportDefaultSpecifier����L�Identifier����windowX�Literal�����@ohos.window�'@ohos.window'e�ImportDeclaration���#�g�ImportDefaultSpecifier���L�Identifier����accessX�Literal�
|
|
1140
|
-
�"�@ohos.bluetooth.access�"@ohos.bluetooth.access"e�ImportDeclaration�%�P�g�ImportDefaultSpecifier�,�1L�Identifier�,�1�audioX�Literal�7�O�@ohos.multimedia.audio�"@ohos.multimedia.audio"e�ImportDeclaration�R�~�g�ImportDefaultSpecifier�Y�dL�Identifier�Y�d�wifiManagerX�Literal�j�}�@ohos.wifiManager�'@ohos.wifiManager'e�ImportDeclaration�����g�ImportDefaultSpecifier����L�Identifier�����geoLocationManagerX�Literal�����@ohos.geoLocationManager�'@ohos.geoLocationManager'e�ImportDeclaration�����g�ImportDefaultSpecifier����L�Identifier���ԱabilityAccessCtrlX�Literal����@ohos.abilityAccessCtrl�'@ohos.abilityAccessCtrl'
|