From bdc822aefc90356620831e4d0988be1f295d3863 Mon Sep 17 00:00:00 2001 From: Yaroslav Heriatovych Date: Sat, 17 Dec 2016 19:29:02 +0000 Subject: [PATCH] bump version, add changelog --- CHANGES.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ build.gradle | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index a14141a..880ac19 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,57 @@ # Reductor Releases # +### Version 0.12.0 - December 17, 2016 + +#### New feature: Dispatcher and Cursor + +Introduced two interfaces, both implemented by `Store`: + +```java +public interface Dispatcher { + void dispatch(Object action); +} +``` + +```java +public interface Cursor { + State getState(); + Cancelable subscribe(StateChangeListener listener); +} +``` + +* `Cursor` responsible for retrieving the state and observing updates. +* `Dispatcher` responsible for dispatching actions. + +That allows you to expose `Store` functionality as interfaces to your components. + +##### State mapping + +Having `Cursor` interface, it is possible now to have `map` operation similar to `rx.Observable.map(func)`. +For that purpose new helper class `Cursors` with `map` function was introduced. +Usage example: + +```java +Store store = ...; +Cursor userCursor = Cursors.map(store, state -> state.getUser()); +//use mapped cursor in component +UserPresenter presenter = new UserPresenter(userCursor); +``` + +Mapped cursors allow your components to depend only on specific substate they need, instead of depending on the whole state, + knowing on how to get to particular substate. + +Current implementation of `map` will only propagate unique values, so it's more efficient to pass mapped `Cursor` +to upper levels of application. + +#### Other (breaking) changes + +* `store.forEach(listener)` was moved as static function to `Cursors.forEach(cursor, listeners)`; +* `action.getValue(index)` now returns generic parameter instead of Object. + +##### + +#### Breaking changes + ### Version 0.11.1 - November 30, 2016 Replaced `@Generated` annotation with just a comment diff --git a/build.gradle b/build.gradle index 8984c0f..3344ab1 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ buildscript { project.ext { bintrayUser = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : "" bintrayKey = project.hasProperty('BINTRAY_KEY') ? project.property('BINTRAY_KEY') : "" - reductorVersion = '0.11.1' + reductorVersion = '0.12.0' }