Skip to content

Releases: rainbowcake/rainbowcake

1.6.0

28 Sep 21:27
13f7080
Compare
Choose a tag to compare

1.6.0

Twenty-second release of RainbowCake.

What's new

  • Added a removeObserver method to LiveDataCollection

Dependency updates

  • Kotlin 1.5.31

1.5.0

31 Aug 08:57
8054c98
Compare
Choose a tag to compare

Twenty-first release of RainbowCake.

What's new

Dagger Hilt support

Using Dagger Hilt? RainbowCake now has you covered! Huge thanks to stewe93 for contributing this.

  1. Include the new Hilt artifact:

    implementation "co.zsmb:rainbow-cake-hilt:$rainbow_cake_version"
  2. Set up Hilt following the official Android guide.

  3. Call into the getViewModelFromFactory function of the co.zsmb.rainbowcake.hilt package in
    your Activities or Fragments.

Check out the hilt-demo module for an example of a basic setup.

Note: You may also use multiple DI solutions within the same RainbowCake project simultaneously, for example if you're migrating a project piece by piece. Even shared ViewModels will work!

There is now a Blank Hilt starter project available showcasing a blank app set up with RainbowCake's Hilt support.

Dependency updates

  • Android Gradle Plugin 7.0.1
  • Kotlin 1.5.30
  • Coroutines 1.5.1
  • AppCompat 1.3.1
  • ConstraintLayout 2.1.0
  • Material 1.4.0
  • Lifecycle 2.3.1
  • Dagger 2.38.1
  • Koin 3.1.2
  • Timber 5.0.0

1.4.0

10 Jun 19:38
7084d60
Compare
Choose a tag to compare

Twentieth release of RainbowCake.

What's new

Integration of requireKTX

Instead of providing its own extensions for requiring values from Bundles, RainbowCake now depends on requireKTX to handle these operations. The require style methods in RainbowCake are now deprecated and will be removed.

Updated Koin module to use Koin 3.x

Migrated the Koin integration module from 2.x to 3.x, including the change of dependency coordinates from org.koin to io.insert-koin. For more about the 3.x version of Koin, see its documentation.

Thanks to Benjiko99 for notifying me about this change.

Minor things

  • Expose a CoroutineScope as the receiver of the lambda passed to execute methods
  • Mark ioContext as @InternalRainbowCakeApi instead of using deprecations on it
  • Migrate to an up-to-date Maven publishing setup

Dependency updates

  • Removed jcenter as a dependency
  • Android Gradle Plugin 4.2.1
  • Kotlin 1.5.10
  • Coroutines 1.5.0
  • AppCompat 1.3.0
  • Material 1.3.0
  • Lifecycle 2.3.1
  • Dagger 2.36
  • Koin 3.0.2
  • ConstraintLayout 2.0.4

1.3.0

01 Dec 16:02
a5c24c5
Compare
Choose a tag to compare

Nineteenth release of RainbowCake.

What's new

Support for DialogFragment and BottomSheetDialogFragment

RainbowCake now ships two classes for supporting special kinds of Fragments. Using the new RainbowCakeDialogFragment and RainbowCakeBottomSheetDialogFragment (now isn't that a mouthful!) classes works very similarly to using RainbowCakeFragment.

Thanks to julienherrero for their contribution that kicked this off.

Dependency updates

  • Kotlin 1.4.20
  • Android Gradle Plugin 4.1.1

1.2.0

29 Oct 20:34
a9360cc
Compare
Choose a tag to compare

Eighteenth release of RainbowCake.

What's new

Eased requirements for layout inflation in RainbowCakeFragments

Previously, this base Fragment strictly required overriding the getViewResource method, and inflated the layout returned from that method in onCreateView, which was also mandatory to call if overridden.

This was inconvenient when using View Binding or Data Binding, so now:

  • getViewResource is no longer abstract, instead it returns 0 by default. If you don't override getViewResource, you must override onCreateView.
  • Overriding onCreateView no longer requires a call to the super method.

Introduced the @InternalRainbowCakeApi opt-in annotation

This annotation is only for internal use between RainbowCake's modules. Previous visibility hacks have been replaced with this new annotation. You should generally avoid opting into its usage, as it's not guaranteed public API.

The coroutineScope used by RainbowCakeViewModel is now exposed as @InternalRainbowCakeApi for extensions that need access to this scope.

Small changes

  • Removed the Application receiver of the rainbowCake configuration function, to make it easier to call

Dependency updates

  • Kotlin 1.4.10
  • Android Gradle Plugin 4.1.0
  • Dagger 2.29.1
  • Gradle wrapper 6.7
  • AndroidX libraries to latest versions

1.1.0

26 Aug 20:10
e8d206e
Compare
Choose a tag to compare

Seventeenth release of RainbowCake.

What's new:

Kotlin 1.4 update

The project is now compiled with Kotlin 1.4, the latest stable version of Kotlin 🎉. This cleaned up a bit of the implementation, and most importantly, all library modules now have explicit API mode enabled, ensuring that all public API is explicitly marked as public.

Small things

  • Fixed an issue with built-in logging #16 (Thanks to Tamás Vágó!)
  • Updated target and compile SDK versions to 30
  • Version updates for various dependencies

1.0.0

27 Jun 14:38
0330d41
Compare
Choose a tag to compare

Sixteenth release of RainbowCake.

What's new:

Removed deprecated constructs

A handful or previously deprecated pieces of code are now removed. If you want to migrate away from them, use 0.7.0 and IDE migration features before upgrading to 1.0.0.

  • JobViewModel: replace usages with RainbowCakeViewModel
  • RainbowCakeViewModel#postEvent: update view state from the UI thread instead
    _ Navigation extensions in co.zsmb.rainbowcake.extensions: use the methods from the co.zsmb.rainbowcake.navigation.extensions package instead
  • The rainbow-cake-channels artifact: use Flows instead

Small stuff

  • ViewModels are now initialized in onCreate instead of onAttach
  • Decoupled event dispatches, no synchronous, blocking dispatch anymore for either state or events
  • Improved internal logging
  • Updated Koin & Dagger to latest version
  • Updated visibility of a lots of things
  • Optimizations, more inline methods and helpers
  • Code documentation updates
  • Small bugfixes

0.7.0

24 May 17:43
f821ed6
Compare
Choose a tag to compare

Fifteenth release of RainbowCake.

What's new:

AndroidX migration

RainbowCake has been migrated to AndroidX dependencies instead of the support libraries, and no longer supports projects built on the support library. A year and a half after release of AndroidX, this seemed like a reasonable time to make the jump.

JobViewModel deprecation

The JobViewModel class that provides the coroutine integration of the framework (via execute) is now deprecated, and will be removed in a couple releases. Its functionality has been pulled up into the RainbowCakeViewModel base class, which now handles view state, events, and coroutine support. Having just one ViewModel base class in the framework should make things less confusing.

Please replace any usages of JobViewModel with RainbowCakeViewModel (you get IDE support for this, so it should be trivial).

Channel module deprecation

The rainbow-cake-channels module has been deprecated, and will be removed in an upcoming release entirely. Coroutine Flows should replace most usages of channels at this point.

Small stuff

  • Some method visibilities have been restricted in RainbowCakeFragment. These method should not be called anywhere outside of descendants of the Fragment.
  • The observeStateAndEvents testing function now has a variant that can observe queued events, in addition to view state and events.
  • The requireArguments method is now deprecated, as the AndroidX Fragment class includes the method, making the extension unnecessary.
  • Added some new unit tests for SingleShotLiveData.
  • Small project configuration updates, dependency version bumps, etc.

0.6.0

22 Mar 17:49
08604a2
Compare
Choose a tag to compare

Fourteenth release of RainbowCake.

What's new:

Small stuff

  • The reified popUntil extension used to return Unit instead of Boolean, which is what the original method returns to indicate if popping happened. Fixed!
  • ViewModel instances are now set in onAttach instead of onCreate. Because there was no real reason to wait until onCreate to do this.
  • ViewModelProviders has been deprecated, so now ViewModelProvider is being used directly.
  • Version updates (Gradle 6.2.2, AGP 3.6.1, Kotlin 1.3.70).
  • Revamped publishing setup for the libraries.

0.5.0

01 Nov 15:05
Compare
Choose a tag to compare

Thirteenth release of RainbowCake.

What's new:

Internal changes to ViewModel scopes

Instead of implementing CoroutineScope in JobViewModel, it now contains a CoroutineScope instance, which falls in line with many recommendations regarding scopes, as well as the classic advice of favouring composition over inheritance.

This should be an internal only change, but if you've been abusing the scope interface on ViewModels to launch coroutines on them from Fragments, it's a potentially breaking change.

First release of rainbow-cake-test

The architecture now ships with a dedicated testing module, which supports unit testing the architecture (Yay! 🎉). This testing module is in an experimental status, as it itself relies on experimental coroutine testing libraries at this point.

Presenter testing

For Presenter tests, you can use the PresenterTest base class, which will replace the IO dispatcher used in Presenters with the test dispatcher, to make it execute immediately:

ViewModel testing

For ViewModel tests, you can use the ViewModelTest base class, which will replace the Main dispatcher used by the execute method with the test dispatcher, and also replace the internal LiveData executor with a mock executor that executes everything on a single thread, in a blocking manner.

The difficult part of testing ViewModels is having to observe their reactions to inputs through various LiveData-based mechanisms - both state changes and events work this way. To make this easy, the rainbow-cake-test library provides the observeStateAndEvents function that lets you assert changes to state, as well as any emitted events:

vm.observeStateAndEvents { stateObserver, eventsObserver ->
    vm.loadArticle(1L)
    stateObserver.assertObserved(Loading, ArticleLoaded())
    vm.loadArticle(-1L)
    eventsObserver.assertObserved(InvalidIdError)
}

See the extensions on the MockObserver class for the currently available assertions. Note that you can also add your own assertion extensions on this class, as needed.

All other tests

Testing other, lower level components such as Interactors or Data Sources should not require additional support from the architecture. You can use the experimental coroutines test library to wrap such tests in runBlockingTest calls.