[PR #1854] feat: Stay Awake mode — active sleep detection #1728

Open
opened 2026-04-25 00:00:52 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf-app/pull/1854
Author: @collaed
Created: 4/22/2026
Status: 🔄 Open

Base: masterHead: feat/stay-awake-mode


📝 Commits (1)

  • e6dc5da feat: Stay Awake mode — active sleep detection via periodic check-in

📊 Changes

3 files changed (+418 additions, -0 deletions)

View changed files

android/app/src/main/java/com/audiobookshelf/app/managers/StayAwakeManager.kt (+213 -0)
components/modals/StayAwakeModal.vue (+78 -0)
ios/App/Shared/player/StayAwakeManager.swift (+127 -0)

📄 Description

Stay Awake Mode

An alternative to the timer-based sleep feature. Instead of counting down a fixed duration, it periodically confirms the user is still awake.

How it works

  1. User enables Stay Awake mode from the sleep timer menu
  2. Every 15 minutes, a soft chime plays at 30% volume
  3. A Still listening? modal appears with a 60-second countdown
  4. User taps the checkmark → confirmed, interval extends
  5. Miss 1 check → volume drops to 50%, next check comes sooner
  6. Miss 2 checks → playback pauses, position bookmarked

Why?

The current sleep timer requires guessing how long you'll stay awake. Stay Awake mode detects when you actually stop responding — no guessing needed.

Shake-to-reset works for solo listeners, but not when your partner is sleeping next to you. A silent tap on a dimmed screen is the marriage-friendly option.

Changes

3 new files, 0 modified:

File Lines Description
StayAwakeManager.kt 190 Android — integrates with PlayerNotificationService
StayAwakeManager.swift 120 iOS — callback-based player integration
StayAwakeModal.vue 70 Shared UI — checkmark button with countdown

Integration needed

These are self-contained. To wire in:

  • PlayerNotificationService.kt: instantiate + add event emitters
  • iOS player controller: instantiate + connect callbacks
  • Sleep timer UI: add Stay Awake toggle
  • Store: stayAwakeActive state
  • Strings: localization

Optional server endpoint

A companion POST /api/sleep/report + GET /api/sleep/rewind/:bookId can store sleep events and suggest rewind points. Works with stock ABS or any compatible server.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf-app/pull/1854 **Author:** [@collaed](https://github.com/collaed) **Created:** 4/22/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `feat/stay-awake-mode` --- ### 📝 Commits (1) - [`e6dc5da`](https://github.com/advplyr/audiobookshelf-app/commit/e6dc5dabf5b39de2fec713fc14bbaea628bbf54a) feat: Stay Awake mode — active sleep detection via periodic check-in ### 📊 Changes **3 files changed** (+418 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `android/app/src/main/java/com/audiobookshelf/app/managers/StayAwakeManager.kt` (+213 -0) ➕ `components/modals/StayAwakeModal.vue` (+78 -0) ➕ `ios/App/Shared/player/StayAwakeManager.swift` (+127 -0) </details> ### 📄 Description ## Stay Awake Mode An alternative to the timer-based sleep feature. Instead of counting down a fixed duration, it periodically confirms the user is still awake. ### How it works 1. User enables **Stay Awake** mode from the sleep timer menu 2. Every 15 minutes, a soft chime plays at 30% volume 3. A **Still listening?** modal appears with a 60-second countdown 4. User taps the checkmark → confirmed, interval extends 5. Miss 1 check → volume drops to 50%, next check comes sooner 6. Miss 2 checks → playback pauses, position bookmarked ### Why? The current sleep timer requires guessing how long you'll stay awake. Stay Awake mode detects when you **actually stop responding** — no guessing needed. Shake-to-reset works for solo listeners, but not when your partner is sleeping next to you. A silent tap on a dimmed screen is the marriage-friendly option. ### Changes 3 new files, 0 modified: | File | Lines | Description | |------|-------|-------------| | `StayAwakeManager.kt` | 190 | Android — integrates with PlayerNotificationService | | `StayAwakeManager.swift` | 120 | iOS — callback-based player integration | | `StayAwakeModal.vue` | 70 | Shared UI — checkmark button with countdown | ### Integration needed These are self-contained. To wire in: - `PlayerNotificationService.kt`: instantiate + add event emitters - iOS player controller: instantiate + connect callbacks - Sleep timer UI: add Stay Awake toggle - Store: `stayAwakeActive` state - Strings: localization ### Optional server endpoint A companion `POST /api/sleep/report` + `GET /api/sleep/rewind/:bookId` can store sleep events and suggest rewind points. Works with stock ABS or any compatible server. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:00:52 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#1728