diff --git a/vector/src/main/java/im/vector/app/core/epoxy/VectorEpoxyModel.kt b/vector/src/main/java/im/vector/app/core/epoxy/VectorEpoxyModel.kt index fcb5a473a4..e9dd72a6f2 100644 --- a/vector/src/main/java/im/vector/app/core/epoxy/VectorEpoxyModel.kt +++ b/vector/src/main/java/im/vector/app/core/epoxy/VectorEpoxyModel.kt @@ -30,24 +30,19 @@ import kotlinx.coroutines.cancelChildren /** * EpoxyModelWithHolder which can listen to visibility state change */ -abstract class VectorEpoxyModel : EpoxyModelWithHolder(), LifecycleOwner { +abstract class VectorEpoxyModel : EpoxyModelWithHolder(){ protected val coroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Main) - private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry(this) - - override fun getLifecycle() = lifecycleRegistry private var onModelVisibilityStateChangedListener: OnVisibilityStateChangedListener? = null @CallSuper override fun bind(holder: H) { super.bind(holder) - lifecycleRegistry.currentState = Lifecycle.State.STARTED } @CallSuper override fun unbind(holder: H) { - lifecycleRegistry.currentState = Lifecycle.State.DESTROYED coroutineScope.coroutineContext.cancelChildren() super.unbind(holder) }