-
Notifications
You must be signed in to change notification settings - Fork 927
Expand file tree
/
Copy pathsystemConfiguration.js
More file actions
58 lines (49 loc) · 1.64 KB
/
systemConfiguration.js
File metadata and controls
58 lines (49 loc) · 1.64 KB
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
export const HARDKEYBOARDHIDDEN_NO = 1;
export const HARDKEYBOARDHIDDEN_YES = 2;
export const HARDKEYBOARDHIDDEN_UNDEFINED = 0;
export const KEYBOARDHIDDEN_NO = 1;
export const KEYBOARDHIDDEN_YES = 2;
export const KEYBOARDHIDDEN_UNDEFINED = 0;
export const KEYBOARD_12KEY = 3;
export const KEYBOARD_QWERTY = 2;
export const KEYBOARD_UNDEFINED = 0;
export const KEYBOARD_NOKEYS = 1;
export const NAVIGATIONHIDDEN_NO = 1;
export const NAVIGATIONHIDDEN_YES = 2;
export const NAVIGATIONHIDDEN_UNDEFINED = 0;
export const NAVIGATION_DPAD = 2;
export const NAVIGATION_TRACKBALL = 3;
export const NAVIGATION_WHEEL = 4;
export const NAVIGATION_UNDEFINED = 0;
export const ORIENTATION_LANDSCAPE = 2;
export const ORIENTATION_PORTRAIT = 1;
export const ORIENTATION_SQUARE = 3;
export const ORIENTATION_UNDEFINED = 0;
export const TOUCHSCREEN_FINGER = 3;
export const TOUCHSCREEN_NOTOUCH = 1;
export const TOUCHSCREEN_STYLUS = 2;
export const TOUCHSCREEN_UNDEFINED = 0;
/**
* @typedef {Object} SystemConfiguration
* @property {number} hardKeyboardHidden
* @property {number} navigationHidden
* @property {number} keyboardHidden
* @property {number} keyboardHeight
* @property {number} orientation
* @property {number} navigation
* @property {number} fontScale
* @property {number} keyboard
* @property {string} locale
*/
/**
* Get the system configuration
* @returns {Promise<SystemConfiguration>}
*/
export function getSystemConfiguration() {
return new Promise((resolve, reject) => {
cordova.exec(resolve, reject, "System", "get-configuration", []);
});
}
export function isDeviceDarkTheme() {
return window.matchMedia("(prefers-color-scheme: dark)").matches;
}