Skip to content

Commit

Permalink
Merge pull request #21 from floschu/feature/managed-controller
Browse files Browse the repository at this point in the history
ManagedController
  • Loading branch information
floschu authored May 30, 2020
2 parents a0c127d + 269545f commit d616739
Show file tree
Hide file tree
Showing 46 changed files with 1,104 additions and 603 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .media/controller_flow.drawio
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<mxfile host="www.draw.io" modified="2020-01-19T20:25:46.998Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36" etag="v1QQIyKJY47N_jd35UVe" version="12.5.5" type="device"><diagram id="fH6b8eDpqPfBBpIu5eh0" name="Page-1">7ZpJk5s4FMc/jY/pQggwPqYXzxwylVR1VSY5TckgQBOMXELe5tOPBGIRwo67gSaVal+MnhaQfu//tMACPmxPfzC0S/6iIU4XthWeFvBxYdsA+J74k5ZzafGAXxpiRkJVqDE8k/+wMlrKuichzrWCnNKUk51uDGiW4YBrNsQYPerFIprqd92hGBuG5wClpvVvEvKktPr2srH/iUmcVHcG3qrM2aDgR8zoPlP3y2iGy5wtqppRfcwTFNJjywSfFvCBUcrLq+3pAadyWKsRK+utL+TWj8xwxm+pQED42SVn5Lrrzeafk42/fvn2Aahmcn6uxgKHYmhUkjKe0JhmKH1qrPdFf7FsFohUU+YTpTtl/Bdzflac0Z5TYUr4NlW5+ET4N3Ft3bkq9V2m1PXjqZ04V4mMs3Orkkx+b+c11YpUVS/njP6oqYpRvy97LLt5cSSrUaF7FuBrw6d8FbEY8yvlYM1bSAjTLRZPKOoxnCJODvpzIOXLcV2ugSouFNeXMC7bPaB0r+50IPhocNepRiRNH2hKWZEJI99fWSthj1OU59XQVh4tEwHdkkBdxwyFRAxmq4Fg424QrnlUOYVemgqPhAl5E5qJLIxyLh+Eau1E4qc70zEhHD/vUAHqKOJTjfiAGcen65BNKKqCr2SrIpq9UuljEx9AJe2kFRs8ayKMtoHxJwhbY9QDZLnxImybpEHoB6E/EJQqndFPaIOvgdJcqO1bbXcagaa91HGCpYmzRt7GCcFkPC2D30tCrzVm6K1ypg69uk+Vch43IsMbI7I3Z0SGhpRRKabrgu4TUAvtCDKBLtRl4rm3RT04lUqAGeVmW6C8TiVgzgWKc6McLrjF28jBgbMwrnlpMa2Bd5EXYvyj3HQ0E11hWxPZ7RZTI86ZqDurm3Xxm8cFlgNdoKgqxgWdWwV2lGQ8b7X8RRpaAcfS52VHbazWN5aHS7vjfuUTNM5Yd2WAfxrhWvDmeFi0NlzEKn7TxHHHdeaO46v31c74qx3vjbQ9CL1nyGe7F/oRgzKigFQg7m5bo+hS5J1ws9FVn+3MvXesjuPe1Tem+pY3qs+ZU31LQ30Mh/sAT6G+CbQDHXtu7QxbnQ7VTks5jY5+oh2weP2KNpBxUUZDbVELeiU2opb8G7U0677dNxeCmB1IMHAp2D2d65/L6gO7/onv6kZikCQ9t3MUOvt0ZpsHKDkJsfTFKJLvh7o4ROf5C1cPyoRSEstDzkAMloiZ8F4OJQlQ+lFlbEkYFpLvg6yHgRFYuI6vs3BNFsseFPZkKMzNUUjyHeJB8vtSsD2gUQCVQ7YoOG9KwVxjBzRNf2spdCG4ljcvBGhGpWDPiu5IAn0nBsNhpDjiw1Dc9ApmwukFVtyqswpgnjm/LUdzmrfu7jJhKfathGb5O8gekI5tayChtTJA9r1imw7kygCZyRff72K8wlAPqo7lz8vQMdcXgeg+k7ObuYX9NSa310AsDycYLQOMsH1w3JHmyc6XDKDnS4aR4qtINt8zlafvzfdi8Ol/</diagram></mxfile>
<mxfile host="app.diagrams.net" modified="2020-05-24T09:17:27.875Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36" etag="a5EAd2_T_byAgiBleQfB" version="13.1.3" type="device"><diagram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ii422+lzv0mvHen/uTX0D1DftqT7vqtQ3tdTHcLyJ8BjqG0E70HMvrZ1hs9Oh2tGU0+joL9oBk5fPaCOZF2U2NCa1oFNiL9dS2FNL17VuD+2JIGZbIp7UnW8KHKFi4KSwvU/XPaodt+66h8DnLin6izPwW5uiFx/YXHsrpSAxliGTJPJNURuHeFL+zHmEMqGMpHK7MxL+E9kT3kq/kQhl71XFisRxKf4uyGZCOAML3wtNFr7NYtqBwh0Nhb1MikmxRjxa/rsU3AAYFEAdkBoF71Up2LPtiGbZPy2FNgTfCS4LAdpZac3wltBNUSLo2jwYTiPDCR/GotfbmBHHF1iDq7ctgL39/Log7RHfubnJhaVcwhKaF28gO0B6rmuAhM7MAtn1tm08kDMLZC7fgb+J8QRDM6t6TnhZhp49wYjE4zM5vNmr2esY3V4CsdqnYLRKMML2zvPPNFC2PmoAHR81nCm/imLzaVO1Ed98OQYf/gA=</diagram></mxfile>
Binary file modified .media/controller_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# changelog

## `[X.X.X]` - Unreleased
## `[1.0.0]` - Unreleased

- binary compatibility will now be verified on every release.

## `[0.11.0]` - 2020-05-30

- `CoroutineScope.createController` and `CoroutineScope.createSynchronousController` now accept a custom `ControllerStart` parameter instead of `CoroutineStart`.
- Add `ManagedController`.
- `Controller.stub` is now marked as `@TestOnly`.
- binary compatibility is now verified on each `[build]` & `[publish]`.
- `Controller.stub` is now marked as `@TestOnly`

## `[0.10.0]` - 2020-05-11

Expand All @@ -12,5 +18,5 @@

## `[0.9.0]` - 2020-05-10

- `ControllerImplemenation` now uses `MutableStateFlow` instead of `ConflatedBroadCastChannel` internally.
- `ControllerImplementation` now uses `MutableStateFlow` instead of `ConflatedBroadCastChannel` internally.
- `Controller.state` emissions are now distinct by default (via `StateFlow`).
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/Libs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ object Libs {
/**
* https://github.com/reactivecircus/FlowBinding
*/
const val flowbinding_android: String =
"io.github.reactivecircus.flowbinding:flowbinding-android:" +
const val flowbinding_core: String = "io.github.reactivecircus.flowbinding:flowbinding-core:" +
Versions.io_github_reactivecircus_flowbinding

/**
* https://github.com/reactivecircus/FlowBinding
*/
const val flowbinding_core: String = "io.github.reactivecircus.flowbinding:flowbinding-core:" +
const val flowbinding_android: String =
"io.github.reactivecircus.flowbinding:flowbinding-android:" +
Versions.io_github_reactivecircus_flowbinding

/**
Expand Down
12 changes: 6 additions & 6 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ object Versions {

const val androidx_test: String = "1.2.0"

const val androidx_ui: String = "0.1.0-dev11"
const val androidx_ui: String = "0.1.0-dev12"

const val io_ktor: String = "1.3.2" // available: "1.3.2-1.4-M1-release-99"

const val com_android_tools_build_gradle: String = "4.1.0-alpha09"
const val com_android_tools_build_gradle: String = "4.1.0-alpha10"

const val org_jlleitschuh_gradle_ktlint_gradle_plugin: String = "9.2.1"

Expand All @@ -47,13 +47,13 @@ object Versions {

const val gradle_pitest_plugin: String = "1.5.1"

const val compose_compiler: String = "0.1.0-dev11"
const val compose_compiler: String = "0.1.0-dev12"

const val constraintlayout: String = "2.0.0-beta4"

const val espresso_core: String = "3.2.0"

const val lint_gradle: String = "27.1.0-alpha09"
const val lint_gradle: String = "27.1.0-alpha10"

const val appcompat: String = "1.1.0"

Expand All @@ -65,12 +65,12 @@ object Versions {

const val ktlint: String = "0.36.0"

const val aapt2: String = "4.1.0-alpha09-6422342"
const val aapt2: String = "4.1.0-alpha10-6481518"

const val mockk: String = "1.10.0"

/**
* Current version: "6.4.1"
* Current version: "6.5-milestone-1"
* See issue 19: How to update Gradle itself?
* https://github.com/jmfayard/buildSrcVersions/issues/19
*/
Expand Down
39 changes: 30 additions & 9 deletions control-core/api/control-core.api
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
public final class at/florianschuster/control/BuildersKt {
public static final fun createController (Lkotlinx/coroutines/CoroutineScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lat/florianschuster/control/ControllerLog;Lkotlinx/coroutines/CoroutineStart;Lkotlinx/coroutines/CoroutineDispatcher;)Lat/florianschuster/control/Controller;
public static synthetic fun createController$default (Lkotlinx/coroutines/CoroutineScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lat/florianschuster/control/ControllerLog;Lkotlinx/coroutines/CoroutineStart;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Lat/florianschuster/control/Controller;
public static final fun createSynchronousController (Lkotlinx/coroutines/CoroutineScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lat/florianschuster/control/ControllerLog;Lkotlinx/coroutines/CoroutineStart;Lkotlinx/coroutines/CoroutineDispatcher;)Lat/florianschuster/control/Controller;
public static synthetic fun createSynchronousController$default (Lkotlinx/coroutines/CoroutineScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lat/florianschuster/control/ControllerLog;Lkotlinx/coroutines/CoroutineStart;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Lat/florianschuster/control/Controller;
}

public abstract interface class at/florianschuster/control/Controller {
public abstract fun dispatch (Ljava/lang/Object;)V
public abstract fun getCurrentState ()Ljava/lang/Object;
Expand Down Expand Up @@ -40,6 +33,13 @@ public final class at/florianschuster/control/ControllerEvent$State : at/florian
public final class at/florianschuster/control/ControllerEvent$Stub : at/florianschuster/control/ControllerEvent {
}

public final class at/florianschuster/control/ControllerKt {
public static final fun createController (Lkotlinx/coroutines/CoroutineScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lat/florianschuster/control/ControllerLog;Lat/florianschuster/control/ControllerStart;Lkotlinx/coroutines/CoroutineDispatcher;)Lat/florianschuster/control/Controller;
public static synthetic fun createController$default (Lkotlinx/coroutines/CoroutineScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lat/florianschuster/control/ControllerLog;Lat/florianschuster/control/ControllerStart;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Lat/florianschuster/control/Controller;
public static final fun createSynchronousController (Lkotlinx/coroutines/CoroutineScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lat/florianschuster/control/ControllerLog;Lat/florianschuster/control/ControllerStart;Lkotlinx/coroutines/CoroutineDispatcher;)Lat/florianschuster/control/Controller;
public static synthetic fun createSynchronousController$default (Lkotlinx/coroutines/CoroutineScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lat/florianschuster/control/ControllerLog;Lat/florianschuster/control/ControllerStart;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Lat/florianschuster/control/Controller;
}

public abstract class at/florianschuster/control/ControllerLog {
public static final field Companion Lat/florianschuster/control/ControllerLog$Companion;
}
Expand All @@ -61,6 +61,17 @@ public final class at/florianschuster/control/ControllerLog$Println : at/florian
public static final field INSTANCE Lat/florianschuster/control/ControllerLog$Println;
}

public abstract class at/florianschuster/control/ControllerStart {
}

public final class at/florianschuster/control/ControllerStart$Immediately : at/florianschuster/control/ControllerStart {
public static final field INSTANCE Lat/florianschuster/control/ControllerStart$Immediately;
}

public final class at/florianschuster/control/ControllerStart$Lazy : at/florianschuster/control/ControllerStart {
public static final field INSTANCE Lat/florianschuster/control/ControllerStart$Lazy;
}

public abstract interface class at/florianschuster/control/ControllerStub {
public abstract fun emitState (Ljava/lang/Object;)V
public abstract fun getDispatchedActions ()Ljava/util/List;
Expand All @@ -74,11 +85,21 @@ public final class at/florianschuster/control/ExtensionsKt {
public static synthetic fun takeUntil$default (Lkotlinx/coroutines/flow/Flow;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
}

public abstract interface class at/florianschuster/control/LoggerScope {
public abstract interface class at/florianschuster/control/LoggerContext {
public abstract fun getEvent ()Lat/florianschuster/control/ControllerEvent;
}

public abstract interface class at/florianschuster/control/MutatorScope {
public abstract interface class at/florianschuster/control/ManagedController : at/florianschuster/control/Controller {
public abstract fun cancel ()Ljava/lang/Object;
public abstract fun start ()Z
}

public final class at/florianschuster/control/ManagedControllerKt {
public static final fun ManagedController (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lat/florianschuster/control/ControllerLog;Lkotlinx/coroutines/CoroutineDispatcher;)Lat/florianschuster/control/ManagedController;
public static synthetic fun ManagedController$default (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Ljava/lang/String;Lat/florianschuster/control/ControllerLog;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Lat/florianschuster/control/ManagedController;
}

public abstract interface class at/florianschuster/control/MutatorContext {
public abstract fun getActions ()Lkotlinx/coroutines/flow/Flow;
public abstract fun getCurrentState ()Ljava/lang/Object;
}
Expand Down
4 changes: 2 additions & 2 deletions control-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ pitest {
"at.florianschuster.control.ExtensionsKt**", // too many inline collects

// inlined invokeSuspend
"at.florianschuster.control.ControllerImplementation\$1\$2",
"at.florianschuster.control.ControllerImplementation\$1",
"at.florianschuster.control.ControllerImplementation\$stateJob\$1",
"at.florianschuster.control.ControllerImplementation\$stateJob\$1\$2",

// lateinit var isInitialized
"at.florianschuster.control.ControllerImplementation\$stubInitialized\$1"
Expand Down
Loading

0 comments on commit d616739

Please sign in to comment.