forked from c19354837/react-native-system-setting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SystemSetting.d.ts
81 lines (74 loc) · 2.48 KB
/
SystemSetting.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
export {};
interface EmitterSubscription {
remove: () => void;
}
type CompleteFunc = () => void
type VolumeType =
| "call"
| "system"
| "ring"
| "music"
| "alarm"
| "notification";
interface VolumeConfig {
type?: VolumeType;
playSound?: boolean;
showUI?: boolean;
}
interface VolumeData {
value: number;
call?: number;
system?: number;
ring?: number;
music?: number;
alarm?: number;
notification?: number;
}
interface SystemSetting {
getBrightness: () => Promise<number>;
setBrightness: (val: number) => Promise<boolean>;
setBrightnessForce: (val: number) => Promise<boolean>;
getAppBrightness: () => Promise<number>;
setAppBrightness: (val: number) => Promise<true>;
grantWriteSettingPremission: () => void;
getScreenMode: () => Promise<number>;
setScreenMode: (val: number) => Promise<boolean>;
saveBrightness: () => Promise<void>;
restoreBrightness: () => number;
getVolume: (type?: VolumeType) => Promise<number>;
setVolume: (value: number, config?: VolumeConfig | VolumeType) => void;
addVolumeListener: (
callback: (volumeData: VolumeData) => void
) => EmitterSubscription;
removeVolumeListener: (listener?: EmitterSubscription) => void;
isWifiEnabled: () => Promise<boolean>;
switchWifiSilence: (onComplete?: CompleteFunc) => void;
switchWifi: (onComplete?: CompleteFunc) => void;
isLocationEnabled: () => Promise<boolean>;
getLocationMode: () => Promise<number>;
switchLocation: (onComplete?: CompleteFunc) => void;
isBluetoothEnabled: () => Promise<boolean>;
switchBluetooth: (onComplete?: CompleteFunc) => void;
switchBluetoothSilence: (onComplete?: CompleteFunc) => void;
isAirplaneEnabled: () => Promise<boolean>;
switchAirplane: (onComplete?: CompleteFunc) => void;
openAppSystemSettings: () => Promise<void>;
addBluetoothListener: (
callback: (bluetoothEnabled: boolean) => void
) => Promise<EmitterSubscription>;
addWifiListener: (
callback: (wifiEnabled: boolean) => void
) => Promise<EmitterSubscription | null>;
addLocationListener: (
callback: (locationEnabled: boolean) => void
) => Promise<EmitterSubscription | null>;
addLocationModeListener: (
callback: (locationMode: number) => void
) => Promise<EmitterSubscription | null>;
addAirplaneListener: (
callback: (airplaneModeEnabled: boolean) => void
) => Promise<EmitterSubscription | null>;
removeListener: (listener?: EmitterSubscription) => void;
}
declare const systemSetting: SystemSetting;
export default systemSetting;