Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 9cc60a05 authored by Evan Laird's avatar Evan Laird
Browse files

[Mobile] Create a child scope for mobile view models

MobileIconsViewModel was mistakenly using the @Application scope when
instantiating the child view models that are passed out to the status
bar. Instead, this change creates a child scope of the application scope
and tracks it along in the reuse cache so that the child scopes can be
properly canceled.

There is a discussion to be had about the existing architecture, namely
better ways that this problem could be fixed. We could find a different
way to solve the duplicate log problem (i.e., remove the need for
caching), remove the usage of `stateIn` for the view models, or find a
better place to bind the models to a single scope while in use. All of
these changes are potentially valid, though they would represent a
larger change. For now, creating child scopes should solve the issue at
hand.

Test: MobileIconsViewModelTest
Bug: 325198700
Flag: NONE
Change-Id: I7f2c6a1644620d2e16fb1dc8ad986fa3c6e01bd4
parent 230a6ecb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment