Skip to content

Conversation

@xenonnn4w
Copy link
Contributor

@xenonnn4w xenonnn4w commented Jan 14, 2026

Purpose / Description/ Approch

Wire the CardTemplateEditorViewModel to CardTemplateEditor Activity.

  • Add viewModel by viewModels<CardTemplateEditorViewModel>()
  • Setup state collection using lifecycleScope.launch { repeatOnLifecycle(STARTED) }
  • Handle state changes (shouldFinish, error, message)
  • Wire tab selection to update ViewModel state

Links without closing (Part of)

Based on

How Has This Been Tested?

No regressions obtained, and all TemplateEditorViewModelTest passes.

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@xenonnn4w
Copy link
Contributor Author

The when block for UserMessage includes SaveSuccess and CantAddTemplateToDynamic with generic placeholder strings (dialog_ok, multimedia_editor_something_wrong). Nothing in the ViewModel currently triggers these messages. Will be updated follow up PR.

@lukstbit lukstbit added the Blocked by dependency Currently blocked by some other dependent / related change label Jan 14, 2026
Introduce CardTemplateEditorViewModel and CardTemplateEditorState as
the foundation for migrating CardTemplateEditor to use the Rust
backend's atomic updateNotetype() API.

Part 1 of migration, infrastructure only, no behavioral changes yet.
Connect CardTemplateEditorViewModel to CardTemplateEditor Activity:
- Add viewModel declaration using viewModels delegate
- Add state collection with lifecycleScope + repeatOnLifecycle
- Wire tab selection to viewModel.setCurrentTemplateOrd()
- Handle sealed class states (Loading, Loaded, Error, Finished)

Part 2 of migration, infrastructure wiring, no behavioral changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocked by dependency Currently blocked by some other dependent / related change Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants