mirror of
https://github.com/AdrianKuta/KahootQuiz.git
synced 2025-09-14 17:24:21 +02:00
7d38facda575738fe169e6316c7d26dfae2b8650
This commit addresses issues with the question timer in `QuizScreen`. Key changes: - **QuizScreenViewModel:** - Initialize `_remainingTimeSeconds` to `0` instead of `-1` to prevent premature timer display. - Start timer only if `timerJob` is `null` (not already running) and it's the first question. - Set `timerJob` to `null` when it's cancelled (on choice selection, moving to next question, or finishing the quiz). - If a question has no time limit (null or <= 0 seconds), set `_remainingTimeSeconds` to `0` and do not start the `timerJob`. - When the timer finishes and no choice was selected, set `_selectedChoiceIndex` to `-1` (indicating time ran out) and ensure `timerJob` is nullified. - **QuizScreen:** - Conditionally display the `TimerBar` only if `selectedChoiceIndex` is `null` (no choice made yet) AND `timerState.totalTimeSeconds` is greater than `0` (meaning there's a valid timer for the current question). This prevents showing a timer when a question has no time limit.
Description
No description provided
Languages
Kotlin
100%