16ffcca748
* add ktlint plugin to project and apply default code style * some manual adjustments, fix wildcard imports * update CONTRIBUTING.md * fix formatting
18 lines
478 B
Kotlin
18 lines
478 B
Kotlin
package com.keylesspalace.tusky.util
|
|
|
|
import androidx.annotation.CallSuper
|
|
import androidx.lifecycle.ViewModel
|
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
|
import io.reactivex.rxjava3.disposables.Disposable
|
|
|
|
open class RxAwareViewModel : ViewModel() {
|
|
val disposables = CompositeDisposable()
|
|
|
|
fun Disposable.autoDispose() = disposables.add(this)
|
|
|
|
@CallSuper
|
|
override fun onCleared() {
|
|
super.onCleared()
|
|
disposables.clear()
|
|
}
|
|
}
|