@react-native-ohos/react-native-system-setting 1.7.7-rc.1 → 1.8.0-rc.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/API.md +57 -57
- package/LICENSE.md +21 -21
- package/RCTSystemSetting.podspec +20 -20
- package/README.OpenSource +10 -10
- package/README.md +15 -15
- package/SystemSetting.d.ts +81 -81
- package/SystemSetting.js +347 -347
- package/Utils.js +11 -11
- package/harmony/react_native_system_setting/BuildProfile.ets +15 -4
- package/harmony/react_native_system_setting/Index.ets +27 -27
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/.ts_checker_cache +3265 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/.tsbuildinfo +1 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/.tsbuildinfo.linter +1 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@HarCompileArkTS/esmodule/compileInfo.json +1 -0
- 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 +1139 -1
- 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 +1 -0
- 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 +1 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/BuildProfile.ets +17 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/Index.ets +27 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/ResourceTable.txt +1 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/build-profile.json5 +31 -0
- 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 +6 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/obfuscation-rules.txt +18 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/oh-package-lock.json5 +19 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/oh-package.json5 +1 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/cpp/CMakeLists.txt +7 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/cpp/RNSystemSettingPackage.h +76 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/cpp/ReactNativeSystemSetting.cpp +54 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/cpp/ReactNativeSystemSetting.h +21 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/Logger.ts +64 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/RNSystemSettingPackage.ts +52 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/RNSystemSettingTurboModule.ts +362 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/generated/components/ts.ts +5 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/generated/index.ets +8 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/generated/ts.ts +9 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/generated/turboModules/ReactNativeSystemSetting.ts +86 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/ets/generated/turboModules/ts.ts +8 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/module.json +28 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/resources/base/element/string.json +8 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/react_native_system_setting/build/default/cache/default/default@PackageHar/ts.ts +25 -0
- package/harmony/react_native_system_setting/build/default/generated/pm/default/oh-package.json5 +1 -0
- package/harmony/react_native_system_setting/build/default/generated/r/default/ResourceTable.h +24 -0
- package/harmony/react_native_system_setting/build/default/intermediates/loader/default/loader.json +30 -0
- package/harmony/react_native_system_setting/build/default/intermediates/merge_profile/default/module.json +25 -0
- package/harmony/react_native_system_setting/build/default/intermediates/patch/default/base_native_libs.json +1 -0
- package/harmony/react_native_system_setting/build/default/intermediates/process_profile/default/module.json +28 -0
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/ResourceTable.txt +1 -0
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/ark_module.json +1 -0
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/ids_map/id_defined.json +7 -0
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/module.json +26 -0
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/opt-compression.json +1 -0
- package/harmony/react_native_system_setting/build/default/intermediates/res/default/resConfig.json +1 -0
- 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/build-profile.json5 +31 -31
- package/harmony/react_native_system_setting/hvigorfile.ts +6 -6
- package/harmony/react_native_system_setting/obfuscation-rules.txt +17 -17
- package/harmony/react_native_system_setting/oh-package-lock.json5 +19 -0
- package/harmony/react_native_system_setting/oh-package.json5 +10 -10
- package/harmony/react_native_system_setting/src/main/cpp/RNSystemSettingPackage.h +76 -76
- package/harmony/react_native_system_setting/src/main/cpp/ReactNativeSystemSetting.cpp +54 -54
- package/harmony/react_native_system_setting/src/main/cpp/ReactNativeSystemSetting.h +21 -21
- package/harmony/react_native_system_setting/src/main/ets/Logger.ts +63 -63
- package/harmony/react_native_system_setting/src/main/ets/RNSystemSettingPackage.ts +51 -51
- package/harmony/react_native_system_setting/src/main/ets/RNSystemSettingTurboModule.ts +361 -361
- package/harmony/react_native_system_setting/src/main/ets/generated/components/ts.ts +5 -5
- package/harmony/react_native_system_setting/src/main/ets/generated/index.ets +8 -8
- package/harmony/react_native_system_setting/src/main/ets/generated/ts.ts +9 -9
- package/harmony/react_native_system_setting/src/main/ets/generated/turboModules/ReactNativeSystemSetting.ts +86 -86
- package/harmony/react_native_system_setting/src/main/ets/generated/turboModules/ts.ts +8 -8
- package/harmony/react_native_system_setting/src/main/module.json5 +9 -9
- package/harmony/react_native_system_setting/src/main/resources/base/element/string.json +8 -8
- package/harmony/react_native_system_setting/src/main/resources/en_US/element/string.json +8 -8
- package/harmony/react_native_system_setting/src/main/resources/zh_CN/element/string.json +8 -8
- package/harmony/react_native_system_setting/ts.ts +24 -24
- package/harmony/react_native_system_setting.har +0 -0
- package/package.json +46 -46
- package/src/ReactRNSystemSetting.ts +112 -112
- package/LICENSE +0 -21
package/API.md
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
## API
|
|
2
|
-
|
|
3
|
-
**All are static method, and all GET mothods return a promise**
|
|
4
|
-
|
|
5
|
-
**Maybe [codes](https://github.com/c19354837/react-native-system-setting/blob/master/SystemSetting.js) is best document**
|
|
6
|
-
|
|
7
|
-
> Some APIs are marked with an asterisk at the beginning, and it means you need declare permission for Androidn since V1.5.0, see [Android Permission](https://github.com/c19354837/react-native-system-setting#android-permission)
|
|
8
|
-
>
|
|
9
|
-
> Some APIs which start with `swtich` or containt `bluetooth` are disabled for iOS since V1.7.0, you can [enable it](https://github.com/c19354837/react-native-system-setting/blob/master/iOS.md#ios) in a few steps.
|
|
10
|
-
|
|
11
|
-
method | description
|
|
12
|
-
------ | -----------
|
|
13
|
-
**Volume**|
|
|
14
|
-
getVolume(type:string) => Promise | Get the system volume. <br><br>`type` must be one of `music`, `call`, `system`, `ring`, `alarm`, `notification`, default is `music`
|
|
15
|
-
setVolume(val:float, config:object) | Set the system volume by specified value, from 0 to 1. 0 for mute, and 1 is max volume.<br><br> `config` can be `{type: 'music', playSound:true, showUI:true}`<br><br> `type` : must be one of `music`, `call`, `system`, `ring`, `alarm`, `notification`, default is `music`.(Android only) <br>`playSound`: Whether to play a sound when changing the volume, default is `false`(Android only)<br>`showUI`: Show a toast containing the current volume, default is `false`(Android & iOS)<br><br> **since 1.2.2**
|
|
16
|
-
addVolumeListener(callback) | Listen the volume changing, and it will return the listener. More info see [the example](https://github.com/c19354837/react-native-system-setting/blob/master/examples/SystemSettingExample/index.js#L42)
|
|
17
|
-
removeVolumeListener(listener)| Remove listener when it no longer needed.
|
|
18
|
-
---|---
|
|
19
|
-
**Brightness**|
|
|
20
|
-
getBrightness() => Promise | Get the system brightness.
|
|
21
|
-
setBrightness(val:float) => Promise | Set the system brightness by specified value, from 0 to 1. 0 for brightless, and 1 is max.<br><br>Return false if permission deny ( iOS always be true
|
|
22
|
-
\* setBrightnessForce(val:float) => Promise| In Android, if the screen mode is auto, SystemSetting.setBrightness() will not work. You can call this to change the screen mode to MANUAL first. <br><br>Return false if permission deny ( iOS always be true
|
|
23
|
-
\* setAppBrightness(val:float)| For Android, `setBrightness()` or `setBrightnessForce()` will change the system's brightness, while this just changes the app's brightness, and it has no permission trouble.<br><br> For iOS, it's same with `setBrightness()`.
|
|
24
|
-
getAppBrightness() => Promise | Get the app brightness, and it will returns system brightness if you haven't call `setAppBrightness(val)` yet. (iOS allways returns system brightness)
|
|
25
|
-
getScreenMode() => Promise| (Only for Android, iOS will return -1). Get the screen mode, 0 is manual, while 1 is automatic.
|
|
26
|
-
\* setScreenMode(mode:int) => Promise|(Only for Android, iOS cannot change it). Change the screen mode, 0 is manual, while 1 is automatic.<br><br>Return false if permission deny ( iOS always be true
|
|
27
|
-
grantWriteSettingPermission()| open app setting page. It's user-friendly when you need some permission. Normally, you can call it if `setScreenMode()`, `setBrightness()` or `setBrightnessForce()` return false
|
|
28
|
-
\* saveBrightness()|It will save current brightness and screen mode.
|
|
29
|
-
restoreBrightness() => Promise|Restore brightness and screen mode back to saveBrightness(). While iOS only restore the brightness, Android will restore both. <br><br>You should call this before setBrightness() or setBrightnessForce(). <br><br>It will return the saved brightness.
|
|
30
|
-
---|---
|
|
31
|
-
**Wifi**|
|
|
32
|
-
\* isWifiEnabled() => Promise|Get wifi state, true if wifi is on.
|
|
33
|
-
switchWifi(complete)|It will open **Wifi Setting Page**, and you can change it by yourself. When come back to the app, the `complete` will be call.
|
|
34
|
-
\*\* switchWifiSilence(complete)|It will open wifi if the wifi is off, and close wifi when the wifi is on now. When it has done, the `complete` will be call.<br/>In android, it's done programmatically. <br><br>In iOS, I cannot do that by code for system limiting, so it just calls `switchWifi(complete)`<br><br>You need declare `android.permission.CHANGE_WIFI_STATE` in your AndroidManifest.xml, see [detail](https://github.com/c19354837/react-native-system-setting#android-permission)
|
|
35
|
-
addWifiListener(callback) => Promise| Listen the wifi state changing, and it will return the listener. (Android only)
|
|
36
|
-
---|---
|
|
37
|
-
**Location**|
|
|
38
|
-
isLocationEnabled() => Promise|Get location state, true if location is on.
|
|
39
|
-
switchLocation(complete)|It will open **System Location Setting Page**, and you can change it by yourself. When come back to the app, the `complete` will be call.
|
|
40
|
-
addLocationListener(callback) => Promise| Listen the location state changing, and it will return the listener. (Android only)
|
|
41
|
-
getLocationMode() => Promise| Get current location mode code: `0` - 'off', `1` - 'gps', `2` - 'network', `3` - 'gps & network'. (Android only)
|
|
42
|
-
addLocationModeListener(callback) => Promise| Listen the location mode changing, and it will return the listener. (Android only)
|
|
43
|
-
---|---
|
|
44
|
-
**Bluetooth**|
|
|
45
|
-
\* isBluetoothEnabled() => Promise|Get bluetooth state, true if bluetooth is on.
|
|
46
|
-
switchBluetooth(complete)|It will open **System Bluetooth Setting Page**, and you can change it by yourself. When come back to the app, the `complete` will be call.
|
|
47
|
-
\*\* switchBluetoothSilence(complete)|It will open bluetooth if the bluetooth is off, and close bluetooth when the bluetooth is on now. When it has done, the `complete` will be call.<br/>In android, it's done programmatically. <br><br>In iOS, I cannot do that by code for system limiting, so it just calls `switchBluetooth(complete)`<br><br>You need declare `android.permission.BLUETOOTH_ADMIN` in your AndroidManifest.xml, see [detail](https://github.com/c19354837/react-native-system-setting#android-permission)
|
|
48
|
-
addBluetoothListener(callback) => Promise| Listen the bluetooth state changing, and it will return the listener.
|
|
49
|
-
---|---
|
|
50
|
-
**Airplane**|
|
|
51
|
-
isAirplaneEnabled() => Promise|Get airplane state, true if airplane is on. <br><br>It will always return `true` for iOS if your device has no SIM card, see [detail](https://github.com/c19354837/react-native-system-setting/issues/37)
|
|
52
|
-
switchAirplane(complete)|It will open **System Setting Page**, and you can change it by yourself. When come back to the app, the `complete` will be call.
|
|
53
|
-
addAirplaneListener(callback) => Promise| Listen the airplane state changing, and it will return the listener. (Android only)
|
|
54
|
-
---|---
|
|
55
|
-
**Other**|
|
|
56
|
-
setAppStore(isAppStore:bool)| `true` means that you'll submit your app to App Store. In order to throught the App Store review, it has some side effects, see [Private API](https://github.com/c19354837/react-native-system-setting/blob/master/iOS.md#private-api).<br><br>`false` means that your app will not upload to App Store, and you can use any APIs at will.
|
|
57
|
-
removeListener(listener)| you can use this to remove the listener which return by `add*Listener(callback)`
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
**All are static method, and all GET mothods return a promise**
|
|
4
|
+
|
|
5
|
+
**Maybe [codes](https://github.com/c19354837/react-native-system-setting/blob/master/SystemSetting.js) is best document**
|
|
6
|
+
|
|
7
|
+
> Some APIs are marked with an asterisk at the beginning, and it means you need declare permission for Androidn since V1.5.0, see [Android Permission](https://github.com/c19354837/react-native-system-setting#android-permission)
|
|
8
|
+
>
|
|
9
|
+
> Some APIs which start with `swtich` or containt `bluetooth` are disabled for iOS since V1.7.0, you can [enable it](https://github.com/c19354837/react-native-system-setting/blob/master/iOS.md#ios) in a few steps.
|
|
10
|
+
|
|
11
|
+
method | description
|
|
12
|
+
------ | -----------
|
|
13
|
+
**Volume**|
|
|
14
|
+
getVolume(type:string) => Promise | Get the system volume. <br><br>`type` must be one of `music`, `call`, `system`, `ring`, `alarm`, `notification`, default is `music`
|
|
15
|
+
setVolume(val:float, config:object) | Set the system volume by specified value, from 0 to 1. 0 for mute, and 1 is max volume.<br><br> `config` can be `{type: 'music', playSound:true, showUI:true}`<br><br> `type` : must be one of `music`, `call`, `system`, `ring`, `alarm`, `notification`, default is `music`.(Android only) <br>`playSound`: Whether to play a sound when changing the volume, default is `false`(Android only)<br>`showUI`: Show a toast containing the current volume, default is `false`(Android & iOS)<br><br> **since 1.2.2**
|
|
16
|
+
addVolumeListener(callback) | Listen the volume changing, and it will return the listener. More info see [the example](https://github.com/c19354837/react-native-system-setting/blob/master/examples/SystemSettingExample/index.js#L42)
|
|
17
|
+
removeVolumeListener(listener)| Remove listener when it no longer needed.
|
|
18
|
+
---|---
|
|
19
|
+
**Brightness**|
|
|
20
|
+
getBrightness() => Promise | Get the system brightness.
|
|
21
|
+
setBrightness(val:float) => Promise | Set the system brightness by specified value, from 0 to 1. 0 for brightless, and 1 is max.<br><br>Return false if permission deny ( iOS always be true
|
|
22
|
+
\* setBrightnessForce(val:float) => Promise| In Android, if the screen mode is auto, SystemSetting.setBrightness() will not work. You can call this to change the screen mode to MANUAL first. <br><br>Return false if permission deny ( iOS always be true
|
|
23
|
+
\* setAppBrightness(val:float)| For Android, `setBrightness()` or `setBrightnessForce()` will change the system's brightness, while this just changes the app's brightness, and it has no permission trouble.<br><br> For iOS, it's same with `setBrightness()`.
|
|
24
|
+
getAppBrightness() => Promise | Get the app brightness, and it will returns system brightness if you haven't call `setAppBrightness(val)` yet. (iOS allways returns system brightness)
|
|
25
|
+
getScreenMode() => Promise| (Only for Android, iOS will return -1). Get the screen mode, 0 is manual, while 1 is automatic.
|
|
26
|
+
\* setScreenMode(mode:int) => Promise|(Only for Android, iOS cannot change it). Change the screen mode, 0 is manual, while 1 is automatic.<br><br>Return false if permission deny ( iOS always be true
|
|
27
|
+
grantWriteSettingPermission()| open app setting page. It's user-friendly when you need some permission. Normally, you can call it if `setScreenMode()`, `setBrightness()` or `setBrightnessForce()` return false
|
|
28
|
+
\* saveBrightness()|It will save current brightness and screen mode.
|
|
29
|
+
restoreBrightness() => Promise|Restore brightness and screen mode back to saveBrightness(). While iOS only restore the brightness, Android will restore both. <br><br>You should call this before setBrightness() or setBrightnessForce(). <br><br>It will return the saved brightness.
|
|
30
|
+
---|---
|
|
31
|
+
**Wifi**|
|
|
32
|
+
\* isWifiEnabled() => Promise|Get wifi state, true if wifi is on.
|
|
33
|
+
switchWifi(complete)|It will open **Wifi Setting Page**, and you can change it by yourself. When come back to the app, the `complete` will be call.
|
|
34
|
+
\*\* switchWifiSilence(complete)|It will open wifi if the wifi is off, and close wifi when the wifi is on now. When it has done, the `complete` will be call.<br/>In android, it's done programmatically. <br><br>In iOS, I cannot do that by code for system limiting, so it just calls `switchWifi(complete)`<br><br>You need declare `android.permission.CHANGE_WIFI_STATE` in your AndroidManifest.xml, see [detail](https://github.com/c19354837/react-native-system-setting#android-permission)
|
|
35
|
+
addWifiListener(callback) => Promise| Listen the wifi state changing, and it will return the listener. (Android only)
|
|
36
|
+
---|---
|
|
37
|
+
**Location**|
|
|
38
|
+
isLocationEnabled() => Promise|Get location state, true if location is on.
|
|
39
|
+
switchLocation(complete)|It will open **System Location Setting Page**, and you can change it by yourself. When come back to the app, the `complete` will be call.
|
|
40
|
+
addLocationListener(callback) => Promise| Listen the location state changing, and it will return the listener. (Android only)
|
|
41
|
+
getLocationMode() => Promise| Get current location mode code: `0` - 'off', `1` - 'gps', `2` - 'network', `3` - 'gps & network'. (Android only)
|
|
42
|
+
addLocationModeListener(callback) => Promise| Listen the location mode changing, and it will return the listener. (Android only)
|
|
43
|
+
---|---
|
|
44
|
+
**Bluetooth**|
|
|
45
|
+
\* isBluetoothEnabled() => Promise|Get bluetooth state, true if bluetooth is on.
|
|
46
|
+
switchBluetooth(complete)|It will open **System Bluetooth Setting Page**, and you can change it by yourself. When come back to the app, the `complete` will be call.
|
|
47
|
+
\*\* switchBluetoothSilence(complete)|It will open bluetooth if the bluetooth is off, and close bluetooth when the bluetooth is on now. When it has done, the `complete` will be call.<br/>In android, it's done programmatically. <br><br>In iOS, I cannot do that by code for system limiting, so it just calls `switchBluetooth(complete)`<br><br>You need declare `android.permission.BLUETOOTH_ADMIN` in your AndroidManifest.xml, see [detail](https://github.com/c19354837/react-native-system-setting#android-permission)
|
|
48
|
+
addBluetoothListener(callback) => Promise| Listen the bluetooth state changing, and it will return the listener.
|
|
49
|
+
---|---
|
|
50
|
+
**Airplane**|
|
|
51
|
+
isAirplaneEnabled() => Promise|Get airplane state, true if airplane is on. <br><br>It will always return `true` for iOS if your device has no SIM card, see [detail](https://github.com/c19354837/react-native-system-setting/issues/37)
|
|
52
|
+
switchAirplane(complete)|It will open **System Setting Page**, and you can change it by yourself. When come back to the app, the `complete` will be call.
|
|
53
|
+
addAirplaneListener(callback) => Promise| Listen the airplane state changing, and it will return the listener. (Android only)
|
|
54
|
+
---|---
|
|
55
|
+
**Other**|
|
|
56
|
+
setAppStore(isAppStore:bool)| `true` means that you'll submit your app to App Store. In order to throught the App Store review, it has some side effects, see [Private API](https://github.com/c19354837/react-native-system-setting/blob/master/iOS.md#private-api).<br><br>`false` means that your app will not upload to App Store, and you can use any APIs at will.
|
|
57
|
+
removeListener(listener)| you can use this to remove the listener which return by `add*Listener(callback)`
|
|
58
58
|
openAppSystemSettings()| open app's setting page
|
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018 Ninty
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Ninty
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/RCTSystemSetting.podspec
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
pjson = JSON.parse(File.read('package.json'))
|
|
3
|
-
|
|
4
|
-
Pod::Spec.new do |s|
|
|
5
|
-
|
|
6
|
-
s.name = "RCTSystemSetting"
|
|
7
|
-
s.version = pjson["version"]
|
|
8
|
-
s.homepage = pjson["homepage"]
|
|
9
|
-
s.summary = pjson["description"]
|
|
10
|
-
s.license = pjson["license"]
|
|
11
|
-
s.author = { "Ninty" => "c19354837@hotmail.com" }
|
|
12
|
-
|
|
13
|
-
s.ios.deployment_target = '7.0'
|
|
14
|
-
|
|
15
|
-
s.source = { :git => "https://github.com/c19354837/react-native-system-setting", :tag => "v#{s.version}" }
|
|
16
|
-
s.source_files = 'ios/*.{h,m}'
|
|
17
|
-
s.preserve_paths = "**/*.js"
|
|
18
|
-
|
|
19
|
-
s.dependency 'React'
|
|
20
|
-
end
|
|
1
|
+
require 'json'
|
|
2
|
+
pjson = JSON.parse(File.read('package.json'))
|
|
3
|
+
|
|
4
|
+
Pod::Spec.new do |s|
|
|
5
|
+
|
|
6
|
+
s.name = "RCTSystemSetting"
|
|
7
|
+
s.version = pjson["version"]
|
|
8
|
+
s.homepage = pjson["homepage"]
|
|
9
|
+
s.summary = pjson["description"]
|
|
10
|
+
s.license = pjson["license"]
|
|
11
|
+
s.author = { "Ninty" => "c19354837@hotmail.com" }
|
|
12
|
+
|
|
13
|
+
s.ios.deployment_target = '7.0'
|
|
14
|
+
|
|
15
|
+
s.source = { :git => "https://github.com/c19354837/react-native-system-setting", :tag => "v#{s.version}" }
|
|
16
|
+
s.source_files = 'ios/*.{h,m}'
|
|
17
|
+
s.preserve_paths = "**/*.js"
|
|
18
|
+
|
|
19
|
+
s.dependency 'React'
|
|
20
|
+
end
|
package/README.OpenSource
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"Name": "react-native-system-setting",
|
|
4
|
-
"License": "MIT",
|
|
5
|
-
"License File": "https://github.com/c19354837/react-native-system-setting/blob/master/LICENSE.md",
|
|
6
|
-
"Version Number": "1.7.6",
|
|
7
|
-
"Owner" : "xiafeng@huawei.com",
|
|
8
|
-
"Upstream URL": "https://github.com/c19354837/react-native-system-setting",
|
|
9
|
-
"Description": "
|
|
10
|
-
}
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"Name": "react-native-system-setting",
|
|
4
|
+
"License": "MIT",
|
|
5
|
+
"License File": "https://github.com/c19354837/react-native-system-setting/blob/master/LICENSE.md",
|
|
6
|
+
"Version Number": "1.7.6",
|
|
7
|
+
"Owner" : "xiafeng@huawei.com",
|
|
8
|
+
"Upstream URL": "https://github.com/c19354837/react-native-system-setting",
|
|
9
|
+
"Description": "A library to access system setting, and change it easily. eg: volume, brightness, wifi"
|
|
10
|
+
}
|
|
11
11
|
]
|
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
# @react-native-ohos/react-native-system-setting
|
|
3
|
-
|
|
4
|
-
本项目基于 [react-native-system-setting](https://github.com/c19354837/react-native-system-setting)
|
|
5
|
-
|
|
6
|
-
## 文档地址 / Documentation URL
|
|
7
|
-
|
|
8
|
-
[中文 / Chinese](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-system-setting.md)
|
|
9
|
-
|
|
10
|
-
[英文 / English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-system-setting.md)
|
|
11
|
-
|
|
12
|
-
## 请悉知 / Acknowledgements
|
|
13
|
-
|
|
14
|
-
本项目基于 [The MIT License (MIT)](https://github.com/c19354837/react-native-system-setting/blob/master/LICENSE.md) ,请自由地享受和参与开源。
|
|
15
|
-
|
|
1
|
+
|
|
2
|
+
# @react-native-ohos/react-native-system-setting
|
|
3
|
+
|
|
4
|
+
本项目基于 [react-native-system-setting@1.7.6](https://github.com/c19354837/react-native-system-setting/tree/V1.7.6)
|
|
5
|
+
|
|
6
|
+
## 文档地址 / Documentation URL
|
|
7
|
+
|
|
8
|
+
[中文 / Chinese](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-system-setting.md)
|
|
9
|
+
|
|
10
|
+
[英文 / English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-system-setting.md)
|
|
11
|
+
|
|
12
|
+
## 请悉知 / Acknowledgements
|
|
13
|
+
|
|
14
|
+
本项目基于 [The MIT License (MIT)](https://github.com/c19354837/react-native-system-setting/blob/master/LICENSE.md) ,请自由地享受和参与开源。
|
|
15
|
+
|
package/SystemSetting.d.ts
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
|
|
3
|
-
export interface EmitterSubscription {
|
|
4
|
-
remove: () => void;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
type CompleteFunc = () => void
|
|
8
|
-
|
|
9
|
-
type VolumeType =
|
|
10
|
-
| "call"
|
|
11
|
-
| "system"
|
|
12
|
-
| "ring"
|
|
13
|
-
| "music"
|
|
14
|
-
| "alarm"
|
|
15
|
-
| "notification";
|
|
16
|
-
|
|
17
|
-
interface VolumeConfig {
|
|
18
|
-
type?: VolumeType;
|
|
19
|
-
playSound?: boolean;
|
|
20
|
-
showUI?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface VolumeData {
|
|
24
|
-
value: number;
|
|
25
|
-
call?: number;
|
|
26
|
-
system?: number;
|
|
27
|
-
ring?: number;
|
|
28
|
-
music?: number;
|
|
29
|
-
alarm?: number;
|
|
30
|
-
notification?: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface SystemSetting {
|
|
34
|
-
getBrightness: () => Promise<number>;
|
|
35
|
-
setBrightness: (val: number) => Promise<boolean>;
|
|
36
|
-
setBrightnessForce: (val: number) => Promise<boolean>;
|
|
37
|
-
getAppBrightness: () => Promise<number>;
|
|
38
|
-
setAppBrightness: (val: number) => Promise<true>;
|
|
39
|
-
grantWriteSettingPremission: () => void;
|
|
40
|
-
getScreenMode: () => Promise<number>;
|
|
41
|
-
setScreenMode: (val: number) => Promise<boolean>;
|
|
42
|
-
saveBrightness: () => Promise<void>;
|
|
43
|
-
restoreBrightness: () => number;
|
|
44
|
-
getVolume: (type?: VolumeType) => Promise<number>;
|
|
45
|
-
setVolume: (value: number, config?: VolumeConfig | VolumeType) => void;
|
|
46
|
-
addVolumeListener: (
|
|
47
|
-
callback: (volumeData: VolumeData) => void
|
|
48
|
-
) => EmitterSubscription;
|
|
49
|
-
removeVolumeListener: (listener?: EmitterSubscription) => void;
|
|
50
|
-
isWifiEnabled: () => Promise<boolean>;
|
|
51
|
-
switchWifiSilence: (onComplete?: CompleteFunc) => void;
|
|
52
|
-
switchWifi: (onComplete?: CompleteFunc) => void;
|
|
53
|
-
isLocationEnabled: () => Promise<boolean>;
|
|
54
|
-
getLocationMode: () => Promise<number>;
|
|
55
|
-
switchLocation: (onComplete?: CompleteFunc) => void;
|
|
56
|
-
isBluetoothEnabled: () => Promise<boolean>;
|
|
57
|
-
switchBluetooth: (onComplete?: CompleteFunc) => void;
|
|
58
|
-
switchBluetoothSilence: (onComplete?: CompleteFunc) => void;
|
|
59
|
-
isAirplaneEnabled: () => Promise<boolean>;
|
|
60
|
-
switchAirplane: (onComplete?: CompleteFunc) => void;
|
|
61
|
-
openAppSystemSettings: () => Promise<void>;
|
|
62
|
-
addBluetoothListener: (
|
|
63
|
-
callback: (bluetoothEnabled: boolean) => void
|
|
64
|
-
) => Promise<EmitterSubscription>;
|
|
65
|
-
addWifiListener: (
|
|
66
|
-
callback: (wifiEnabled: boolean) => void
|
|
67
|
-
) => Promise<EmitterSubscription | null>;
|
|
68
|
-
addLocationListener: (
|
|
69
|
-
callback: (locationEnabled: boolean) => void
|
|
70
|
-
) => Promise<EmitterSubscription | null>;
|
|
71
|
-
addLocationModeListener: (
|
|
72
|
-
callback: (locationMode: number) => void
|
|
73
|
-
) => Promise<EmitterSubscription | null>;
|
|
74
|
-
addAirplaneListener: (
|
|
75
|
-
callback: (airplaneModeEnabled: boolean) => void
|
|
76
|
-
) => Promise<EmitterSubscription | null>;
|
|
77
|
-
removeListener: (listener?: EmitterSubscription) => void;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
declare const systemSetting: SystemSetting;
|
|
81
|
-
export default systemSetting;
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
export interface EmitterSubscription {
|
|
4
|
+
remove: () => void;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
type CompleteFunc = () => void
|
|
8
|
+
|
|
9
|
+
type VolumeType =
|
|
10
|
+
| "call"
|
|
11
|
+
| "system"
|
|
12
|
+
| "ring"
|
|
13
|
+
| "music"
|
|
14
|
+
| "alarm"
|
|
15
|
+
| "notification";
|
|
16
|
+
|
|
17
|
+
interface VolumeConfig {
|
|
18
|
+
type?: VolumeType;
|
|
19
|
+
playSound?: boolean;
|
|
20
|
+
showUI?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface VolumeData {
|
|
24
|
+
value: number;
|
|
25
|
+
call?: number;
|
|
26
|
+
system?: number;
|
|
27
|
+
ring?: number;
|
|
28
|
+
music?: number;
|
|
29
|
+
alarm?: number;
|
|
30
|
+
notification?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface SystemSetting {
|
|
34
|
+
getBrightness: () => Promise<number>;
|
|
35
|
+
setBrightness: (val: number) => Promise<boolean>;
|
|
36
|
+
setBrightnessForce: (val: number) => Promise<boolean>;
|
|
37
|
+
getAppBrightness: () => Promise<number>;
|
|
38
|
+
setAppBrightness: (val: number) => Promise<true>;
|
|
39
|
+
grantWriteSettingPremission: () => void;
|
|
40
|
+
getScreenMode: () => Promise<number>;
|
|
41
|
+
setScreenMode: (val: number) => Promise<boolean>;
|
|
42
|
+
saveBrightness: () => Promise<void>;
|
|
43
|
+
restoreBrightness: () => number;
|
|
44
|
+
getVolume: (type?: VolumeType) => Promise<number>;
|
|
45
|
+
setVolume: (value: number, config?: VolumeConfig | VolumeType) => void;
|
|
46
|
+
addVolumeListener: (
|
|
47
|
+
callback: (volumeData: VolumeData) => void
|
|
48
|
+
) => EmitterSubscription;
|
|
49
|
+
removeVolumeListener: (listener?: EmitterSubscription) => void;
|
|
50
|
+
isWifiEnabled: () => Promise<boolean>;
|
|
51
|
+
switchWifiSilence: (onComplete?: CompleteFunc) => void;
|
|
52
|
+
switchWifi: (onComplete?: CompleteFunc) => void;
|
|
53
|
+
isLocationEnabled: () => Promise<boolean>;
|
|
54
|
+
getLocationMode: () => Promise<number>;
|
|
55
|
+
switchLocation: (onComplete?: CompleteFunc) => void;
|
|
56
|
+
isBluetoothEnabled: () => Promise<boolean>;
|
|
57
|
+
switchBluetooth: (onComplete?: CompleteFunc) => void;
|
|
58
|
+
switchBluetoothSilence: (onComplete?: CompleteFunc) => void;
|
|
59
|
+
isAirplaneEnabled: () => Promise<boolean>;
|
|
60
|
+
switchAirplane: (onComplete?: CompleteFunc) => void;
|
|
61
|
+
openAppSystemSettings: () => Promise<void>;
|
|
62
|
+
addBluetoothListener: (
|
|
63
|
+
callback: (bluetoothEnabled: boolean) => void
|
|
64
|
+
) => Promise<EmitterSubscription>;
|
|
65
|
+
addWifiListener: (
|
|
66
|
+
callback: (wifiEnabled: boolean) => void
|
|
67
|
+
) => Promise<EmitterSubscription | null>;
|
|
68
|
+
addLocationListener: (
|
|
69
|
+
callback: (locationEnabled: boolean) => void
|
|
70
|
+
) => Promise<EmitterSubscription | null>;
|
|
71
|
+
addLocationModeListener: (
|
|
72
|
+
callback: (locationMode: number) => void
|
|
73
|
+
) => Promise<EmitterSubscription | null>;
|
|
74
|
+
addAirplaneListener: (
|
|
75
|
+
callback: (airplaneModeEnabled: boolean) => void
|
|
76
|
+
) => Promise<EmitterSubscription | null>;
|
|
77
|
+
removeListener: (listener?: EmitterSubscription) => void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
declare const systemSetting: SystemSetting;
|
|
81
|
+
export default systemSetting;
|