Skip to content

MVVM Refactor Phase 1: App shell, Settings and Home - #49

Open
kara-melvin wants to merge 16 commits into
mainfrom
mvvm-refactor-summer26
Open

kara-melvin wants to merge 16 commits into
mainfrom
mvvm-refactor-summer26

Conversation

@kara-melvin

Copy link
Copy Markdown
Collaborator

Migrates the app shell (AppViewModel), SettingsScreen, and HomeScreen to the new StateViewModel single-immutable-state pattern.

  1. StateViewModel base class and UserMessage (one-shot messages as state)
  2. SettingsRepository as single source of truth over both the pref files
  3. MainActivity slimmed down. Composables in MainActivity (AppNavHost/ConversationChatScreen) were pulled into their own files.
  4. Deep link conversation IDs are now validated at the trust boundary.
  5. AppViewModel test suite + test infrastructure (MainDispatchRule, FakeSettingsRepository)

Kara added 16 commits June 22, 2026 14:03
…e DI bindings in GlobalApp.kt. This wraps both prefs files (settings/project_mesh_prefs) and exposes StateFlows from prefs with single-writer setters.
…s. Removed redundant coroutine calls/navigation code. Tested on 1 physical device.
…nActivity still uses its old state). AppViewModel is the first consumer of StateViewModel.
…now route through SettingsRepository setters, Home collects deviceName and the server-restart toast lives in a temporary Settings-composable. MainActivity's setContent block is rewritten onto AppViewModel with collectAsStateWithLifeCycle, deep-link parsing and LocalUtil.applyLocale. Device test works.
…server restarts. Toasts are migrated to userMessage state. SettingsScreen drops all 6 callbacks and collects our new immutable state. AppNavHost's Settings composable collapses to SettingsScreen().
…sly from SettingsRepository before launching.
…el. This left AppViewModel with no userMessage producer. We pulled out the dead code.
…Model + 4 loose stateflows. deviceName and concurrency_supported now mirror SettingsRepository. HomeScreen loses its deviceName param, StartHomeScreen loses its viewModel default param
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@umbrai

umbrai commented Sep 3, 2026

Copy link
Copy Markdown

To my understanding, this is just a more uniform way for each screen to work with its corresponding ViewModel, so the screens shouldn't be changed to any extent that would affect my audit?

@peter6718

Copy link
Copy Markdown

I agree with Tomas, this seems like a uniform communication between each screen and its ViewModel, with a UIState and public entry points. The only thing that I see that affects audit/design work is the small change on line 63 in BottomNavHost.kt that changed the label pixel size from 7.5 to 10.5.

@Alister117

Copy link
Copy Markdown

Based off the fact that seemingly the home and settings screen will be affected the most, its still safe to say the the app will work similarly as the old one, at least from the outside point of view. I see that Kara's addition of SettingsRepository fixes data managment, and how the structure of the program was shifted though SettingsScreenViewModel. The app should still behave like the old version, since none of the changes would signal the user that things did in fact change yes?

@Mathhew02

Copy link
Copy Markdown

Observation: doesn't seem to change any UI/behavior on my end, just confirms the app is still on SharedPreferences for now.

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.

5 participants