From 6180224372b6845c72d461bca0e53e099496481f Mon Sep 17 00:00:00 2001 From: takahirom Date: Sat, 15 Jun 2024 16:51:00 +0900 Subject: [PATCH 1/3] Fix ./gradlew detekt --auto-correct --- .../github/droidkaigi/confsched/KaigiApp.kt | 2 + .../compose/ComposeEffectErrorHandler.kt | 4 +- .../confsched/data/di/RepositoryQualifier.kt | 3 +- .../AchievementRepositoryModule.kt | 2 +- .../DefaultAchievementRepository.kt | 2 +- .../sessions/DefaultSessionsRepository.kt | 50 +++++++-------- .../droidkaigi/confsched/data/DataModule.kt | 9 +-- .../compose/ui/tooling/preview/Preview.kt | 2 +- .../confsched/designsystem/theme/Color.kt | 7 --- .../confsched/designsystem/theme/Theme.kt | 27 ++++---- .../confsched/designsystem/theme/Type.kt | 4 -- .../model/compositionlocal/LocalRepository.kt | 1 + .../confsched/testing/MiniRobots.kt | 4 +- .../confsched/testing/RobotTestRule.kt | 2 +- .../confsched/testing/robot/KaigiAppRobot.kt | 7 +-- .../robot/TimetableItemDetailScreenRobot.kt | 2 +- .../testing/robot/TimetableScreenRobot.kt | 4 +- .../confsched/ui/ScreenInfo.android.kt | 2 +- .../confsched/ui/ErrorAndRetryHandler.kt | 5 -- .../confsched/ui/PresenterDefaultsProvider.kt | 4 +- ...ument.kt => RememberNavigationArgument.kt} | 0 .../confsched/ui/IosComposeAdapter.kt | 20 +++--- .../droidkaigi/confsched/ui/ScreenInfo.ios.kt | 4 +- .../contributors/ContributorsScreenTest.kt | 4 +- .../contributors/ContributorsScreen.kt | 17 +++--- .../ContributorsScreenPresenter.kt | 4 +- .../component/ContributorsItem.kt | 4 +- .../confsched/contributors/IosCompose.kt | 6 +- .../droidkaigi/confsched/main/MainScreen.kt | 8 ++- .../confsched/main/MainScreenPresenter.kt | 5 +- .../confsched/main/DarwinContributors.kt | 61 ------------------- .../sessions/TimetableItemDetailPresenter.kt | 6 +- .../sessions/TimetableItemDetailScreen.kt | 20 +++--- .../confsched/sessions/TimetableScreen.kt | 4 +- .../sessions/TimetableScreenPresenter.kt | 2 +- .../sessions/section/TimetableList.kt | 7 +-- .../sessions/section/TimetableSheet.kt | 3 +- 37 files changed, 122 insertions(+), 196 deletions(-) rename core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/{rememberNavigationArgument.kt => RememberNavigationArgument.kt} (100%) delete mode 100644 feature/main/src/iosMain/kotlin/io/github/droidkaigi/confsched/main/DarwinContributors.kt diff --git a/app-android/src/main/java/io/github/droidkaigi/confsched/KaigiApp.kt b/app-android/src/main/java/io/github/droidkaigi/confsched/KaigiApp.kt index fd710c36f..0e8004370 100644 --- a/app-android/src/main/java/io/github/droidkaigi/confsched/KaigiApp.kt +++ b/app-android/src/main/java/io/github/droidkaigi/confsched/KaigiApp.kt @@ -69,6 +69,7 @@ fun KaigiApp( @Composable private fun KaigiNavHost( windowSize: WindowSizeClass, + @Suppress("UnusedParameter") displayFeatures: PersistentList, navController: NavHostController = rememberNavController(), externalNavController: ExternalNavController = rememberExternalNavController(), @@ -96,6 +97,7 @@ private fun KaigiNavHost( private fun NavGraphBuilder.mainScreen( windowSize: WindowSizeClass, navController: NavHostController, + @Suppress("UnusedParameter") externalNavController: ExternalNavController, ) { mainScreen( diff --git a/core/common/src/commonMain/kotlin/io/github/droidkaigi/confsched/compose/ComposeEffectErrorHandler.kt b/core/common/src/commonMain/kotlin/io/github/droidkaigi/confsched/compose/ComposeEffectErrorHandler.kt index 7d3f5c93d..8a24aed32 100644 --- a/core/common/src/commonMain/kotlin/io/github/droidkaigi/confsched/compose/ComposeEffectErrorHandler.kt +++ b/core/common/src/commonMain/kotlin/io/github/droidkaigi/confsched/compose/ComposeEffectErrorHandler.kt @@ -18,7 +18,8 @@ import kotlin.coroutines.EmptyCoroutineContext @Composable @OptIn(InternalComposeApi::class) -fun CompositionLocalProviderWithReturnValue( +@Suppress("ComposeCompositionLocalUsage") +fun compositionLocalProviderWithReturnValue( value: ProvidedValue<*>, content: @Composable () -> T, ): T { @@ -32,6 +33,7 @@ interface ComposeEffectErrorHandler { suspend fun emit(throwable: Throwable) } +@Suppress("CompositionLocalAllowlist") val LocalComposeEffectErrorHandler = staticCompositionLocalOf { object : ComposeEffectErrorHandler { override suspend fun emit(throwable: Throwable) { diff --git a/core/data/src/androidMain/kotlin/io/github/droidkaigi/confsched/data/di/RepositoryQualifier.kt b/core/data/src/androidMain/kotlin/io/github/droidkaigi/confsched/data/di/RepositoryQualifier.kt index 70a26fc9c..6ad05f68e 100644 --- a/core/data/src/androidMain/kotlin/io/github/droidkaigi/confsched/data/di/RepositoryQualifier.kt +++ b/core/data/src/androidMain/kotlin/io/github/droidkaigi/confsched/data/di/RepositoryQualifier.kt @@ -16,10 +16,11 @@ public class RepositoryProvider @Inject constructor( .map { (k, v) -> k.kotlin to v as Any }.toMap() + @Composable public fun Provide(content: @Composable () -> Unit) { CompositionLocalProvider( - LocalRepositories provides repositoriesMap + LocalRepositories provides repositoriesMap, ) { content() } diff --git a/core/data/src/androidMain/kotlin/io/github/droidkaigi/confsched/data/remoteconfig/AchievementRepositoryModule.kt b/core/data/src/androidMain/kotlin/io/github/droidkaigi/confsched/data/remoteconfig/AchievementRepositoryModule.kt index a0b3ddacf..dbc0c75a1 100644 --- a/core/data/src/androidMain/kotlin/io/github/droidkaigi/confsched/data/remoteconfig/AchievementRepositoryModule.kt +++ b/core/data/src/androidMain/kotlin/io/github/droidkaigi/confsched/data/remoteconfig/AchievementRepositoryModule.kt @@ -20,7 +20,7 @@ public abstract class AchievementRepositoryModule { @RepositoryQualifier @IntoMap @ClassKey(AchievementRepository::class) - public abstract fun bindAchievementRepository( + public abstract fun bindAchievementRepository( repository: AchievementRepository, ): Any diff --git a/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/achievements/DefaultAchievementRepository.kt b/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/achievements/DefaultAchievementRepository.kt index 7781fd32a..ec80a15c0 100644 --- a/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/achievements/DefaultAchievementRepository.kt +++ b/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/achievements/DefaultAchievementRepository.kt @@ -1,8 +1,8 @@ package io.github.droidkaigi.confsched.data.achievements -import io.github.droidkaigi.confsched.model.AchievementRepository import io.github.droidkaigi.confsched.data.remoteconfig.RemoteConfigApi import io.github.droidkaigi.confsched.model.Achievement +import io.github.droidkaigi.confsched.model.AchievementRepository import kotlinx.collections.immutable.PersistentSet import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow diff --git a/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/sessions/DefaultSessionsRepository.kt b/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/sessions/DefaultSessionsRepository.kt index e4c35f6a5..18e2e1350 100644 --- a/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/sessions/DefaultSessionsRepository.kt +++ b/core/data/src/commonMain/kotlin/io/github/droidkaigi/confsched/data/sessions/DefaultSessionsRepository.kt @@ -32,27 +32,27 @@ public class DefaultSessionsRepository( var first = true combine( sessionCacheDataStore.getTimetableStream().catch { e -> - Logger.d( - "DefaultSessionsRepository sessionCacheDataStore.getTimetableStream catch", - e, - ) - sessionCacheDataStore.save(sessionsApi.sessionsAllResponse()) - emitAll(sessionCacheDataStore.getTimetableStream()) - }, + Logger.d( + "DefaultSessionsRepository sessionCacheDataStore.getTimetableStream catch", + e, + ) + sessionCacheDataStore.save(sessionsApi.sessionsAllResponse()) + emitAll(sessionCacheDataStore.getTimetableStream()) + }, userDataStore.getFavoriteSessionStream(), ) { timetable, favorites -> timetable.copy(bookmarks = favorites) }.collect { - if (!it.isEmpty()) { - emit(it) - } - if (first) { - first = false - Logger.d("DefaultSessionsRepository onStart getTimetableStream()") - sessionCacheDataStore.save(sessionsApi.sessionsAllResponse()) - Logger.d("DefaultSessionsRepository onStart fetched") - } + if (!it.isEmpty()) { + emit(it) } + if (first) { + first = false + Logger.d("DefaultSessionsRepository onStart getTimetableStream()") + sessionCacheDataStore.save(sessionsApi.sessionsAllResponse()) + Logger.d("DefaultSessionsRepository onStart fetched") + } + } } override fun getTimetableItemWithBookmarkStream(id: TimetableItemId): Flow> { @@ -75,13 +75,13 @@ public class DefaultSessionsRepository( val timetable by remember { sessionCacheDataStore.getTimetableStream().catch { e -> - Logger.d( - "DefaultSessionsRepository sessionCacheDataStore.getTimetableStream catch", - e, - ) - sessionCacheDataStore.save(sessionsApi.sessionsAllResponse()) - emitAll(sessionCacheDataStore.getTimetableStream()) - } + Logger.d( + "DefaultSessionsRepository sessionCacheDataStore.getTimetableStream catch", + e, + ) + sessionCacheDataStore.save(sessionsApi.sessionsAllResponse()) + emitAll(sessionCacheDataStore.getTimetableStream()) + } }.safeCollectAsState(Timetable()) val favoriteSessions by remember { userDataStore.getFavoriteSessionStream() @@ -99,7 +99,9 @@ public class DefaultSessionsRepository( timetable.timetableItems.firstOrNull { it.id == id } ?: return@remember null timetableItem to timetable.bookmarks.contains(id) } - Logger.d { "DefaultSessionsRepository timetableItemWithBookmark() timetableSize:${timetable.timetableItems.size} id:$id itemWithBookmark=$itemWithBookmark" } + Logger.d { + "DefaultSessionsRepository timetableItemWithBookmark() timetableSize:${timetable.timetableItems.size} id:$id itemWithBookmark=$itemWithBookmark" + } return itemWithBookmark } diff --git a/core/data/src/iosMain/kotlin/io/github/droidkaigi/confsched/data/DataModule.kt b/core/data/src/iosMain/kotlin/io/github/droidkaigi/confsched/data/DataModule.kt index dc2b21ccb..9940de755 100644 --- a/core/data/src/iosMain/kotlin/io/github/droidkaigi/confsched/data/DataModule.kt +++ b/core/data/src/iosMain/kotlin/io/github/droidkaigi/confsched/data/DataModule.kt @@ -5,7 +5,6 @@ import io.github.droidkaigi.confsched.data.achievements.AchievementsDataStore import io.github.droidkaigi.confsched.data.achievements.DefaultAchievementRepository import io.github.droidkaigi.confsched.data.auth.AuthApi import io.github.droidkaigi.confsched.data.auth.DefaultAuthApi -import io.github.droidkaigi.confsched.model.AchievementRepository import io.github.droidkaigi.confsched.data.contributors.ContributorsApiClient import io.github.droidkaigi.confsched.data.contributors.DefaultContributorsApiClient import io.github.droidkaigi.confsched.data.contributors.DefaultContributorsRepository @@ -22,6 +21,7 @@ import io.github.droidkaigi.confsched.data.staff.DefaultStaffApiClient import io.github.droidkaigi.confsched.data.staff.DefaultStaffRepository import io.github.droidkaigi.confsched.data.staff.StaffApiClient import io.github.droidkaigi.confsched.data.user.UserDataStore +import io.github.droidkaigi.confsched.model.AchievementRepository import io.github.droidkaigi.confsched.model.ContributorsRepository import io.github.droidkaigi.confsched.model.SessionsRepository import io.github.droidkaigi.confsched.model.SponsorsRepository @@ -53,7 +53,7 @@ public interface Repositories { public class DefaultRepositories( public override val map: Map, Any>, -): Repositories +) : Repositories @OptIn(ExperimentalForeignApi::class) public val dataModule: Module = module { @@ -144,13 +144,14 @@ public val dataModule: Module = module { singleOf(::DefaultStaffRepository) bind StaffRepository::class singleOf(::DefaultSponsorsRepository) bind SponsorsRepository::class single { - DefaultRepositories(mapOf( + DefaultRepositories( + mapOf( AchievementRepository::class to get(), SessionsRepository::class to get(), ContributorsRepository::class to get(), StaffRepository::class to get(), SponsorsRepository::class to get(), - ) + ), ) } } diff --git a/core/designsystem/src/commonMain/kotlin/androidx/compose/ui/tooling/preview/Preview.kt b/core/designsystem/src/commonMain/kotlin/androidx/compose/ui/tooling/preview/Preview.kt index 19b0ea558..cd13a0a06 100644 --- a/core/designsystem/src/commonMain/kotlin/androidx/compose/ui/tooling/preview/Preview.kt +++ b/core/designsystem/src/commonMain/kotlin/androidx/compose/ui/tooling/preview/Preview.kt @@ -3,7 +3,7 @@ package androidx.compose.ui.tooling.preview @Retention(AnnotationRetention.BINARY) @Target( AnnotationTarget.ANNOTATION_CLASS, - AnnotationTarget.FUNCTION + AnnotationTarget.FUNCTION, ) @Repeatable annotation class Preview( diff --git a/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Color.kt b/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Color.kt index af91b0c87..8367726bb 100644 --- a/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Color.kt +++ b/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Color.kt @@ -217,10 +217,3 @@ val surfaceContainerLowDarkHighContrast = Color(0xFF1A1C1C) val surfaceContainerDarkHighContrast = Color(0xFF1F2020) val surfaceContainerHighDarkHighContrast = Color(0xFF292A2A) val surfaceContainerHighestDarkHighContrast = Color(0xFF343535) - - - - - - - diff --git a/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Theme.kt b/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Theme.kt index d26e39022..2972785f1 100644 --- a/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Theme.kt +++ b/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Theme.kt @@ -1,6 +1,7 @@ +@file:Suppress("UnusedPrivateProperty") + package io.github.droidkaigi.confsched.designsystem.theme -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme import androidx.compose.material3.lightColorScheme @@ -241,18 +242,23 @@ data class ColorFamily( val color: Color, val onColor: Color, val colorContainer: Color, - val onColorContainer: Color + val onColorContainer: Color, ) val unspecified_scheme = ColorFamily( - Color.Unspecified, Color.Unspecified, Color.Unspecified, Color.Unspecified + Color.Unspecified, + Color.Unspecified, + Color.Unspecified, + Color.Unspecified, ) @Composable fun KaigiTheme( - content: @Composable() () -> Unit + content: + @Composable() + () -> Unit, ) { - val colorScheme = darkScheme + val colorScheme = darkScheme // val view = LocalView.current // if (!view.isInEditMode) { // SideEffect { @@ -262,10 +268,9 @@ fun KaigiTheme( // } // } - MaterialTheme( - colorScheme = colorScheme, - typography = AppTypography, - content = content - ) + MaterialTheme( + colorScheme = colorScheme, + typography = AppTypography, + content = content, + ) } - diff --git a/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Type.kt b/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Type.kt index fe1860c07..912ba0ff9 100644 --- a/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Type.kt +++ b/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Type.kt @@ -1,9 +1,5 @@ package io.github.droidkaigi.confsched.designsystem.theme import androidx.compose.material3.Typography -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.sp val AppTypography = Typography() diff --git a/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/compositionlocal/LocalRepository.kt b/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/compositionlocal/LocalRepository.kt index 3345eb999..9bc88fa9f 100644 --- a/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/compositionlocal/LocalRepository.kt +++ b/core/model/src/commonMain/kotlin/io/github/droidkaigi/confsched/model/compositionlocal/LocalRepository.kt @@ -3,6 +3,7 @@ package io.github.droidkaigi.confsched.model.compositionlocal import androidx.compose.runtime.compositionLocalOf import kotlin.reflect.KClass +@Suppress("CompositionLocalAllowlist") val LocalRepositories = compositionLocalOf, Any>> { error("No LocalRepository provided") } diff --git a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/MiniRobots.kt b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/MiniRobots.kt index 2d06a9841..059b985fd 100644 --- a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/MiniRobots.kt +++ b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/MiniRobots.kt @@ -51,7 +51,7 @@ interface CaptureScreenRobot { @Deprecated( message = "Use captureScreenWithChecks instead and add checks to ensure screen contents are correct", - replaceWith = ReplaceWith("captureScreenWithChecks(checks)") + replaceWith = ReplaceWith("captureScreenWithChecks(checks)"), ) fun captureScreenWithChecks() } @@ -69,7 +69,7 @@ class DefaultCaptureScreenRobot @Inject constructor(private val robotTestRule: R @Deprecated( "Use captureScreenWithChecks instead and add checks to ensure screen contents are correct", - replaceWith = ReplaceWith("captureScreenWithChecks(checks)") + replaceWith = ReplaceWith("captureScreenWithChecks(checks)"), ) override fun captureScreenWithChecks() { robotTestRule.captureScreen() diff --git a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/RobotTestRule.kt b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/RobotTestRule.kt index aa73825f4..99e46b5ec 100644 --- a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/RobotTestRule.kt +++ b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/RobotTestRule.kt @@ -121,7 +121,7 @@ class RobotTestRule( fun setContent(content: @Composable () -> Unit) { val repositoryProvider = EntryPoints.get( composeTestRule.activity.application, - RepositoryProviderEntryPoint::class.java + RepositoryProviderEntryPoint::class.java, ) .getRepositoryProvider() composeTestRule.setContent { diff --git a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/KaigiAppRobot.kt b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/KaigiAppRobot.kt index 5f5707e2b..28fac9b44 100644 --- a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/KaigiAppRobot.kt +++ b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/KaigiAppRobot.kt @@ -1,21 +1,16 @@ package io.github.droidkaigi.confsched.testing.robot import androidx.compose.ui.test.hasTestTag -import androidx.compose.ui.test.junit4.AndroidComposeTestRule import androidx.compose.ui.test.onFirst import androidx.compose.ui.test.performClick import io.github.droidkaigi.confsched.main.MainScreenTab import io.github.droidkaigi.confsched.testing.DefaultScreenRobot -import io.github.droidkaigi.confsched.testing.DefaultWaitRobot -import io.github.droidkaigi.confsched.testing.RobotTestRule import io.github.droidkaigi.confsched.testing.ScreenRobot -import kotlinx.coroutines.test.TestDispatcher import javax.inject.Inject class KaigiAppRobot @Inject constructor( - robotTestRule: RobotTestRule, private val defaultScreenRobot: DefaultScreenRobot, -): ScreenRobot by defaultScreenRobot { +) : ScreenRobot by defaultScreenRobot { @Inject lateinit var timetableScreenRobot: TimetableScreenRobot fun goToAbout() { diff --git a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/TimetableItemDetailScreenRobot.kt b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/TimetableItemDetailScreenRobot.kt index 2f1375140..eb2aca09a 100644 --- a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/TimetableItemDetailScreenRobot.kt +++ b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/TimetableItemDetailScreenRobot.kt @@ -26,7 +26,7 @@ class TimetableItemDetailScreenRobot @Inject constructor( suspend fun setupScreenContent() { val firstSessionId = SessionsAllResponse.Companion.fake().sessions.first().id robotTestRule.setContentWithNavigation( - startDestination = "timetableItemDetail/${firstSessionId}", + startDestination = "timetableItemDetail/$firstSessionId", route = timetableItemDetailScreenRoute, ) { KaigiTheme { diff --git a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/TimetableScreenRobot.kt b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/TimetableScreenRobot.kt index 52663c236..8acbd533b 100644 --- a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/TimetableScreenRobot.kt +++ b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/TimetableScreenRobot.kt @@ -28,9 +28,9 @@ import javax.inject.Inject class TimetableScreenRobot @Inject constructor( private val screenRobot: DefaultScreenRobot, - private val timetableServerRobot: DefaultTimetableServerRobot + private val timetableServerRobot: DefaultTimetableServerRobot, ) : ScreenRobot by screenRobot, - TimetableServerRobot by timetableServerRobot{ + TimetableServerRobot by timetableServerRobot { fun setupTimetableScreenContent() { robotTestRule.setContent { CompositionLocalProvider(LocalClock provides FakeClock) { diff --git a/core/ui/src/androidMain/kotlin/io/github/droidkaigi/confsched/ui/ScreenInfo.android.kt b/core/ui/src/androidMain/kotlin/io/github/droidkaigi/confsched/ui/ScreenInfo.android.kt index bfbc4d5d0..8f419bf1c 100644 --- a/core/ui/src/androidMain/kotlin/io/github/droidkaigi/confsched/ui/ScreenInfo.android.kt +++ b/core/ui/src/androidMain/kotlin/io/github/droidkaigi/confsched/ui/ScreenInfo.android.kt @@ -11,6 +11,6 @@ actual fun getScreenSizeInfo(): ScreenInfo { // val hDp = config.screenHeightDp.dp // val wDp = config.screenWidthDp.dp return ScreenInfo( - isPort = LocalConfiguration.current.orientation == Configuration.ORIENTATION_PORTRAIT + isPort = LocalConfiguration.current.orientation == Configuration.ORIENTATION_PORTRAIT, ) } diff --git a/core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/ErrorAndRetryHandler.kt b/core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/ErrorAndRetryHandler.kt index 64a261efc..f74a1a5e4 100644 --- a/core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/ErrorAndRetryHandler.kt +++ b/core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/ErrorAndRetryHandler.kt @@ -1,10 +1,5 @@ package io.github.droidkaigi.confsched.ui -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import io.github.droidkaigi.confsched.compose.ComposeEffectErrorHandler -import io.github.droidkaigi.confsched.compose.CompositionLocalProviderWithReturnValue -import io.github.droidkaigi.confsched.compose.LocalComposeEffectErrorHandler import io.github.droidkaigi.confsched.designsystem.strings.Strings import io.github.droidkaigi.confsched.ui.UserMessageResult.ActionPerformed import kotlinx.coroutines.flow.Flow diff --git a/core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/PresenterDefaultsProvider.kt b/core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/PresenterDefaultsProvider.kt index 341498814..049fa658c 100644 --- a/core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/PresenterDefaultsProvider.kt +++ b/core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/PresenterDefaultsProvider.kt @@ -3,8 +3,8 @@ package io.github.droidkaigi.confsched.ui import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import io.github.droidkaigi.confsched.compose.ComposeEffectErrorHandler -import io.github.droidkaigi.confsched.compose.CompositionLocalProviderWithReturnValue import io.github.droidkaigi.confsched.compose.LocalComposeEffectErrorHandler +import io.github.droidkaigi.confsched.compose.compositionLocalProviderWithReturnValue @Composable fun providePresenterDefaults( @@ -22,7 +22,7 @@ fun providePresenterDefaults( } } } - return CompositionLocalProviderWithReturnValue(LocalComposeEffectErrorHandler provides handler) { + return compositionLocalProviderWithReturnValue(LocalComposeEffectErrorHandler provides handler) { block(userMessageStateHolder) } } diff --git a/core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/rememberNavigationArgument.kt b/core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/RememberNavigationArgument.kt similarity index 100% rename from core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/rememberNavigationArgument.kt rename to core/ui/src/commonMain/kotlin/io/github/droidkaigi/confsched/ui/RememberNavigationArgument.kt diff --git a/core/ui/src/iosMain/kotlin/io/github/droidkaigi/confsched/ui/IosComposeAdapter.kt b/core/ui/src/iosMain/kotlin/io/github/droidkaigi/confsched/ui/IosComposeAdapter.kt index bb020474e..d506a2ca8 100644 --- a/core/ui/src/iosMain/kotlin/io/github/droidkaigi/confsched/ui/IosComposeAdapter.kt +++ b/core/ui/src/iosMain/kotlin/io/github/droidkaigi/confsched/ui/IosComposeAdapter.kt @@ -19,7 +19,7 @@ import androidx.navigation.compose.rememberNavController import app.cash.molecule.RecompositionMode import app.cash.molecule.moleculeFlow import co.touchlab.kermit.Logger -import io.github.droidkaigi.confsched.compose.CompositionLocalProviderWithReturnValue +import io.github.droidkaigi.confsched.compose.compositionLocalProviderWithReturnValue import io.github.droidkaigi.confsched.data.Repositories import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import io.github.droidkaigi.confsched.model.compositionlocal.LocalRepositories @@ -44,9 +44,9 @@ fun presenterStateFlow( override val lifecycle: Lifecycle = LifecycleRegistry(this) } } - CompositionLocalProviderWithReturnValue(LocalViewModelStoreOwner provides nestedRegistry) { - CompositionLocalProviderWithReturnValue(LocalLifecycleOwner provides lifecycleRegistry) { - CompositionLocalProviderWithReturnValue(LocalRepositories provides repositories) { + compositionLocalProviderWithReturnValue(LocalViewModelStoreOwner provides nestedRegistry) { + compositionLocalProviderWithReturnValue(LocalLifecycleOwner provides lifecycleRegistry) { + compositionLocalProviderWithReturnValue(LocalRepositories provides repositories) { presenter(events) } } @@ -54,19 +54,15 @@ fun presenterStateFlow( } } - @Suppress("UNUSED") fun composeViewController( repositories: Repositories, content: @Composable () -> Unit, -): UIViewController = /** no action for iOS side **/ - ComposeUIViewController { - /** no action for iOS side **/ - NavHost(rememberNavController(), startDestination = "root") { +): UIViewController = ComposeUIViewController { + NavHost(rememberNavController(), startDestination = "root") { composable("root") { - /** no action for iOS side **/ CompositionLocalProvider( - LocalRepositories provides repositories.map + LocalRepositories provides repositories.map, ) { Logger.d { "contributorViewController" } val uiViewController = LocalUIViewController.current @@ -76,7 +72,6 @@ fun composeViewController( // viewModel.viewModelScope.cancel() } - /** no action for iOS side **/ KaigiTheme { content() } @@ -84,4 +79,3 @@ fun composeViewController( } } } - diff --git a/core/ui/src/iosMain/kotlin/io/github/droidkaigi/confsched/ui/ScreenInfo.ios.kt b/core/ui/src/iosMain/kotlin/io/github/droidkaigi/confsched/ui/ScreenInfo.ios.kt index 24ff6578e..54e8a8af4 100644 --- a/core/ui/src/iosMain/kotlin/io/github/droidkaigi/confsched/ui/ScreenInfo.ios.kt +++ b/core/ui/src/iosMain/kotlin/io/github/droidkaigi/confsched/ui/ScreenInfo.ios.kt @@ -2,15 +2,13 @@ package io.github.droidkaigi.confsched.ui import androidx.compose.runtime.Composable import androidx.compose.ui.ExperimentalComposeUiApi -import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalWindowInfo @OptIn(ExperimentalComposeUiApi::class) @Composable actual fun getScreenSizeInfo(): ScreenInfo { - val density = LocalDensity.current val config = LocalWindowInfo.current.containerSize return ScreenInfo( - isPort = config.height > config.width + isPort = config.height > config.width, ) } diff --git a/feature/contributors/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreenTest.kt b/feature/contributors/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreenTest.kt index 514c379ae..e803664f9 100644 --- a/feature/contributors/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreenTest.kt +++ b/feature/contributors/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreenTest.kt @@ -32,7 +32,7 @@ class ContributorsScreenTest { setupScreenContent() captureScreenWithChecks( - checks = todoChecks("This screen is still empty now. Please add some checks.") + checks = todoChecks("This screen is still empty now. Please add some checks."), ) } } @@ -44,7 +44,7 @@ class ContributorsScreenTest { setupScreenContent() captureScreenWithChecks( - checks = todoChecks("This screen is still empty now. Please add some checks.") + checks = todoChecks("This screen is still empty now. Please add some checks."), ) } } diff --git a/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreen.kt b/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreen.kt index f4635fffd..e119458e6 100644 --- a/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreen.kt +++ b/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreen.kt @@ -5,8 +5,8 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.Icons.AutoMirrored.Filled +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -61,9 +61,10 @@ data class ContributorsUiState( @Composable fun ContributorsScreen( - isTopAppBarHidden: Boolean = false, onNavigationIconClick: () -> Unit, onContributorsItemClick: (url: String) -> Unit, + modifier: Modifier = Modifier, + isTopAppBarHidden: Boolean = false, ) { val eventEmitter = rememberEventEmitter() val uiState = contributorsScreenPresenter( @@ -82,6 +83,7 @@ fun ContributorsScreen( snackbarHostState = snackbarHostState, onBackClick = onNavigationIconClick, onContributorsItemClick = onContributorsItemClick, + modifier = modifier, ) } @@ -93,6 +95,7 @@ fun ContributorsScreen( onBackClick: () -> Unit, onContributorsItemClick: (url: String) -> Unit, isTopAppBarHidden: Boolean, + modifier: Modifier = Modifier, ) { Logger.d { "ContributorsScreen: $uiState" } val scrollBehavior = @@ -102,7 +105,7 @@ fun ContributorsScreen( null } Scaffold( - modifier = Modifier.testTag(ContributorsScreenTestTag), + modifier = modifier.testTag(ContributorsScreenTestTag), snackbarHost = { SnackbarHost(hostState = snackbarHostState) }, topBar = { if (scrollBehavior != null) { @@ -115,12 +118,12 @@ fun ContributorsScreen( onClick = onBackClick, ) { Icon( - imageVector = Icons.Default.ArrowBack, + imageVector = Filled.ArrowBack, contentDescription = "Back", ) } }, - scrollBehavior = scrollBehavior + scrollBehavior = scrollBehavior, ) } }, @@ -155,7 +158,7 @@ private fun Contributors( ContributorsItem( contributor = it, onClick = onContributorsItemClick, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) } } diff --git a/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreenPresenter.kt b/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreenPresenter.kt index ac182569d..cf67f59d2 100644 --- a/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreenPresenter.kt +++ b/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreenPresenter.kt @@ -9,8 +9,7 @@ import io.github.droidkaigi.confsched.model.localContributorsRepository import io.github.droidkaigi.confsched.ui.providePresenterDefaults import kotlinx.coroutines.flow.Flow -sealed interface ContributorsScreenEvent { -} +sealed interface ContributorsScreenEvent @Composable fun contributorsScreenPresenter( @@ -20,7 +19,6 @@ fun contributorsScreenPresenter( val contributors by rememberUpdatedState(contributorsRepository.contributors()) SafeLaunchedEffect(Unit) { events.collect { - } } ContributorsUiState( diff --git a/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/component/ContributorsItem.kt b/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/component/ContributorsItem.kt index 52463b01f..378b9c469 100644 --- a/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/component/ContributorsItem.kt +++ b/feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/component/ContributorsItem.kt @@ -29,7 +29,7 @@ private val contributorIconShape = RoundedCornerShape(20.dp) fun ContributorsItem( contributor: Contributor, onClick: (url: String) -> Unit, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { Row( modifier = modifier @@ -51,7 +51,7 @@ fun ContributorsItem( .border( width = 1.dp, color = MaterialTheme.colorScheme.outline, - shape = contributorIconShape + shape = contributorIconShape, ), ) Text( diff --git a/feature/contributors/src/iosMain/kotlin/io/github/droidkaigi/confsched/contributors/IosCompose.kt b/feature/contributors/src/iosMain/kotlin/io/github/droidkaigi/confsched/contributors/IosCompose.kt index 52cf1d231..9ef5fc0de 100644 --- a/feature/contributors/src/iosMain/kotlin/io/github/droidkaigi/confsched/contributors/IosCompose.kt +++ b/feature/contributors/src/iosMain/kotlin/io/github/droidkaigi/confsched/contributors/IosCompose.kt @@ -14,7 +14,7 @@ fun contributorsViewController( ): UIViewController = composeViewController(repositories) { ContributorsScreen( isTopAppBarHidden = true, - onNavigationIconClick = { /** no action for iOS side **/ }, + onNavigationIconClick = { /* no action for iOS side */ }, onContributorsItemClick = onContributorsItemClick, ) } @@ -25,9 +25,7 @@ fun contributorsScreenPresenterStateFlow( events: Flow, ): Flow = presenterStateFlow( events = events, - repositories = repositories + repositories = repositories, ) { contributorsScreenPresenter(events) } - - diff --git a/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreen.kt b/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreen.kt index 540d94512..05d597106 100644 --- a/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreen.kt +++ b/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreen.kt @@ -159,17 +159,20 @@ data class MainScreenUiState( @Composable fun MainScreen( + @Suppress("UnusedParameter") uiState: MainScreenUiState, + @Suppress("UnusedParameter") snackbarHostState: SnackbarHostState, navigationType: NavigationType, routeToTab: String.() -> MainScreenTab?, onTabSelected: (NavController, MainScreenTab) -> Unit, mainNestedNavGraph: NavGraphBuilder.(NavController, PaddingValues) -> Unit, + modifier: Modifier = Modifier, ) { val mainNestedNavController = rememberNavController() val navBackStackEntry by mainNestedNavController.currentBackStackEntryAsState() val currentTab = navBackStackEntry?.destination?.route?.routeToTab() - Row(modifier = Modifier.fillMaxSize()) { + Row(modifier = modifier.fillMaxSize()) { AnimatedVisibility(visible = navigationType == NavigationRail) { Column { Text(text = "nav rail") @@ -187,13 +190,12 @@ fun MainScreen( MainScreenTab.entries.forEach { tab -> Button( modifier = Modifier.weight(1F), - onClick = { onTabSelected(mainNestedNavController, tab) } + onClick = { onTabSelected(mainNestedNavController, tab) }, ) { Text(text = tab.label + " " + (currentTab == tab)) } } } - } }, ) { padding -> diff --git a/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreenPresenter.kt b/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreenPresenter.kt index 09ef02433..145085092 100644 --- a/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreenPresenter.kt +++ b/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreenPresenter.kt @@ -8,17 +8,18 @@ import io.github.droidkaigi.confsched.model.localAchievementRepository import io.github.droidkaigi.confsched.ui.providePresenterDefaults import kotlinx.coroutines.flow.Flow -sealed interface MainScreenEvent {} +sealed interface MainScreenEvent @Composable fun mainScreenPresenter( + @Suppress("UnusedParameter") events: Flow, achievementRepository: AchievementRepository = localAchievementRepository(), ): MainScreenUiState = providePresenterDefaults { userMessageStateHolder -> val isAchievementsEnabled: Boolean by achievementRepository .getAchievementEnabledStream() .safeCollectAsState( - initial = false + initial = false, ) MainScreenUiState( isAchievementsEnabled = isAchievementsEnabled, diff --git a/feature/main/src/iosMain/kotlin/io/github/droidkaigi/confsched/main/DarwinContributors.kt b/feature/main/src/iosMain/kotlin/io/github/droidkaigi/confsched/main/DarwinContributors.kt deleted file mode 100644 index 901b3262e..000000000 --- a/feature/main/src/iosMain/kotlin/io/github/droidkaigi/confsched/main/DarwinContributors.kt +++ /dev/null @@ -1,61 +0,0 @@ -package io.github.droidkaigi.confsched.main - -import androidx.compose.material3.SnackbarHostState -import androidx.compose.runtime.CompositionLocalProvider -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.remember -import androidx.compose.ui.interop.LocalUIViewController -import androidx.compose.ui.window.ComposeUIViewController -import androidx.navigation.compose.NavHost -import androidx.navigation.compose.composable -import androidx.navigation.compose.rememberNavController -import co.touchlab.kermit.Logger -import io.github.droidkaigi.confsched.compose.rememberEventEmitter -import io.github.droidkaigi.confsched.data.Repositories -import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme -import io.github.droidkaigi.confsched.model.compositionlocal.LocalRepositories -import io.github.droidkaigi.confsched.ui.SnackbarMessageEffect -import platform.UIKit.UIViewController - -@Suppress("UNUSED") -fun mainViewController( - repositories: Repositories, - onContributorItemClick: (url: String) -> Unit, -): UIViewController = ComposeUIViewController { - NavHost(rememberNavController(), startDestination = "root") { - composable("root") { - CompositionLocalProvider( - LocalRepositories provides repositories.map - ) { - Logger.d { "mainViewController" } - val eventEmitter = rememberEventEmitter() - - val uiState = mainScreenPresenter( - events = eventEmitter, - ) - - val snackbarHostState = remember { SnackbarHostState() } - - SnackbarMessageEffect( - snackbarHostState = snackbarHostState, - userMessageStateHolder = uiState.userMessageStateHolder, - ) - val uiViewController = LocalUIViewController.current - LaunchedEffect(uiViewController) { -// uiViewController - // TODO: How to know the destroy event of the ViewController? -// viewModel.viewModelScope.cancel() - } - val mainNestedGraphStateHolder = - - KaigiTheme { - -// MainScreen( -// uiState = uiState, -// snackbarHostState = snackbarHostState, -// ) - } - } - } - } -} diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailPresenter.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailPresenter.kt index d2efaa0f6..7f8c6532d 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailPresenter.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailPresenter.kt @@ -37,7 +37,7 @@ fun timetableItemDetailPresenter( sessionsRepository: SessionsRepository = localSessionsRepository(), timetableItemId: String = rememberNavigationArgument( key = timetableItemDetailScreenRouteItemIdParameterName, - initialValue = "" + initialValue = "", ), ): TimetableItemDetailScreenUiState = providePresenterDefaults { userMessageStateHolder -> val timetableItemStateWithBookmark by rememberUpdatedState( @@ -56,7 +56,7 @@ fun timetableItemDetailPresenter( sessionsRepository.toggleBookmark(timetableItem.id) val oldBookmarked = timetableItemWithBookmark.second if (!oldBookmarked) { - val result = userMessageStateHolder.showMessage( + userMessageStateHolder.showMessage( message = BookmarkedSuccessfully.asString(), actionLabel = ViewBookmarkList.asString(), duration = Short, @@ -88,6 +88,6 @@ fun timetableItemDetailPresenter( isBookmarked = bookmarked, isLangSelectable = timetableItem.sessionType == NORMAL, currentLang = selectedDescriptionLanguage, - userMessageStateHolder = userMessageStateHolder + userMessageStateHolder = userMessageStateHolder, ) } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt index 8c4531be6..d69b359ac 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableItemDetailScreen.kt @@ -156,25 +156,25 @@ private fun TimetableItemDetailScreen( Button(onClick = { onNavigationIconClick() }) { Text( text = "Back", - style = MaterialTheme.typography.bodySmall + style = MaterialTheme.typography.bodySmall, ) } Text( modifier = Modifier.weight(1F), text = uiState.timetableItem.title.currentLangTitle, - style = MaterialTheme.typography.bodyLarge + style = MaterialTheme.typography.bodyLarge, ) if (uiState.isLangSelectable) { Button(onClick = { onSelectedLanguage(JAPANESE) }) { Text( text = "日本語", - style = MaterialTheme.typography.bodySmall + style = MaterialTheme.typography.bodySmall, ) } Button(onClick = { onSelectedLanguage(Lang.ENGLISH) }) { Text( text = "English", - style = MaterialTheme.typography.bodySmall + style = MaterialTheme.typography.bodySmall, ) } } @@ -187,12 +187,14 @@ private fun TimetableItemDetailScreen( Column { Button( modifier = Modifier.testTag(TimetableItemDetailBookmarkIconTestTag), - onClick = { onBookmarkClick(uiState.timetableItem) }) { + onClick = { onBookmarkClick(uiState.timetableItem) }, + ) { Text(text = "Bookmark: ${uiState.isBookmarked}") } Button( - onClick = { onCalendarRegistrationClick(uiState.timetableItem) }) { + onClick = { onCalendarRegistrationClick(uiState.timetableItem) }, + ) { Text(text = "Calendar") } Button(onClick = { onShareClick(uiState.timetableItem) }) { @@ -206,8 +208,8 @@ private fun TimetableItemDetailScreen( if (uiState is Loaded) { Column( Modifier.padding( - top = innerPadding.calculateTopPadding() - ) + top = innerPadding.calculateTopPadding(), + ), ) { val currentLang = uiState.currentLang ?: Lang.ENGLISH fun MultiLangText.getByLang(lang: Lang): String { @@ -221,7 +223,7 @@ private fun TimetableItemDetailScreen( text = when (val item = uiState.timetableItem) { is TimetableItem.Session -> item.description.getByLang(currentLang) is TimetableItem.Special -> item.description.getByLang(currentLang) - } + }, ) Button(onClick = { onLinkClick(uiState.timetableItem.url) }) { Text(text = "Link") diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreen.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreen.kt index df17ca9be..5f39617f6 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreen.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreen.kt @@ -91,7 +91,6 @@ fun TimetableScreen( events = eventEmitter, ), ) { - val snackbarHostState = remember { SnackbarHostState() } SnackbarMessageEffect( @@ -189,7 +188,8 @@ private fun TimetableScreen( Text(text = "UiType: ${uiState.timetableUiType}") Button( modifier = Modifier.testTag(TimetableUiTypeChangeButtonTestTag), - onClick = { onTimetableUiChangeClick() }) { + onClick = { onTimetableUiChangeClick() }, + ) { Text("Change UiType!") } } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreenPresenter.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreenPresenter.kt index bef3dab6f..b0a291fe5 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreenPresenter.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/TimetableScreenPresenter.kt @@ -65,7 +65,7 @@ fun timetableScreenPresenter( TimetableScreenUiState( contentUiState = timetableUiState, timetableUiType = timetableUiType, - userMessageStateHolder = userMessageStateHolder + userMessageStateHolder = userMessageStateHolder, ) } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableList.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableList.kt index 709289b67..12e8df34b 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableList.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableList.kt @@ -12,7 +12,6 @@ import androidx.compose.material3.Button import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.dp import io.github.droidkaigi.confsched.model.Timetable @@ -37,7 +36,6 @@ fun TimetableList( contentPadding: PaddingValues, modifier: Modifier = Modifier, ) { - val density = LocalDensity.current LazyColumn( modifier = modifier.testTag(TimetableListTestTag), state = scrollState, @@ -56,9 +54,10 @@ fun TimetableList( Spacer(modifier = Modifier.weight(1f)) Button( modifier = Modifier.testTag(TimetableListItemBookmarkIconTestTag), - onClick = { onBookmarkClick(timetableItem, true) }) { + onClick = { onBookmarkClick(timetableItem, true) }, + ) { Text( - text = "Bookmark ${isBookmarked}", + text = "Bookmark $isBookmarked", ) } } diff --git a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableSheet.kt b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableSheet.kt index 4a4b1a237..b5f089598 100644 --- a/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableSheet.kt +++ b/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/section/TimetableSheet.kt @@ -52,10 +52,9 @@ fun TimetableSheet( ) { Column( modifier = Modifier - .fillMaxSize() + .fillMaxSize(), ) { when (uiState) { - is ListTimetable -> { TimetableList( uiState = requireNotNull(uiState.timetableListUiStates[selectedDay]), From 05e67ba2a34f04ce2f5687eca427092d299de806 Mon Sep 17 00:00:00 2001 From: takahirom Date: Sat, 15 Jun 2024 16:55:03 +0900 Subject: [PATCH 2/3] Update some libs --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 22650e8f7..cde74e533 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -38,7 +38,7 @@ okHttp = "4.12.0" ktorfit = "1.12.0" ossLicensesPlugin = "0.10.6" ossLicenses = "17.1.0" -detekt = "1.23.1" +detekt = "1.23.6" twitterComposeRule = "0.0.26" lottie = "6.1.0" molecule = "1.4.1" @@ -106,7 +106,7 @@ composeUiTestJunit4 = { module = "androidx.compose.ui:ui-test-junit4" } composeNavigation = { module = "org.jetbrains.androidx.navigation:navigation-compose", version = "2.8.0-alpha02" } coreBundle = { module = "org.jetbrains.androidx.core:core-bundle", version = "1.0.0-alpha01" } composeHiltNavigtation = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "composeHiltNavigatiaon" } -composeLintCheck = { module = "com.slack.lint.compose:compose-lint-checks", version = "1.2.0" } +composeLintCheck = { module = "com.slack.lint.compose:compose-lint-checks", version = "1.3.1" } composeCoil = { module = "io.coil-kt:coil-compose", version = "2.4.0" } composeImageLoader = { module = "io.github.qdsfdhvh:image-loader", version = "1.6.7" } composeShimmer = { module = "com.valentinilk.shimmer:compose-shimmer", version = "1.0.5" } From 66dd8556e325d4871a1ed8f623ed72bce7394145 Mon Sep 17 00:00:00 2001 From: takahirom Date: Sat, 15 Jun 2024 16:59:16 +0900 Subject: [PATCH 3/3] Add detekt format to ci.sh --- ci.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci.sh b/ci.sh index 45adbfb41..e24ec4273 100755 --- a/ci.sh +++ b/ci.sh @@ -1,5 +1,7 @@ #!/bin/sh -./gradlew testDebugUnitTest +# this is now in GHA +# ./gradlew testDebugUnitTest +./gradlew detekt --auto-correct ./gradlew assembleSharedXCFramework --no-configuration-cache ./gradlew iosSimulatorArm64Test --no-configuration-cache