Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RxLifecycle Extensions #353

Merged
merged 6 commits into from
May 15, 2019
Merged

RxLifecycle Extensions #353

merged 6 commits into from
May 15, 2019

Conversation

ShaishavGandhi
Copy link
Collaborator

No description provided.

@ShaishavGandhi ShaishavGandhi self-assigned this May 15, 2019
Copy link
Collaborator

@ZacSweers ZacSweers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but address comments before merging

/**
* Extension that converts a [LifecycleProvider] to [ScopeProvider].
*/
fun <E> LifecycleProvider<E>.toScopeProvider(event: E? = null): ScopeProvider {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline. Also - convention is to call this scope

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CheckReturnValue
inline fun <T, E> Flowable<T>.autoDisposable(lifecycleProvider: LifecycleProvider<E>, event: E? = null): FlowableSubscribeProxy<T> {
return if (event == null) {
this.`as`(AutoDispose.autoDisposable(RxLifecycleInterop.from(lifecycleProvider)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we reuse the toScopeProvider function for all of these impls?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

override fun <T : Any?> bindUntilEvent(event: Event): LifecycleTransformer<T> {
TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's stub these with a more descriptive TODO

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShaishavGandhi
Copy link
Collaborator Author

you could simplify all of these to just a single this.as(AutoDispose.autoDisposable(lifecycleProvider.scope(event))) since event is nullable

D'oh that's right. Will update.

@ShaishavGandhi ShaishavGandhi merged commit 7a83e77 into master May 15, 2019
@ShaishavGandhi ShaishavGandhi deleted the sg/rxlifecycle-extensions branch May 15, 2019 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants