Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ListDetailDesktopHeadlessTest {
}

private suspend fun ReceiveTurbine<AppTemplate>.awaitPhoneBackstack(
size: Int
size: Int,
): DefaultBackstackModel {
while (true) {
val template = requireInstance<AppTemplate.FullScreenTemplate>(awaitItem())
Expand All @@ -83,7 +83,7 @@ class ListDetailDesktopHeadlessTest {
}

private suspend fun ReceiveTurbine<AppTemplate>.awaitTabletContent(
selectedCharacterId: String? = null
selectedCharacterId: String? = null,
): TabletListDetailPresenter.Model.Content {
while (true) {
val template = requireInstance<AppTemplate.FullScreenTemplate>(awaitItem())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class TemplateProvider(
/** Creates a provider with a fresh Compose presenter scope that it can cancel independently. */
fun createTemplateProvider(): TemplateProvider {
return templateProviderFactory.create(
composePresenterScopeFactory.createComposePresenterScope()
composePresenterScopeFactory.createComposePresenterScope(),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import dev.zacsweers.metro.createGraphFactory
/** Android test application that installs the graph containing integration-test robots. */
class TestAndroidApplication : AndroidApplication() {
override fun metroGraph(
listDetailApplication: software.ralf.app.platform.listdetail.Application
listDetailApplication: software.ralf.app.platform.listdetail.Application,
): AppGraph {
return createGraphFactory<TestAndroidAppGraph.Factory>().create(this, listDetailApplication)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ open class AndroidApplication : Application(), RootScopeProvider {

/** Creates the production graph. Tests can override this to install a test graph. */
protected open fun metroGraph(
listDetailApplication: software.ralf.app.platform.listdetail.Application
listDetailApplication: software.ralf.app.platform.listdetail.Application,
): AppGraph {
return createGraphFactory<AndroidAppGraph.Factory>().create(this, listDetailApplication)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ class CharacterDetailPresenter(
/** The requested character is present in the latest repository value. */
data class Available(
/** Character rendered by the detail screen. */
val character: Character
val character: Character,
) : State

/** The requested character is no longer present in the repository. */
data class Missing(
/** Identifier that could not be resolved. */
val characterId: String
val characterId: String,
) : State
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CharacterListPresenter(private val repository: CharacterRepository) :
/** Selection owned by the parent phone or tablet presenter. */
data class Input(
/** Identifier highlighted by the list renderer, or `null` when nothing is selected. */
val selectedCharacterId: String?
val selectedCharacterId: String?,
)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class CharacterListRenderer : ComposeRenderer<CharacterListPresenter.Model>() {
AppTheme.colorScheme.secondaryContainer
} else {
AppTheme.colorScheme.surface
}
},
),
modifier =
Modifier.selectable(selected = selected, onClick = onClick)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ internal fun Modifier.sharedCharacterBounds(
sharedBounds(
sharedContentState =
rememberSharedContentState(
key = CharacterSharedElementKey(characterId = characterId, element = element)
key = CharacterSharedElementKey(characterId = characterId, element = element),
),
animatedVisibilityScope = animatedVisibilityScope,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ class PhoneListDetailPresenter(

@Composable
private fun presentListModel(
selectionState: ListDetailSelectionState
selectionState: ListDetailSelectionState,
): CharacterListPresenter.Model {
val backstackScope = LocalBackstackScope.requireNotNull()
val listModel =
listPresenter.present(
CharacterListPresenter.Input(selectedCharacterId = selectionState.selectedCharacterId)
CharacterListPresenter.Input(selectedCharacterId = selectionState.selectedCharacterId),
)

return listModel.copy(
Expand All @@ -58,16 +58,16 @@ class PhoneListDetailPresenter(
detailPresenterFactory.createCharacterDetailPresenter(
characterId = character.id,
showBackButton = true,
)
),
)
}
},
)
}

/** State supplied by the adaptive parent so selection survives layout changes. */
data class Input(
/** Shared character selection state. */
val selectionState: ListDetailSelectionState
val selectionState: ListDetailSelectionState,
)

/** Delegates rendering to App Platform's presenter-backstack model. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class TabletListDetailPresenter(
/** State supplied by the adaptive parent so selection survives layout changes. */
data class Input(
/** Shared character selection state. */
val selectionState: ListDetailSelectionState
val selectionState: ListDetailSelectionState,
)

/** States understood by the tablet renderer. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class ListDetailPresenterImplTest {
}

private fun detailPresenterFactory(
repository: CharacterRepository
repository: CharacterRepository,
): CharacterDetailPresenter.Factory {
return object : CharacterDetailPresenter.Factory {
override fun createCharacterDetailPresenter(
Expand Down Expand Up @@ -230,7 +230,7 @@ class ListDetailPresenterImplTest {
}

private suspend fun ReceiveTurbine<BaseModel>.awaitTabletModel(
selectedCharacterId: String? = null
selectedCharacterId: String? = null,
): TabletListDetailPresenter.Model {
while (true) {
val model = awaitItem().delegatedModel()
Expand All @@ -245,7 +245,7 @@ class ListDetailPresenterImplTest {
}

private suspend fun ReceiveTurbine<BaseModel>.awaitTabletContent(
selectedCharacterId: String? = null
selectedCharacterId: String? = null,
): TabletListDetailPresenter.Model.Content {
while (true) {
val model = awaitItem().delegatedModel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DefaultBackstackRenderer : PresenterBackstackRenderer<DefaultBackstackMode
// NavDisplay is implemented with AnimatedContent. Forward its entry-specific scope so child
// renderers can coordinate shared elements with the outgoing or incoming navigation entry.
CompositionLocalProvider(
LocalAnimatedVisibilityScope provides LocalNavAnimatedContentScope.current
LocalAnimatedVisibilityScope provides LocalNavAnimatedContentScope.current,
) {
Render(model)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data class DefaultBackstackModel(
/** Presents [initialPresenter] in a backstack that pops its current entry on back. */
@Composable
fun presenterBackstackDefault(
initialPresenter: ComposePresenter<Unit, out BaseModel>
initialPresenter: ComposePresenter<Unit, out BaseModel>,
): DefaultBackstackModel {
return presenterBackstack(initialPresenter) { backstack ->
DefaultBackstackModel(backstack = backstack, onBack = { pop() })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sealed interface AppTemplate : Template {
/** Template that delegates the entire available window to one feature model. */
data class FullScreenTemplate(
/** Feature model resolved through the platform's renderer factory. */
val model: BaseModel
val model: BaseModel,
) : AppTemplate
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AppTemplatePresenter(
@Composable
override fun present(input: Unit): AppTemplate {
return withCompositionLocal(
LocalBackGestureDispatcherPresenter provides backGestureDispatcherPresenter
LocalBackGestureDispatcherPresenter provides backGestureDispatcherPresenter,
) {
rootPresenter.present(Unit).toAppTemplate()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TemplateProvider(
*/
fun createTemplateProvider(): TemplateProvider {
return templateProviderFactory.create(
composePresenterScopeFactory.createComposePresenterScope()
composePresenterScopeFactory.createComposePresenterScope(),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open class AndroidApplication : Application(), RootScopeProvider {

/** Create the [AppGraph]. In UI tests we use a different instance. */
protected open fun metroGraph(
templateApplication: software.ralf.app.platform.template.Application
templateApplication: software.ralf.app.platform.template.Application,
): AppGraph {
return createGraphFactory<AndroidAppGraph.Factory>().create(this, templateApplication)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class NavigationHeaderRenderer : ComposeRenderer<Model>() {

Spacer(
modifier =
Modifier.fillMaxWidth().height(1.dp).background(MaterialTheme.colorScheme.primary)
Modifier.fillMaxWidth().height(1.dp).background(MaterialTheme.colorScheme.primary),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
* This class is part of the `:testing` module and shared with other modules.
*/
class FakeExampleRepository(
override val exampleStateFlow: MutableStateFlow<Int> = MutableStateFlow(0)
override val exampleStateFlow: MutableStateFlow<Int> = MutableStateFlow(0),
) : ExampleRepository {

override fun setExampleFlowValue(value: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sealed interface AppTemplate : Template {
/** A template that hosts a single model, which should rendered as full-screen element. */
data class FullScreenTemplate(
/** The model to be rendered fullscreen. */
val model: BaseModel
val model: BaseModel,
) : AppTemplate

data class HeaderDetailTemplate(val header: BaseModel, val detail: BaseModel) : AppTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal const val ANDROID_TEST_EXECUTION = "ANDROIDX_TEST_ORCHESTRATOR"
internal val ANDROID_TEST_INSTRUMENTATION_RUNNER_ARGUMENTS = mapOf("clearPackageData" to "true")

internal fun Project.configureAppPlatformInstrumentedTests(
implementationConfigurationName: String
implementationConfigurationName: String,
) {
releaseTask.configure { it.dependsOn("emulatorCheck") }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ constructor(objects: ObjectFactory, private val project: Project) {
.convention(
project.provider {
project.ci || project.gradle.taskGraph.hasTask("${project.path}:release")
}
},
)

public fun kotlinWarningsAsErrors(enabled: Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ internal fun Project.allExportedDependencies(): Set<Any> {
.filter { it.subprojects.isEmpty() }
.filter { it.appOrNull == null }
.filter { !it.isRobotsModule() && !it.isTestingModule() && !it.isAppModule() }
.map { dependencies.project(it.path) }
.map { dependencies.project(it.path) },
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public open class KmpPlugin : Plugin<Project> {
implementation(libs.findLibrary("kotlin.inject.runtime").get().get().toString())
implementation(libs.findLibrary("kotlin.inject.anvil.runtime").get().get().toString())
implementation(
libs.findLibrary("kotlin.inject.anvil.runtime.optional").get().get().toString()
libs.findLibrary("kotlin.inject.anvil.runtime.optional").get().get().toString(),
)

if (path != ":di-common:public" && path != ":kotlin-inject:public") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ internal sealed interface Platform {

project.kmpExtension.sourceSets.getByName("desktopMain").dependencies {
implementation(
"org.jetbrains.compose.desktop:desktop-jvm-${currentOsTarget()}:$composeVersion"
"org.jetbrains.compose.desktop:desktop-jvm-${currentOsTarget()}:$composeVersion",
)
}

project.kmpExtension.sourceSets.getByName("desktopTest").dependencies {
implementation("org.jetbrains.compose.ui:ui-test-junit4:$composeVersion")
implementation(
"org.jetbrains.compose.desktop:desktop-jvm-${currentOsTarget()}:$composeVersion"
"org.jetbrains.compose.desktop:desktop-jvm-${currentOsTarget()}:$composeVersion",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal object SdkPlugin {
"App Platform ${
artifactId.split('-')
.joinToString(separator = " ", prefix = "", postfix = "") { it.capitalize() }
}"
}",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ import software.amazon.lastmile.kotlin.inject.anvil.extend.ContributingAnnotatio
@ContributingAnnotation
public annotation class ContributesRobot(
/** The scope in which to include this contributed binding. */
val scope: KClass<*>
val scope: KClass<*>,
)
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ private fun Project.enableKotlinInject() {
implementation("$APP_PLATFORM_GROUP:kotlin-inject-public:$APP_PLATFORM_VERSION")
implementation("$APP_PLATFORM_GROUP:kotlin-inject-contribute-public:$APP_PLATFORM_VERSION")
implementation(
"software.amazon.lastmile.kotlin.inject.anvil:runtime:$KOTLIN_INJECT_ANVIL_VERSION"
"software.amazon.lastmile.kotlin.inject.anvil:runtime:$KOTLIN_INJECT_ANVIL_VERSION",
)
implementation(
"software.amazon.lastmile.kotlin.inject.anvil:runtime-optional:" +
KOTLIN_INJECT_ANVIL_VERSION
KOTLIN_INJECT_ANVIL_VERSION,
)
}

Expand Down Expand Up @@ -477,7 +477,7 @@ private fun Project.enableComposeUi() {
implementation("org.jetbrains.compose.runtime:runtime:$COMPOSE_MULTIPLATFORM_VERSION")

implementation(
"$APP_PLATFORM_GROUP:renderer-compose-multiplatform-public:$APP_PLATFORM_VERSION"
"$APP_PLATFORM_GROUP:renderer-compose-multiplatform-public:$APP_PLATFORM_VERSION",
)

if (isRobotsModule()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public abstract class ModuleStructureDependencyCheckTask : DefaultTask() {
throw GradleException(
":public modules are only allowed to depend on other :public modules. " +
"Remove the dependencies: ${forbiddenDependencies.joinToString()} " +
"from $modulePath."
"from $modulePath.",
)
}
}
Expand All @@ -102,7 +102,7 @@ public abstract class ModuleStructureDependencyCheckTask : DefaultTask() {
throw GradleException(
"No module except for an app module is allowed to import an :impl module. " +
"Remove the dependencies: ${forbiddenDependencies.joinToString()} " +
"from $modulePath."
"from $modulePath.",
)
}
}
Expand All @@ -116,7 +116,7 @@ public abstract class ModuleStructureDependencyCheckTask : DefaultTask() {
throw GradleException(
"Testing modules should be added to the test compile classpath, otherwise " +
"they're included in the final app. Remove the dependencies: " +
"${forbiddenDependencies.joinToString()} from $modulePath."
"${forbiddenDependencies.joinToString()} from $modulePath.",
)
}
}
Expand All @@ -128,7 +128,7 @@ public abstract class ModuleStructureDependencyCheckTask : DefaultTask() {
throw GradleException(
"Robot modules should be added to the instrumented test compile classpath, " +
"otherwise they're included in the final app. Remove the dependencies: " +
"${forbiddenDependencies.joinToString()} from $modulePath."
"${forbiddenDependencies.joinToString()} from $modulePath.",
)
}
}
Expand All @@ -153,7 +153,7 @@ public abstract class ModuleStructureDependencyCheckTask : DefaultTask() {
throw GradleException(
"Internal modules can only be imported within the same library or by app " +
"modules, but not from another library. Remove the dependencies: " +
"${forbiddenDependencies.joinToString()} from $modulePath."
"${forbiddenDependencies.joinToString()} from $modulePath.",
)
}
}
Expand Down Expand Up @@ -207,7 +207,7 @@ public abstract class ModuleStructureDependencyCheckTask : DefaultTask() {
)
task.modulePath = path
task.allowLibraryImplToImplDependencies.set(
appPlatform.moduleStructureOptions().isLibraryImplToImplDependenciesAllowed()
appPlatform.moduleStructureOptions().isLibraryImplToImplDependenciesAllowed(),
)
task.testFixtures.set(isTestFixtures)
task.testCompilation.set(isTestCompilation)
Expand Down
Loading
Loading