Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Migrate LiveData to Flow #68

Merged
merged 12 commits into from
Apr 8, 2022
Merged

Migrate LiveData to Flow #68

merged 12 commits into from
Apr 8, 2022

Conversation

Goooler
Copy link
Owner

@Goooler Goooler commented Mar 23, 2022

Comment on lines +22 to +26

val repoDetailModel: StateFlow<RepoDetailModel>
get() = _repoDetailModel.asStateFlow()
val isRefreshing: StateFlow<Boolean>
get() = _isRefreshing.asStateFlow()
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow up #57 (comment).

@Goooler Goooler added enhancement New feature or request housekeeping labels Mar 25, 2022
@Goooler Goooler added this to the 1.6.0 milestone Mar 25, 2022

@AnyThread
override fun showLoading() {
loading.postValue(true)
_loading.value = true
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current value of this state flow.
Setting a value that is equal to the previous one does nothing.
This property is thread-safe and can be safely updated from concurrent coroutines without external synchronization.

# Conflicts:
#	detail/src/main/kotlin/io/goooler/demoapp/detail/ui/RepoDetailActivity.kt
@Goooler
Copy link
Owner Author

Goooler commented Apr 5, 2022

Rebased from #75.

Comment on lines -270 to -183
@MainThread
inline fun <reified V, reified VM : BaseViewModel> V.baseViewModels(): Lazy<VM>
where V : LifecycleOwner, V : ViewModelStoreOwner = lazy(LazyThreadSafetyMode.NONE) {
ViewModelProvider(this)[VM::class.java].apply(lifecycle::addObserver)
}

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow up #75 (comment).

# Conflicts:
#	common/src/main/kotlin/io/goooler/demoapp/common/util/CommonExtensions.kt
#	obsolete/src/main/kotlin/io/goooler/demoapp/obsolete/util/ObsoleteExtensions.kt
@Goooler Goooler merged commit d0c61a2 into trunk Apr 8, 2022
@Goooler Goooler deleted the flow branch April 8, 2022 17:52
@Goooler Goooler mentioned this pull request Apr 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request housekeeping
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant