Skip to content

Commit 440bd7e

Browse files
committed
Update changelog
1 parent 9844d5b commit 440bd7e

File tree

4 files changed

+98
-41
lines changed

4 files changed

+98
-41
lines changed

Diff for: CHANGELOG.md

+40-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1-
## Unreleased
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
---
9+
10+
## [Unreleased]
11+
12+
---
13+
14+
## [0.6.0]
215

316
### Added
417

518
- All missing ios, watchos, tvos and macos simulator targets added
619
- Added `androidNativeX64` and `androidNativeX86` targets
720
- Added proper android release and debug variants instead of piggybacking on jvm artefact
21+
- New and improved `typedReducer` and `createTypedStore` builders for those needing a simple action-typed store.
22+
Recommended to use with sealed interface hierarchies.
823

924
### Changed
1025

@@ -16,50 +31,74 @@
1631

1732
- Remove deprecated `wasm32` target
1833

34+
---
35+
1936
## [0.5.5] - 2020-08-16
2037

2138
- update to Kotlin 1.4.0
2239
- added platforms (androidNativeArm32, androidNativeArm64, iosArm32, linuxArm64, linuxX64,
2340
mingwX86, tvosArm64, tvosX64, watchosArm32, watchosArm64, watchosX86)
2441
- remove spek & atrium deps and use plain kotlin tests & assertions. Tests run for all platforms now.
2542

43+
---
44+
2645
## [0.5.2] - 2020-07-03
2746

2847
- publish all available platforms to maven
2948
- add CI/CD through github actions
3049

50+
---
51+
3152
## [0.5.1] - 2020-06-11
3253

3354
- update lib dependency to api import, so core lib is included in redux-kotlin-threadsafe
3455

56+
---
57+
3558
## [0.5.0] - 2020-06-11
3659

3760
- kotlin 1.3.72
3861
- createThreadSafeStore fun added for thread synchronized access
3962
- createEnsureSameThreadStore to provide existing same-thread-enforcement
4063

64+
---
65+
4166
## [0.4.0] - 2020-03-23
4267

4368
- kotlin 1.3.70
4469

70+
---
71+
4572
## [0.3.2] - 2020-02-22
4673

4774
- issue #34 - incorrect same thread enforcement behavior fixed
4875

76+
---
77+
4978
## [0.3.1] - 2019-12-16
5079

5180
### Changed
5281

5382
- update same thread enforcement message to not be getState only
5483

84+
---
85+
5586
## [0.3.0] - 2019-12-16
5687

5788
### Added
5889

5990
- thread enforcement
6091

92+
---
93+
6194
## [0.2.9] - 2019-11-23
6295

6396
### Changed
6497

6598
- update Kotlin to 1.3.60
99+
100+
---
101+
102+
[Unreleased]: https://github.com/reduxkotlin/redux-kotlin/compare/v0.6.0...HEAD
103+
[0.6.0]: https://github.com/reduxkotlin/redux-kotlin/compare/v0.5.5...0.6.0
104+
[0.5.5]: https://github.com/reduxkotlin/redux-kotlin/releases/tag/v0.5.5

Diff for: README.md

+46-24
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
![badge][badge-linux]
1010
![badge][badge-windows]
1111
![badge][badge-mac]
12-
[![Slack chat](https://img.shields.io/badge/kotlinlang-%23redux-green?logo=slack&style=flat-square)](https://kotlinlang.slack.com/archives/C8A8G5F9Q)
12+
[![Slack chat](https://img.shields.io/badge/kotlinlang-%23redux-green?logo=slack&style=flat-square)][slack]
1313
[![Dokka docs](https://img.shields.io/badge/docs-dokka-orange?style=flat-square&logo=kotlin)](http://reduxkotlin.github.io/redux-kotlin)
1414
[![Version maven-central](https://img.shields.io/maven-central/v/org.reduxkotlin/redux-kotlin?logo=apache-maven&style=flat-square)](https://mvnrepository.com/artifact/org.reduxkotlin/redux-kotlin/latest)
1515
[![Version maven-snapshot](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Foss.sonatype.org%2Fcontent%2Frepositories%2Fsnapshots%2Forg%2Freduxkotlin%2Fredux-kotlin%2Fmaven-metadata.xml&logo=apache-maven&label=maven-snapshot&style=flat-square)](https://oss.sonatype.org/content/repositories/snapshots/org/reduxkotlin/redux-kotlin/)
@@ -18,23 +18,29 @@ A redux standard for Kotlin that supports multiplatform projects.
1818

1919
Full documentation at http://reduxkotlin.org.
2020

21-
## Misson Statement
21+
## Mission Statement
2222

23-
Provide a standard redux implementation for Kotlin. In doing so will foster a ecosystem of middleware, store
23+
Provide a standard redux implementation for Kotlin. In doing so will foster a ecosystem of
24+
middleware, store
2425
enhancers, & dev tools. These core values will guide descisions for the project:
2526

2627
* core redux-kotlin will be a minimal implementation that other libraries can build upon
2728
* modular development (follow example of https://github.com/reduxjs)
2829
* support for all platforms supported by Kotlin multiplatform (JVM, iOS, Native, JS, WASM)
29-
* developed in open and enable discussion for all interested parties via open channels (slack, github, etc. TBD)
30+
* developed in open and enable discussion for all interested parties via open channels (slack,
31+
github, etc. TBD)
3032
* not owned by a individual or company
3133

32-
Redux in Kotlin, and in mobile in particular, may differ a bit from javascript. Many have found the basic pattern useful
33-
on Android & iOS leading to tens of opensource redux libraries in Kotlin, Java, and Swift, yet an ecosystem has yet to
34-
emerge. A port of javascript redux is a good starting point for creating a standard and will aid in cross-pollination of
34+
Redux in Kotlin, and in mobile in particular, may differ a bit from javascript. Many have found the
35+
basic pattern useful
36+
on Android & iOS leading to tens of opensource redux libraries in Kotlin, Java, and Swift, yet an
37+
ecosystem has yet to
38+
emerge. A port of javascript redux is a good starting point for creating a standard and will aid in
39+
cross-pollination of
3540
middleware, store enhancers, & dev tools from the javascript world.
3641

37-
Redux has proven helpful for state management in mobile. A multiplatform Kotlin implementation & ecosystem will increase
42+
Redux has proven helpful for state management in mobile. A multiplatform Kotlin implementation &
43+
ecosystem will increase
3844
developer productivity and code reuse across platforms.
3945

4046
[Droidcon NYC Slides](https://www.slideshare.net/PatrickJackson14/reduxkotlinorg-droidcon-nyc-2019)
@@ -44,31 +50,35 @@ Video TBA
4450

4551
__How to add to project:__
4652

47-
Artifacts are hosted on maven central. They are published with gradle metadata, so you may need to enable
48-
with `enableFeaturePreview("GRADLE_METADATA")` in your settings.gradle file. For multiplatform, add the following to
53+
Artifacts are hosted on maven central. They are published with gradle metadata, so you may need to
54+
enable
55+
with `enableFeaturePreview("GRADLE_METADATA")` in your settings.gradle file. For multiplatform, add
56+
the following to
4957
your shared module:
5058

5159
```kotlin
5260
kotlin {
5361
sourceSets {
5462
commonMain { // <--- name may vary on your project
5563
dependencies {
56-
implementation("org.reduxkotlin:redux-kotlin-threadsafe:0.5.5")
64+
implementation("org.reduxkotlin:redux-kotlin-threadsafe:_")
5765
}
5866
}
5967
}
68+
}
6069
```
6170

6271
For JVM only:
6372

6473
```kotlin
65-
implementation("org.reduxkotlin:redux-kotlin-threadsafe-jvm:0.5.5")
74+
implementation("org.reduxkotlin:redux-kotlin-threadsafe-jvm:_>")
6675
```
6776

6877
*Non threadsafe store is available. Typical usage will be with the threadsafe
6978
store. [More info read here](https://www.reduxkotlin.org/introduction/getting-started)
7079

71-
Usage is very similar to JS Redux and those docs will be useful https://redux.js.org/. These docs are not an intro to
80+
Usage is very similar to JS Redux and those docs will be useful https://redux.js.org/. These docs
81+
are not an intro to
7282
Redux, and just documentation on Kotlin specific bits. For more info on Redux in general, check
7383
out https://redux.js.org/.
7484

@@ -136,11 +146,13 @@ You then will have access to dispatch and subscribe functions from the `store`.
136146
__Create a synchronized store__
137147

138148
```kotlin
139-
val store = createThreadSafeStore(reducer, AppState(user, listOf()), applyMiddleware(loggingMiddleware))
149+
val store =
150+
createThreadSafeStore(reducer, AppState(user, listOf()), applyMiddleware(loggingMiddleware))
140151
```
141152

142-
Access to `store` methods like `dispatch` and `getState` will be synchronized. Note: if using a thread safe store with
143-
enhancers or middleware that require access to store methods, see usage below.
153+
Access to `store` methods like `dispatch` and `getState` will be synchronized. Note: if using a
154+
thread safe store with enhancers or middleware that require access to store methods, see usage
155+
below.
144156

145157
__Create a synchronized store using an enhancer__
146158

@@ -155,19 +167,27 @@ val store = createStore(
155167
)
156168
```
157169

158-
Access to `store` methods like `dispatch` and `getState` will be synchronized, and enhancers (eg. `applyMiddleware`)
159-
that are placed above `createSynchronizedStoreEnhancer` in the enhancer composition chain will receive the synchronized
160-
store.
170+
Access to `store` methods like `dispatch` and `getState` will be synchronized, and enhancers (
171+
eg. `applyMiddleware`) that are placed above `createSynchronizedStoreEnhancer` in the enhancer
172+
composition chain will receive the synchronized store.
161173

162-
## Communication
174+
## Extensions
163175

164-
Want to give feedback, contribute, or ask questions?
176+
Here's a list of optional extensions available. Raise an issue to add yours!
165177

166-
__\#redux__ slack channel in [kotlinlang](https://kotlinlang.slack.com)
178+
- [redux-kotlin-thunk](https://github.com/reduxkotlin/redux-kotlin-thunk)
179+
- [redux-kotlin-compose](https://github.com/reduxkotlin/redux-kotlin-compose)
180+
- [presenter-middleware](https://github.com/reduxkotlin/presenter-middleware)
167181

168-
Trello boards - https://trello.com/reduxkotlinorg
182+
## Communication
169183

170-
Or create an issue on [github](https://github.com/reduxkotlin/redux-kotlin/issues).
184+
Want to give feedback, contribute, or ask questions?
185+
186+
- Chat on [#redux][slack] slack channel
187+
- Use [Trello boards](https://trello.com/reduxkotlinorg)
188+
- Raise GitHub [issues](https://github.com/reduxkotlin/redux-kotlin/issues)
189+
- Ask questions on
190+
GitHub [discussions](https://github.com/reduxkotlin/redux-kotlin/discussions/categories/q-a)
171191

172192
[badge-android]: http://img.shields.io/badge/platform-android-brightgreen.svg?style=flat
173193

@@ -184,3 +204,5 @@ Or create an issue on [github](https://github.com/reduxkotlin/redux-kotlin/issue
184204
[badge-windows]: http://img.shields.io/badge/platform-windows-informational.svg?style=flat
185205

186206
[badge-mac]: http://img.shields.io/badge/platform-macos-lightgrey.svg?style=flat
207+
208+
[slack]: https://kotlinlang.slack.com/archives/C8A8G5F9Q

Diff for: redux-kotlin/src/commonMain/kotlin/org/reduxkotlin/CreateStore.kt

+6-16
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ public fun <State> createStore(
188188
|If #2 switch to createThreadSafeStore().
189189
|https://reduxkotlin.org/introduction/threading""".trimMargin()
190190
}
191-
192191
*/
193192

194193
try {
@@ -240,6 +239,7 @@ public fun <State> createStore(
240239
dispatch(ActionTypes.INIT)
241240

242241
return object : Store<State> {
242+
override val store = this
243243
override val getState = ::getState
244244
override var dispatch: Dispatcher = ::dispatch
245245
override val subscribe = ::subscribe
@@ -254,18 +254,8 @@ public inline fun <State, reified Action : Any> createTypedStore(
254254
crossinline reducer: TypedReducer<State, Action>,
255255
preloadedState: State,
256256
noinline enhancer: StoreEnhancer<State>? = null
257-
): TypedStore<State, Action> {
258-
val store = createStore(
259-
reducer = typedReducer(reducer),
260-
preloadedState,
261-
enhancer,
262-
)
263-
return object : TypedStore<State, Action> {
264-
override val getState: GetState<State> = store.getState
265-
override var dispatch: TypedDispatcher<Action> = store.dispatch
266-
override val subscribe: (StoreSubscriber) -> StoreSubscription = store.subscribe
267-
override val replaceReducer: (TypedReducer<State, Action>) -> Unit = {
268-
store.replaceReducer(typedReducer(it))
269-
}
270-
}
271-
}
257+
): TypedStore<State, Action> = createStore(
258+
reducer = typedReducer(reducer),
259+
preloadedState,
260+
enhancer,
261+
).asTyped()

Diff for: redux-kotlin/src/commonMain/kotlin/org/reduxkotlin/Definitions.kt

+6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public typealias Store<State> = TypedStore<State, Any>
5454
*/
5555
public inline fun <State, reified Action : Any> Store<State>.asTyped(): TypedStore<State, Action> =
5656
object : TypedStore<State, Action> {
57+
override val store: Store<State> = this@asTyped
5758
override val getState: GetState<State> = this@asTyped.getState
5859
override var dispatch: TypedDispatcher<Action> = this@asTyped.dispatch
5960
override val subscribe: (StoreSubscriber) -> StoreSubscription = this@asTyped.subscribe
@@ -66,6 +67,11 @@ public inline fun <State, reified Action : Any> Store<State>.asTyped(): TypedSto
6667
* Main redux storage container for a given [State] and typesafe actions
6768
*/
6869
public interface TypedStore<State, Action> {
70+
/**
71+
* Reference to the underlying untyped store
72+
*/
73+
public val store: Store<State>
74+
6975
/**
7076
* Current store state getter
7177
*/

0 commit comments

Comments
 (0)