~captainepoch/husky

ref: 1c9021346e976f8f139aa10f7f2541581dd9bc2b husky/husky/app/src/main/java/com/keylesspalace/tusky/core/ui/viewmodel/RegisteredViewModel.kt -rw-r--r-- 524 bytes
1c902134Adolfo Santiago Create RegisteredViewModel for ViewModels with services 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.keylesspalace.tusky.core.ui.viewmodel

import com.zhuinden.simplestack.ScopedServices
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable

abstract class RegisteredViewModel : BaseViewModel(), ScopedServices.Registered {

    private val compositeDisposable = CompositeDisposable()

    override fun onServiceUnregistered() {
        compositeDisposable.clear()
    }

    fun addDisposable(disposable: Disposable) {
        compositeDisposable.add(disposable)
    }
}