This repository has been archived by the owner on Mar 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 101
Let manageSubscription(Subscription) return Subscription #59
Labels
Comments
Don't get the benefit here.
I can also first out the subscription to an field and then put it to the
`mangeSubscription`...
```java
mSub = Observable.stuff();
rxHelper.manageSub(mSub);
```
…On Jan 9, 2017 7:05 PM, "Pascal Welsch" ***@***.***> wrote:
RxTiPresenterSubscriptionHandler.manageSubscription(Subscription...)
returns void. It would be cool if there is a manageSubscription function
with the following signature:
public Subscription ***@***.*** final Subscription subscription)
Usage
// inside TiPresenter
val rxHelper: RxTiPresenterSubscriptionHandler(this)val sub: Subscription? = null
/** * download some data */fun download() {
// subscription is managed, it will be cancelled when the Presenter gets destroyed
sub = rxHelper.manageSubscription(myService.downloadSomething().subscribe{ data ->
sendToView { view -> view.showData(data) }
})
}
/** * cancel download before it completes */fun cancelDownload() {
sub?.unsubscribe()
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#59>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJwYe4Q0qsEHYNY-y2r7g4wvluIjfK80ks5rQnb_gaJpZM4LejWk>
.
|
right now: mSub = someObservable.subscribe();
rxHelper.manageSubscription(mSub); proposed: mSub = rxHelper.manageSubscription(someObservable.subscribe()) it saves one line of code 😄 |
Does it any sense, with the current implementation? |
of course we have to change the interface and add a new method. We can still change the public API because manageSubscription with varargs is only released in rc builds. // for single subscriptions
public Subscription manageSubscription(Subscription sub);
// for multiple
public void manageSubscriptions(Subscription... subs); |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
RxTiPresenterSubscriptionHandler.manageSubscription(Subscription...)
returns void. It would be cool if there is amanageSubscription
function with the following signature:Usage
The text was updated successfully, but these errors were encountered: