Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#535] Add asStateFlow to the StateFlow variables in ViewModel class #545

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

kaungkhantsoe
Copy link
Contributor

What happened 👀

Currently we can emit values to our StateFlow variables by casting them to MutableStateFlow. We should update our StateFlow declarations to make them read-only

Insight 📝

  • Update our StateFlow declarations as follows:
    private val _uiModels = MutableStateFlow<List<UiModel>>(emptyList())
    val uiModels = _uiModels.asStateFlow()
    
  • Apply updates to template-compose and sample-compose ViewModels

Proof Of Work 📹

The application still runs as usual.

Screen.Recording.2023-10-19.at.4.34.47.PM.mov

@github-actions
Copy link

github-actions bot commented Oct 19, 2023

2 Warnings
⚠️ Uh oh! BaseViewModel.kt is under 95% coverage!
⚠️ Uh oh! Your project is under 80% coverage!

Kover report for template-compose:

🧛 Template - Compose Unit Tests Code Coverage: 63.04%

Coverage of Modified Files:

File Coverage
BaseViewModel.kt 73.91%
HomeViewModel.kt 100.00%

Modified Files Not Found In Coverage Report:

Codebase cunningly covered by count Shroud 🧛

Generated by 🚫 Danger

@kaungkhantsoe kaungkhantsoe temporarily deployed to template-compose October 20, 2023 04:10 — with GitHub Actions Inactive
@kaungkhantsoe kaungkhantsoe requested a review from luongvo October 20, 2023 04:10
@ryan-conway ryan-conway merged commit b90cbe3 into develop Oct 23, 2023
3 checks passed
@ryan-conway ryan-conway deleted the feature/535-add-asstateflow-to-viewmodel branch October 23, 2023 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add asStateFlow to the StateFlow variables in ViewModel class
7 participants