Skip to content

[Deprecated, too many LOC changed] MainViewModel and SendViewModel

Jørgen Svennevik Notland requested to merge jQrgen/wally:compose_send_vm into mp

Fixes "not currency" bug on send and implements the View/ViewModel Unidirectional State Flow pattern for Compose

WARNING: Replaced by: !157 (merged)

Separated concerns from the CommonApp and Compose Views+Screens into two ViewModels: MainViewModel - Handles accounts and selected account SendViewModel - Handler send view data such as address, amount and assets

Improves concurrency, readability and data access.

Using the ViewModel pattern is a de-fact standard for testing in Android which is being adopted by Compose Multiplatform

As Compose Multiplatform UI testing libs are maturing, this pattern is Compose UI test ready.

1_dp-AOa7xWrQsiMs_noX4Cw

A View uses the ViewModel to observe its current state

Ideally, one ViewModel per View plus some global ViewModels such as MainViewModel

For example: SendView can access functions in SendViewModel and MainViewModel and observe changes in SendState and MainState

This MR does not create any Repositories

  • Fix not currency error

This MR aims to resolve and close !154 (closed)

Edited by Jørgen Svennevik Notland

Merge request reports

Loading