Skip to content

Commit 52371c9

Browse files
authored
Merge pull request #273 from arkivanov/version-3.0.0
Version 3.0.0
2 parents a0c46f2 + 1a9b4a7 commit 52371c9

File tree

303 files changed

+4200
-5962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+4200
-5962
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install Java
1616
uses: actions/setup-java@v1
1717
with:
18-
java-version: 1.8
18+
java-version: 11
1919
- name: Update dependencies
2020
run: sudo apt-get update
2121
- name: Install dependencies
@@ -38,7 +38,7 @@ jobs:
3838
- name: Install Java
3939
uses: actions/setup-java@v1
4040
with:
41-
java-version: 1.8
41+
java-version: 11
4242
- name: Set up cache
4343
uses: actions/cache@v2
4444
with:

.github/workflows/publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install Java
3030
uses: actions/setup-java@v1
3131
with:
32-
java-version: 1.8
32+
java-version: 11
3333
- name: Publish Metadata
3434
env:
3535
SONATYPE_REPOSITORY_ID: ${{ needs.create-staging-repository.outputs.repository-id }}
@@ -47,7 +47,7 @@ jobs:
4747
- name: Install Java
4848
uses: actions/setup-java@v1
4949
with:
50-
java-version: 1.8
50+
java-version: 11
5151
- name: Publish on Linux
5252
env:
5353
SONATYPE_REPOSITORY_ID: ${{ needs.create-staging-repository.outputs.repository-id }}
@@ -65,7 +65,7 @@ jobs:
6565
- name: Install Java
6666
uses: actions/setup-java@v1
6767
with:
68-
java-version: 1.8
68+
java-version: 11
6969
- name: Publish on macOS
7070
env:
7171
SONATYPE_REPOSITORY_ID: ${{ needs.create-staging-repository.outputs.repository-id }}
@@ -95,7 +95,7 @@ jobs:
9595
- name: Install Java
9696
uses: actions/setup-java@v1
9797
with:
98-
java-version: 1.8
98+
java-version: 11
9999
- name: Update dependencies
100100
run: sudo apt-get update
101101
- name: Install dependencies
@@ -112,6 +112,6 @@ jobs:
112112
- name: Install Java
113113
uses: actions/setup-java@v1
114114
with:
115-
java-version: 1.8
115+
java-version: 11
116116
- name: Check macOS publication
117117
run: ./gradlew :tools:check-publication:build -Pcheck_publication -Dtargets=IOS,WATCHOS,MACOS_X64

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ Recommended minimum Gradle version is 5.3. Please read first the documentation a
4848
[metadata publishing mode](https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#experimental-metadata-publishing-mode).
4949

5050
There are a number of modules published to Maven Central:
51+
5152
- `mvikotlin` - core interfaces and functionality (multiplatform)
5253
- `mvikotlin-main` - the main module with the default `Store` implementation (mutiplatform)
5354
- `mvikotlin-logging` - logging functionality (mutiplatform)
5455
- `mvikotlin-timetravel` - time travel feature (mutiplatform)
5556
- `mvikotlin-extensions-reaktive` - extensions set for Reaktive library (multiplatform)
5657
- `mvikotlin-extensions-coroutines` - extensions set for coroutines (multiplatform)
57-
- `keepers` - provides `StateKeeper` and `InstanceKeeper` API for state preservation and objects retaining
58+
- ~~`keepers` - provides `StateKeeper` and `InstanceKeeper` API for state preservation and objects retaining~~ (deprecated)
5859
- `rx` - a tiny module with abstractions over rx and coroutines (multiplatform)
5960

6061
Add required modules to your module`s build.gradle file:
@@ -68,14 +69,15 @@ implementation "com.arkivanov.mvikotlin:<module-name>:<version>"
6869
* Extensions for [Reaktive](https://github.com/badoo/Reaktive) library
6970
* Extensions for [Coroutines](https://github.com/Kotlin/kotlinx.coroutines)
7071
* Multithreading friendly (freezable in Kotlin Native if needed)
72+
* Lifecycle-aware connections (bindins) between inputs and outputs
7173
* Logging functionality with customizable logger and formatter
7274
* Time travel feature:
73-
* Multiplatform for all supported targets
74-
* Plug-and-play UI for Android
75-
* Plug-and-play UI for iOS (copy-paste from the sample app)
76-
* Export/import events for Android
77-
* IDEA and Android Studio [plugin](https://plugins.jetbrains.com/plugin/14241-mvikotlin-time-travel) for Android apps
78-
* MacOS [client application](mvikotlin-timetravel-client/app-macos) for iOS and macOS apps
75+
* Multiplatform for all supported targets
76+
* Plug-and-play UI for Android
77+
* Plug-and-play UI for iOS (copy-paste from the sample app)
78+
* Export/import events for Android
79+
* IntelliJ IDEA and Android Studio [plugin](https://plugins.jetbrains.com/plugin/14241-mvikotlin-time-travel) for Android apps
80+
* Desktop [client application](mvikotlin-timetravel-client/app-desktop) for Android, Java and native Apple (iOS, watchOS, tvOS, macOS) apps
7981

8082
## Documentation
8183

@@ -84,7 +86,7 @@ implementation "com.arkivanov.mvikotlin:<module-name>:<version>"
8486
## Sample project
8587

8688
The sample project is a todo list with details view.
87-
* Shared module using Reaktive is [here](sample/todo-reaktive)
89+
* Shared module using Reaktive is [here](sample/todo-reaktive)
8890
* Shared module using coroutines is [here](sample/todo-coroutines)
8991
* Sample Android application with both Reaktive and coroutines implementations, plus logging and time travel is [here](sample/todo-app-android)
9092
* Sample iOS application with Reaktive implementation only, plus logging and time travel is [here](sample/todo-app-ios)

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ buildscript {
88
mavenCentral()
99
google()
1010
maven { url "https://plugins.gradle.org/m2/" }
11+
maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" }
1112
}
1213
dependencies {
1314
classpath 'com.android.tools.build:gradle:4.2.0'
1415
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
1516
classpath "gradle.plugin.org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.4.18"
17+
classpath "org.jetbrains.compose:compose-gradle-plugin:$composeVersion"
1618
}
1719
}
1820

@@ -24,6 +26,7 @@ allprojects {
2426
repositories {
2527
mavenCentral()
2628
google()
29+
maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" }
2730
}
2831

2932
plugins.apply("io.gitlab.arturbosch.detekt")

detekt.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ naming:
400400
active: true
401401
mustBeFirst: true
402402
MemberNameEqualsClassName:
403-
active: true
403+
active: false
404404
ignoreOverridden: true
405405
NonBooleanPropertyPrefixedWithIs:
406406
active: false
@@ -533,7 +533,7 @@ style:
533533
includeLineWrapping: false
534534
ForbiddenComment:
535535
active: true
536-
values: ['TODO:', 'FIXME:', 'STOPSHIP:']
536+
values: ['FIXME:', 'STOPSHIP:']
537537
allowedPatterns: ''
538538
ForbiddenImport:
539539
active: false
@@ -563,7 +563,7 @@ style:
563563
active: true
564564
maxJumpCount: 1
565565
MagicNumber:
566-
active: true
566+
active: false
567567
excludes: ['**/test/**', '**/*Test/**']
568568
ignoreNumbers: ['-1', '0', '1', '2']
569569
ignoreHashCodeFunction: true

docs/binding_and_lifecycle.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Binding
44

5-
Connecting inputs and outputs sounds like a simple task. And indeed it is. But it can be even easier if you use [Binder](https://github.com/arkivanov/MVIKotlin/blob/master/mvikotlin/src/commonMain/kotlin/com/arkivanov/mvikotlin/core/binder/Binder.kt). It provides just two methods: `start()` and `stop()`. When you call `start()` it connects (subscribes) outputs with inputs. And when you call `stop()` it disconnects (unsubscribes).
5+
Connecting inputs and outputs sounds like a simple task, and indeed it is. But it can be even easier if you use [Binder](https://github.com/arkivanov/MVIKotlin/blob/master/mvikotlin/src/commonMain/kotlin/com/arkivanov/mvikotlin/core/binder/Binder.kt). It provides just two methods: `start()` and `stop()`. When you call `start()` it connects (subscribes) outputs with inputs. And when you call `stop()` it disconnects (unsubscribes).
66

77
### Creating a Binder
88

@@ -74,14 +74,15 @@ Please note that you must dispose `Stores` at the end of life cycle. In this exa
7474

7575
## Lifecycle
7676

77-
MVIKotlin provides an abstraction over [Lifecycle](https://github.com/arkivanov/MVIKotlin/blob/master/mvikotlin/src/commonMain/kotlin/com/arkivanov/mvikotlin/core/lifecycle/Lifecycle.kt) states and events. Please take a look at the following diagram:
78-
![Lifecycle](media/lifecycle.jpg)
77+
MVIKotlin uses [Essenty](https://github.com/arkivanov/Essenty) library (from the same author), which provides `Lifecycle` - a multiplatform abstraction for lifecycle states and events. The Essenty's `lifecycle` module is used as `api` dependency, so you don't need to explicitly add it to your project. Please familiarise yourself with Essenty library, especially with the `Lifecycle`.
7978

80-
You can subscribe to `Lifecycle` events and unsubscribe from it. You can convert the [AndroidX Lifecycle](https://developer.android.com/topic/libraries/architecture/lifecycle) to MVIKotlin `Lifecycle` using [asMviLifecycle()](https://github.com/arkivanov/MVIKotlin/blob/master/mvikotlin/src/androidMain/kotlin/com/arkivanov/mvikotlin/core/lifecycle/AndroidLifecycleExt.kt) extension function. Also there is [LifecycleRegistry](https://github.com/arkivanov/MVIKotlin/blob/master/mvikotlin/src/commonMain/kotlin/com/arkivanov/mvikotlin/core/lifecycle/LifecycleRegistry.kt) which implements both the `Lifecycle` and `Lifecycle.Callbacks` interfaces, so you can manually control it.
79+
<img src="media/lifecycle.jpg" width="512">
8180

8281
## Binder + Lifecycle
8382

84-
Work with the `Binder` can be simplified if you use the `Lifecycle`. Let's simplify our previous binding example::
83+
Work with the `Binder` can be simplified if you use the `Lifecycle`. You need to add one of the extension modules in order to use `Binder` with `Lifecycle`, either `mvikotlin-extensions-reaktive` or `mvikotlin-extensions-coroutines`.
84+
85+
Let's simplify our previous binding example::
8586

8687
```kotlin
8788
class CalculatorController(lifecycle: Lifecycle) {

docs/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Overview | [Store](store.md) | [View](view.md) | [Binding and Lifecycle](binding
66

77
MVI stands for Model-View-Intent. It is an architectural pattern that utilizes unidirectional data flow. The data circulates between `Model` and `View` only in one direction - from `Model` to `View` and from `View` to `Model`.
88

9-
![MVI](media/mvi.jpg)
9+
<img src="media/mvi.jpg" width="256">
1010

1111
### What is MVIKotlin
1212

@@ -17,7 +17,7 @@ MVIKotlin does not bring or enforce any particular architecture. Its responsibil
1717

1818
- To provide a single source of truth for `State` (the scope is not defined, it can be a whole app, a screen, a feature, or a part of a feature);
1919
- To provide an abstraction for UI with efficient updates (however this is not obligatory, you can use whatever you want);
20-
- To provide lifecycle aware connections (binding) between inputs and outputs (again this is not obligatory in any way).
20+
- To provide lifecycle-aware connections (binding) between inputs and outputs (again this is not obligatory in any way).
2121

2222
Everything else is out of scope of the library, there are no definitions for "screens", "features", "modules", etc. Also, no particular reactive framework is enforced/exposed. This gives a lot of flexibility:
2323

@@ -32,12 +32,13 @@ You can find one of the architecture options in the [samples](https://github.com
3232
There are two core components in MVIKotlin:
3333

3434
- `Store` - represents `Model` from MVI, this is the place for business logic
35-
- `MviView` - represents `View` from MVI, the UI part
35+
- `MviView` - represents `View` from MVI, the UI part, optional
3636

3737
### How the data flows
3838

3939
Please take a look at the following diagram:
40-
![MVIKotlin](media/mvikotlin.jpg)
40+
41+
<img src="media/mvikotlin.jpg" width="384">
4142

4243
The `Store` produces a stream of `States` which is transformed to a stream of `View Models` by a `Mapper` function (f). The `View` renders `View Models` and produces a stream of `View Events` which is transformed to a stream of `Intents` by another `Mapper` function (f). This makes the `Store` and the `View` independent from each other. You can also combine multiple `States` (multiple `Stores`) into a single `View Model` (single `View`), or multiple `View Events` (multiple `Views`) into a single `Intent` (single `Store`). But if you have only one `Store` and only one `View` and you need simplicity then your `View` can directly render `States` and produce `Intents`.
4344

@@ -51,7 +52,6 @@ The data flows between core components only on Main thread.
5152

5253
MVI loves reactivity, it's all about data streams and transformations. MVIKotlin is a reactive framework. But the main functionality of the framework does not depend on any such library. A tiny abstraction over Rx is used instead. Extensions for [Reaktive](https://github.com/badoo/Reaktive) and for [Coroutines](https://github.com/Kotlin/kotlinx.coroutines) libraries are provided as separate modules.
5354

54-
5555
### Kotlin/Native
5656

5757
MVIKotlin is Kotlin/Native friendly and supports its tricky memory model (please read about Kotlin/Native [concurrency](https://kotlinlang.org/docs/reference/native/concurrency.html) and [immutability](https://kotlinlang.org/docs/reference/native/immutability.html) if you are unsure).
402 KB
Loading

0 commit comments

Comments
 (0)