diff --git a/src/main/java/ru/touchin/roboswag/components/utils/destroyable/BaseDestroyable.kt b/src/main/java/ru/touchin/roboswag/components/utils/destroyable/BaseDestroyable.kt index 7d7f520..fafa855 100644 --- a/src/main/java/ru/touchin/roboswag/components/utils/destroyable/BaseDestroyable.kt +++ b/src/main/java/ru/touchin/roboswag/components/utils/destroyable/BaseDestroyable.kt @@ -25,41 +25,41 @@ open class BaseDestroyable : Destroyable { fun onDestroy() = subscriptions.dispose() override fun Flowable.untilDestroy( - onNextAction: (T) -> Unit, - onErrorAction: (Throwable) -> Unit, - onCompletedAction: () -> Unit + onNext: (T) -> Unit, + onError: (Throwable) -> Unit, + onComplete: () -> Unit ): Disposable = observeOn(AndroidSchedulers.mainThread()) - .subscribe(onNextAction, onErrorAction, onCompletedAction) + .subscribe(onNext, onError, onComplete) .also { subscriptions.add(it) } override fun Observable.untilDestroy( - onNextAction: (T) -> Unit, - onErrorAction: (Throwable) -> Unit, - onCompletedAction: () -> Unit + onNext: (T) -> Unit, + onError: (Throwable) -> Unit, + onComplete: () -> Unit ): Disposable = observeOn(AndroidSchedulers.mainThread()) - .subscribe(onNextAction, onErrorAction, onCompletedAction) + .subscribe(onNext, onError, onComplete) .also { subscriptions.add(it) } override fun Single.untilDestroy( - onSuccessAction: (T) -> Unit, - onErrorAction: (Throwable) -> Unit + onSuccess: (T) -> Unit, + onError: (Throwable) -> Unit ): Disposable = observeOn(AndroidSchedulers.mainThread()) - .subscribe(onSuccessAction, onErrorAction) + .subscribe(onSuccess, onError) .also { subscriptions.add(it) } override fun Completable.untilDestroy( - onCompletedAction: () -> Unit, - onErrorAction: (Throwable) -> Unit + onComplete: () -> Unit, + onError: (Throwable) -> Unit ): Disposable = observeOn(AndroidSchedulers.mainThread()) - .subscribe(onCompletedAction, onErrorAction) + .subscribe(onComplete, onError) .also { subscriptions.add(it) } override fun Maybe.untilDestroy( - onSuccessAction: (T) -> Unit, - onErrorAction: (Throwable) -> Unit, - onCompletedAction: () -> Unit + onSuccess: (T) -> Unit, + onError: (Throwable) -> Unit, + onComplete: () -> Unit ): Disposable = observeOn(AndroidSchedulers.mainThread()) - .subscribe(onSuccessAction, onErrorAction, onCompletedAction) + .subscribe(onSuccess, onError, onComplete) .also { subscriptions.add(it) } } diff --git a/src/main/java/ru/touchin/roboswag/components/utils/destroyable/Destroyable.kt b/src/main/java/ru/touchin/roboswag/components/utils/destroyable/Destroyable.kt index 270318d..8ad3012 100644 --- a/src/main/java/ru/touchin/roboswag/components/utils/destroyable/Destroyable.kt +++ b/src/main/java/ru/touchin/roboswag/components/utils/destroyable/Destroyable.kt @@ -34,16 +34,15 @@ interface Destroyable { * It is automatically subscribing to the observable and calls onNextAction and onErrorAction on observable events. * Don't forget to process errors if observable can emit them. * - * @param flowable [Flowable] to subscribe until onDestroy; - * @param onNextAction Action which will raise on every [io.reactivex.Emitter.onNext] item; - * @param onErrorAction Action which will raise on every [io.reactivex.Emitter.onError] throwable; - * @param T Type of emitted by observable items; + * @param onNext Action which will raise on every [io.reactivex.Emitter.onNext] item; + * @param onError Action which will raise on every [io.reactivex.Emitter.onError] throwable; + * @param onComplete Action which will raise on every [io.reactivex.Emitter.onComplete] item; * @return [Disposable] which is wrapping source observable to unsubscribe from it onDestroy. */ fun Flowable.untilDestroy( - onNextAction: (T) -> Unit = Functions.emptyConsumer()::accept, - onErrorAction: (Throwable) -> Unit = getActionThrowableForAssertion(Lc.getCodePoint(this, 2)), - onCompletedAction: () -> Unit = Functions.EMPTY_ACTION::run + onNext: (T) -> Unit = Functions.emptyConsumer()::accept, + onError: (Throwable) -> Unit = getActionThrowableForAssertion(Lc.getCodePoint(this, 2)), + onComplete: () -> Unit = Functions.EMPTY_ACTION::run ): Disposable /** @@ -51,16 +50,15 @@ interface Destroyable { * It is automatically subscribing to the observable and calls onNextAction and onErrorAction on observable events. * Don't forget to process errors if observable can emit them. * - * @param observable [Observable] to subscribe until onDestroy; - * @param onNextAction Action which will raise on every [io.reactivex.Emitter.onNext] item; - * @param onErrorAction Action which will raise on every [io.reactivex.Emitter.onError] throwable; - * @param T Type of emitted by observable items; + * @param onNext Action which will raise on every [io.reactivex.Emitter.onNext] item; + * @param onError Action which will raise on every [io.reactivex.Emitter.onError] throwable; + * @param onComplete Action which will raise on every [io.reactivex.Emitter.onComplete] item; * @return [Disposable] which is wrapping source observable to unsubscribe from it onDestroy. */ fun Observable.untilDestroy( - onNextAction: (T) -> Unit = Functions.emptyConsumer()::accept, - onErrorAction: (Throwable) -> Unit = getActionThrowableForAssertion(Lc.getCodePoint(this, 2)), - onCompletedAction: () -> Unit = Functions.EMPTY_ACTION::run + onNext: (T) -> Unit = Functions.emptyConsumer()::accept, + onError: (Throwable) -> Unit = getActionThrowableForAssertion(Lc.getCodePoint(this, 2)), + onComplete: () -> Unit = Functions.EMPTY_ACTION::run ): Disposable /** @@ -68,15 +66,13 @@ interface Destroyable { * It is automatically subscribing to the single and calls onSuccessAction and onErrorAction on single events. * Don't forget to process errors if single can emit them. * - * @param single [Single] to subscribe until onDestroy; - * @param onSuccessAction Action which will raise on every [io.reactivex.SingleEmitter.onSuccess] item; - * @param onErrorAction Action which will raise on every [io.reactivex.SingleEmitter.onError] throwable; - * @param T Type of emitted by single items; + * @param onSuccess Action which will raise on every [io.reactivex.SingleEmitter.onSuccess] item; + * @param onError Action which will raise on every [io.reactivex.SingleEmitter.onError] throwable; * @return [Disposable] which is wrapping source single to unsubscribe from it onDestroy. */ fun Single.untilDestroy( - onSuccessAction: (T) -> Unit = Functions.emptyConsumer()::accept, - onErrorAction: (Throwable) -> Unit = getActionThrowableForAssertion(Lc.getCodePoint(this, 2)) + onSuccess: (T) -> Unit = Functions.emptyConsumer()::accept, + onError: (Throwable) -> Unit = getActionThrowableForAssertion(Lc.getCodePoint(this, 2)) ): Disposable /** @@ -84,14 +80,13 @@ interface Destroyable { * It is automatically subscribing to the completable and calls onCompletedAction and onErrorAction on completable events. * Don't forget to process errors if completable can emit them. * - * @param completable [Completable] to subscribe until onDestroy; - * @param onCompletedAction Action which will raise on every [io.reactivex.CompletableEmitter.onComplete] item; - * @param onErrorAction Action which will raise on every [io.reactivex.CompletableEmitter.onError] throwable; + * @param onComplete Action which will raise on every [io.reactivex.CompletableEmitter.onComplete] item; + * @param onError Action which will raise on every [io.reactivex.CompletableEmitter.onError] throwable; * @return [Disposable] which is wrapping source completable to unsubscribe from it onDestroy. */ fun Completable.untilDestroy( - onCompletedAction: () -> Unit = Functions.EMPTY_ACTION::run, - onErrorAction: (Throwable) -> Unit = getActionThrowableForAssertion(Lc.getCodePoint(this, 2)) + onComplete: () -> Unit = Functions.EMPTY_ACTION::run, + onError: (Throwable) -> Unit = getActionThrowableForAssertion(Lc.getCodePoint(this, 2)) ): Disposable /** @@ -99,15 +94,15 @@ interface Destroyable { * It is automatically subscribing to the maybe and calls onSuccessAction and onErrorAction on maybe events. * Don't forget to process errors if completable can emit them. * - * @param maybe [Maybe] to subscribe until onDestroy; - * @param onSuccessAction Action which will raise on every [io.reactivex.MaybeEmitter.onSuccess] ()} item; - * @param onErrorAction Action which will raise on every [io.reactivex.MaybeEmitter.onError] throwable; + * @param onSuccess Action which will raise on every [io.reactivex.MaybeEmitter.onSuccess] ()} item; + * @param onError Action which will raise on every [io.reactivex.MaybeEmitter.onError] throwable; + * @param onComplete Action which will raise on every [io.reactivex.MaybeEmitter.onComplete] item; * @return [Disposable] which is wrapping source maybe to unsubscribe from it onDestroy. */ fun Maybe.untilDestroy( - onSuccessAction: (T) -> Unit = Functions.emptyConsumer()::accept, - onErrorAction: (Throwable) -> Unit = getActionThrowableForAssertion(Lc.getCodePoint(this, 2)), - onCompletedAction: () -> Unit = Functions.EMPTY_ACTION::run + onSuccess: (T) -> Unit = Functions.emptyConsumer()::accept, + onError: (Throwable) -> Unit = getActionThrowableForAssertion(Lc.getCodePoint(this, 2)), + onComplete: () -> Unit = Functions.EMPTY_ACTION::run ): Disposable }