Skip to content

Commit

Permalink
Remove unnecessary receiver type enforcement (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
wax911 authored Apr 8, 2023
1 parent 12f6cc7 commit 65247cf
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 96 deletions.

This file was deleted.

4 changes: 2 additions & 2 deletions gradle/release.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=1.6.0
code=1000600000
version=1.6.1
code=1000600001
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import androidx.annotation.IntegerRes
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.Observer
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import androidx.paging.PagedList
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.Adapter.StateRestorationPolicy
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import co.anitrend.arch.domain.entities.LoadState
import co.anitrend.arch.extension.ext.attachComponent
import co.anitrend.arch.extension.ext.detachComponent
import co.anitrend.arch.extension.ext.repeatOn
import co.anitrend.arch.recycler.SupportRecyclerView
import co.anitrend.arch.recycler.adapter.SupportListAdapter
import co.anitrend.arch.recycler.adapter.contract.ISupportAdapter
Expand Down Expand Up @@ -88,17 +88,19 @@ abstract class SupportFragmentList<M> : SupportFragment(), ISupportFragmentList<
}

protected open fun ISupportAdapter<*>.registerFlowListener() {
lifecycleScope.repeatOn(Lifecycle.State.RESUMED) {
clickableFlow
.debounce(16)
.filterIsInstance<ClickableItem.State>()
.onEach {
if (it.state !is LoadState.Loading) {
viewModelState()?.retry()
} else {
Timber.d("retry -> state is loading? current state: ${it.state}")
}
}.collect()
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
clickableFlow
.debounce(16)
.filterIsInstance<ClickableItem.State>()
.onEach {
if (it.state !is LoadState.Loading) {
viewModelState()?.retry()
} else {
Timber.d("retry -> state is loading? current state: ${it.state}")
}
}.collect()
}
}
}

Expand Down Expand Up @@ -154,22 +156,26 @@ abstract class SupportFragmentList<M> : SupportFragment(), ISupportFragmentList<
override fun initializeComponents(savedInstanceState: Bundle?) {
attachComponent(supportViewAdapter)
attachComponent(listPresenter)
lifecycleScope.repeatOn(Lifecycle.State.RESUMED) {
listPresenter.stateLayout.interactionFlow
.debounce(16)
.filterIsInstance<ClickableItem.State>()
.onEach {
if (it.state !is LoadState.Loading) {
viewModelState()?.retry()
} else {
Timber.d("state is loading? current state: ${it.state}")
}
}.collect()
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
listPresenter.stateLayout.interactionFlow
.debounce(16)
.filterIsInstance<ClickableItem.State>()
.onEach {
if (it.state !is LoadState.Loading) {
viewModelState()?.retry()
} else {
Timber.d("state is loading? current state: ${it.state}")
}
}.collect()
}
}

lifecycleScope.repeatOn(Lifecycle.State.RESUMED) {
if (supportViewAdapter.isEmpty()) {
onFetchDataInitialize()
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
if (supportViewAdapter.isEmpty()) {
onFetchDataInitialize()
}
}
}
}
Expand Down

0 comments on commit 65247cf

Please sign in to comment.