Skip to content
Snippets Groups Projects
Unverified Commit cec56fdb authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Refactor missused ViewModels, support automated UI tests and screenshots (EXPOSUREAPP-2946) (#1415)


* Introduced `TracingCardState` and `TracingDetailsState`.
Removed all direct viewmodel/livedata access from all nested layouts for `TracingViewModel`.
Removed `FormatterRiskHelper`.
Introduced logic to reactively update the UI state if bluetooth, location or tracing state changes.

TODO:
* Finish tests in TracingCardStateTest.kt and TracingDetailsStateTest.kt
* Finish TracingDetailsViewModel.kt and TracingCardViewModel.kt
* Remove obsolete dependencies on TracingViewModel.kt and singletons RiskLevelRepository.kt, TracingRepository.kt

* Breakthrough, cards update again.

* Further cleanup of TracingViewModel.kt, TracingRepository.kt
Still not quite there yet, too many calls going into every direction, back and forth, instead of just top->down, but we are getting there.
We want data flow from business logic code to the UI, keep the UI KISS.

* Update TracingCardState tests to account for changes

* More refactoring, TracingViewModel.kt is now finally gone.

* Fix risk details card, we reuse the cardviewmodel but need to overwrite the `showDetails` flag depending from where it's used.

* Refactored several properties (notification related) out of SettingsViewModel/Repository

* Fix injection

* Refactoring submission related databinding code on the home fragment

* Make TracingRepository.kt injectable and change viewmodel scoping for refresh calls to app scope.

* Remove additional formatter calls from submission cards on home screen.

* Refactored additional SubmissionViewModel logic into SubmissionRepository on the Homescreen.
First UI Test is now passing.

Simplified ViewModel instantiation related code.
Prepared HomeFragment for smoother UI state changes, less reloading.

* Improved home,tracing-details and tracing-settings loading behavior, less flickering.
Fixed LiveData value assignment on background-thread.

* New reactive provider for Bluetooth and Location status.
Cleaned up ConnectivityHelper.kt partially.

* Implement remaining tests, batch 1.

* Implement remaining tests, batch 2.

* Fix lint issues.

* Removed a few codesmells and code duplication.
Introduced Flow.shareLatest(...)

* Removed unused parameters.

* LINT fixes.

* Fix unit test failing due to missing mocks.

* Address PR comments.

* Improve UI loading states, remove flickering.

* Remove log spam due to polling values, add extra abort condition that checks for cancellation.

Co-authored-by: default avatarralfgehrer <mail@ralfgehrer.com>
parent 47af324b
No related branches found
No related tags found
Loading
Showing
with 289 additions and 214 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment