diff --git a/build-support/src/main/kotlin/app/cash/redwood/buildsupport/RedwoodBuildPlugin.kt b/build-support/src/main/kotlin/app/cash/redwood/buildsupport/RedwoodBuildPlugin.kt index 3c3517f489..64e8002332 100644 --- a/build-support/src/main/kotlin/app/cash/redwood/buildsupport/RedwoodBuildPlugin.kt +++ b/build-support/src/main/kotlin/app/cash/redwood/buildsupport/RedwoodBuildPlugin.kt @@ -126,7 +126,10 @@ class RedwoodBuildPlugin : Plugin { ) .editorConfigOverride( mapOf( + // Lowercase names are great for grouping multiple functions and/or types. "ktlint_standard_filename" to "disabled", + // Making something an expression body should be a choice around readability. + "ktlint_standard_function-expression-body" to "disabled", "ktlint_function_naming_ignore_when_annotated_with" to "Composable", "ktlint_compose_compositionlocal-allowlist" to "disabled", ), diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6b761ee872..0c026d5765 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -84,7 +84,7 @@ coil-compose = { module = "io.coil-kt.coil3:coil-compose-core", version.ref = "c coil-core = { module = "io.coil-kt.coil3:coil", version.ref = "coil" } coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coil" } turbine = "app.cash.turbine:turbine:1.1.0" -ktlint = "com.pinterest.ktlint:ktlint-cli:1.2.1" +ktlint = "com.pinterest.ktlint:ktlint-cli:1.3.0" ktlintComposeRules = "io.nlopez.compose.rules:ktlint:0.4.3" googleJavaFormat = "com.google.googlejavaformat:google-java-format:1.22.0" poko-gradlePlugin = "dev.drewhamilton.poko:poko-gradle-plugin:0.15.2" diff --git a/redwood-compose/src/commonMain/kotlin/app/cash/redwood/compose/WidgetApplier.kt b/redwood-compose/src/commonMain/kotlin/app/cash/redwood/compose/WidgetApplier.kt index 86b1ca2f92..493ef0f3a2 100644 --- a/redwood-compose/src/commonMain/kotlin/app/cash/redwood/compose/WidgetApplier.kt +++ b/redwood-compose/src/commonMain/kotlin/app/cash/redwood/compose/WidgetApplier.kt @@ -55,7 +55,8 @@ internal class NodeApplier( override val widgetSystem: WidgetSystem, root: Widget.Children, private val onEndChanges: () -> Unit, -) : AbstractApplier>(ChildrenNode(root)), RedwoodApplier { +) : AbstractApplier>(ChildrenNode(root)), + RedwoodApplier { private var closed = false private val changedWidgets = LinkedHashSet() diff --git a/redwood-compose/src/commonTest/kotlin/app/cash/redwood/compose/ListeningButton.kt b/redwood-compose/src/commonTest/kotlin/app/cash/redwood/compose/ListeningButton.kt index 30b83109f3..9cf96ec279 100644 --- a/redwood-compose/src/commonTest/kotlin/app/cash/redwood/compose/ListeningButton.kt +++ b/redwood-compose/src/commonTest/kotlin/app/cash/redwood/compose/ListeningButton.kt @@ -21,7 +21,9 @@ import app.cash.redwood.widget.ChangeListener import com.example.redwood.testapp.testing.ButtonValue import com.example.redwood.testapp.widget.Button -class ListeningButton : Button, ChangeListener { +class ListeningButton : + Button, + ChangeListener { private val changes = ArrayList() fun changes(): List { val snapshot = changes.toList() diff --git a/redwood-compose/src/commonTest/kotlin/app/cash/redwood/compose/ListeningTestRow.kt b/redwood-compose/src/commonTest/kotlin/app/cash/redwood/compose/ListeningTestRow.kt index 6154496075..c6620b917e 100644 --- a/redwood-compose/src/commonTest/kotlin/app/cash/redwood/compose/ListeningTestRow.kt +++ b/redwood-compose/src/commonTest/kotlin/app/cash/redwood/compose/ListeningTestRow.kt @@ -22,7 +22,9 @@ import app.cash.redwood.widget.Widget import com.example.redwood.testapp.testing.TestRowValue import com.example.redwood.testapp.widget.TestRow -class ListeningTestRow : TestRow, ChangeListener { +class ListeningTestRow : + TestRow, + ChangeListener { private val changes = ArrayList() fun changes(): List { val snapshot = changes.toList() diff --git a/redwood-gradle-plugin/src/main/kotlin/app/cash/redwood/gradle/RedwoodComposeExtensionImpl.kt b/redwood-gradle-plugin/src/main/kotlin/app/cash/redwood/gradle/RedwoodComposeExtensionImpl.kt index 63f3e42680..b4a043484d 100644 --- a/redwood-gradle-plugin/src/main/kotlin/app/cash/redwood/gradle/RedwoodComposeExtensionImpl.kt +++ b/redwood-gradle-plugin/src/main/kotlin/app/cash/redwood/gradle/RedwoodComposeExtensionImpl.kt @@ -23,7 +23,8 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinCompile internal class RedwoodComposeExtensionImpl( private val project: Project, -) : RedwoodComposeExtension, DangerZone { +) : RedwoodComposeExtension, + DangerZone { private var metricsEnabled = false private var reportsEnabled = false diff --git a/redwood-layout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiFlexContainerTest.kt b/redwood-layout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiFlexContainerTest.kt index 61031d42a7..12f040daa4 100644 --- a/redwood-layout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiFlexContainerTest.kt +++ b/redwood-layout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiFlexContainerTest.kt @@ -66,7 +66,8 @@ class ComposeUiFlexContainerTest( class ComposeTestFlexContainer private constructor( private val delegate: ComposeUiFlexContainer, - ) : TestFlexContainer<@Composable () -> Unit>, FlexContainer<@Composable () -> Unit> by delegate { + ) : TestFlexContainer<@Composable () -> Unit>, + FlexContainer<@Composable () -> Unit> by delegate { private var childCount = 0 override val children: ComposeWidgetChildren = delegate.children constructor(direction: FlexDirection, backgroundColor: Int) : this( diff --git a/redwood-layout-dom/src/commonMain/kotlin/app/cash/redwood/layout/dom/HTMLElementRedwoodLayoutWidgetFactory.kt b/redwood-layout-dom/src/commonMain/kotlin/app/cash/redwood/layout/dom/HTMLElementRedwoodLayoutWidgetFactory.kt index 86a0d9e066..d7230d5c6c 100644 --- a/redwood-layout-dom/src/commonMain/kotlin/app/cash/redwood/layout/dom/HTMLElementRedwoodLayoutWidgetFactory.kt +++ b/redwood-layout-dom/src/commonMain/kotlin/app/cash/redwood/layout/dom/HTMLElementRedwoodLayoutWidgetFactory.kt @@ -129,8 +129,7 @@ private class HTMLSpacer( private class HTMLFlexElementChildren( private val container: HTMLElement, private val delegate: HTMLElementChildren = HTMLElementChildren(container), -) : - Widget.Children by delegate { +) : Widget.Children by delegate { override fun onModifierUpdated(index: Int, widget: Widget) { widget.applyModifiers(clearStyles = true) delegate.onModifierUpdated(index, widget) diff --git a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt index c150607138..1b31f3a7db 100644 --- a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt +++ b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt @@ -604,7 +604,9 @@ abstract class AbstractFlexContainerTest { } } -interface TestFlexContainer : Widget, ChangeListener { +interface TestFlexContainer : + Widget, + ChangeListener { override val value: T val children: Widget.Children fun width(width: Constraint) diff --git a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/utils.common.kt b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/utils.common.kt index 2789de2e8c..e489dc4064 100644 --- a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/utils.common.kt +++ b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/utils.common.kt @@ -64,7 +64,8 @@ fun assumeTrue(b: Boolean) { internal data class CrossAxisAlignmentImpl( override val alignment: CrossAxisAlignment, -) : HorizontalAlignment, VerticalAlignment +) : HorizontalAlignment, + VerticalAlignment internal data class WidthImpl( override val width: Dp, diff --git a/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainer.kt b/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainer.kt index a5ab5e81c3..98fc0eb9b1 100644 --- a/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainer.kt +++ b/redwood-layout-uiview/src/commonMain/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainer.kt @@ -30,7 +30,8 @@ import platform.darwin.NSInteger internal class UIViewFlexContainer( direction: FlexDirection, -) : YogaFlexContainer, ChangeListener { +) : YogaFlexContainer, + ChangeListener { private val yogaView: YogaUIView = YogaUIView( applyModifier = { node, index -> node.applyModifier(node.context as Modifier, Density.Default) diff --git a/redwood-layout-uiview/src/commonTest/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainerTest.kt b/redwood-layout-uiview/src/commonTest/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainerTest.kt index 9475e59064..9ace70ad40 100644 --- a/redwood-layout-uiview/src/commonTest/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainerTest.kt +++ b/redwood-layout-uiview/src/commonTest/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainerTest.kt @@ -46,7 +46,9 @@ class UIViewFlexContainerTest( class UIViewTestFlexContainer internal constructor( private val delegate: UIViewFlexContainer, - ) : TestFlexContainer, FlexContainer by delegate, ChangeListener by delegate { + ) : TestFlexContainer, + FlexContainer by delegate, + ChangeListener by delegate { private var childCount = 0 override val children: Widget.Children = delegate.children diff --git a/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewBox.kt b/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewBox.kt index 73c1180c7e..de70eafcb4 100644 --- a/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewBox.kt +++ b/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewBox.kt @@ -39,7 +39,8 @@ import app.cash.redwood.widget.ViewGroupChildren internal class ViewBox( context: Context, -) : FrameLayout(context), Box { +) : FrameLayout(context), + Box { private val density = Density(context.resources) private var horizontalAlignment = CrossAxisAlignment.Start private var verticalAlignment = CrossAxisAlignment.Start diff --git a/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewFlexContainer.kt b/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewFlexContainer.kt index 09d5e930f6..d267eba0cc 100644 --- a/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewFlexContainer.kt +++ b/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewFlexContainer.kt @@ -39,7 +39,8 @@ import app.cash.redwood.yoga.isHorizontal internal class ViewFlexContainer( private val context: Context, private val direction: FlexDirection, -) : YogaFlexContainer, ChangeListener { +) : YogaFlexContainer, + ChangeListener { private val yogaLayout: YogaLayout = YogaLayout( context, applyModifier = { node, index -> diff --git a/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewSpacer.kt b/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewSpacer.kt index 252a1974b8..5046ee23cf 100644 --- a/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewSpacer.kt +++ b/redwood-layout-view/src/main/kotlin/app/cash/redwood/layout/view/ViewSpacer.kt @@ -27,7 +27,8 @@ import kotlin.math.min internal class ViewSpacer( context: Context, -) : View(context), Spacer { +) : View(context), + Spacer { private val density = Density(context.resources) override val value get() = this diff --git a/redwood-layout-view/src/test/kotlin/app/cash/redwood/layout/view/ViewFlexContainerTest.kt b/redwood-layout-view/src/test/kotlin/app/cash/redwood/layout/view/ViewFlexContainerTest.kt index 8ba33a5c5f..6423c38057 100644 --- a/redwood-layout-view/src/test/kotlin/app/cash/redwood/layout/view/ViewFlexContainerTest.kt +++ b/redwood-layout-view/src/test/kotlin/app/cash/redwood/layout/view/ViewFlexContainerTest.kt @@ -65,7 +65,9 @@ class ViewFlexContainerTest( class ViewTestFlexContainer internal constructor( private val delegate: ViewFlexContainer, - ) : TestFlexContainer, FlexContainer by delegate, ChangeListener by delegate { + ) : TestFlexContainer, + FlexContainer by delegate, + ChangeListener by delegate { private var childCount = 0 override val children: ViewGroupChildren = delegate.children override fun add(widget: Widget) { diff --git a/redwood-layout-widget/src/commonMain/kotlin/app/cash/redwood/layout/widget/FlexContainer.kt b/redwood-layout-widget/src/commonMain/kotlin/app/cash/redwood/layout/widget/FlexContainer.kt index 76a63ee020..ff6d34ea30 100644 --- a/redwood-layout-widget/src/commonMain/kotlin/app/cash/redwood/layout/widget/FlexContainer.kt +++ b/redwood-layout-widget/src/commonMain/kotlin/app/cash/redwood/layout/widget/FlexContainer.kt @@ -18,7 +18,9 @@ package app.cash.redwood.layout.widget import app.cash.redwood.layout.api.CrossAxisAlignment import app.cash.redwood.layout.api.MainAxisAlignment -public interface FlexContainer : Row, Column { +public interface FlexContainer : + Row, + Column { override fun horizontalAlignment(horizontalAlignment: MainAxisAlignment) { mainAxisAlignment(horizontalAlignment) } diff --git a/redwood-lazylayout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiLazyListTest.kt b/redwood-lazylayout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiLazyListTest.kt index c6dc43c4fc..42284ad000 100644 --- a/redwood-lazylayout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiLazyListTest.kt +++ b/redwood-lazylayout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiLazyListTest.kt @@ -104,7 +104,8 @@ class ComposeUiLazyListTest( class ComposeTestFlexContainer private constructor( private val delegate: ComposeUiLazyList, - ) : TestFlexContainer<@Composable () -> Unit>, LazyList<@Composable () -> Unit> by delegate { + ) : TestFlexContainer<@Composable () -> Unit>, + LazyList<@Composable () -> Unit> by delegate { private var childCount = 0 constructor(direction: FlexDirection, backgroundColor: Int) : this( diff --git a/redwood-lazylayout-composeui/src/commonMain/kotlin/app/cash/redwood/lazylayout/composeui/ComposeUiRedwoodTreehouseLazyLayoutWidgetFactory.kt b/redwood-lazylayout-composeui/src/commonMain/kotlin/app/cash/redwood/lazylayout/composeui/ComposeUiRedwoodTreehouseLazyLayoutWidgetFactory.kt index f79f65786b..ad3903aa0f 100644 --- a/redwood-lazylayout-composeui/src/commonMain/kotlin/app/cash/redwood/lazylayout/composeui/ComposeUiRedwoodTreehouseLazyLayoutWidgetFactory.kt +++ b/redwood-lazylayout-composeui/src/commonMain/kotlin/app/cash/redwood/lazylayout/composeui/ComposeUiRedwoodTreehouseLazyLayoutWidgetFactory.kt @@ -20,8 +20,7 @@ import app.cash.redwood.lazylayout.widget.LazyList import app.cash.redwood.lazylayout.widget.RedwoodLazyLayoutWidgetFactory import app.cash.redwood.lazylayout.widget.RefreshableLazyList -public class ComposeUiRedwoodLazyLayoutWidgetFactory : - RedwoodLazyLayoutWidgetFactory<@Composable () -> Unit> { +public class ComposeUiRedwoodLazyLayoutWidgetFactory : RedwoodLazyLayoutWidgetFactory<@Composable () -> Unit> { override fun LazyList(): LazyList<@Composable () -> Unit> = ComposeUiLazyList() override fun RefreshableLazyList(): RefreshableLazyList<@Composable () -> Unit> = ComposeUiLazyList() diff --git a/redwood-lazylayout-dom/src/commonMain/kotlin/app/cash/redwood/lazylayout/dom/HTMLLazyList.kt b/redwood-lazylayout-dom/src/commonMain/kotlin/app/cash/redwood/lazylayout/dom/HTMLLazyList.kt index 60f28d3f4a..b5e4aa1e3d 100644 --- a/redwood-lazylayout-dom/src/commonMain/kotlin/app/cash/redwood/lazylayout/dom/HTMLLazyList.kt +++ b/redwood-lazylayout-dom/src/commonMain/kotlin/app/cash/redwood/lazylayout/dom/HTMLLazyList.kt @@ -162,7 +162,8 @@ internal open class HTMLLazyList(document: Document) : LazyList { internal class HTMLRefreshableLazyList( document: Document, -) : HTMLLazyList(document), RefreshableLazyList { +) : HTMLLazyList(document), + RefreshableLazyList { override fun refreshing(refreshing: Boolean) { } diff --git a/redwood-lazylayout-uiview/src/commonMain/kotlin/app/cash/redwood/lazylayout/uiview/UIViewLazyList.kt b/redwood-lazylayout-uiview/src/commonMain/kotlin/app/cash/redwood/lazylayout/uiview/UIViewLazyList.kt index 5797716358..db46fb1c09 100644 --- a/redwood-lazylayout-uiview/src/commonMain/kotlin/app/cash/redwood/lazylayout/uiview/UIViewLazyList.kt +++ b/redwood-lazylayout-uiview/src/commonMain/kotlin/app/cash/redwood/lazylayout/uiview/UIViewLazyList.kt @@ -65,7 +65,9 @@ import platform.UIKit.item import platform.darwin.NSInteger import platform.darwin.NSObject -internal open class UIViewLazyList : LazyList, ChangeListener { +internal open class UIViewLazyList : + LazyList, + ChangeListener { internal val tableView: UITableView = object : UITableView( CGRectZero.readValue(), UITableViewStyle.UITableViewStylePlain, @@ -333,7 +335,9 @@ internal class LazyListContainerCell( } } -internal class UIViewRefreshableLazyList : UIViewLazyList(), RefreshableLazyList { +internal class UIViewRefreshableLazyList : + UIViewLazyList(), + RefreshableLazyList { private var onRefresh: (() -> Unit)? = null diff --git a/redwood-lazylayout-view/src/main/kotlin/app/cash/redwood/lazylayout/view/ViewLazyList.kt b/redwood-lazylayout-view/src/main/kotlin/app/cash/redwood/lazylayout/view/ViewLazyList.kt index 2edf3e864d..f7e9acc4ab 100644 --- a/redwood-lazylayout-view/src/main/kotlin/app/cash/redwood/lazylayout/view/ViewLazyList.kt +++ b/redwood-lazylayout-view/src/main/kotlin/app/cash/redwood/lazylayout/view/ViewLazyList.kt @@ -53,7 +53,8 @@ private const val VIEW_TYPE_ITEM = 1 internal open class ViewLazyList private constructor( internal val recyclerView: RecyclerView, -) : LazyList, ChangeListener { +) : LazyList, + ChangeListener { private val adapter = LazyContentItemListAdapter() private val scope = MainScope() @@ -292,7 +293,8 @@ internal open class ViewLazyList private constructor( internal class ViewRefreshableLazyList( context: Context, -) : ViewLazyList(context), RefreshableLazyList { +) : ViewLazyList(context), + RefreshableLazyList { private val swipeRefreshLayout = SwipeRefreshLayout(context) diff --git a/redwood-lazylayout-view/src/test/kotlin/app/cash/redwood/lazylayout/view/ViewLazyListTest.kt b/redwood-lazylayout-view/src/test/kotlin/app/cash/redwood/lazylayout/view/ViewLazyListTest.kt index 47c3ee5c32..bd8cdc229a 100644 --- a/redwood-lazylayout-view/src/test/kotlin/app/cash/redwood/lazylayout/view/ViewLazyListTest.kt +++ b/redwood-lazylayout-view/src/test/kotlin/app/cash/redwood/lazylayout/view/ViewLazyListTest.kt @@ -89,7 +89,9 @@ class ViewLazyListTest( class ViewTestFlexContainer private constructor( private val delegate: ViewLazyList, - ) : TestFlexContainer, LazyList by delegate, ChangeListener by delegate { + ) : TestFlexContainer, + LazyList by delegate, + ChangeListener by delegate { private var childCount = 0 constructor(context: Context, direction: FlexDirection, backgroundColor: Int) : this( diff --git a/redwood-protocol-guest/src/jsMain/kotlin/app/cash/redwood/protocol/guest/PlatformList.kt b/redwood-protocol-guest/src/jsMain/kotlin/app/cash/redwood/protocol/guest/PlatformList.kt index e34ce50b4e..731e321e96 100644 --- a/redwood-protocol-guest/src/jsMain/kotlin/app/cash/redwood/protocol/guest/PlatformList.kt +++ b/redwood-protocol-guest/src/jsMain/kotlin/app/cash/redwood/protocol/guest/PlatformList.kt @@ -32,7 +32,8 @@ internal actual inline fun PlatformList.asList(): List { internal class JsArrayList( private val storage: JsArray, -) : AbstractList(), RandomAccess { +) : AbstractList(), + RandomAccess { override val size: Int get() = storage.size override fun get(index: Int): E { diff --git a/redwood-protocol-host/src/commonMain/kotlin/app/cash/redwood/protocol/host/ProtocolBridge.kt b/redwood-protocol-host/src/commonMain/kotlin/app/cash/redwood/protocol/host/ProtocolBridge.kt index e3085fed32..40fe8d4ee0 100644 --- a/redwood-protocol-host/src/commonMain/kotlin/app/cash/redwood/protocol/host/ProtocolBridge.kt +++ b/redwood-protocol-host/src/commonMain/kotlin/app/cash/redwood/protocol/host/ProtocolBridge.kt @@ -373,7 +373,8 @@ public class ProtocolBridge( @OptIn(RedwoodCodegenApi::class) private class RootProtocolNode( children: Widget.Children, -) : ProtocolNode(Id.Root, UnknownWidgetTag), Widget { +) : ProtocolNode(Id.Root, UnknownWidgetTag), + Widget { private val children = ProtocolChildren(children) override fun apply(change: PropertyChange, eventSink: EventSink) { diff --git a/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/ApiCommand.kt b/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/ApiCommand.kt index 4d5e05d521..978c92caf6 100644 --- a/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/ApiCommand.kt +++ b/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/ApiCommand.kt @@ -34,10 +34,11 @@ import com.github.ajalt.clikt.parameters.types.path import java.io.File import java.net.URLClassLoader -internal class ApiCommand : CliktCommand( - name = "api", - help = "Write schema protocol API to XML, or validate schema compatibility with existing XML", -) { +internal class ApiCommand : + CliktCommand( + name = "api", + help = "Write schema protocol API to XML, or validate schema compatibility with existing XML", + ) { private val file by option("-f", "--file") .path() .required() diff --git a/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/JsonCommand.kt b/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/JsonCommand.kt index 4539688859..9157988a14 100644 --- a/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/JsonCommand.kt +++ b/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/JsonCommand.kt @@ -29,10 +29,11 @@ import java.net.URLClassLoader import kotlin.io.path.createDirectories import kotlin.io.path.writeText -internal class JsonCommand : CliktCommand( - name = "json", - help = "Parse schema members into a JSON representation", -) { +internal class JsonCommand : + CliktCommand( + name = "json", + help = "Parse schema members into a JSON representation", + ) { private val out by option().path().required() .help("Directory into which JSON is written") diff --git a/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/schemaApi.kt b/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/schemaApi.kt index eb2048e4bd..6596116206 100644 --- a/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/schemaApi.kt +++ b/redwood-tooling-schema/src/main/kotlin/app/cash/redwood/tooling/schema/schemaApi.kt @@ -158,9 +158,15 @@ public interface ProtocolWidget : Widget { public sealed interface ProtocolTrait : Trait { public val tag: Int } - public interface ProtocolProperty : Property, ProtocolTrait - public interface ProtocolEvent : Event, ProtocolTrait - public interface ProtocolChildren : Children, ProtocolTrait + public interface ProtocolProperty : + Property, + ProtocolTrait + public interface ProtocolEvent : + Event, + ProtocolTrait + public interface ProtocolChildren : + Children, + ProtocolTrait } public interface ProtocolModifier : Modifier { diff --git a/redwood-treehouse-guest/src/commonMain/kotlin/app/cash/redwood/treehouse/treehouseCompose.kt b/redwood-treehouse-guest/src/commonMain/kotlin/app/cash/redwood/treehouse/treehouseCompose.kt index ad7a63a3e9..a9bceed743 100644 --- a/redwood-treehouse-guest/src/commonMain/kotlin/app/cash/redwood/treehouse/treehouseCompose.kt +++ b/redwood-treehouse-guest/src/commonMain/kotlin/app/cash/redwood/treehouse/treehouseCompose.kt @@ -53,7 +53,9 @@ private class RedwoodZiplineTreehouseUi( private val appLifecycle: StandardAppLifecycle, private val treehouseUi: TreehouseUi, private val bridge: ProtocolBridge, -) : ZiplineTreehouseUi, ZiplineScoped, EventSink by bridge { +) : ZiplineTreehouseUi, + ZiplineScoped, + EventSink by bridge { /** * By overriding [ZiplineScoped.scope], all services passed into [start] are added to this scope, diff --git a/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/TreehouseLayout.kt b/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/TreehouseLayout.kt index 08365b3d2f..b5980011a7 100644 --- a/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/TreehouseLayout.kt +++ b/redwood-treehouse-host/src/androidMain/kotlin/app/cash/redwood/treehouse/TreehouseLayout.kt @@ -33,7 +33,8 @@ public class TreehouseLayout( context: Context, override val widgetSystem: WidgetSystem, androidOnBackPressedDispatcher: AndroidOnBackPressedDispatcher, -) : RedwoodLayout(context, androidOnBackPressedDispatcher), TreehouseView { +) : RedwoodLayout(context, androidOnBackPressedDispatcher), + TreehouseView { override var readyForContentChangeListener: ReadyForContentChangeListener? = null set(value) { check(value == null || field == null) { "View already bound to a listener" } diff --git a/redwood-treehouse-host/src/appsJvmTest/kotlin/app/cash/redwood/treehouse/RetainEverythingEventListenerFactory.kt b/redwood-treehouse-host/src/appsJvmTest/kotlin/app/cash/redwood/treehouse/RetainEverythingEventListenerFactory.kt index 2dd3fb4260..32234ebd9e 100644 --- a/redwood-treehouse-host/src/appsJvmTest/kotlin/app/cash/redwood/treehouse/RetainEverythingEventListenerFactory.kt +++ b/redwood-treehouse-host/src/appsJvmTest/kotlin/app/cash/redwood/treehouse/RetainEverythingEventListenerFactory.kt @@ -24,7 +24,8 @@ import app.cash.zipline.ZiplineManifest */ class RetainEverythingEventListenerFactory( private val eventLog: EventLog, -) : EventListener(), EventListener.Factory { +) : EventListener(), + EventListener.Factory { var app: TreehouseApp<*>? = null var manifestUrl: String? = null var zipline: Zipline? = null diff --git a/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/TreehouseAppContent.kt b/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/TreehouseAppContent.kt index dc1d606971..6dac22327a 100644 --- a/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/TreehouseAppContent.kt +++ b/redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/TreehouseAppContent.kt @@ -82,7 +82,9 @@ internal class TreehouseAppContent( private val dispatchers: TreehouseDispatchers, private val codeEventPublisher: CodeEventPublisher, private val source: TreehouseContentSource, -) : Content, CodeHost.Listener, CodeSession.Listener { +) : Content, + CodeHost.Listener, + CodeSession.Listener { private val stateFlow = MutableStateFlow>( State(ViewState.None, CodeState.Idle(isInitialLaunch = true)), ) @@ -303,7 +305,9 @@ private class ViewContentCodeBinding( private val isInitialLaunch: Boolean, private val onBackPressedDispatcher: OnBackPressedDispatcher, firstUiConfiguration: StateFlow, -) : ChangesSinkService, TreehouseView.SaveCallback, ZiplineTreehouseUi.Host { +) : ChangesSinkService, + TreehouseView.SaveCallback, + ZiplineTreehouseUi.Host { private val uiConfigurationFlow = SequentialStateFlow(firstUiConfiguration) private val bindingScope = CoroutineScope( diff --git a/redwood-treehouse-host/src/iosMain/kotlin/app/cash/redwood/treehouse/TreehouseUIView.kt b/redwood-treehouse-host/src/iosMain/kotlin/app/cash/redwood/treehouse/TreehouseUIView.kt index 4edd59343e..2be057dff9 100644 --- a/redwood-treehouse-host/src/iosMain/kotlin/app/cash/redwood/treehouse/TreehouseUIView.kt +++ b/redwood-treehouse-host/src/iosMain/kotlin/app/cash/redwood/treehouse/TreehouseUIView.kt @@ -31,7 +31,8 @@ import platform.UIKit.UIView public class TreehouseUIView private constructor( override val widgetSystem: WidgetSystem, view: RootUiView, -) : TreehouseView, RedwoodUIView(view) { +) : RedwoodUIView(view), + TreehouseView { override var saveCallback: TreehouseView.SaveCallback? = null override var stateSnapshotId: StateSnapshot.Id = StateSnapshot.Id(null) diff --git a/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/CancellableService.kt b/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/CancellableService.kt index f9831a5cac..87e316c5d3 100644 --- a/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/CancellableService.kt +++ b/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/CancellableService.kt @@ -21,4 +21,6 @@ import kotlin.native.ObjCName /** Redwood's [Cancellable] but implementing [ZiplineService]. */ @ObjCName("CancellableService", exact = true) -public interface CancellableService : ZiplineService, Cancellable +public interface CancellableService : + ZiplineService, + Cancellable diff --git a/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/ChangesSinkService.kt b/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/ChangesSinkService.kt index d3656a071f..2600999a74 100644 --- a/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/ChangesSinkService.kt +++ b/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/ChangesSinkService.kt @@ -21,4 +21,6 @@ import kotlin.native.ObjCName /** Redwood's [ChangesSink] but implementing [ZiplineService]. */ @ObjCName("ChangesSinkService", exact = true) -public interface ChangesSinkService : ZiplineService, ChangesSink +public interface ChangesSinkService : + ZiplineService, + ChangesSink diff --git a/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/ZiplineTreehouseUi.kt b/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/ZiplineTreehouseUi.kt index a5d6f9bdbe..746dbff881 100644 --- a/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/ZiplineTreehouseUi.kt +++ b/redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/ZiplineTreehouseUi.kt @@ -27,7 +27,9 @@ import kotlinx.coroutines.flow.StateFlow * Most callers shouldn't use this directly; instead use `TreehouseUi`. */ @ObjCName("ZiplineTreehouseUi", exact = true) -public interface ZiplineTreehouseUi : ZiplineService, EventSink { +public interface ZiplineTreehouseUi : + ZiplineService, + EventSink { public fun start(host: Host) @Deprecated("Use `start` method that takes in a Host") @@ -51,7 +53,9 @@ public interface ZiplineTreehouseUi : ZiplineService, EventSink { public fun snapshotState(): StateSnapshot? = null /** Access to the host that presents this UI. */ - public interface Host : ZiplineService, ChangesSinkService { + public interface Host : + ZiplineService, + ChangesSinkService { public val uiConfigurations: StateFlow public val stateSnapshot: StateSnapshot? diff --git a/redwood-widget/src/androidMain/kotlin/app/cash/redwood/widget/RedwoodLayout.kt b/redwood-widget/src/androidMain/kotlin/app/cash/redwood/widget/RedwoodLayout.kt index 3ce6ce7e15..1e8984108c 100644 --- a/redwood-widget/src/androidMain/kotlin/app/cash/redwood/widget/RedwoodLayout.kt +++ b/redwood-widget/src/androidMain/kotlin/app/cash/redwood/widget/RedwoodLayout.kt @@ -37,7 +37,8 @@ import kotlinx.coroutines.flow.StateFlow public open class RedwoodLayout( context: Context, androidOnBackPressedDispatcher: AndroidOnBackPressedDispatcher, -) : FrameLayout(context), RedwoodView { +) : FrameLayout(context), + RedwoodView { init { // The view needs to have an ID to participate in instance state saving. id = R.id.redwood_layout diff --git a/redwood-widget/src/commonMain/kotlin/app/cash/redwood/widget/MutableListChildren.kt b/redwood-widget/src/commonMain/kotlin/app/cash/redwood/widget/MutableListChildren.kt index 64854783e9..8fce15011f 100644 --- a/redwood-widget/src/commonMain/kotlin/app/cash/redwood/widget/MutableListChildren.kt +++ b/redwood-widget/src/commonMain/kotlin/app/cash/redwood/widget/MutableListChildren.kt @@ -26,7 +26,8 @@ import kotlin.native.ObjCName public class MutableListChildren( private val container: MutableList> = mutableListOf(), private val modifierUpdated: () -> Unit = {}, -) : Widget.Children, MutableList> by container { +) : Widget.Children, + MutableList> by container { override val widgets: MutableList> get() = container override fun insert(index: Int, widget: Widget) { diff --git a/samples/emoji-search/android-composeui/src/main/kotlin/com/example/redwood/emojisearch/android/composeui/RealHostApi.kt b/samples/emoji-search/android-composeui/src/main/kotlin/com/example/redwood/emojisearch/android/composeui/RealHostApi.kt index 8939af8b4d..d90edbe22b 100644 --- a/samples/emoji-search/android-composeui/src/main/kotlin/com/example/redwood/emojisearch/android/composeui/RealHostApi.kt +++ b/samples/emoji-search/android-composeui/src/main/kotlin/com/example/redwood/emojisearch/android/composeui/RealHostApi.kt @@ -28,8 +28,7 @@ import okhttp3.Response import okio.IOException /** Exception for an unexpected, non-2xx HTTP response. */ -class HttpException(response: Response) : - RuntimeException("HTTP ${response.code} ${response.message}") +class HttpException(response: Response) : RuntimeException("HTTP ${response.code} ${response.message}") class RealHostApi( private val client: OkHttpClient, diff --git a/samples/emoji-search/android-views/src/main/kotlin/com/example/redwood/emojisearch/android/views/RealHostApi.kt b/samples/emoji-search/android-views/src/main/kotlin/com/example/redwood/emojisearch/android/views/RealHostApi.kt index 036bcd9794..22792cfd02 100644 --- a/samples/emoji-search/android-views/src/main/kotlin/com/example/redwood/emojisearch/android/views/RealHostApi.kt +++ b/samples/emoji-search/android-views/src/main/kotlin/com/example/redwood/emojisearch/android/views/RealHostApi.kt @@ -32,8 +32,7 @@ import okhttp3.Response import okio.IOException /** Exception for an unexpected, non-2xx HTTP response. */ -class HttpException(response: Response) : - RuntimeException("HTTP ${response.code} ${response.message}") +class HttpException(response: Response) : RuntimeException("HTTP ${response.code} ${response.message}") class RealHostApi( private val context: Context, diff --git a/samples/emoji-search/desktop-composeui/src/main/kotlin/com/example/redwood/emojisearch/desktop/JvmHttpClient.kt b/samples/emoji-search/desktop-composeui/src/main/kotlin/com/example/redwood/emojisearch/desktop/JvmHttpClient.kt index 0fa49cd06f..1c61d13cea 100644 --- a/samples/emoji-search/desktop-composeui/src/main/kotlin/com/example/redwood/emojisearch/desktop/JvmHttpClient.kt +++ b/samples/emoji-search/desktop-composeui/src/main/kotlin/com/example/redwood/emojisearch/desktop/JvmHttpClient.kt @@ -54,7 +54,8 @@ private suspend fun Call.await(): Response { private class ContinuationCallback( private val call: Call, private val continuation: CancellableContinuation, -) : Callback, CompletionHandler { +) : Callback, + CompletionHandler { override fun onResponse(call: Call, response: Response) { continuation.resume(response) diff --git a/samples/emoji-search/presenter-treehouse/src/commonMain/kotlin/com/example/redwood/emojisearch/treehouse/EmojiSearchPresenter.kt b/samples/emoji-search/presenter-treehouse/src/commonMain/kotlin/com/example/redwood/emojisearch/treehouse/EmojiSearchPresenter.kt index df362be117..c7fde19692 100644 --- a/samples/emoji-search/presenter-treehouse/src/commonMain/kotlin/com/example/redwood/emojisearch/treehouse/EmojiSearchPresenter.kt +++ b/samples/emoji-search/presenter-treehouse/src/commonMain/kotlin/com/example/redwood/emojisearch/treehouse/EmojiSearchPresenter.kt @@ -21,6 +21,8 @@ import app.cash.zipline.ZiplineService import kotlin.native.ObjCName @ObjCName("EmojiSearchPresenter", exact = true) -interface EmojiSearchPresenter : AppService, ZiplineService { +interface EmojiSearchPresenter : + AppService, + ZiplineService { fun launch(): ZiplineTreehouseUi } diff --git a/test-app/android-views/src/main/kotlin/com/example/redwood/testapp/android/views/RealHostApi.kt b/test-app/android-views/src/main/kotlin/com/example/redwood/testapp/android/views/RealHostApi.kt index 555e601452..36e35bd491 100644 --- a/test-app/android-views/src/main/kotlin/com/example/redwood/testapp/android/views/RealHostApi.kt +++ b/test-app/android-views/src/main/kotlin/com/example/redwood/testapp/android/views/RealHostApi.kt @@ -28,8 +28,7 @@ import okhttp3.Response import okio.IOException /** Exception for an unexpected, non-2xx HTTP response. */ -class HttpException(response: Response) : - RuntimeException("HTTP ${response.code} ${response.message}") +class HttpException(response: Response) : RuntimeException("HTTP ${response.code} ${response.message}") class RealHostApi( private val client: OkHttpClient, diff --git a/test-app/presenter-treehouse/src/commonMain/kotlin/com/example/redwood/testapp/treehouse/TestAppPresenter.kt b/test-app/presenter-treehouse/src/commonMain/kotlin/com/example/redwood/testapp/treehouse/TestAppPresenter.kt index 4f4b45bc00..c6fc329a84 100644 --- a/test-app/presenter-treehouse/src/commonMain/kotlin/com/example/redwood/testapp/treehouse/TestAppPresenter.kt +++ b/test-app/presenter-treehouse/src/commonMain/kotlin/com/example/redwood/testapp/treehouse/TestAppPresenter.kt @@ -21,7 +21,9 @@ import app.cash.zipline.ZiplineService import kotlin.native.ObjCName @ObjCName("TestAppPresenter", exact = true) -interface TestAppPresenter : AppService, ZiplineService { +interface TestAppPresenter : + AppService, + ZiplineService { fun launchForApp(): ZiplineTreehouseUi fun launchForTester(): ZiplineTreehouseUi }