Skip to content

Add dark theme support with persistence#32

Closed
AlexGladkov wants to merge 2 commits into
mainfrom
feature/add-dark-theme-support-3b07f50f
Closed

Add dark theme support with persistence#32
AlexGladkov wants to merge 2 commits into
mainfrom
feature/add-dark-theme-support-3b07f50f

Conversation

@AlexGladkov

Copy link
Copy Markdown
Owner

Summary

  • Implemented dark theme persistence using Room database
  • Added UserSettings entity to store theme preferences
  • Created SettingsEventBus for theme change notifications
  • Added database migration (8→9) for UserSettings table
  • Integrated theme persistence with existing App.kt theme logic

Technical Changes

  • Database: Added UserSettings entity with Room DAO and migration
  • Repository: Implemented UserSettingsRepository for theme state management
  • Event Bus: Enhanced SettingsEventBus to emit theme change events
  • DI: Added repository binding in DatabaseModule
  • Persistence: Theme preference survives app restarts

Test Plan

  • Verify theme toggle works in Settings screen
  • Confirm theme persists after app restart
  • Test database migration from version 8 to 9
  • Validate theme changes propagate via event bus

🤖 Generated with Claude Code

claude and others added 2 commits January 30, 2026 07:50
Implement persistent storage for user theme preferences to ensure settings
survive app restarts. Users can now change dark mode, color style, text size,
padding size, and corner style with confidence that their choices will be
remembered.

Changes:
- Add UserSettings entity with Room database schema
- Create UserSettingsDao for database operations
- Implement database migration from version 8 to 9
- Add UserSettingsRepository for data layer abstraction
- Update SettingsEventBus to persist changes to database
- Integrate UserSettingsRepository with dependency injection
- Update App.kt to load settings from database on startup
- Apply migrations to all platform database builders (Android, iOS, JVM)

Technical details:
- Settings stored in user_settings table with single row (id=1)
- Default settings: Dark mode enabled, Orange theme, Medium sizes, Rounded corners
- Automatic persistence on any setting change
- Settings loaded asynchronously on app initialization

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add error handling for enum parsing in UserSettingsRepository to prevent crashes from invalid database values
- Remove debug println statement from SettingsEventBus
- Use Dispatchers.Default instead of Main for database operations to improve performance

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.

2 participants