autodispose-lifecycle / com.uber.autodispose.lifecycle / LifecycleScopes

LifecycleScopes

class LifecycleScopes

Utilities for dealing with LifecycleScopeProviders. This includes factories for resolving Completable representations of scopes, corresponding events, etc.

Functions

resolveScopeFromLifecycle

static fun <E : Any> resolveScopeFromLifecycle(provider: LifecycleScopeProvider<E>): CompletableSource

Overload for resolving lifecycle providers that defaults to checking start and end boundaries of lifecycles. That is, they will ensure that the lifecycle has both started and not ended.

Note: This resolves the scope immediately, so consider deferring execution as needed, such as using defer.

static fun <E : Any> resolveScopeFromLifecycle(provider: LifecycleScopeProvider<E>, checkEndBoundary: Boolean): CompletableSource

Overload for resolving lifecycle providers allows configuration of checking "end" boundaries of lifecycles. That is, they will ensure that the lifecycle has both started and not ended, and otherwise will throw one of LifecycleNotStartedException (if returns null) or if the lifecycle is ended. To configure the runtime behavior of these exceptions, see AutoDisposePlugins.

Note: This resolves the scope immediately, so consider deferring execution as needed, such as using defer.

static fun <E : Any> resolveScopeFromLifecycle(lifecycle: Observable<E>, endEvent: E): CompletableSource
static fun <E : Any> resolveScopeFromLifecycle(lifecycle: Observable<E>, endEvent: E, comparator: Comparator<E>?): CompletableSource