From 5f09d7169e649a320ee42c31a54657c28f9cb56d Mon Sep 17 00:00:00 2001 From: TheNoumanDev <76642732+TheNoumanDev@users.noreply.github.com> Date: Tue, 7 Oct 2025 15:30:01 +0500 Subject: [PATCH 1/2] updated the docs for Wakelock action --- pages/actions/_meta.json | 3 ++ pages/actions/wakelock.md | 62 +++++++++++++++++++++++++++++++++++++++ pages/device-object.md | 21 +++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 pages/actions/wakelock.md diff --git a/pages/actions/_meta.json b/pages/actions/_meta.json index 88198c4..fb1c600 100644 --- a/pages/actions/_meta.json +++ b/pages/actions/_meta.json @@ -175,5 +175,8 @@ }, "upload-files": { "title": "Upload Files" + }, + "wakelock": { + "title": "Wakelock" } } diff --git a/pages/actions/wakelock.md b/pages/actions/wakelock.md new file mode 100644 index 0000000..4281cd2 --- /dev/null +++ b/pages/actions/wakelock.md @@ -0,0 +1,62 @@ +# wakelock + +The wakelock action controls the device's screen wakelock, preventing the screen from automatically turning off while the app is in use. This is particularly useful for apps that display information users need to view continuously without interaction, such as recipe apps, navigation, or presentation modes. + +### Properties + +| Property | Type | Description | +| :--------- | :------ | :---------------------------------------------------------------------------------------------------- | +| enable | boolean | Controls the wakelock state. `true` to keep screen on, `false` to allow normal screen timeout. (default: true) | +| onComplete | action | Callback Action executed after the wakelock state is successfully changed | +| onError | action | Callback Action if wakelock operation fails. Error details available under 'error' field | + +**Example** + +```yaml +View: + header: + title: Wakelock Control + body: + Column: + styles: { gap: 16, padding: 24 } + children: + - Button: + label: Enable Wakelock + onTap: + wakelock: + enable: true + onComplete: | + //@code + status.text = 'Wakelock enabled - screen will stay on'; + onError: | + //@code + status.text = 'Error: ' + error; + - Button: + label: Disable Wakelock + onTap: + wakelock: + enable: false + onComplete: | + //@code + status.text = 'Wakelock disabled - normal screen timeout'; + - Button: + label: Check Wakelock Status + onTap: | + //@code + status.text = 'Wakelock is ' + (device.wakelockEnabled ? 'enabled' : 'disabled'); + - Text: + id: status + text: Press a button to control wakelock +``` + +### Use Cases + +- **Recipe/Cooking Apps**: Keep the screen on while users are following cooking instructions +- **Navigation**: Prevent screen timeout during route guidance +- **Presentations**: Keep display active during slideshows or demonstrations +- **Reading Apps**: Allow continuous reading without screen dimming +- **Fitness Apps**: Keep workout instructions visible during exercise sessions + +### Note + +The wakelock state can be checked at any time using `device.wakelockEnabled`, which returns `true` if the wakelock is currently active and `false` otherwise. diff --git a/pages/device-object.md b/pages/device-object.md index 12887f1..0594ded 100644 --- a/pages/device-object.md +++ b/pages/device-object.md @@ -51,3 +51,24 @@ View: - Text: text: Size of bottom area used by device is ${device.safeAreaBottom} ``` + +## device.wakelockEnabled + +Returns a boolean indicating whether the device's screen wakelock is currently active. When the wakelock is enabled (`true`), the screen will not automatically turn off due to inactivity. When disabled (`false`), the device follows its normal screen timeout settings. + +```yaml +View: + body: + Column: + styles: { gap: 16, padding: 24 } + children: + - Text: + text: Wakelock is ${device.wakelockEnabled ? 'enabled' : 'disabled'} + - Button: + label: Toggle Wakelock + onTap: + wakelock: + enable: ${!device.wakelockEnabled} +``` + +This property is useful for checking the current wakelock state before toggling it or displaying the status to users. See the [wakelock action](/actions/wakelock) for controlling the wakelock state. From af5f20c5b6d74664f648fc237f8b8f22113f09e8 Mon Sep 17 00:00:00 2001 From: TheNoumanDev <76642732+TheNoumanDev@users.noreply.github.com> Date: Tue, 7 Oct 2025 15:38:34 +0500 Subject: [PATCH 2/2] checking deployment --- pages/actions/_meta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/actions/_meta.json b/pages/actions/_meta.json index fb1c600..9b8596c 100644 --- a/pages/actions/_meta.json +++ b/pages/actions/_meta.json @@ -177,6 +177,6 @@ "title": "Upload Files" }, "wakelock": { - "title": "Wakelock" + "title": "Wakelock" } }