@gachlab/capacitor-keep-awake-plugin 2.0.0 → 2.0.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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export interface KeepAwakePlugin { dontAllowSleep(): Promise<{ isAllowdSleep: boolean }>; allowSleep(): Promise<{ isAllowdSleep: boolean }>; } declare const KeepAwake: KeepAwakePlugin; export { KeepAwake };
|
|
@@ -3,11 +3,15 @@ import UIKit
|
|
|
3
3
|
|
|
4
4
|
@objc public class KeepAwake: NSObject {
|
|
5
5
|
@objc public func dontAllowSleep() -> Bool {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
DispatchQueue.main.async {
|
|
7
|
+
UIApplication.shared.isIdleTimerDisabled = true
|
|
8
|
+
}
|
|
9
|
+
return true
|
|
8
10
|
}
|
|
9
11
|
@objc public func allowSleep() -> Bool {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
DispatchQueue.main.async {
|
|
13
|
+
UIApplication.shared.isIdleTimerDisabled = false
|
|
14
|
+
}
|
|
15
|
+
return false
|
|
12
16
|
}
|
|
13
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gachlab/capacitor-keep-awake-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A plugin to keep awake the device screen",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
41
41
|
"swiftlint": "node-swiftlint",
|
|
42
42
|
"docgen": "docgen --api KeepAwakePlugin --output-readme README.md --output-json dist/docs.json",
|
|
43
|
-
"build": "npm run clean && vite build",
|
|
43
|
+
"build": "npm run clean && vite build && npm run generate-types",
|
|
44
|
+
"generate-types": "echo 'export interface KeepAwakePlugin { dontAllowSleep(): Promise<{ isAllowdSleep: boolean }>; allowSleep(): Promise<{ isAllowdSleep: boolean }>; } declare const KeepAwake: KeepAwakePlugin; export { KeepAwake };' > dist/esm/index.d.ts",
|
|
44
45
|
"clean": "rimraf ./dist",
|
|
45
46
|
"watch": "vite build --watch",
|
|
46
47
|
"prepublishOnly": "npm run build"
|