Skip to content

feat: auto-close live charge screen when charging stops#163

Open
vide wants to merge 1 commit intomainfrom
feature/auto-close-live-charge-on-stop
Open

feat: auto-close live charge screen when charging stops#163
vide wants to merge 1 commit intomainfrom
feature/auto-close-live-charge-on-stop

Conversation

@vide
Copy link
Owner

@vide vide commented Feb 13, 2026

Summary

Automatically closes the live charge screen and navigates back to the previous screen when the car stops charging. Since the live screen is designed for real-time updates, once charging completes, the charge is immediately available in the charges list and the live view is no longer needed.

Implementation

  • Added state tracking in CurrentChargeScreen to detect charging transitions
  • Uses LaunchedEffect to monitor isNotCharging flag changes
  • Triggers automatic navigation via onNavigateBack() when charging stops
  • Preserves existing fallback behavior when opening screen with no active charge

Key Files Modified

  • app/src/main/java/com/matedroid/ui/screens/charges/CurrentChargeScreen.kt
  • CHANGELOG.md

Behavior

Automatic close triggers when:

  • User is viewing the live charge screen
  • Car stops charging (detected via API polling every 30s)
  • Screen automatically navigates back

No automatic close when:

  • Screen is opened when car is already not charging (shows fallback message)
  • Charging resumes after stopping

Test Plan

  • Lint passed: ./gradlew lintDebug
  • Unit tests passed: ./gradlew testDebugUnitTest
  • Manual testing with real charging session
    • Start charging and open live screen
    • Stop charging (unplug or reach limit)
    • Verify screen auto-closes within 30 seconds
  • Edge case: Open screen when not charging (should show fallback, not auto-close)

🤖 Generated with Claude Code

Automatically navigate back to the previous screen when the car stops
charging. The live screen is meant for real-time updates, so once
charging completes, the charge is already available in the charges
list and the live view is no longer needed.

Implementation:
- Track charging state transitions in CurrentChargeScreen
- Detect when charging stops (was charging → now not charging)
- Automatically call onNavigateBack() to dismiss the screen
- Preserve existing behavior when opening screen with no active charge

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@vide vide force-pushed the feature/auto-close-live-charge-on-stop branch from 769d73b to ca43e43 Compare February 14, 2026 06:46
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.

1 participant