Skip to content

Releases: lwj1994/android_view_model

v0.4.0

Choose a tag to compare

@lwj1994 lwj1994 released this 02 Aug 12:30

Added

  • Add an English, skill-local Instagram architecture example showing a
    multi-root Compose app composed from API, repository, user, feed,
    post-detail, comment, and startup-coordinator ViewModels.
  • Add nestable, idempotently restorable overrideWith and coroutine-isolated
    runWithOverride APIs to zero- through four-argument ViewModel specs.
  • Add the strongly typed Compose selectViewModelState API with an optional
    selector-local equality rule.

Changed

  • Make ViewModel.reset() the complete runtime reset: it force-disposes every
    cached generation, including aliveForever, before clearing configuration
    and lifecycle observers.
  • Align full-state and selector equality with Flutter: full state uses local,
    global, then reference identity; selected values use local, global, then
    Kotlin ==.
  • Freeze each state transition before synchronous listener dispatch so a
    reentrant setState cannot corrupt later listeners' previous/current pair.
  • Make Compose watchViewModel and readViewModel re-resolve after their
    handle is recycled instead of retaining the disposed generation.
  • Make maybe*Cached return null only for ViewModelError; unrelated
    exceptions now propagate to the caller.

Fixed

  • Skip listeners removed before their turn during the current notification.
  • Contain failures thrown by the configured error handler so later listeners
    and disposal callbacks still run.
  • Preserve explicit null key/tag and false retention values from an active
    legacy or scoped spec proxy instead of falling back to the base spec.
  • Guard the complete reset sequence against teardown-triggered nested resets so
    remaining generations still use the outer error and lifecycle pipeline.
  • Throw ViewModelError consistently when resolving through a disposed
    binding.
  • Keep read-style Compose resolution and typed selectors subscribed only to
    generation changes, avoiding recomposition from unrelated watched
    ViewModels on the same binding.

Tests

  • Add serial contract coverage for reset, maybe lookup errors, listener
    mutation, reentrant state, equality fallback, secondary error handling, and
    scoped spec overrides, plus Compose recycle and typed-selector behavior.

v0.3.0

Choose a tag to compare

@lwj1994 lwj1994 released this 27 Jul 12:10

Removed

  • Remove the public ViewModelBinding.recreate API together with Manager,
    Store, and InstanceHandle in-place replacement logic, plus all
    InstanceAction / currentAction bookkeeping.
  • Remove the Compose ViewModelBuilder convenience function. Use
    watchViewModel(spec) for reactive spec-based resolution.

Changed

  • AutoDispose now observes handle disposal only. Owner paths, ViewModel
    listeners, binding-owned subscriptions, and dependency edges are no longer
    migrated between object generations.
  • Obtain a distinct instance with a new explicit key, or globally recycle the
    old generation and let a resolver property call watch/read(spec) again.

AndroidViewModel 0.2.2

Choose a tag to compare

@lwj1994 lwj1994 released this 27 Jul 10:36

Documentation

  • Make stable specs plus watch/read the unambiguous default in the README,
    bundled skill, project guidance, examples, and public API documentation.
  • Separate cached lookup into an advanced-only section and document its cache
    miss, creation-order, identity, and cross-owner lifecycle coupling.
  • Replace stored ViewModel references in the sample with resolver properties
    and remove unnecessary aliveForever retention.

v0.2.1

Choose a tag to compare

@lwj1994 lwj1994 released this 27 Jul 09:35

Fixed

  • Require an explicit key for every aliveForever spec, including root
    bindings as well as ViewModel-to-ViewModel dependencies. Invalid
    configurations now throw ViewModelError before the builder runs, while the
    Store enforces the same rule for internal factories.

Tests

  • Add root, nested, computed-key, and Store-boundary validation coverage while
    retaining single-fork, sequential unit-test execution.

v0.2.0

Choose a tag to compare

@lwj1994 lwj1994 released this 27 Jul 09:20

Highlights

  • Add a stable dependency binding owned by each parent ViewModel generation.
  • Preserve unkeyed child identity while shared-parent root owners join or leave.
  • Track direct and parent ownership paths independently with source-aware references.
  • Deduplicate synchronous watch propagation across diamond dependency graphs.
  • Make recycle global and preserve owners plus binding subscriptions during recreate.
  • Add construction rollback, cycle detection, reset-safe recreation, aligned docs, and serial test enforcement.

Migration notes

  • Repeated unkeyed specs of the same resolved ViewModel type now reuse one instance within a binding. Add distinct keys when multiple same-type instances are intentional.
  • Nested aliveForever dependencies now require an explicit key.
  • Resolve ViewModels through properties rather than by lazy or stored references so recycle/recreate can return the active generation.

Validation

  • :android-view-model:testDebugUnitTest
  • :android-view-model:assembleRelease
  • :android-view-model:lintRelease
  • :android-view-model:publishToMavenLocal

v0.1.1

Choose a tag to compare

@lwj1994 lwj1994 released this 07 Jun 08:14

JitPack release for AndroidViewModel.

Gradle dependency:

implementation("com.github.lwj1994:android_view_model:v0.1.1")

Build log: https://jitpack.io/com/github/lwj1994/android_view_model/v0.1.1/build.log

v0.1.0

Choose a tag to compare

@lwj1994 lwj1994 released this 06 Jun 03:39

Initial release of AndroidViewModel.\n\n- Package namespace is milu.viewmodel.\n- Example now consumes the library through Gradle Git source dependencies instead of project(":android-view-model").\n- README documents Maven-free Git source dependency usage.\n- Includes ViewModel, StateViewModel, ViewModelSpec, and ViewModelBinding support for Compose, Activity, Fragment, View, and plain classes.