@react-native-ohos/react-native-system-setting 1.7.7-rc.3 → 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/README.OpenSource +1 -1
- package/harmony/react_native_system_setting/BuildProfile.ets +17 -0
- package/harmony/react_native_system_setting/Index.ets +1 -2
- package/harmony/react_native_system_setting/oh-package.json5 +1 -1
- package/harmony/react_native_system_setting/src/main/cpp/CMakeLists.txt +3 -5
- package/harmony/react_native_system_setting/src/main/cpp/{generated/RNOH/generated/BaseReactNativeSystemSettingPackage.h → RNSystemSettingPackage.h} +21 -10
- package/harmony/react_native_system_setting/src/main/cpp/{generated/RNOH/generated/turbo_modules/ReactNativeSystemSetting.cpp → ReactNativeSystemSetting.cpp} +8 -1
- package/harmony/react_native_system_setting/src/main/cpp/{generated/RNOH/generated/turbo_modules/ReactNativeSystemSetting.h → ReactNativeSystemSetting.h} +6 -1
- package/harmony/react_native_system_setting/src/main/ets/{RNSystemSettingPackage.ets → RNSystemSettingPackage.ts} +1 -2
- package/harmony/react_native_system_setting/src/main/ets/RNSystemSettingTurboModule.ts +27 -5
- package/harmony/react_native_system_setting/src/main/ets/generated/index.ets +4 -1
- package/harmony/react_native_system_setting/src/main/ets/generated/ts.ts +4 -1
- package/harmony/react_native_system_setting/src/main/ets/generated/turboModules/ReactNativeSystemSetting.ts +12 -4
- package/harmony/react_native_system_setting/src/main/ets/generated/turboModules/ts.ts +4 -1
- package/harmony/react_native_system_setting.har +0 -0
- package/package.json +13 -15
- package/src/ReactRNSystemSetting.ts +4 -0
- package/CHANGELOG.md +0 -206
- package/COMMITTERS.md +0 -7
- package/LICENSE +0 -21
- package/OAT.xml +0 -81
- package/harmony/react_native_system_setting/src/main/cpp/SystemSettingPackage.h +0 -36
- package/harmony/react_native_system_setting/src/main/cpp/generated/react/renderer/components/react_native_system_setting/ComponentDescriptors.h +0 -22
- package/harmony/react_native_system_setting/src/main/cpp/generated/react/renderer/components/react_native_system_setting/EventEmitters.cpp +0 -18
- package/harmony/react_native_system_setting/src/main/cpp/generated/react/renderer/components/react_native_system_setting/EventEmitters.h +0 -19
- package/harmony/react_native_system_setting/src/main/cpp/generated/react/renderer/components/react_native_system_setting/Props.cpp +0 -21
- package/harmony/react_native_system_setting/src/main/cpp/generated/react/renderer/components/react_native_system_setting/Props.h +0 -20
- package/harmony/react_native_system_setting/src/main/cpp/generated/react/renderer/components/react_native_system_setting/ShadowNodes.cpp +0 -19
- package/harmony/react_native_system_setting/src/main/cpp/generated/react/renderer/components/react_native_system_setting/ShadowNodes.h +0 -25
- package/harmony/react_native_system_setting/src/main/cpp/generated/react/renderer/components/react_native_system_setting/States.cpp +0 -18
- package/harmony/react_native_system_setting/src/main/cpp/generated/react/renderer/components/react_native_system_setting/States.h +0 -23
- package/harmony/react_native_system_setting/src/mock/mock-config.json5 +0 -2
- package/harmony/react_native_system_setting/src/ohosTest/ets/test/Ability.test.ets +0 -35
- package/harmony/react_native_system_setting/src/ohosTest/ets/test/List.test.ets +0 -5
- package/harmony/react_native_system_setting/src/ohosTest/ets/testability/TestAbility.ets +0 -47
- package/harmony/react_native_system_setting/src/ohosTest/ets/testability/pages/Index.ets +0 -17
- package/harmony/react_native_system_setting/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets +0 -90
- package/harmony/react_native_system_setting/src/ohosTest/module.json5 +0 -36
- package/harmony/react_native_system_setting/src/ohosTest/resources/base/element/color.json +0 -8
- package/harmony/react_native_system_setting/src/ohosTest/resources/base/element/string.json +0 -16
- package/harmony/react_native_system_setting/src/ohosTest/resources/base/media/icon.png +0 -0
- package/harmony/react_native_system_setting/src/ohosTest/resources/base/profile/test_pages.json +0 -5
- package/harmony/react_native_system_setting/src/test/List.test.ets +0 -5
- package/harmony/react_native_system_setting/src/test/LocalUnit.test.ets +0 -33
- package/iOS.md +0 -101
- /package/harmony/react_native_system_setting/{ts.ets → ts.ts} +0 -0
package/README.OpenSource
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"Version Number": "1.7.6",
|
|
7
7
|
"Owner" : "xiafeng@huawei.com",
|
|
8
8
|
"Upstream URL": "https://github.com/c19354837/react-native-system-setting",
|
|
9
|
-
"Description": "
|
|
9
|
+
"Description": "A library to access system setting, and change it easily. eg: volume, brightness, wifi"
|
|
10
10
|
}
|
|
11
11
|
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use these variables when you tailor your ArkTS code. They must be of the const type.
|
|
3
|
+
*/
|
|
4
|
+
export const HAR_VERSION = '1.8.0-rc.2';
|
|
5
|
+
export const BUILD_MODE_NAME = 'debug';
|
|
6
|
+
export const DEBUG = true;
|
|
7
|
+
export const TARGET_NAME = 'default';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* BuildProfile Class is used only for compatibility purposes.
|
|
11
|
+
*/
|
|
12
|
+
export default class BuildProfile {
|
|
13
|
+
static readonly HAR_VERSION = HAR_VERSION;
|
|
14
|
+
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
|
|
15
|
+
static readonly DEBUG = DEBUG;
|
|
16
|
+
static readonly TARGET_NAME = TARGET_NAME;
|
|
17
|
+
}
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
export * from './ts';
|
|
26
26
|
export * from "./src/main/ets/RNSystemSettingPackage";
|
|
27
27
|
export * from "./src/main/ets/RNSystemSettingTurboModule";
|
|
28
|
-
export default SystemSettingPackage
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.13)
|
|
2
2
|
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
add_library(rnoh_system_setting SHARED ${rnoh_system_setting_SRC} ${rnoh_system_setting_generated_SRC})
|
|
8
|
-
target_include_directories(rnoh_system_setting PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_system_setting_generated_dir})
|
|
4
|
+
file(GLOB RNOH_SYSTEM_SETTING_SRC CONFIGURE_DEPENDS *.cpp)
|
|
5
|
+
add_library(rnoh_system_setting SHARED ${RNOH_SYSTEM_SETTING_SRC})
|
|
6
|
+
target_include_directories(rnoh_system_setting PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|
9
7
|
target_link_libraries(rnoh_system_setting PUBLIC rnoh)
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generatorVersion: 1
|
|
3
8
|
*/
|
|
4
9
|
|
|
5
10
|
#pragma once
|
|
6
11
|
|
|
7
12
|
#include "RNOH/Package.h"
|
|
8
13
|
#include "RNOH/ArkTSTurboModule.h"
|
|
9
|
-
#include "
|
|
14
|
+
#include "./ReactNativeSystemSetting.h"
|
|
10
15
|
|
|
11
16
|
namespace rnoh {
|
|
12
17
|
|
|
13
|
-
class
|
|
18
|
+
class RNSystemSettingFactoryDelegate : public TurboModuleFactoryDelegate {
|
|
14
19
|
public:
|
|
15
20
|
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
|
|
16
21
|
if (name == "ReactNativeSystemSetting") {
|
|
@@ -20,29 +25,35 @@ class BaseReactNativeSystemSettingPackageTurboModuleFactoryDelegate : public Tur
|
|
|
20
25
|
};
|
|
21
26
|
};
|
|
22
27
|
|
|
23
|
-
class
|
|
28
|
+
class RNSystemSettingEventEmitRequestHandler : public EventEmitRequestHandler {
|
|
24
29
|
public:
|
|
25
30
|
void handleEvent(Context const &ctx) override {
|
|
26
31
|
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
|
|
32
|
+
auto componentName = ctx.shadowViewRegistry->getComponentName(ctx.tag);
|
|
33
|
+
|
|
27
34
|
if (eventEmitter == nullptr) {
|
|
28
35
|
return;
|
|
29
36
|
}
|
|
30
37
|
|
|
38
|
+
std::vector<std::string> supportedComponentNames = {
|
|
39
|
+
};
|
|
40
|
+
|
|
31
41
|
std::vector<std::string> supportedEventNames = {
|
|
32
42
|
};
|
|
33
|
-
|
|
43
|
+
|
|
44
|
+
if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
|
|
45
|
+
std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
|
|
34
46
|
eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
|
35
47
|
}
|
|
36
48
|
}
|
|
37
49
|
};
|
|
38
50
|
|
|
39
|
-
|
|
40
|
-
class BaseReactNativeSystemSettingPackage : public Package {
|
|
51
|
+
class RNSystemSettingPackage : public Package {
|
|
41
52
|
public:
|
|
42
|
-
BaseReactNativeSystemSettingPackage(Package::Context ctx) : Package(ctx){};
|
|
43
53
|
|
|
54
|
+
RNSystemSettingPackage(Package::Context ctx) : Package(ctx){};
|
|
44
55
|
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
|
|
45
|
-
return std::make_unique<
|
|
56
|
+
return std::make_unique<RNSystemSettingFactoryDelegate>();
|
|
46
57
|
}
|
|
47
58
|
|
|
48
59
|
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
|
|
@@ -57,7 +68,7 @@ class BaseReactNativeSystemSettingPackage : public Package {
|
|
|
57
68
|
|
|
58
69
|
EventEmitRequestHandlers createEventEmitRequestHandlers() override {
|
|
59
70
|
return {
|
|
60
|
-
std::make_shared<
|
|
71
|
+
std::make_shared<RNSystemSettingEventEmitRequestHandler>(),
|
|
61
72
|
};
|
|
62
73
|
}
|
|
63
74
|
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generatorVersion: 1
|
|
3
8
|
*/
|
|
4
9
|
|
|
5
10
|
#include "ReactNativeSystemSetting.h"
|
|
@@ -41,6 +46,8 @@ ReactNativeSystemSetting::ReactNativeSystemSetting(const ArkTSTurboModule::Conte
|
|
|
41
46
|
ARK_ASYNC_METHOD_METADATA(addLocationModeListener, 1),
|
|
42
47
|
ARK_ASYNC_METHOD_METADATA(addAirplaneListener, 1),
|
|
43
48
|
ARK_METHOD_METADATA(removeListener, 1),
|
|
49
|
+
ARK_METHOD_METADATA(addListener, 1),
|
|
50
|
+
ARK_METHOD_METADATA(removeListeners, 1),
|
|
44
51
|
};
|
|
45
52
|
}
|
|
46
53
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generatorVersion: 1
|
|
3
8
|
*/
|
|
4
9
|
|
|
5
10
|
#pragma once
|
|
@@ -27,7 +27,6 @@ import type {
|
|
|
27
27
|
TurboModule,
|
|
28
28
|
TurboModuleContext,
|
|
29
29
|
} from '@rnoh/react-native-openharmony/ts';
|
|
30
|
-
import { RNOHPackage } from '@rnoh/react-native-openharmony'
|
|
31
30
|
import { TM, RNC } from "./generated/ts"
|
|
32
31
|
import { RNSystemSettingTurboModule } from './RNSystemSettingTurboModule';
|
|
33
32
|
|
|
@@ -46,7 +45,7 @@ class RNSystemSettingTurboModuleFactory extends TurboModulesFactory {
|
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
export class RNSystemSettingPackage extends
|
|
48
|
+
export class RNSystemSettingPackage extends RNPackage {
|
|
50
49
|
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
|
|
51
50
|
return new RNSystemSettingTurboModuleFactory(ctx);
|
|
52
51
|
}
|
|
@@ -31,6 +31,7 @@ import { BusinessError } from '@kit.BasicServicesKit';
|
|
|
31
31
|
import { audio } from '@kit.AudioKit';
|
|
32
32
|
import wifiManager from '@ohos.wifiManager';
|
|
33
33
|
import geoLocationManager from '@ohos.geoLocationManager';
|
|
34
|
+
import abilityAccessCtrl, { PermissionRequestResult, Permissions } from '@ohos.abilityAccessCtrl';
|
|
34
35
|
|
|
35
36
|
export class RNSystemSettingTurboModule extends TurboModule implements TM.ReactNativeSystemSetting.Spec {
|
|
36
37
|
constructor(protected ctx: TurboModuleContext) {
|
|
@@ -41,6 +42,17 @@ export class RNSystemSettingTurboModule extends TurboModule implements TM.ReactN
|
|
|
41
42
|
private _windowClass: window.Window | undefined = undefined
|
|
42
43
|
private _context: window.Window | undefined = undefined
|
|
43
44
|
|
|
45
|
+
private async reqBluetoothPermissions(): Promise<PermissionRequestResult> {
|
|
46
|
+
const permissions: Array<Permissions> = ['ohos.permission.ACCESS_BLUETOOTH'];
|
|
47
|
+
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
|
|
48
|
+
try {
|
|
49
|
+
let data = await atManager.requestPermissionsFromUser(this.ctx.uiAbilityContext, permissions)
|
|
50
|
+
return data;
|
|
51
|
+
} catch (err) {
|
|
52
|
+
console.error('Failed to request permissions from user. Code is ${err.code}, message is ${err.message}')
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
44
56
|
private async setWindowClass(): Promise<void> {
|
|
45
57
|
let context = this.ctx.uiAbilityContext;
|
|
46
58
|
let promise = await window.getLastWindow(context);
|
|
@@ -285,13 +297,19 @@ export class RNSystemSettingTurboModule extends TurboModule implements TM.ReactN
|
|
|
285
297
|
}
|
|
286
298
|
}
|
|
287
299
|
|
|
288
|
-
switchBluetoothSilence(onComplete?: () => void): void {
|
|
300
|
+
async switchBluetoothSilence(onComplete?: () => void): Promise<void> {
|
|
301
|
+
let data: PermissionRequestResult = await this.reqBluetoothPermissions()
|
|
289
302
|
const bluetoothState = access.getState()
|
|
290
|
-
if (
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
303
|
+
if (data.authResults[0] === 0) {
|
|
304
|
+
if (bluetoothState === 0 || bluetoothState === 3) {
|
|
305
|
+
access.enableBluetooth()
|
|
306
|
+
} else if (bluetoothState === 2 || bluetoothState === 1) {
|
|
307
|
+
access.disableBluetooth()
|
|
308
|
+
}
|
|
309
|
+
} else {
|
|
310
|
+
console.log('Failed to request permissions from user')
|
|
294
311
|
}
|
|
312
|
+
|
|
295
313
|
if (onComplete) {
|
|
296
314
|
onComplete()
|
|
297
315
|
}
|
|
@@ -344,4 +362,8 @@ export class RNSystemSettingTurboModule extends TurboModule implements TM.ReactN
|
|
|
344
362
|
access.off('stateChange');
|
|
345
363
|
}
|
|
346
364
|
}
|
|
365
|
+
|
|
366
|
+
addListener(eventName: string): void {}
|
|
367
|
+
|
|
368
|
+
removeListeners(count: number): void {}
|
|
347
369
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
3
6
|
*/
|
|
4
7
|
|
|
5
8
|
export * from "./ts"
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
3
6
|
*/
|
|
4
7
|
|
|
5
8
|
export * as RNC from "./components/ts"
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generatorVersion: 1
|
|
3
8
|
*/
|
|
4
9
|
|
|
5
|
-
import { Tag } from "@rnoh/react-native-openharmony/ts"
|
|
6
10
|
|
|
7
11
|
export namespace ReactNativeSystemSetting {
|
|
8
12
|
export const NAME = 'ReactNativeSystemSetting' as const
|
|
9
13
|
|
|
10
|
-
export type EmitterSubscription = {remove: Object, type:
|
|
14
|
+
export type EmitterSubscription = {remove: Object, type: unknown}
|
|
11
15
|
|
|
12
16
|
export interface Spec {
|
|
13
17
|
getBrightness(): Promise<number>;
|
|
@@ -30,7 +34,7 @@ export namespace ReactNativeSystemSetting {
|
|
|
30
34
|
|
|
31
35
|
restoreBrightness(): number;
|
|
32
36
|
|
|
33
|
-
getVolume(type:
|
|
37
|
+
getVolume(type: unknown): Promise<number>;
|
|
34
38
|
|
|
35
39
|
setVolume(value: number, config: Object): void;
|
|
36
40
|
|
|
@@ -73,6 +77,10 @@ export namespace ReactNativeSystemSetting {
|
|
|
73
77
|
addAirplaneListener(callback: (airplaneModeEnabled: boolean) => void): Promise<null | EmitterSubscription>;
|
|
74
78
|
|
|
75
79
|
removeListener(type: string): void;
|
|
80
|
+
|
|
81
|
+
addListener(eventName: string): void;
|
|
82
|
+
|
|
83
|
+
removeListeners(count: number): void;
|
|
76
84
|
|
|
77
85
|
}
|
|
78
86
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This code was generated by "react-native codegen-
|
|
2
|
+
* This code was generated by "react-native codegen-harmony"
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be
|
|
5
|
+
* lost once the code is regenerated.
|
|
3
6
|
*/
|
|
4
7
|
|
|
5
8
|
export * from "./ReactNativeSystemSetting"
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-ohos/react-native-system-setting",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-rc.2",
|
|
4
4
|
"description": "provide some system setting APIs. Volume, brightness, wifi, location, bluetooth, airplane...",
|
|
5
5
|
"main": "SystemSetting.js",
|
|
6
6
|
"types": "SystemSetting.d.ts",
|
|
7
|
-
"homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-system-setting",
|
|
7
|
+
"homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-system-setting/tree/br_rnoh0.77#readme",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://gitcode.com/openharmony-sig/rntpc_react-native-system-setting/issues"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
|
-
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-system-setting --cpp-output-path ./harmony/react_native_system_setting/src/main/cpp/generated --ets-output-path ./harmony/react_native_system_setting/src/main/ets/generated --turbo-modules-spec-paths ./src --arkts-components-spec-paths ./src"
|
|
12
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
14
13
|
},
|
|
15
14
|
"keywords": [
|
|
16
15
|
"react-native",
|
|
@@ -23,6 +22,15 @@
|
|
|
23
22
|
"bluetooth",
|
|
24
23
|
"airplane"
|
|
25
24
|
],
|
|
25
|
+
"files": [
|
|
26
|
+
"src/",
|
|
27
|
+
"SystemSetting.d.ts",
|
|
28
|
+
"SystemSetting.js",
|
|
29
|
+
"Utils.js",
|
|
30
|
+
"/*.podspec",
|
|
31
|
+
"API.md",
|
|
32
|
+
"harmony"
|
|
33
|
+
],
|
|
26
34
|
"author": {
|
|
27
35
|
"name": "Ninty",
|
|
28
36
|
"email": "c19354837@hotmail.com",
|
|
@@ -33,17 +41,7 @@
|
|
|
33
41
|
"url": "https://gitcode.com/openharmony-sig/rntpc_react-native-system-setting.git"
|
|
34
42
|
},
|
|
35
43
|
"license": "MIT",
|
|
36
|
-
"publishConfig": {
|
|
37
|
-
"registry": "https://registry.npmjs.org/",
|
|
38
|
-
"access": "public"
|
|
39
|
-
},
|
|
40
44
|
"harmony": {
|
|
41
|
-
"alias": "react-native-system-setting"
|
|
42
|
-
"autolinking": {
|
|
43
|
-
"etsPackageClassName": "SystemSettingPackage",
|
|
44
|
-
"cppPackageClassName": "SystemSettingPackage",
|
|
45
|
-
"cmakeLibraryTargetName": "rnoh_system_setting",
|
|
46
|
-
"ohPackageName": "@react-native-ohos/react-native-system-setting"
|
|
47
|
-
}
|
|
45
|
+
"alias": "react-native-system-setting"
|
|
48
46
|
}
|
|
49
47
|
}
|
|
@@ -73,6 +73,10 @@ export interface Spec extends TurboModule {
|
|
|
73
73
|
) => Promise<EmitterSubscription | null>;
|
|
74
74
|
|
|
75
75
|
removeListener: (type: string) => void;
|
|
76
|
+
|
|
77
|
+
addListener(eventName: string): void;
|
|
78
|
+
|
|
79
|
+
removeListeners(count: number): void;
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
type EmitterSubscription = {
|
package/CHANGELOG.md
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
# V1.7.6
|
|
2
|
-
**2020-10-11**
|
|
3
|
-
|
|
4
|
-
fix TypeScript definitions
|
|
5
|
-
|
|
6
|
-
# V1.7.5
|
|
7
|
-
**2020-09-02**
|
|
8
|
-
|
|
9
|
-
adds TypeScript definitions, see [detail](https://github.com/c19354837/react-native-system-setting/pull/116)
|
|
10
|
-
|
|
11
|
-
# V1.7.4
|
|
12
|
-
**2020-01-30**
|
|
13
|
-
|
|
14
|
-
typo: `grantWriteSettingPremission()` -> `grantWriteSettingPermission`, see [detail](https://github.com/c19354837/react-native-system-setting/issues/97)
|
|
15
|
-
|
|
16
|
-
# V1.7.3
|
|
17
|
-
**2019-10-03**
|
|
18
|
-
|
|
19
|
-
fix bug: `setBrightness()` will cause a crash in iOS 13, see [detail](https://github.com/c19354837/react-native-system-setting/pull/89)
|
|
20
|
-
|
|
21
|
-
# V1.7.2
|
|
22
|
-
**2019-02-14**
|
|
23
|
-
|
|
24
|
-
new API: `addLocationModeListener()`, only works in Android
|
|
25
|
-
|
|
26
|
-
# V1.7.1
|
|
27
|
-
**2018-12-30**
|
|
28
|
-
|
|
29
|
-
new API: `openAppSystemSettings` will open app setting page
|
|
30
|
-
|
|
31
|
-
# V1.7.0
|
|
32
|
-
**2018-09-30**
|
|
33
|
-
|
|
34
|
-
add preprocessor `PRIVATE_API` which can enable `switch*()` function, see [detail](https://github.com/c19354837/react-native-system-setting/issues/58)
|
|
35
|
-
|
|
36
|
-
`setAppStore()` is deprecated.
|
|
37
|
-
|
|
38
|
-
breaking change: remove `BLUETOOTH` by default.
|
|
39
|
-
|
|
40
|
-
# V1.6.0
|
|
41
|
-
**2018-09-19**
|
|
42
|
-
|
|
43
|
-
bluetooth issues for App Store, see [detail](https://github.com/c19354837/react-native-system-setting/issues/55)
|
|
44
|
-
|
|
45
|
-
# V1.5.3
|
|
46
|
-
**2018-08-20**
|
|
47
|
-
|
|
48
|
-
fix bug: `setVolume()` may cause a crash, see [detail](https://github.com/c19354837/react-native-system-setting/pull/54)
|
|
49
|
-
|
|
50
|
-
# V1.5.2
|
|
51
|
-
**2018-08-05**
|
|
52
|
-
|
|
53
|
-
`setVolume()` may crash in >= Android M, see [detail](https://github.com/c19354837/react-native-system-setting/pull/48)
|
|
54
|
-
|
|
55
|
-
RN 0.56.+ compatible, [Use project-wide properties and new dependency](https://github.com/c19354837/react-native-system-setting/pull/46)
|
|
56
|
-
|
|
57
|
-
# V1.5.1
|
|
58
|
-
**2018-08-02**
|
|
59
|
-
|
|
60
|
-
show System Volume UI by default for iOS, see [detail](https://github.com/c19354837/react-native-system-setting/pull/43)
|
|
61
|
-
|
|
62
|
-
# V1.5.0
|
|
63
|
-
**2018-07-10**
|
|
64
|
-
|
|
65
|
-
breaking change: remove default Android permission, see [detail](https://github.com/c19354837/react-native-system-setting/pull/44)
|
|
66
|
-
|
|
67
|
-
# V1.4.6
|
|
68
|
-
**2018-06-20**
|
|
69
|
-
|
|
70
|
-
fix bug: `switchAirplane()` will open Bluetooth Setting Page for iOS.
|
|
71
|
-
|
|
72
|
-
# V1.4.5
|
|
73
|
-
**2018-06-07**
|
|
74
|
-
|
|
75
|
-
fix bug: Exception handling for Volume Event, see [detail](https://github.com/c19354837/react-native-system-setting/issues/39)
|
|
76
|
-
|
|
77
|
-
# V1.4.4
|
|
78
|
-
**2018-05-27**
|
|
79
|
-
|
|
80
|
-
new API: `getLocationMode()`, see [detail](https://github.com/c19354837/react-native-system-setting/issues/35)
|
|
81
|
-
|
|
82
|
-
fix bug: all listener may get `null` sometime
|
|
83
|
-
|
|
84
|
-
# V1.4.3
|
|
85
|
-
**2018-05-21**
|
|
86
|
-
|
|
87
|
-
for iOS - override `+(BOOL)requiresMainQueueSetup` to remove warning
|
|
88
|
-
|
|
89
|
-
# V1.4.2
|
|
90
|
-
**2018-05-07**
|
|
91
|
-
|
|
92
|
-
new API: `addLocationListener()`, only works in Android
|
|
93
|
-
|
|
94
|
-
new API: `addAirplaneListener()`, only works in Android
|
|
95
|
-
|
|
96
|
-
# V1.4.1
|
|
97
|
-
**2018-04-23**
|
|
98
|
-
|
|
99
|
-
new API: `addWifiListener()`, only works in Android
|
|
100
|
-
|
|
101
|
-
new API: `addBluetoothListener()`, Android & iOS
|
|
102
|
-
|
|
103
|
-
# V1.4.0
|
|
104
|
-
**2018-04-21**
|
|
105
|
-
|
|
106
|
-
new API: `setAppStore()`, it will avoid some troubles when you submit app to App Store, see [detail](https://github.com/c19354837/react-native-system-setting/issues/28)
|
|
107
|
-
|
|
108
|
-
# V1.3.0
|
|
109
|
-
**2018-04-15**
|
|
110
|
-
|
|
111
|
-
new API: `switchBluetoothSilence()`, see [detail](https://github.com/c19354837/react-native-system-setting/blob/master/API.md)
|
|
112
|
-
|
|
113
|
-
**breaking change**: remove `android.permission.CHANGE_WIFI_STATE` from [AndroidManifest.xml](https://github.com/c19354837/react-native-system-setting/blob/master/android/src/main/AndroidManifest.xml). If you want to call `switchWifiSilence()`, you should declare the permission in your Androidmanifest.xml, see [detail](https://github.com/c19354837/react-native-system-setting#powerful-api)
|
|
114
|
-
|
|
115
|
-
# V1.2.5
|
|
116
|
-
**2018-04-07**
|
|
117
|
-
|
|
118
|
-
fix bug - `setVolume(val, config)` will cause a crash when `type` is null, see [detail](https://github.com/c19354837/react-native-system-setting/issues/22)
|
|
119
|
-
|
|
120
|
-
fix bug - `grantWriteSettingPermission()` navigates to the wrong page, see [detail](https://github.com/c19354837/react-native-system-setting/issues/24)
|
|
121
|
-
|
|
122
|
-
# V1.2.4
|
|
123
|
-
**2018-03-14**
|
|
124
|
-
|
|
125
|
-
fix bug - `isLocationEnabled` return `false` when locate by network only, see [detail](https://github.com/c19354837/react-native-system-setting/issues/19)
|
|
126
|
-
|
|
127
|
-
# V1.2.3
|
|
128
|
-
**2018-02-26**
|
|
129
|
-
|
|
130
|
-
fix bug - `setVolume` will show the `MPVolumeView` in the upper left corner, see [detail](https://github.com/c19354837/react-native-system-setting/issues/17)
|
|
131
|
-
|
|
132
|
-
# V1.2.2
|
|
133
|
-
**2018-02-25**
|
|
134
|
-
|
|
135
|
-
use `MPVolumeView` to get/set volume for iOS.
|
|
136
|
-
|
|
137
|
-
change API `setVolume(val, type)` to `setVolume(val, config)`, see [detail](https://github.com/c19354837/react-native-system-setting/issues/15)
|
|
138
|
-
|
|
139
|
-
# V1.2.1
|
|
140
|
-
**2018-01-21**
|
|
141
|
-
|
|
142
|
-
Supported Cocoapods, see [detail](https://github.com/c19354837/react-native-system-setting/issues/10)
|
|
143
|
-
|
|
144
|
-
# V1.2.0
|
|
145
|
-
**2018-01-07**
|
|
146
|
-
|
|
147
|
-
new API: `isAirplaneEnabled()` & `switchAirplane(complete)`, see [detail](https://github.com/c19354837/react-native-system-setting/blob/master/API.md)
|
|
148
|
-
|
|
149
|
-
# V1.1.1
|
|
150
|
-
**2018-01-03**
|
|
151
|
-
|
|
152
|
-
Supported >= iOS 8.0.
|
|
153
|
-
|
|
154
|
-
new API: `setAppBrightness(val:float)` & `getAppBrightness()`, see [detail](https://github.com/c19354837/react-native-system-setting/blob/master/API.md)
|
|
155
|
-
|
|
156
|
-
# V1.1.0
|
|
157
|
-
**2017-12-14**
|
|
158
|
-
|
|
159
|
-
Check permission when write setting, see [detail](https://github.com/c19354837/react-native-system-setting#runtime-permission-for-android-6)
|
|
160
|
-
|
|
161
|
-
# V1.0.8
|
|
162
|
-
**2017-11-27**
|
|
163
|
-
|
|
164
|
-
Now you can change volume by type (Android only), see [detail](https://github.com/c19354837/react-native-system-setting/issues/5)
|
|
165
|
-
|
|
166
|
-
# V1.0.7
|
|
167
|
-
**2017-08-19**
|
|
168
|
-
|
|
169
|
-
support RN 0.47, see [detail](https://github.com/c19354837/react-native-system-setting/issues/1)
|
|
170
|
-
|
|
171
|
-
# V1.0.6
|
|
172
|
-
**2017-07-23**
|
|
173
|
-
|
|
174
|
-
support switching bluetooth state
|
|
175
|
-
|
|
176
|
-
# V1.0.5
|
|
177
|
-
**2017-07-15**
|
|
178
|
-
|
|
179
|
-
support switching location state
|
|
180
|
-
|
|
181
|
-
API change : `switchWifi()` and `switchWifiSilence()`, see [detail](https://github.com/c19354837/react-native-system-setting/blob/master/API.md)
|
|
182
|
-
|
|
183
|
-
# V1.0.4
|
|
184
|
-
**2017-06-16**
|
|
185
|
-
|
|
186
|
-
support switching wifi state
|
|
187
|
-
|
|
188
|
-
# V1.0.3
|
|
189
|
-
**2017-06-05**
|
|
190
|
-
|
|
191
|
-
Save & Restore for brightness
|
|
192
|
-
|
|
193
|
-
# V1.0.2
|
|
194
|
-
**2017-06-03**
|
|
195
|
-
|
|
196
|
-
Add listener for volume
|
|
197
|
-
|
|
198
|
-
# V1.0.1
|
|
199
|
-
**2017-05-31**
|
|
200
|
-
|
|
201
|
-
Add screen mode (Android only)
|
|
202
|
-
|
|
203
|
-
# V1.0.0
|
|
204
|
-
**2017-05-30**
|
|
205
|
-
|
|
206
|
-
Support volume and brightness
|
package/COMMITTERS.md
DELETED
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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.
|