Skip to content

Conversation

@krugerk
Copy link
Contributor

@krugerk krugerk commented Nov 6, 2024

keep screen on, albeit dimmed, with active timer on timer screen

fixes: #268


private var idleTimer: Timer?
private var defaultBrightnessLevel: CGFloat = UIScreen.main.brightness
private let dimmedBrightnessLevel: CGFloat = 0.2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should be a function of the default brightness level? If the user has brightness turned low this could end up increasing it, right?



private var idleTimer: Timer?
private var defaultBrightnessLevel: CGFloat = UIScreen.main.brightness
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably capture the current value as late as possible (i.e. just before changing it), to minimize surprising behavior if the user changes brightness while on this screen?

resetButton.setTitle("Reset", for: .normal)
}

override func viewWillDisappear(_ animated: Bool) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to when leaving the screen, should we disable the brightness override when the app is moved to background?

self.timingSince = nil
}

resetIdleTimer()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lifecycle of "when we disable the screen" is a little surprising to me. In particular, we enter "do not sleep" mode when you start the timer, but do not leave it when you stop the timer. I'd suggest either enabling it as soon as the user enters the screen, or disabling it when the timer is not running.

@krugerk krugerk force-pushed the feature/268-do-not-let-screen-sleep-when-timer-running branch from 8cb1085 to 91c96c2 Compare November 15, 2024 22:38
@krugerk krugerk marked this pull request as draft January 8, 2025 11:38
@krugerk krugerk force-pushed the feature/268-do-not-let-screen-sleep-when-timer-running branch from a757ef6 to e9ad543 Compare January 27, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't let the screen go to sleep when the timer is running?

2 participants