Skip to content

Add lifecycle observer support for all listeners #25

@roxk

Description

@roxk

Requiring users to remove listeners in onDestroy is sub-optimal now that lifecycle-aware observer is a thing.

There are two approaches:

  1. Use lifecycle observer and remove the listener upon onDestroy
    • Pros
      • Less internal state is android-aware
    • Cons
      • Basically duplicating LiveData's functionality
  2. Expose e.g. session state as LiveData<SessionState>
    • Pros
      • Less work. Just works™
    • Cons
      • The internal state is lifecycle aware by default. Or, we can make authgear core listen to itself and dispatch stateLiveData.value = state in onSessionStateChanged to make it fully modular

Must:

  • Existing listener-based API must remain so that android apps which have not yet adopted lifecycle can still use the SDK

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions