diff --git a/.editorconfig b/.editorconfig index a2e62145..4f9503c7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,29 +15,7 @@ tab_width = 2 indent_size = 2 [*.{kt,kts}] - indent_size = 4 tab_width = 4 - -# Options for IntelliJ IDEA settings -ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL - -ij_kotlin_line_comment_at_first_column = false -ij_kotlin_line_comment_add_space = true - -# These options can keep to use single name import -ij_kotlin_name_count_to_use_star_import = 2147483647 -ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 - -ij_kotlin_keep_blank_lines_in_declarations = 1 -ij_kotlin_keep_blank_lines_in_code = 1 -ij_kotlin_keep_blank_lines_before_right_brace = 0 - -# optional but recommended -ij_kotlin_align_multiline_parameters = false -ij_continuation_indent_size = 4 -# https://kotlinlang.org/docs/coding-conventions.html#trailing-commas -ij_kotlin_allow_trailing_comma = true -ij_kotlin_packages_to_use_import_on_demand = unset -ij_kotlin_allow_trailing_comma_on_call_site = unset +ktlint_code_style = android_studio ktlint_function_naming_ignore_when_annotated_with=Composable, Test \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 37320482..8060b045 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,7 +1,6 @@ plugins { alias(libs.plugins.funch.application) alias(libs.plugins.funch.compose) - alias(libs.plugins.ktlint) // alias(libs.plugins.google.services) // alias(libs.plugins.app.distribution) // alias(libs.plugins.crashlytics) @@ -25,7 +24,7 @@ android { isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro", + "proguard-rules.pro" ) } } diff --git a/app/src/main/java/com/moya/funch/FunchApplication.kt b/app/src/main/java/com/moya/funch/FunchApplication.kt index 8d0e8f8b..97931a1f 100644 --- a/app/src/main/java/com/moya/funch/FunchApplication.kt +++ b/app/src/main/java/com/moya/funch/FunchApplication.kt @@ -18,7 +18,7 @@ class FunchApplication : Application() { override fun createStackElementTag(element: StackTraceElement): String { return "${element.fileName} : ${element.lineNumber} - ${element.methodName}" } - }, + } ) } } diff --git a/app/src/main/java/com/moya/funch/navigation/FunchNavHost.kt b/app/src/main/java/com/moya/funch/navigation/FunchNavHost.kt index dcca00ce..b1e3f1a5 100644 --- a/app/src/main/java/com/moya/funch/navigation/FunchNavHost.kt +++ b/app/src/main/java/com/moya/funch/navigation/FunchNavHost.kt @@ -6,21 +6,18 @@ import androidx.navigation.compose.NavHost import androidx.navigation.compose.rememberNavController @Composable -fun FunchNavHost( - hasProfile: Boolean, - navController: NavHostController = rememberNavController(), -) { +fun FunchNavHost(hasProfile: Boolean, navController: NavHostController = rememberNavController()) { NavHost( navController = navController, - startDestination = determineStartDestination(hasProfile), + startDestination = determineStartDestination(hasProfile) ) { profileGraph( onNavigateToHome = navController::navigateToHome, - onCloseMyProfile = navController::closeMyProfile, + onCloseMyProfile = navController::closeMyProfile ) homeScreen( onNavigateToMatching = { /* @Gun Hyung TODO : 매칭 라우터 연결 */ }, - onNavigateToMyProfile = navController::navigateToMyProfile, + onNavigateToMyProfile = navController::navigateToMyProfile ) } } diff --git a/app/src/main/java/com/moya/funch/ui/FunchApp.kt b/app/src/main/java/com/moya/funch/ui/FunchApp.kt index 5f9e35ae..171440f7 100644 --- a/app/src/main/java/com/moya/funch/ui/FunchApp.kt +++ b/app/src/main/java/com/moya/funch/ui/FunchApp.kt @@ -13,10 +13,10 @@ fun FunchApp() { Surface( modifier = Modifier.fillMaxSize(), - color = backgroundColor, + color = backgroundColor ) { FunchNavHost( - hasProfile = false, + hasProfile = false ) } } diff --git a/build.gradle.kts b/build.gradle.kts index 521e7267..c987c1fa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jlleitschuh.gradle.ktlint.KtlintExtension + buildscript { repositories { google() @@ -28,6 +30,24 @@ plugins { // alias(libs.plugins.crashlytics) apply false } +subprojects { + apply(plugin = "org.jlleitschuh.gradle.ktlint") // Version should be inherited from parent + + configure { + filter { + exclude { element -> element.file.path.contains("generated/") } + } + android.set(true) + coloredOutput.set(true) + verbose.set(true) + outputToConsole.set(true) + reporters { + reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN) + reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE) + } + } +} + tasks.register("clean", Delete::class) { delete(rootProject.buildDir) } diff --git a/core/data/build.gradle.kts b/core/data/build.gradle.kts index 84eb93f1..7c835ff1 100644 --- a/core/data/build.gradle.kts +++ b/core/data/build.gradle.kts @@ -1,5 +1,4 @@ plugins { - alias(libs.plugins.ktlint) alias(libs.plugins.funch.android.library) alias(libs.plugins.funch.junit5) } diff --git a/core/data/src/main/java/com/moya/funch/mapper/DummyMapper.kt b/core/data/src/main/java/com/moya/funch/mapper/DummyMapper.kt index b7b62388..013f12e9 100644 --- a/core/data/src/main/java/com/moya/funch/mapper/DummyMapper.kt +++ b/core/data/src/main/java/com/moya/funch/mapper/DummyMapper.kt @@ -3,39 +3,36 @@ package com.moya.funch.mapper // network response data class DummyDto( val id: Int, - val name: String, + val name: String ) // database entity data class DummyEntity( val id: Int, - val name: String, + val name: String ) // domain model data class DummyDomain( val id: Int, - val name: String, + val name: String ) // toDomain() 함수 -fun DummyDto.toDomain(): DummyDomain = - DummyDomain( - id = this.id, - name = name, - ) +fun DummyDto.toDomain(): DummyDomain = DummyDomain( + id = this.id, + name = name +) // toDto() 함수 -fun DummyDomain.toDto(): DummyDto = - DummyDto( - id = this.id, - name = name, - ) +fun DummyDomain.toDto(): DummyDto = DummyDto( + id = this.id, + name = name +) // toEntity() 함수 -fun DummyDto.toEntity(): DummyEntity = - DummyEntity( - id = this.id, - name = name, - ) +fun DummyDto.toEntity(): DummyEntity = DummyEntity( + id = this.id, + name = name +) diff --git a/core/datastore/build.gradle.kts b/core/datastore/build.gradle.kts index e5cfe0ea..0cd666f2 100644 --- a/core/datastore/build.gradle.kts +++ b/core/datastore/build.gradle.kts @@ -1,5 +1,4 @@ plugins { - // alias(libs.plugins.ktlint) alias(libs.plugins.funch.android.library) } diff --git a/core/datastore/src/main/java/com/moya/funch/datastore/DefaultUserCodeDataStore.kt b/core/datastore/src/main/java/com/moya/funch/datastore/DefaultUserCodeDataStore.kt index 00298bfe..ac19ce7b 100644 --- a/core/datastore/src/main/java/com/moya/funch/datastore/DefaultUserCodeDataStore.kt +++ b/core/datastore/src/main/java/com/moya/funch/datastore/DefaultUserCodeDataStore.kt @@ -13,9 +13,8 @@ import javax.inject.Singleton @Singleton class DefaultUserCodeDataStore @Inject constructor( private val preferences: SharedPreferences, - @ApplicationContext private val context: Context, + @ApplicationContext private val context: Context ) : UserCodeDataStore { - override var deviceId: String get() { initDeviceId() diff --git a/core/datastore/src/main/java/com/moya/funch/datastore/PreferenceFactory.kt b/core/datastore/src/main/java/com/moya/funch/datastore/PreferenceFactory.kt index 7e7d406e..94f9f5dd 100644 --- a/core/datastore/src/main/java/com/moya/funch/datastore/PreferenceFactory.kt +++ b/core/datastore/src/main/java/com/moya/funch/datastore/PreferenceFactory.kt @@ -11,7 +11,7 @@ import java.security.KeyStore import javax.inject.Inject class PreferenceFactory @Inject constructor( - @ApplicationContext private val context: Context, + @ApplicationContext private val context: Context ) { fun create(): SharedPreferences { return if (BuildConfig.DEBUG) { @@ -27,10 +27,7 @@ class PreferenceFactory @Inject constructor( } } - private fun createEncryptedSharedPreferences( - fileName: String, - context: Context, - ): SharedPreferences { + private fun createEncryptedSharedPreferences(fileName: String, context: Context): SharedPreferences { return EncryptedSharedPreferences.create( context, fileName, @@ -39,7 +36,6 @@ class PreferenceFactory @Inject constructor( .build(), EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM - ) } diff --git a/core/datastore/src/main/java/com/moya/funch/datastore/UserCodeDataStore.kt b/core/datastore/src/main/java/com/moya/funch/datastore/UserCodeDataStore.kt index 5f69100b..db5da8a5 100644 --- a/core/datastore/src/main/java/com/moya/funch/datastore/UserCodeDataStore.kt +++ b/core/datastore/src/main/java/com/moya/funch/datastore/UserCodeDataStore.kt @@ -1,7 +1,6 @@ package com.moya.funch.datastore interface UserCodeDataStore { - var userId: String var userCode: String var deviceId: String diff --git a/core/datastore/src/main/java/com/moya/funch/datastore/di/DataStoreModule.kt b/core/datastore/src/main/java/com/moya/funch/datastore/di/DataStoreModule.kt index d1bf52b9..deccd6f8 100644 --- a/core/datastore/src/main/java/com/moya/funch/datastore/di/DataStoreModule.kt +++ b/core/datastore/src/main/java/com/moya/funch/datastore/di/DataStoreModule.kt @@ -14,17 +14,13 @@ import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) object DataStoreModule { - @Provides @Singleton - fun provideAppPreferences( - factory: PreferenceFactory, - ): SharedPreferences = factory.create() + fun provideAppPreferences(factory: PreferenceFactory): SharedPreferences = factory.create() @Module @InstallIn(SingletonComponent::class) abstract class Binder { - @Binds abstract fun bindAppPreferences(dataStore: DefaultUserCodeDataStore): UserCodeDataStore } diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts index 1b0fff9a..c6df68cc 100644 --- a/core/designsystem/build.gradle.kts +++ b/core/designsystem/build.gradle.kts @@ -6,4 +6,3 @@ plugins { android { namespace = "com.moya.funch.designsystem" } - diff --git a/core/designsystem/src/main/java/com/moya/funch/component/Button.kt b/core/designsystem/src/main/java/com/moya/funch/component/Button.kt index 01f495d1..81683120 100644 --- a/core/designsystem/src/main/java/com/moya/funch/component/Button.kt +++ b/core/designsystem/src/main/java/com/moya/funch/component/Button.kt @@ -51,14 +51,14 @@ enum class FunchButtonType(val shape: Shape, val contentVerticalPadding: Dp, val Large(RoundedCornerShape(16.dp), 21.dp, funchTypography.sbt1), Medium(RoundedCornerShape(16.dp), 16.dp, funchTypography.sbt2), Small(RoundedCornerShape(12.dp), 12.dp, funchTypography.b), - XSmall(RoundedCornerShape(12.dp), 8.dp, funchTypography.b); + XSmall(RoundedCornerShape(12.dp), 8.dp, funchTypography.b) } @Immutable data class FunchIcon( @DrawableRes val resId: Int, val description: String, - val tint: Color, + val tint: Color ) @Composable @@ -69,7 +69,7 @@ fun FunchMainButton( enabled: Boolean = true, text: String, contentHorizontalPadding: Dp = 0.dp, - icon: @Composable () -> Unit = {}, + icon: @Composable () -> Unit = {} ) { FunchMainButton( modifier = modifier, @@ -90,27 +90,36 @@ fun FunchMainButton( enabled: Boolean = true, shape: Shape = RoundedCornerShape(size = 16.dp), contentPadding: PaddingValues = PaddingValues(0.dp), - content: @Composable RowScope.() -> Unit, + content: @Composable RowScope.() -> Unit ) { val brush = Brush.horizontalGradient(listOf(Lemon500, Yellow500)) val disabledColor = Lemon900 Box( - modifier = modifier + modifier = + modifier .then( - if (enabled) Modifier.neonSign( - color = Lemon500.copy(alpha = 0.7f), borderRadius = 16.dp, - blurRadius = 5.dp, - spread = PaddingValues(top = (-4).dp, start = 0.dp, end = 0.dp, bottom = 4.dp), - ) else Modifier + if (enabled) { + Modifier.neonSign( + color = Lemon500.copy(alpha = 0.7f), + borderRadius = 16.dp, + blurRadius = 5.dp, + spread = PaddingValues(top = (-4).dp, start = 0.dp, end = 0.dp, bottom = 4.dp) + ) + } else { + Modifier + } ) .clip(shape = shape) .then( - if (enabled) Modifier.background(brush = brush) - else Modifier.background(color = disabledColor) + if (enabled) { + Modifier.background(brush = brush) + } else { + Modifier.background(color = disabledColor) + } ) .clickableSingle(enabled = enabled, onClick = onClick) .padding(contentPadding), - contentAlignment = Alignment.Center, + contentAlignment = Alignment.Center ) { Row { content() @@ -126,13 +135,14 @@ fun FunchSubButton( enabled: Boolean = true, text: String, contentHorizontalPadding: Dp = 0.dp, - icon: @Composable () -> Unit = {}, + icon: @Composable () -> Unit = {} ) { - val color = if (enabled) { - FunchTheme.colors.white - } else { - Gray400 - } + val color = + if (enabled) { + FunchTheme.colors.white + } else { + Gray400 + } FunchSubButton( modifier = modifier, onClick = onClick, @@ -152,15 +162,16 @@ fun FunchSubButton( enabled: Boolean = true, shape: Shape = RoundedCornerShape(size = 16.dp), contentPadding: PaddingValues = PaddingValues(0.dp), - content: @Composable RowScope.() -> Unit, + content: @Composable RowScope.() -> Unit ) { Box( - modifier = modifier + modifier = + modifier .clip(shape = shape) .background(Gray800) .clickableSingle(enabled = enabled, onClick = onClick) .padding(contentPadding), - contentAlignment = Alignment.Center, + contentAlignment = Alignment.Center ) { Row { content() @@ -177,32 +188,33 @@ fun FunchIconButton( backgroundColor: Color = Color.Transparent, roundedCornerShape: RoundedCornerShape = RoundedCornerShape(0.dp), indication: Indication? = LocalIndication.current, - interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, + interactionSource: MutableInteractionSource = remember { MutableInteractionSource() } ) { Box( - modifier = modifier + modifier = + modifier .background( color = backgroundColor, - shape = roundedCornerShape, + shape = roundedCornerShape ) .clip(roundedCornerShape) .clickable( enabled = enabled, onClick = onClick, indication = indication, - interactionSource = interactionSource, + interactionSource = interactionSource ), - contentAlignment = Alignment.Center, + contentAlignment = Alignment.Center ) { Icon( painter = painterResource(id = funchIcon.resId), contentDescription = funchIcon.description, - tint = funchIcon.tint, + tint = funchIcon.tint ) } } -/*============================== Preview =================================*/ +// ============================== Preview ================================= @Preview(name = "main button size", showBackground = true, widthDp = 360) @Composable @@ -310,26 +322,28 @@ private fun Preview3() { Modifier .background(Color.Black) .fillMaxWidth() - .padding(horizontal = 20.dp, vertical = 20.dp), + .padding(horizontal = 20.dp, vertical = 20.dp) ) { FunchMainButton(contentPadding = PaddingValues(vertical = 16.dp, horizontal = 24.dp), onClick = { }) { Text( text = "Button", style = FunchTheme.typography.sbt1, color = Gray900, - textAlign = TextAlign.Center, + textAlign = TextAlign.Center ) } Spacer(modifier = Modifier.padding(16.dp)) - FunchMainButton(enabled = false, + FunchMainButton( + enabled = false, contentPadding = PaddingValues(vertical = 16.dp, horizontal = 24.dp), - onClick = { }) { + onClick = { } + ) { Text( text = "Button", style = FunchTheme.typography.sbt1, color = Gray900, - textAlign = TextAlign.Center, + textAlign = TextAlign.Center ) } } @@ -344,7 +358,7 @@ private fun Preview4() { Modifier .background(Gray900) .fillMaxWidth() - .padding(horizontal = 20.dp, vertical = 20.dp), + .padding(horizontal = 20.dp, vertical = 20.dp) ) { FunchSubButton( buttonType = FunchButtonType.Medium, @@ -373,11 +387,12 @@ private fun Preview5() { roundedCornerShape = RoundedCornerShape(12.dp), backgroundColor = Gray500, onClick = { /*TODO*/ }, - funchIcon = FunchIcon( + funchIcon = + FunchIcon( resId = FunchIconAsset.Search.search_24, description = "", - tint = Yellow500, - ), + tint = Yellow500 + ) ) } @@ -386,11 +401,12 @@ private fun Preview5() { private fun Preview6() { FunchIconButton( onClick = { /*TODO*/ }, - funchIcon = FunchIcon( + funchIcon = + FunchIcon( resId = FunchIconAsset.Search.search_24, description = "", - tint = Gray400, - ), + tint = Gray400 + ) ) } @@ -399,11 +415,12 @@ private fun Preview6() { private fun Preview7() { FunchIconButton( onClick = { /*TODO*/ }, - funchIcon = FunchIcon( + funchIcon = + FunchIcon( resId = FunchIconAsset.Search.search_16, description = "", - tint = Gray400, + tint = Gray400 ), - indication = null, + indication = null ) } diff --git a/core/designsystem/src/main/java/com/moya/funch/component/Card.kt b/core/designsystem/src/main/java/com/moya/funch/component/Card.kt index a251b6fd..f88a3588 100644 --- a/core/designsystem/src/main/java/com/moya/funch/component/Card.kt +++ b/core/designsystem/src/main/java/com/moya/funch/component/Card.kt @@ -28,19 +28,21 @@ private fun FunchNeonSignCard( modifier: Modifier = Modifier, verticalArrangement: Arrangement.Vertical = Arrangement.Top, horizontalAlignment: Alignment.Horizontal = Alignment.Start, - content: @Composable ColumnScope.() -> Unit, + content: @Composable ColumnScope.() -> Unit ) { - val brush = Brush.verticalGradient( - 0.1f to Lemon500, - 0.8f to Gray700, - ) + val brush = + Brush.verticalGradient( + 0.1f to Lemon500, + 0.8f to Gray700 + ) Column( - modifier = modifier + modifier = + modifier .background(Gray800, shape = FunchTheme.shapes.large) .border(1.dp, brush, FunchTheme.shapes.large) .clip(FunchTheme.shapes.large), verticalArrangement = verticalArrangement, - horizontalAlignment = horizontalAlignment, + horizontalAlignment = horizontalAlignment ) { content() } @@ -48,19 +50,23 @@ private fun FunchNeonSignCard( @Composable @Preview( - showBackground = true, widthDp = 360, heightDp = 640, name = "FunchNeonSignCard" + showBackground = true, + widthDp = 360, + heightDp = 640, + name = "FunchNeonSignCard" ) private fun Preview() { FunchTheme { Column( - modifier = Modifier + modifier = + Modifier .background(Gray900) .padding(60.dp) ) { FunchNeonSignCard( modifier = Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center, + verticalArrangement = Arrangement.Center ) { Text(text = "우리가 누구?", color = Color.White) Text(text = "다이나믹 듀오~~", color = Color.White) diff --git a/core/designsystem/src/main/java/com/moya/funch/component/Chip.kt b/core/designsystem/src/main/java/com/moya/funch/component/Chip.kt index a50e13a8..efdd21fd 100644 --- a/core/designsystem/src/main/java/com/moya/funch/component/Chip.kt +++ b/core/designsystem/src/main/java/com/moya/funch/component/Chip.kt @@ -53,9 +53,10 @@ import com.moya.funch.theme.Yellow500 private val FunchChipContentMinHeight = 21.dp private val FunchMinHeight = 48.dp -val MATCHED_BORDER_BRUSH = Brush.horizontalGradient( - listOf(Lemon500, Yellow500) -) +val MATCHED_BORDER_BRUSH = + Brush.horizontalGradient( + listOf(Lemon500, Yellow500) + ) @Composable fun FunchChip( @@ -69,11 +70,12 @@ fun FunchChip( leadingIcon: @Composable (() -> Unit)? = null, trailingIcon: @Composable (() -> Unit)? = null, colors: PunchChipColors = PunchChipColors(), - interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, + interactionSource: MutableInteractionSource = remember { MutableInteractionSource() } ) { val indication = if (enabled) LocalIndication.current else null Row( - modifier = modifier + modifier = + modifier .defaultMinSize(minHeight = FunchMinHeight) .then( if (matched) { @@ -86,7 +88,9 @@ fun FunchChip( spread = PaddingValues((-1).dp) ) .border(1.dp, MATCHED_BORDER_BRUSH, shape) - } else Modifier + } else { + Modifier + } ) .background( color = colors.provideContainerColor(enabled, selected), @@ -97,9 +101,10 @@ fun FunchChip( enabled = enabled, onClick = onSelected, interactionSource = interactionSource, - indication = indication, + indication = indication ) - .padding(provideChipPadding(leadingIcon != null)), verticalAlignment = Alignment.CenterVertically + .padding(provideChipPadding(leadingIcon != null)), + verticalAlignment = Alignment.CenterVertically ) { ChipContent( label = label, @@ -119,10 +124,11 @@ private fun ChipContent( leadingIcon: @Composable (() -> Unit)? = null, trailingIcon: @Composable (() -> Unit)? = null, minHeight: Dp = FunchChipContentMinHeight, - paddingValues: PaddingValues, + paddingValues: PaddingValues ) { CompositionLocalProvider( - LocalContentColor provides labelColor, LocalTextStyle provides labelTextStyle + LocalContentColor provides labelColor, + LocalTextStyle provides labelTextStyle ) { Row( Modifier @@ -144,9 +150,7 @@ private fun ChipContent( } } -private fun provideChipPadding( - hasLeadingIcon: Boolean = false, -): PaddingValues { +private fun provideChipPadding(hasLeadingIcon: Boolean = false): PaddingValues { val start = if (hasLeadingIcon) 8.dp else 16.dp val end = 16.dp return PaddingValues(start = start, end = end) @@ -161,7 +165,7 @@ data class PunchChipColors( private val labelColor: Color = Gray400, private val selectedLabelColor: Color = White, private val disabledLabelColor: Color = Gray400, - private val disabledSelectedLabelColor: Color = White, + private val disabledSelectedLabelColor: Color = White // private val ) { @Stable @@ -189,7 +193,8 @@ data class PunchChipColors( * Preview * */ @Preview( - name = "FunchChip - Chip with leading and trailing icon", showBackground = true + name = "FunchChip - Chip with leading and trailing icon", + showBackground = true ) @Composable private fun Preview1() { @@ -203,7 +208,7 @@ private fun Preview1() { onSelected = onSelected, leadingIcon = { LeadingIconForPreview() }, trailingIcon = { TrailingIconForPreview() }, - label = { Text(text = "안뇽") }, + label = { Text(text = "안뇽") } ) } } @@ -211,7 +216,7 @@ private fun Preview1() { @Composable @Preview( name = "FunchChip - Chip with leading icon", - showBackground = true, + showBackground = true ) private fun Preview2() { FunchTheme { @@ -222,14 +227,15 @@ private fun Preview2() { enabled = true, onSelected = onSelected, leadingIcon = { LeadingIconForPreview() }, - label = { Text(text = "안뇽") }, + label = { Text(text = "안뇽") } ) } } @Composable @Preview( - name = "FunchChip - Chip with trailing icon", showBackground = true + name = "FunchChip - Chip with trailing icon", + showBackground = true ) private fun Preview3() { FunchTheme { @@ -240,13 +246,14 @@ private fun Preview3() { enabled = true, onSelected = onSelected, trailingIcon = { TrailingIconForPreview() }, - label = { Text(text = "안뇽") }, + label = { Text(text = "안뇽") } ) } } @Preview( - name = "FunchChip - non interactive", showBackground = true + name = "FunchChip - non interactive", + showBackground = true ) @Composable private fun Preview4() { @@ -258,7 +265,7 @@ private fun Preview4() { selected = false, enabled = false, leadingIcon = { LeadingIconForPreview() }, - label = { Text(text = "안뇽") }, + label = { Text(text = "안뇽") } ) Spacer(modifier = Modifier.size(12.dp)) @@ -266,14 +273,15 @@ private fun Preview4() { selected = true, enabled = false, leadingIcon = { LeadingIconForPreview() }, - label = { Text(text = "안뇽") }, + label = { Text(text = "안뇽") } ) } } } @Preview( - name = "FunchChip - matched", showBackground = true + name = "FunchChip - matched", + showBackground = true ) @Composable private fun Preview5() { @@ -288,7 +296,7 @@ private fun Preview5() { matched = true, selected = true, enabled = false, - label = { Text(text = "Text", color = White, style = FunchTheme.typography.b) }, + label = { Text(text = "Text", color = White, style = FunchTheme.typography.b) } ) } } @@ -299,7 +307,8 @@ private fun Preview5() { private fun TrailingIconForPreview() { Row { Box( - modifier = Modifier + modifier = + Modifier .background(White, CircleShape) .border(1.dp, Color.Green, CircleShape) .size(16.dp), @@ -309,7 +318,8 @@ private fun TrailingIconForPreview() { } Spacer(modifier = Modifier.size(2.dp)) Box( - modifier = Modifier + modifier = + Modifier .background(White, CircleShape) .border(1.dp, Color.Blue, CircleShape) .size(16.dp), @@ -319,7 +329,8 @@ private fun TrailingIconForPreview() { } Spacer(modifier = Modifier.size(2.dp)) Box( - modifier = Modifier + modifier = + Modifier .background(White, CircleShape) .border(1.dp, Color.Red, CircleShape) .size(16.dp), @@ -333,12 +344,12 @@ private fun TrailingIconForPreview() { @Composable private fun LeadingIconForPreview() { Box( - modifier = Modifier + modifier = + Modifier .size(32.dp) .clip(shape = RoundedCornerShape(10.dp)) .background(color = Gray900), contentAlignment = Alignment.Center - ) { Icon( modifier = Modifier.size(18.dp), diff --git a/core/designsystem/src/main/java/com/moya/funch/component/TextField.kt b/core/designsystem/src/main/java/com/moya/funch/component/TextField.kt index f68fbe9a..c4aa8e17 100644 --- a/core/designsystem/src/main/java/com/moya/funch/component/TextField.kt +++ b/core/designsystem/src/main/java/com/moya/funch/component/TextField.kt @@ -59,19 +59,20 @@ fun FunchDefaultTextField( interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, isFocus: Boolean = interactionSource.collectIsFocusedAsState().value, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, - keyboardActions: KeyboardActions = KeyboardActions.Default, + keyboardActions: KeyboardActions = KeyboardActions.Default ) { BasicTextField( modifier = modifier, value = value, onValueChange = onValueChange, singleLine = true, - textStyle = TextStyle( + textStyle = + TextStyle( color = White, fontSize = FunchTheme.typography.b.fontSize, lineHeight = FunchTheme.typography.b.lineHeight, fontFamily = FunchTheme.typography.b.fontFamily, - fontWeight = FunchTheme.typography.b.fontWeight, + fontWeight = FunchTheme.typography.b.fontWeight ), cursorBrush = SolidColor(Color(0xFF0074FF)), keyboardOptions = keyboardOptions, @@ -79,34 +80,37 @@ fun FunchDefaultTextField( interactionSource = interactionSource, decorationBox = { innerTextField -> Box( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .height(56.dp) .background(Gray800, RoundedCornerShape(16.dp)) .then( - if (isFocus) + if (isFocus) { Modifier.border( width = 1.dp, color = Color.White, shape = RoundedCornerShape(16.dp) ) - else if (isError) + } else if (isError) { Modifier.border( width = 1.dp, color = Coral500, shape = RoundedCornerShape(16.dp) ) - else Modifier + } else { + Modifier + } ) .padding(horizontal = 16.dp), - contentAlignment = Alignment.CenterStart, + contentAlignment = Alignment.CenterStart ) { if (value.isEmpty()) { Text( text = hint, color = Gray400, fontSize = 14.sp, - style = FunchTheme.typography.b, + style = FunchTheme.typography.b ) } innerTextField() @@ -126,19 +130,20 @@ fun FunchMaxLengthTextField( interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, isFocus: Boolean = interactionSource.collectIsFocusedAsState().value, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, - keyboardActions: KeyboardActions = KeyboardActions.Default, + keyboardActions: KeyboardActions = KeyboardActions.Default ) { BasicTextField( modifier = modifier, value = value, onValueChange = onValueChange, singleLine = true, - textStyle = TextStyle( + textStyle = + TextStyle( color = White, fontSize = FunchTheme.typography.b.fontSize, lineHeight = FunchTheme.typography.b.lineHeight, fontFamily = FunchTheme.typography.b.fontFamily, - fontWeight = FunchTheme.typography.b.fontWeight, + fontWeight = FunchTheme.typography.b.fontWeight ), cursorBrush = SolidColor(Color(0xFF0074FF)), keyboardOptions = keyboardOptions, @@ -146,28 +151,31 @@ fun FunchMaxLengthTextField( interactionSource = interactionSource, decorationBox = { innerTextField -> Row( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .height(56.dp) .background(Gray800, RoundedCornerShape(16.dp)) .then( - if (isFocus) + if (isFocus) { Modifier.border( width = 1.dp, color = Color.White, shape = RoundedCornerShape(16.dp) ) - else if (isError) + } else if (isError) { Modifier.border( width = 1.dp, color = Coral500, shape = RoundedCornerShape(16.dp) ) - else Modifier + } else { + Modifier + } ) .padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Box { if (value.isEmpty()) { @@ -175,24 +183,26 @@ fun FunchMaxLengthTextField( text = hint, color = Gray400, fontSize = 14.sp, - style = FunchTheme.typography.b, + style = FunchTheme.typography.b ) } innerTextField() } Text( - text = annotatedStringMaxLengthType( + text = + annotatedStringMaxLengthType( isError = isError, value = value, maxLength = maxLength ), - style = TextStyle( + style = + TextStyle( fontSize = 14.sp, lineHeight = FunchTheme.typography.b.lineHeight, fontFamily = FunchTheme.typography.b.fontFamily, - fontWeight = FunchTheme.typography.b.fontWeight, - ), + fontWeight = FunchTheme.typography.b.fontWeight + ) ) } } @@ -210,19 +220,20 @@ fun FunchIconTextField( interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, isFocus: Boolean = interactionSource.collectIsFocusedAsState().value, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, - keyboardActions: KeyboardActions = KeyboardActions.Default, + keyboardActions: KeyboardActions = KeyboardActions.Default ) { BasicTextField( modifier = modifier, value = value, onValueChange = onValueChange, singleLine = true, - textStyle = TextStyle( + textStyle = + TextStyle( color = White, fontSize = FunchTheme.typography.b.fontSize, lineHeight = FunchTheme.typography.b.lineHeight, fontFamily = FunchTheme.typography.b.fontFamily, - fontWeight = FunchTheme.typography.b.fontWeight, + fontWeight = FunchTheme.typography.b.fontWeight ), cursorBrush = SolidColor(Color(0xFF0074FF)), keyboardOptions = keyboardOptions, @@ -230,32 +241,35 @@ fun FunchIconTextField( interactionSource = interactionSource, decorationBox = { innerTextField -> Row( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .height(56.dp) .background(Gray800, RoundedCornerShape(16.dp)) .then( - if (isFocus) + if (isFocus) { Modifier.border( width = 1.dp, color = Color.White, shape = RoundedCornerShape(16.dp) ) - else if (isError) + } else if (isError) { Modifier.border( width = 1.dp, color = Coral500, shape = RoundedCornerShape(16.dp) ) - else Modifier + } else { + Modifier + } ) .padding(horizontal = 16.dp), - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Icon( painter = painterResource(id = iconType.resId), contentDescription = iconType.description, - tint = iconType.tint, + tint = iconType.tint ) Spacer(modifier = Modifier.width(8.dp)) Box { @@ -264,7 +278,7 @@ fun FunchIconTextField( text = hint, color = Gray400, fontSize = 14.sp, - style = FunchTheme.typography.b, + style = FunchTheme.typography.b ) } innerTextField() @@ -284,19 +298,20 @@ fun FunchButtonTextField( iconButton: @Composable () -> Unit, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, - keyboardActions: KeyboardActions = KeyboardActions.Default, + keyboardActions: KeyboardActions = KeyboardActions.Default ) { BasicTextField( modifier = modifier, value = value, onValueChange = onValueChange, singleLine = true, - textStyle = TextStyle( + textStyle = + TextStyle( color = White, fontSize = FunchTheme.typography.b.fontSize, lineHeight = FunchTheme.typography.b.lineHeight, fontFamily = FunchTheme.typography.b.fontFamily, - fontWeight = FunchTheme.typography.b.fontWeight, + fontWeight = FunchTheme.typography.b.fontWeight ), cursorBrush = SolidColor(Color(0xFF0074FF)), keyboardOptions = keyboardOptions, @@ -304,13 +319,14 @@ fun FunchButtonTextField( interactionSource = interactionSource, decorationBox = { innerTextField -> Row( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .height(56.dp) .background(backgroundColor, RoundedCornerShape(16.dp)) .padding(start = 16.dp, end = 8.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceBetween ) { Box(modifier = Modifier.weight(1f)) { if (value.isEmpty()) { @@ -318,7 +334,7 @@ fun FunchButtonTextField( text = hint, color = Gray400, fontSize = 14.sp, - style = FunchTheme.typography.b, + style = FunchTheme.typography.b ) } innerTextField() @@ -330,32 +346,28 @@ fun FunchButtonTextField( ) } -private fun annotatedStringMaxLengthType( - isError: Boolean, - value: String, - maxLength: Int, -) = buildAnnotatedString { +private fun annotatedStringMaxLengthType(isError: Boolean, value: String, maxLength: Int) = buildAnnotatedString { if (!isError) { if (value.isEmpty()) { withStyle(style = SpanStyle(color = Gray400)) { - append("${value.length}/${maxLength}") + append("${value.length}/$maxLength") } } else { withStyle(style = SpanStyle(color = White)) { append("${value.length}") } withStyle(style = SpanStyle(color = Gray400)) { - append("/${maxLength}") + append("/$maxLength") } } } else { withStyle(style = SpanStyle(color = Coral500)) { - append("${value.length}/${maxLength}") + append("${value.length}/$maxLength") } } } -/*============================== Preview =================================*/ +// ============================== Preview ================================= @Preview("Default", showBackground = true, backgroundColor = 0xFF2C2C2C) @Composable @@ -376,15 +388,15 @@ private fun Preview1() { value = text, onValueChange = { innerText -> text = innerText }, hint = "최대 ${maxLength}글자", - isError = isError.value, + isError = isError.value ) FunchErrorCaption( modifier = Modifier.padding(top = 4.dp, start = 4.dp), isError = isError.value, - errorText = "errorText", + errorText = "errorText" ) Button( - onClick = { isError.value = text.length > maxLength }, + onClick = { isError.value = text.length > maxLength } ) { Text(text = "전송") } @@ -423,12 +435,12 @@ private fun Preview2() { hint = "최대 ${maxLength}글자", isError = isError.value, interactionSource = interactionSource, - isFocus = isFocused, + isFocus = isFocused ) FunchErrorCaption( modifier = Modifier.padding(top = 4.dp, start = 4.dp), isError = isError.value, - errorText = if (isError.value) "최대 ${maxLength}글자까지 입력할 수 있어요" else "", + errorText = if (isError.value) "최대 ${maxLength}글자까지 입력할 수 있어요" else "" ) } } @@ -446,17 +458,18 @@ private fun Preview3() { value = text, onValueChange = { innerText -> text = innerText }, hint = "가까운 지하철역 검색", - iconType = FunchIcon( + iconType = + FunchIcon( resId = FunchIconAsset.Search.search_24, description = "", tint = Gray500 ), - isError = isError.value, + isError = isError.value ) FunchErrorCaption( modifier = Modifier.padding(top = 4.dp, start = 4.dp), isError = isError.value, - errorText = "존재하지 않는 지하철역이에요", + errorText = "존재하지 않는 지하철역이에요" ) } } @@ -481,17 +494,18 @@ private fun Preview4() { backgroundColor = Gray500, onClick = { /*TODO*/ }, roundedCornerShape = RoundedCornerShape(12.dp), - funchIcon = FunchIcon( + funchIcon = + FunchIcon( resId = FunchIconAsset.Search.search_24, description = "", - tint = Yellow500, - ), + tint = Yellow500 + ) ) } ) FunchErrorCaption( isError = isError.value, - errorText = "존재하지 않는 지하철역이에요", + errorText = "존재하지 않는 지하철역이에요" ) } } diff --git a/core/designsystem/src/main/java/com/moya/funch/component/TopBar.kt b/core/designsystem/src/main/java/com/moya/funch/component/TopBar.kt index 00d593ef..a13be0d7 100644 --- a/core/designsystem/src/main/java/com/moya/funch/component/TopBar.kt +++ b/core/designsystem/src/main/java/com/moya/funch/component/TopBar.kt @@ -18,17 +18,16 @@ import com.moya.funch.theme.Gray900 import com.moya.funch.ui.FunchFeedbackButton @Composable -fun FunchNonTitleTopBar( - leadingIcon: (@Composable () -> Unit)? = {}, - trailingIcon: (@Composable () -> Unit) = {}, -) { - val arrangement = if (leadingIcon != null) { - Arrangement.SpaceBetween - } else { - Arrangement.End - } +fun FunchNonTitleTopBar(leadingIcon: (@Composable () -> Unit)? = {}, trailingIcon: (@Composable () -> Unit) = {}) { + val arrangement = + if (leadingIcon != null) { + Arrangement.SpaceBetween + } else { + Arrangement.End + } Row( - modifier = Modifier + modifier = + Modifier .fillMaxWidth() .background(Gray900), horizontalArrangement = arrangement, @@ -40,7 +39,6 @@ fun FunchNonTitleTopBar( } } - @Composable @Preview(showBackground = true, name = "FunchNonTitleTopBar - Leading and Trailing Icon") private fun Preview() { @@ -50,11 +48,12 @@ private fun Preview() { FunchIconButton( modifier = Modifier.size(40.dp), onClick = { }, - funchIcon = FunchIcon( + funchIcon = + FunchIcon( resId = FunchIconAsset.Search.search_24, description = "Search", tint = Gray400 - ), + ) ) }, trailingIcon = { @@ -73,11 +72,12 @@ private fun Preview2() { FunchIconButton( modifier = Modifier.size(40.dp), onClick = { }, - funchIcon = FunchIcon( + funchIcon = + FunchIcon( resId = FunchIconAsset.Search.search_24, description = "Search", tint = Gray400 - ), + ) ) } ) @@ -95,5 +95,3 @@ private fun Preview3() { ) } } - - diff --git a/core/designsystem/src/main/java/com/moya/funch/icon/FunchIconAsset.kt b/core/designsystem/src/main/java/com/moya/funch/icon/FunchIconAsset.kt index 31eaf022..1487fcce 100644 --- a/core/designsystem/src/main/java/com/moya/funch/icon/FunchIconAsset.kt +++ b/core/designsystem/src/main/java/com/moya/funch/icon/FunchIconAsset.kt @@ -3,7 +3,6 @@ package com.moya.funch.icon import com.moya.funch.designsystem.R object FunchIconAsset { - object Search { val search_24 = R.drawable.ic_search_24 val search_16 = R.drawable.ic_search_16 diff --git a/core/designsystem/src/main/java/com/moya/funch/modifier/ClickableSingle.kt b/core/designsystem/src/main/java/com/moya/funch/modifier/ClickableSingle.kt index 7851cd5b..1f1a098c 100644 --- a/core/designsystem/src/main/java/com/moya/funch/modifier/ClickableSingle.kt +++ b/core/designsystem/src/main/java/com/moya/funch/modifier/ClickableSingle.kt @@ -23,21 +23,26 @@ fun Modifier.clickableSingle( onClickLabel: String? = null, role: Role? = null, interactionSource: MutableInteractionSource? = null, - onClick: () -> Unit, -): Modifier = composed(inspectorInfo = debugInspectorInfo { - name = "clickable" - properties["enabled"] = enabled - properties["onClickLabel"] = onClickLabel - properties["role"] = role - properties["onClick"] = onClick -}) { + onClick: () -> Unit +): Modifier = composed( + inspectorInfo = + debugInspectorInfo { + name = "clickable" + properties["enabled"] = enabled + properties["onClickLabel"] = onClickLabel + properties["role"] = role + properties["onClick"] = onClick + } +) { val manager: SingleEventHandler = remember { DefaultSingleEventHandler() } - Modifier.clickable(enabled = enabled, + Modifier.clickable( + enabled = enabled, onClickLabel = onClickLabel, onClick = { manager.handle { onClick() } }, role = role, indication = LocalIndication.current, - interactionSource = interactionSource ?: remember { MutableInteractionSource() }) + interactionSource = interactionSource ?: remember { MutableInteractionSource() } + ) } fun interface SingleEventHandler { @@ -48,6 +53,7 @@ internal class DefaultSingleEventHandler : SingleEventHandler { private val currentTime: TimeMark get() = TimeSource.Monotonic.markNow() private val throttleDuration: Duration = 300.milliseconds private lateinit var lastEventTime: TimeMark + override fun handle(event: () -> Unit) { if (::lastEventTime.isInitialized.not() || (lastEventTime + throttleDuration).hasPassedNow()) { event() diff --git a/core/designsystem/src/main/java/com/moya/funch/modifier/NeonSign.kt b/core/designsystem/src/main/java/com/moya/funch/modifier/NeonSign.kt index 30e45557..fa2bab51 100644 --- a/core/designsystem/src/main/java/com/moya/funch/modifier/NeonSign.kt +++ b/core/designsystem/src/main/java/com/moya/funch/modifier/NeonSign.kt @@ -49,7 +49,7 @@ fun Modifier.neonSign( offsetY: Dp = 0.dp, offsetX: Dp = 0.dp, spread: PaddingValues = PaddingValues(top = (-2).dp, start = 0.dp, end = 0.dp, bottom = 2.dp), - modifier: Modifier = Modifier, + modifier: Modifier = Modifier ): Modifier = this.then( modifier.drawBehind { this.drawIntoCanvas { canvas -> @@ -62,13 +62,14 @@ fun Modifier.neonSign( val top = (0f + offsetY.toPx()) - spreadTop val right = (size.width + offsetX.toPx()) + spreadRight val bottom = (size.height + offsetY.toPx()) + spreadBottom - val paint = Paint().apply { - val nativePaint = asFrameworkPaint() - if (blurRadius != 0.dp) { - nativePaint.maskFilter = (BlurMaskFilter(blurRadius.toPx(), BlurMaskFilter.Blur.NORMAL)) + val paint = + Paint().apply { + val nativePaint = asFrameworkPaint() + if (blurRadius != 0.dp) { + nativePaint.maskFilter = (BlurMaskFilter(blurRadius.toPx(), BlurMaskFilter.Blur.NORMAL)) + } + nativePaint.color = color.toArgb() } - nativePaint.color = color.toArgb() - } canvas.drawRoundRect( left = left, @@ -94,7 +95,8 @@ private fun ShadowPreview() { .background(Color.Black) ) { Box( - modifier = Modifier + modifier = + Modifier .padding(16.dp) .padding(horizontal = 4.dp) .neonSign( @@ -106,18 +108,16 @@ private fun ShadowPreview() { .clip(RoundedCornerShape(size = 16.dp)) .background( brush - ) - , + ), contentAlignment = Alignment.Center ) { Text( text = "Button", style = FunchTheme.typography.sbt1, color = Gray900, - textAlign = TextAlign.Center, + textAlign = TextAlign.Center ) } } } } - diff --git a/core/designsystem/src/main/java/com/moya/funch/theme/Background.kt b/core/designsystem/src/main/java/com/moya/funch/theme/Background.kt index 245b19f9..9019aa2a 100644 --- a/core/designsystem/src/main/java/com/moya/funch/theme/Background.kt +++ b/core/designsystem/src/main/java/com/moya/funch/theme/Background.kt @@ -8,7 +8,7 @@ import androidx.compose.ui.unit.Dp @Immutable data class BackgroundTheme( val color: Color = Color.Unspecified, - val tonalElevation: Dp = Dp.Unspecified, + val tonalElevation: Dp = Dp.Unspecified ) val LocalBackgroundTheme = staticCompositionLocalOf { BackgroundTheme() } diff --git a/core/designsystem/src/main/java/com/moya/funch/theme/Color.kt b/core/designsystem/src/main/java/com/moya/funch/theme/Color.kt index 5ffe20d7..27c57821 100644 --- a/core/designsystem/src/main/java/com/moya/funch/theme/Color.kt +++ b/core/designsystem/src/main/java/com/moya/funch/theme/Color.kt @@ -25,7 +25,7 @@ internal val Gray300 = Color(0xFF9B9B9B) class FunchColorSchema( background: Color, error: Color, - white: Color, + white: Color ) { var background by mutableStateOf(background) private set @@ -37,7 +37,7 @@ class FunchColorSchema( fun copy(): FunchColorSchema = FunchColorSchema( background = background, error = error, - white = white, + white = white ) fun update(other: FunchColorSchema) { @@ -47,15 +47,10 @@ class FunchColorSchema( } } -fun funchDarkColorSchema( - background: Color = Gray900, - white: Color = White, - error: Color = Coral500, - - ): FunchColorSchema { +fun funchDarkColorSchema(background: Color = Gray900, white: Color = White, error: Color = Coral500): FunchColorSchema { return FunchColorSchema( white = white, background = background, - error = error, + error = error ) } diff --git a/core/designsystem/src/main/java/com/moya/funch/theme/Gradient.kt b/core/designsystem/src/main/java/com/moya/funch/theme/Gradient.kt index aed59a1b..1d66012f 100644 --- a/core/designsystem/src/main/java/com/moya/funch/theme/Gradient.kt +++ b/core/designsystem/src/main/java/com/moya/funch/theme/Gradient.kt @@ -8,7 +8,7 @@ import androidx.compose.ui.graphics.Color data class GradientColors( val top: Color = Color.Unspecified, val bottom: Color = Color.Unspecified, - val container: Color = Color.Unspecified, + val container: Color = Color.Unspecified ) val LocalGradientColors = staticCompositionLocalOf { GradientColors() } diff --git a/core/designsystem/src/main/java/com/moya/funch/theme/Shape.kt b/core/designsystem/src/main/java/com/moya/funch/theme/Shape.kt index 67f46a7c..48fc253a 100644 --- a/core/designsystem/src/main/java/com/moya/funch/theme/Shape.kt +++ b/core/designsystem/src/main/java/com/moya/funch/theme/Shape.kt @@ -26,21 +26,21 @@ class FunchShapes( val small: CornerBasedShape = FunchShapeDefaults.Small, val medium: CornerBasedShape = FunchShapeDefaults.Medium, val large: CornerBasedShape = FunchShapeDefaults.Large, - val extraLarge: CornerBasedShape = FunchShapeDefaults.ExtraLarge, + val extraLarge: CornerBasedShape = FunchShapeDefaults.ExtraLarge ) { fun copy( extraSmall: CornerBasedShape = this.extraSmall, small: CornerBasedShape = this.small, medium: CornerBasedShape = this.medium, large: CornerBasedShape = this.large, - extraLarge: CornerBasedShape = this.extraLarge, + extraLarge: CornerBasedShape = this.extraLarge ): FunchShapes { return FunchShapes( extraSmall = extraSmall, small = small, medium = medium, large = large, - extraLarge = extraLarge, + extraLarge = extraLarge ) } } diff --git a/core/designsystem/src/main/java/com/moya/funch/theme/Theme.kt b/core/designsystem/src/main/java/com/moya/funch/theme/Theme.kt index 03d0dd3d..ffaf63b5 100644 --- a/core/designsystem/src/main/java/com/moya/funch/theme/Theme.kt +++ b/core/designsystem/src/main/java/com/moya/funch/theme/Theme.kt @@ -11,12 +11,14 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.tooling.preview.Preview -private val LocalFunchColors = staticCompositionLocalOf { - error("No FunchColors provided") -} -private val LocalFunchTypography = staticCompositionLocalOf { - error("No FunchTypography provided") -} +private val LocalFunchColors = + staticCompositionLocalOf { + error("No FunchColors provided") + } +private val LocalFunchTypography = + staticCompositionLocalOf { + error("No FunchTypography provided") + } private val DarkGradientColors = GradientColors(top = Gray900, bottom = Gray900) @@ -29,11 +31,7 @@ object FunchTheme { } @Composable -fun ProvideFunchProperty( - colors: FunchColorSchema, - typography: FunchTypography, - content: @Composable () -> Unit, -) { +fun ProvideFunchProperty(colors: FunchColorSchema, typography: FunchTypography, content: @Composable () -> Unit) { val provideColors = remember { colors.copy() } provideColors.update(colors) val provideTypography = remember { typography.copy() } @@ -48,9 +46,7 @@ fun ProvideFunchProperty( } @Composable -fun FunchTheme( - content: @Composable () -> Unit, -) { +fun FunchTheme(content: @Composable () -> Unit) { // this version provides only dark theme val colors = funchDarkColorSchema() val gradientColors = DarkGradientColors @@ -59,7 +55,7 @@ fun FunchTheme( CompositionLocalProvider( LocalGradientColors provides gradientColors, - LocalBackgroundTheme provides backgroundTheme, + LocalBackgroundTheme provides backgroundTheme ) { ProvideFunchProperty(colors, typography) { MaterialTheme(content = content) @@ -78,20 +74,22 @@ private fun NiaThemePreview() { ) { Column { Text( - text = "Hello, Funch!", color = FunchTheme.colors.white, style = FunchTheme.typography.t1 + text = "Hello, Funch!", + color = FunchTheme.colors.white, + style = FunchTheme.typography.t1 ) Text( - text = "Hello, Funch!", color = FunchTheme.colors.white, style = FunchTheme.typography.sbt1 + text = "Hello, Funch!", + color = FunchTheme.colors.white, + style = FunchTheme.typography.sbt1 ) Button( onClick = { /*TODO*/ }, - shape = FunchTheme.shapes.small, + shape = FunchTheme.shapes.small ) { Text(text = "Button") } } - } - } } diff --git a/core/designsystem/src/main/java/com/moya/funch/theme/Type.kt b/core/designsystem/src/main/java/com/moya/funch/theme/Type.kt index cac8ff96..dd45963a 100644 --- a/core/designsystem/src/main/java/com/moya/funch/theme/Type.kt +++ b/core/designsystem/src/main/java/com/moya/funch/theme/Type.kt @@ -14,23 +14,24 @@ import androidx.compose.ui.unit.em import androidx.compose.ui.unit.sp import com.moya.funch.designsystem.R -private val spoqaHanSansNeo = FontFamily( - Font( - R.font.spoqa_han_sans_neo_bold, - FontWeight.Bold, - FontStyle.Normal - ), - Font( - R.font.spoqa_han_sans_neo_medium, - FontWeight.Medium, - FontStyle.Normal - ), - Font( - R.font.spoqa_han_sans_neo_regular, - FontWeight.Normal, - FontStyle.Normal - ), -) +private val spoqaHanSansNeo = + FontFamily( + Font( + R.font.spoqa_han_sans_neo_bold, + FontWeight.Bold, + FontStyle.Normal + ), + Font( + R.font.spoqa_han_sans_neo_medium, + FontWeight.Medium, + FontStyle.Normal + ), + Font( + R.font.spoqa_han_sans_neo_regular, + FontWeight.Normal, + FontStyle.Normal + ) + ) @Stable class FunchTypography internal constructor( @@ -39,7 +40,7 @@ class FunchTypography internal constructor( sbt1: TextStyle, sbt2: TextStyle, b: TextStyle, - caption: TextStyle, + caption: TextStyle ) { var t1: TextStyle by mutableStateOf(t1) private set @@ -60,14 +61,14 @@ class FunchTypography internal constructor( sbt1: TextStyle = this.sbt1, sbt2: TextStyle = this.sbt2, b: TextStyle = this.b, - caption: TextStyle = this.caption, + caption: TextStyle = this.caption ): FunchTypography = FunchTypography( t1 = t1, t2 = t2, sbt1 = sbt1, sbt2 = sbt2, b = b, - caption = caption, + caption = caption ) fun update(other: FunchTypography) { @@ -82,68 +83,80 @@ class FunchTypography internal constructor( internal fun funchTypography(): FunchTypography { return FunchTypography( - t1 = TextStyle( + t1 = + TextStyle( fontFamily = spoqaHanSansNeo, fontWeight = FontWeight.Bold, fontSize = 22.sp, letterSpacing = (-0.02).em, lineHeight = 28.6.sp, - lineHeightStyle = LineHeightStyle( + lineHeightStyle = + LineHeightStyle( alignment = LineHeightStyle.Alignment.Proportional, trim = LineHeightStyle.Trim.None ) ), - t2 = TextStyle( + t2 = + TextStyle( fontFamily = spoqaHanSansNeo, fontWeight = FontWeight.Bold, fontSize = 20.sp, letterSpacing = (-0.02).em, lineHeight = 26.sp, - lineHeightStyle = LineHeightStyle( + lineHeightStyle = + LineHeightStyle( alignment = LineHeightStyle.Alignment.Proportional, trim = LineHeightStyle.Trim.None ) ), - sbt1 = TextStyle( + sbt1 = + TextStyle( fontFamily = spoqaHanSansNeo, fontWeight = FontWeight.Bold, fontSize = 18.sp, letterSpacing = (-0.02).em, lineHeight = 23.4.sp, - lineHeightStyle = LineHeightStyle( + lineHeightStyle = + LineHeightStyle( alignment = LineHeightStyle.Alignment.Proportional, trim = LineHeightStyle.Trim.None ) ), - sbt2 = TextStyle( + sbt2 = + TextStyle( fontFamily = spoqaHanSansNeo, fontWeight = FontWeight.Bold, fontSize = 16.sp, letterSpacing = (-0.02).sp, lineHeight = 20.8.sp, - lineHeightStyle = LineHeightStyle( + lineHeightStyle = + LineHeightStyle( alignment = LineHeightStyle.Alignment.Proportional, trim = LineHeightStyle.Trim.None ) ), - b = TextStyle( + b = + TextStyle( fontFamily = spoqaHanSansNeo, fontWeight = FontWeight.Normal, fontSize = 14.sp, letterSpacing = (-0.03).em, lineHeight = 21.sp, - lineHeightStyle = LineHeightStyle( + lineHeightStyle = + LineHeightStyle( alignment = LineHeightStyle.Alignment.Proportional, trim = LineHeightStyle.Trim.None ) ), - caption = TextStyle( + caption = + TextStyle( fontFamily = spoqaHanSansNeo, fontWeight = FontWeight.Normal, fontSize = 12.sp, letterSpacing = (-0.03).em, lineHeight = 18.sp, - lineHeightStyle = LineHeightStyle( + lineHeightStyle = + LineHeightStyle( alignment = LineHeightStyle.Alignment.Proportional, trim = LineHeightStyle.Trim.None ) diff --git a/core/designsystem/src/main/java/com/moya/funch/ui/FunchCaption.kt b/core/designsystem/src/main/java/com/moya/funch/ui/FunchCaption.kt index 97d464fa..11c0cf92 100644 --- a/core/designsystem/src/main/java/com/moya/funch/ui/FunchCaption.kt +++ b/core/designsystem/src/main/java/com/moya/funch/ui/FunchCaption.kt @@ -23,29 +23,29 @@ fun FunchErrorCaption( modifier: Modifier = Modifier, isError: Boolean = false, errorText: String, - description: String = "", + description: String = "" ) { if (isError) { Row( modifier = modifier, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { Icon( painter = painterResource(id = FunchIconAsset.Etc.information_24), contentDescription = description, - tint = Coral500, + tint = Coral500 ) Spacer(modifier = Modifier.width(4.dp)) Text( text = errorText, color = Coral500, - style = FunchTheme.typography.caption, + style = FunchTheme.typography.caption ) } } } -/*============================== Preview =================================*/ +// ============================== Preview ================================= @Preview("Error Caption", showBackground = true, backgroundColor = 0xFF2C2C2C) @Composable @@ -54,10 +54,11 @@ private fun Preview1() { FunchTheme { FunchErrorCaption( - modifier = Modifier + modifier = + Modifier .padding(top = 4.dp, start = 4.dp), isError = isError.value, - errorText = "errorText", + errorText = "errorText" ) } } diff --git a/core/designsystem/src/main/java/com/moya/funch/ui/FunchFeedbackButton.kt b/core/designsystem/src/main/java/com/moya/funch/ui/FunchFeedbackButton.kt index 50c9485b..04e6ffb6 100644 --- a/core/designsystem/src/main/java/com/moya/funch/ui/FunchFeedbackButton.kt +++ b/core/designsystem/src/main/java/com/moya/funch/ui/FunchFeedbackButton.kt @@ -18,10 +18,7 @@ import com.moya.funch.theme.FunchTheme import com.moya.funch.theme.Gray900 @Composable -internal fun FunchFeedbackButton( - enabled: Boolean = true, - onClick: () -> Unit, -) { +internal fun FunchFeedbackButton(enabled: Boolean = true, onClick: () -> Unit) { FunchSubButton( modifier = Modifier.wrapContentSize(), enabled = enabled, @@ -39,15 +36,16 @@ private fun Preview1() { Column( Modifier .background(Gray900) - .padding(12.dp), horizontalAlignment = Alignment.CenterHorizontally + .padding(12.dp), + horizontalAlignment = Alignment.CenterHorizontally ) { FunchFeedbackButton( - onClick = { }, + onClick = { } ) Spacer(modifier = Modifier.padding(8.dp)) FunchFeedbackButton( enabled = false, - onClick = { /*TODO*/ }, + onClick = { /*TODO*/ } ) } } diff --git a/core/designsystem/src/main/java/com/moya/funch/ui/FunchTopBar.kt b/core/designsystem/src/main/java/com/moya/funch/ui/FunchTopBar.kt index a4f5b8de..87852723 100644 --- a/core/designsystem/src/main/java/com/moya/funch/ui/FunchTopBar.kt +++ b/core/designsystem/src/main/java/com/moya/funch/ui/FunchTopBar.kt @@ -21,10 +21,13 @@ fun FunchTopBar( enabledTrailingIcon: Boolean = true, onClickLeadingIcon: () -> Unit = {}, onClickTrailingIcon: () -> Unit = {}, - leadingIcon: FunchIcon? = FunchIcon( - resId = FunchIconAsset.Search.search_24, description = "Search", tint = Gray400 - ), - trailingIcon: (@Composable () -> Unit)? = { FunchFeedbackButton(enabledTrailingIcon, onClickTrailingIcon) }, + leadingIcon: FunchIcon? = + FunchIcon( + resId = FunchIconAsset.Search.search_24, + description = "Search", + tint = Gray400 + ), + trailingIcon: (@Composable () -> Unit)? = { FunchFeedbackButton(enabledTrailingIcon, onClickTrailingIcon) } ) { FunchNonTitleTopBar(leadingIcon = { if (leadingIcon != null) { @@ -32,7 +35,7 @@ fun FunchTopBar( enabled = enabledLeadingIcon, modifier = Modifier.size(40.dp), onClick = onClickLeadingIcon, - funchIcon = leadingIcon, + funchIcon = leadingIcon ) } }, trailingIcon = { @@ -49,8 +52,7 @@ private fun Preview() { Column( modifier = Modifier.background(Gray400), verticalArrangement = Arrangement.spacedBy(8.dp) - ) - { + ) { FunchTopBar() FunchTopBar(leadingIcon = null) FunchTopBar(trailingIcon = null) @@ -65,8 +67,7 @@ private fun Preview2() { Column( modifier = Modifier.background(Gray400), verticalArrangement = Arrangement.spacedBy(8.dp) - ) - { + ) { FunchTopBar(enabledLeadingIcon = false) FunchTopBar(enabledTrailingIcon = false) FunchTopBar(enabledLeadingIcon = false, enabledTrailingIcon = false) diff --git a/core/designsystem/src/main/java/com/moya/funch/ui/SingleEventArea.kt b/core/designsystem/src/main/java/com/moya/funch/ui/SingleEventArea.kt index 8cc59fb7..201c01a0 100644 --- a/core/designsystem/src/main/java/com/moya/funch/ui/SingleEventArea.kt +++ b/core/designsystem/src/main/java/com/moya/funch/ui/SingleEventArea.kt @@ -9,9 +9,7 @@ import com.moya.funch.modifier.SingleEventHandler * 여러 번 클릭 이벤트를 막아주는 Wrapper Composable * */ @Composable -fun SingleEventArea( - content: @Composable (SingleEventHandler) -> T, -) { +fun SingleEventArea(content: @Composable (SingleEventHandler) -> T) { val singleEventHandler = remember { DefaultSingleEventHandler() } content(singleEventHandler) diff --git a/core/domain/build.gradle.kts b/core/domain/build.gradle.kts index df94074b..36e60448 100644 --- a/core/domain/build.gradle.kts +++ b/core/domain/build.gradle.kts @@ -1,7 +1,6 @@ plugins { `java-library` alias(libs.plugins.funch.jvm.library) - alias(libs.plugins.ktlint) } tasks.withType { diff --git a/core/domain/src/main/java/com/moya/funch/entity/Blood.kt b/core/domain/src/main/java/com/moya/funch/entity/Blood.kt index 1ce0e59e..9fa96afc 100644 --- a/core/domain/src/main/java/com/moya/funch/entity/Blood.kt +++ b/core/domain/src/main/java/com/moya/funch/entity/Blood.kt @@ -5,5 +5,5 @@ enum class Blood { B, AB, O, - IDLE, + IDLE } diff --git a/core/domain/src/main/java/com/moya/funch/entity/Club.kt b/core/domain/src/main/java/com/moya/funch/entity/Club.kt index b4ecd27e..662c73c1 100644 --- a/core/domain/src/main/java/com/moya/funch/entity/Club.kt +++ b/core/domain/src/main/java/com/moya/funch/entity/Club.kt @@ -4,7 +4,7 @@ enum class Club(val label: String) { NEXTERS("넥스터즈"), SOPT("SOPT"), DEPROMEET("Depromeet"), - IDLE("idle"), + IDLE("idle") ; companion object { diff --git a/core/domain/src/main/java/com/moya/funch/entity/Job.kt b/core/domain/src/main/java/com/moya/funch/entity/Job.kt index 7232533a..090865b3 100644 --- a/core/domain/src/main/java/com/moya/funch/entity/Job.kt +++ b/core/domain/src/main/java/com/moya/funch/entity/Job.kt @@ -3,7 +3,7 @@ package com.moya.funch.entity enum class Job(val krName: String) { DEVELOPER("개발자"), DESIGNER("디자이너"), - IDLE("idle"), + IDLE("idle") ; companion object { diff --git a/core/domain/src/main/java/com/moya/funch/entity/Mbti.kt b/core/domain/src/main/java/com/moya/funch/entity/Mbti.kt index f69a8b6d..7ab5d32f 100644 --- a/core/domain/src/main/java/com/moya/funch/entity/Mbti.kt +++ b/core/domain/src/main/java/com/moya/funch/entity/Mbti.kt @@ -17,5 +17,5 @@ enum class Mbti { ISFP, ISTJ, ISTP, - IDLE, + IDLE } diff --git a/core/domain/src/main/java/com/moya/funch/entity/SubwayStation.kt b/core/domain/src/main/java/com/moya/funch/entity/SubwayStation.kt index b7c532d2..11e407e4 100644 --- a/core/domain/src/main/java/com/moya/funch/entity/SubwayStation.kt +++ b/core/domain/src/main/java/com/moya/funch/entity/SubwayStation.kt @@ -2,7 +2,7 @@ package com.moya.funch.entity data class SubwayStation( val name: String = "", - val lines: List = emptyList(), + val lines: List = emptyList() ) enum class SubwayLine { @@ -20,5 +20,5 @@ enum class SubwayLine { GYEONGCHUN, GYEONGUI, SINBUNDANG, - SUIN, + SUIN } diff --git a/core/domain/src/main/java/com/moya/funch/entity/match/Chemistry.kt b/core/domain/src/main/java/com/moya/funch/entity/match/Chemistry.kt index 4be4ff0a..80e16cf2 100644 --- a/core/domain/src/main/java/com/moya/funch/entity/match/Chemistry.kt +++ b/core/domain/src/main/java/com/moya/funch/entity/match/Chemistry.kt @@ -2,5 +2,5 @@ package com.moya.funch.entity.match data class Chemistry( val title: String, - val description: String, + val description: String ) diff --git a/core/domain/src/main/java/com/moya/funch/entity/match/Matching.kt b/core/domain/src/main/java/com/moya/funch/entity/match/Matching.kt index f093d451..4c54f654 100644 --- a/core/domain/src/main/java/com/moya/funch/entity/match/Matching.kt +++ b/core/domain/src/main/java/com/moya/funch/entity/match/Matching.kt @@ -8,7 +8,7 @@ data class Matching( val similarity: Int = 0, val chemistrys: List = emptyList(), val recommends: List = emptyList(), - val subways: List = emptyList(), + val subways: List = emptyList() ) { init { require(similarity in 0..100) { diff --git a/core/domain/src/main/java/com/moya/funch/entity/match/Recommend.kt b/core/domain/src/main/java/com/moya/funch/entity/match/Recommend.kt index 7b7d78a8..6638d03e 100644 --- a/core/domain/src/main/java/com/moya/funch/entity/match/Recommend.kt +++ b/core/domain/src/main/java/com/moya/funch/entity/match/Recommend.kt @@ -1,5 +1,5 @@ package com.moya.funch.entity.match data class Recommend( - val title: String, + val title: String ) diff --git a/core/domain/src/main/java/com/moya/funch/entity/profile/Profile.kt b/core/domain/src/main/java/com/moya/funch/entity/profile/Profile.kt index e817fd26..d72282fa 100644 --- a/core/domain/src/main/java/com/moya/funch/entity/profile/Profile.kt +++ b/core/domain/src/main/java/com/moya/funch/entity/profile/Profile.kt @@ -14,5 +14,5 @@ data class Profile( val clubs: List = emptyList(), val mbti: Mbti = Mbti.IDLE, val blood: Blood = Blood.IDLE, - val subways: List = emptyList(), + val subways: List = emptyList() ) diff --git a/core/domain/src/main/java/com/moya/funch/repository/MatchingRepository.kt b/core/domain/src/main/java/com/moya/funch/repository/MatchingRepository.kt index f57d832b..6b5049e6 100644 --- a/core/domain/src/main/java/com/moya/funch/repository/MatchingRepository.kt +++ b/core/domain/src/main/java/com/moya/funch/repository/MatchingRepository.kt @@ -3,8 +3,5 @@ package com.moya.funch.repository import com.moya.funch.entity.match.Matching fun interface MatchingRepository { - suspend fun matchProfile( - userId: String, - targetCode: String, - ): Matching + suspend fun matchProfile(userId: String, targetCode: String): Matching } diff --git a/core/domain/src/main/java/com/moya/funch/usecase/MatchProfileUseCase.kt b/core/domain/src/main/java/com/moya/funch/usecase/MatchProfileUseCase.kt index 701d8675..d4623909 100644 --- a/core/domain/src/main/java/com/moya/funch/usecase/MatchProfileUseCase.kt +++ b/core/domain/src/main/java/com/moya/funch/usecase/MatchProfileUseCase.kt @@ -4,20 +4,13 @@ import com.moya.funch.entity.match.Matching import com.moya.funch.repository.MatchingRepository import javax.inject.Inject -class MatchProfileUseCaseImpl - @Inject - constructor( - private val matchingRepository: MatchingRepository, - ) : MatchProfileUseCase { - override suspend operator fun invoke( - userId: String, - targetCode: String, - ): Matching = matchingRepository.matchProfile(userId, targetCode) - } +class MatchProfileUseCaseImpl @Inject constructor( + private val matchingRepository: MatchingRepository +) : MatchProfileUseCase { + override suspend operator fun invoke(userId: String, targetCode: String): Matching = + matchingRepository.matchProfile(userId, targetCode) +} fun interface MatchProfileUseCase { - suspend operator fun invoke( - userId: String, - targetCode: String, - ): Matching + suspend operator fun invoke(userId: String, targetCode: String): Matching } diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts index c1d4c7c5..4bedd590 100644 --- a/core/network/build.gradle.kts +++ b/core/network/build.gradle.kts @@ -19,14 +19,14 @@ android { buildConfigField( "String", "FUNCH_DEBUG_BASE_URL", - properties.getProperty("FUNCH_DEBUG_BASE_URL"), + properties.getProperty("FUNCH_DEBUG_BASE_URL") ) } getByName("debug") { buildConfigField( "String", "FUNCH_DEBUG_BASE_URL", - properties.getProperty("FUNCH_DEBUG_BASE_URL"), + properties.getProperty("FUNCH_DEBUG_BASE_URL") ) } } diff --git a/core/network/src/main/java/com/moya/funch/network/di/RetrofitModule.kt b/core/network/src/main/java/com/moya/funch/network/di/RetrofitModule.kt index 11fc3516..9ccd28a9 100644 --- a/core/network/src/main/java/com/moya/funch/network/di/RetrofitModule.kt +++ b/core/network/src/main/java/com/moya/funch/network/di/RetrofitModule.kt @@ -6,6 +6,8 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent +import java.util.concurrent.TimeUnit +import javax.inject.Singleton import kotlinx.serialization.json.Json import okhttp3.Interceptor import okhttp3.MediaType.Companion.toMediaType @@ -13,18 +15,15 @@ import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import retrofit2.Converter import retrofit2.Retrofit -import java.util.concurrent.TimeUnit -import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) object RetrofitModule { @Provides @Singleton - fun provideJson(): Json = - Json { - coerceInputValues = true - } + fun provideJson(): Json = Json { + coerceInputValues = true + } @Singleton @Provides @@ -34,34 +33,28 @@ object RetrofitModule { @Singleton @Provides - fun provideLoggingInterceptor(): Interceptor = - HttpLoggingInterceptor().setLevel( - if (BuildConfig.DEBUG) { - HttpLoggingInterceptor.Level.BODY - } else { - HttpLoggingInterceptor.Level.NONE - }, - ) + fun provideLoggingInterceptor(): Interceptor = HttpLoggingInterceptor().setLevel( + if (BuildConfig.DEBUG) { + HttpLoggingInterceptor.Level.BODY + } else { + HttpLoggingInterceptor.Level.NONE + } + ) @Singleton @Provides - fun provideOkHttpClient(logInterceptor: Interceptor): OkHttpClient = - OkHttpClient - .Builder() - .addInterceptor(logInterceptor) - .connectTimeout(60, TimeUnit.SECONDS) - .readTimeout(30, TimeUnit.SECONDS) - .writeTimeout(15, TimeUnit.SECONDS).build() + fun provideOkHttpClient(logInterceptor: Interceptor): OkHttpClient = OkHttpClient + .Builder() + .addInterceptor(logInterceptor) + .connectTimeout(60, TimeUnit.SECONDS) + .readTimeout(30, TimeUnit.SECONDS) + .writeTimeout(15, TimeUnit.SECONDS).build() @Singleton @Provides - fun provideRetrofit( - client: OkHttpClient, - converterFactory: Converter.Factory, - ): Retrofit = - Retrofit.Builder() - .baseUrl(BuildConfig.FUNCH_DEBUG_BASE_URL) - .client(client) - .addConverterFactory(converterFactory) - .build() + fun provideRetrofit(client: OkHttpClient, converterFactory: Converter.Factory): Retrofit = Retrofit.Builder() + .baseUrl(BuildConfig.FUNCH_DEBUG_BASE_URL) + .client(client) + .addConverterFactory(converterFactory) + .build() } diff --git a/core/network/src/main/java/com/moya/funch/network/di/ServiceModule.kt b/core/network/src/main/java/com/moya/funch/network/di/ServiceModule.kt index fdf84879..50fd507a 100644 --- a/core/network/src/main/java/com/moya/funch/network/di/ServiceModule.kt +++ b/core/network/src/main/java/com/moya/funch/network/di/ServiceModule.kt @@ -5,9 +5,9 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent +import javax.inject.Singleton import retrofit2.Retrofit import retrofit2.create -import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) diff --git a/core/network/src/main/java/com/moya/funch/network/dto/request/MatchingRequest.kt b/core/network/src/main/java/com/moya/funch/network/dto/request/MatchingRequest.kt index 1b61f0ac..8e6324fb 100644 --- a/core/network/src/main/java/com/moya/funch/network/dto/request/MatchingRequest.kt +++ b/core/network/src/main/java/com/moya/funch/network/dto/request/MatchingRequest.kt @@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable @Serializable data class MatchingRequest( @SerialName("requestMemberId") val userId: String, - @SerialName("targetMemberCode") val targetCode: String, + @SerialName("targetMemberCode") val targetCode: String ) diff --git a/core/network/src/main/java/com/moya/funch/network/dto/response/BaseResponse.kt b/core/network/src/main/java/com/moya/funch/network/dto/response/BaseResponse.kt index 0b3f970d..e1e9ddd5 100644 --- a/core/network/src/main/java/com/moya/funch/network/dto/response/BaseResponse.kt +++ b/core/network/src/main/java/com/moya/funch/network/dto/response/BaseResponse.kt @@ -10,5 +10,5 @@ data class BaseResponse( @SerialName("message") val message: String, @SerialName("data") - val data: T, + val data: T ) diff --git a/core/network/src/main/java/com/moya/funch/network/dto/response/match/ChemistryResponse.kt b/core/network/src/main/java/com/moya/funch/network/dto/response/match/ChemistryResponse.kt index ff854f52..e63865a6 100644 --- a/core/network/src/main/java/com/moya/funch/network/dto/response/match/ChemistryResponse.kt +++ b/core/network/src/main/java/com/moya/funch/network/dto/response/match/ChemistryResponse.kt @@ -8,5 +8,5 @@ data class ChemistryResponse( @SerialName("title") val title: String = "", @SerialName("description") - val description: String = "", + val description: String = "" ) diff --git a/core/network/src/main/java/com/moya/funch/network/dto/response/match/MatchingResponse.kt b/core/network/src/main/java/com/moya/funch/network/dto/response/match/MatchingResponse.kt index bb1661d7..2c167d0d 100644 --- a/core/network/src/main/java/com/moya/funch/network/dto/response/match/MatchingResponse.kt +++ b/core/network/src/main/java/com/moya/funch/network/dto/response/match/MatchingResponse.kt @@ -15,5 +15,5 @@ data class MatchingResponse( @SerialName("recommendInfos") val recommends: List = listOf(), @SerialName("subwayInfos") - val subways: List = listOf(), + val subways: List = listOf() ) diff --git a/core/network/src/main/java/com/moya/funch/network/dto/response/match/RecommendResponse.kt b/core/network/src/main/java/com/moya/funch/network/dto/response/match/RecommendResponse.kt index be3903db..4ec95cb2 100644 --- a/core/network/src/main/java/com/moya/funch/network/dto/response/match/RecommendResponse.kt +++ b/core/network/src/main/java/com/moya/funch/network/dto/response/match/RecommendResponse.kt @@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable @Serializable data class RecommendResponse( @SerialName("title") - val title: String = "", + val title: String = "" ) diff --git a/core/network/src/main/java/com/moya/funch/network/dto/response/match/SubwayResponse.kt b/core/network/src/main/java/com/moya/funch/network/dto/response/match/SubwayResponse.kt index dc0e3b00..1d8c24d9 100644 --- a/core/network/src/main/java/com/moya/funch/network/dto/response/match/SubwayResponse.kt +++ b/core/network/src/main/java/com/moya/funch/network/dto/response/match/SubwayResponse.kt @@ -8,5 +8,5 @@ data class SubwayResponse( @SerialName("lines") val lines: List = listOf(), @SerialName("name") - val name: String = "", + val name: String = "" ) diff --git a/core/network/src/main/java/com/moya/funch/network/dto/response/profile/ProfileResponse.kt b/core/network/src/main/java/com/moya/funch/network/dto/response/profile/ProfileResponse.kt index 8b21c724..aee26c5f 100644 --- a/core/network/src/main/java/com/moya/funch/network/dto/response/profile/ProfileResponse.kt +++ b/core/network/src/main/java/com/moya/funch/network/dto/response/profile/ProfileResponse.kt @@ -16,5 +16,5 @@ data class ProfileResponse( @SerialName("bloodType") val bloodType: String = "", @SerialName("subwayNames") - val subwayNames: List = listOf(), + val subwayNames: List = listOf() ) diff --git a/core/network/src/main/java/com/moya/funch/network/service/MatchingService.kt b/core/network/src/main/java/com/moya/funch/network/service/MatchingService.kt index f9087a20..11374341 100644 --- a/core/network/src/main/java/com/moya/funch/network/service/MatchingService.kt +++ b/core/network/src/main/java/com/moya/funch/network/service/MatchingService.kt @@ -8,7 +8,5 @@ import retrofit2.http.POST interface MatchingService { @POST("api/v1/matching") - suspend fun matchProfile( - @Body body: MatchingRequest, - ): BaseResponse + suspend fun matchProfile(@Body body: MatchingRequest): BaseResponse } diff --git a/core/network/src/test/java/com/moya/funch/network/service/MatchingServiceTest.kt b/core/network/src/test/java/com/moya/funch/network/service/MatchingServiceTest.kt index 2c1be311..62a0535c 100644 --- a/core/network/src/test/java/com/moya/funch/network/service/MatchingServiceTest.kt +++ b/core/network/src/test/java/com/moya/funch/network/service/MatchingServiceTest.kt @@ -10,6 +10,7 @@ import com.moya.funch.network.dto.response.match.RecommendResponse import com.moya.funch.network.dto.response.profile.ProfileResponse import com.moya.funch.rule.CoroutinesTestExtension import io.mockk.junit5.MockKExtension +import java.io.File import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import kotlinx.serialization.json.Json @@ -21,7 +22,6 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith import retrofit2.Retrofit import retrofit2.create -import java.io.File @OptIn(ExperimentalCoroutinesApi::class) @ExtendWith(MockKExtension::class) @@ -39,61 +39,60 @@ internal class MatchingServiceTest { ignoreUnknownKeys = true prettyPrint = true coerceInputValues = true - }.asConverterFactory("application/json".toMediaType()), + }.asConverterFactory("application/json".toMediaType()) ).baseUrl(mockWebServer.url("")).build().create() } @Test - fun `내 id와 상대방의 code로 Matching 결과를 불러올 수 있다`() = - runTest { - // given - val matchingJson = File("src/test/res/matching_result.json").readText() - val fakeResponse = MockResponse().setBody(matchingJson).setResponseCode(200) - mockWebServer.enqueue(fakeResponse) - val expected = - BaseResponse( - status = 200, - message = "OK", - data = - MatchingResponse( - profile = - ProfileResponse( - name = "aaa", - jobGroup = "개발자", - clubs = listOf("DEPROMEET"), - mbti = "ENFJ", - bloodType = "AB", - subwayNames = listOf(), - ), - similarity = 40, - chemistryInfos = - listOf( - ChemistryResponse( - "기막힌 타이밍에 등장한 너!", - "미정", - ), - ChemistryResponse( - "서로 비슷한 똑! 닮은 꼴", - "미정", - ), - ), - recommends = - listOf( - RecommendResponse("ENFJ"), - RecommendResponse("전갈자리"), - ), - subways = listOf(), + fun `내 id와 상대방의 code로 Matching 결과를 불러올 수 있다`() = runTest { + // given + val matchingJson = File("src/test/res/matching_result.json").readText() + val fakeResponse = MockResponse().setBody(matchingJson).setResponseCode(200) + mockWebServer.enqueue(fakeResponse) + val expected = + BaseResponse( + status = 200, + message = "OK", + data = + MatchingResponse( + profile = + ProfileResponse( + name = "aaa", + jobGroup = "개발자", + clubs = listOf("DEPROMEET"), + mbti = "ENFJ", + bloodType = "AB", + subwayNames = listOf() + ), + similarity = 40, + chemistryInfos = + listOf( + ChemistryResponse( + "기막힌 타이밍에 등장한 너!", + "미정" ), - ) - // when - val actualResponse = - matchingService.matchProfile( - MatchingRequest( - userId = "65b6c543ebe5db753688b9dd", - targetCode = "7O2K", + ChemistryResponse( + "서로 비슷한 똑! 닮은 꼴", + "미정" + ) ), + recommends = + listOf( + RecommendResponse("ENFJ"), + RecommendResponse("전갈자리") + ), + subways = listOf() + ) + ) + // when + val actualResponse = + matchingService.matchProfile( + MatchingRequest( + userId = "65b6c543ebe5db753688b9dd", + targetCode = "7O2K" ) - // then - assertThat(actualResponse).isEqualTo(expected) - } + ) + // then + assertThat(actualResponse).isEqualTo(expected) + } } diff --git a/core/testing/src/main/java/com/moya/funch/rule/CoroutinesTestExtension.kt b/core/testing/src/main/java/com/moya/funch/rule/CoroutinesTestExtension.kt index 7880e079..fa0b45da 100644 --- a/core/testing/src/main/java/com/moya/funch/rule/CoroutinesTestExtension.kt +++ b/core/testing/src/main/java/com/moya/funch/rule/CoroutinesTestExtension.kt @@ -12,9 +12,8 @@ import org.junit.jupiter.api.extension.ExtensionContext @ExperimentalCoroutinesApi class CoroutinesTestExtension( - private val dispatcher: TestDispatcher = UnconfinedTestDispatcher(), + private val dispatcher: TestDispatcher = UnconfinedTestDispatcher() ) : BeforeEachCallback, AfterEachCallback { - override fun beforeEach(context: ExtensionContext?) { Dispatchers.setMain(dispatcher) } @@ -23,4 +22,3 @@ class CoroutinesTestExtension( Dispatchers.resetMain() } } - diff --git a/feature/home/build.gradle.kts b/feature/home/build.gradle.kts index b82253eb..a231addf 100644 --- a/feature/home/build.gradle.kts +++ b/feature/home/build.gradle.kts @@ -1,5 +1,4 @@ plugins { - alias(libs.plugins.ktlint) alias(libs.plugins.funch.feature) alias(libs.plugins.funch.compose) } diff --git a/feature/home/src/main/java/com/moya/funch/HomeScreen.kt b/feature/home/src/main/java/com/moya/funch/HomeScreen.kt index 7cb8d5db..4a2c0b89 100644 --- a/feature/home/src/main/java/com/moya/funch/HomeScreen.kt +++ b/feature/home/src/main/java/com/moya/funch/HomeScreen.kt @@ -53,14 +53,14 @@ import com.moya.funch.theme.Yellow500 private val brush = Brush.horizontalGradient( 0.5f to Lemon500, - 0.5f to Color(0xFFFFD440), + 0.5f to Color(0xFFFFD440) ) @Composable internal fun HomeRoute( viewModel: HomeViewModel = hiltViewModel(), onNavigateToMyProfile: () -> Unit, - onNavigateToMatching: () -> Unit, + onNavigateToMatching: () -> Unit ) { val homeModel = viewModel.homeModel.collectAsState().value @@ -70,7 +70,7 @@ internal fun HomeRoute( matchingCode = homeModel.matchingCode, onMatchingCodeChange = { code -> viewModel.setMatchingCode(code) }, onNavigateToMatching = onNavigateToMatching, - onNavigateToMyProfile = onNavigateToMyProfile, + onNavigateToMyProfile = onNavigateToMyProfile ) } @@ -81,76 +81,72 @@ internal fun HomeScreen( matchingCode: String, onMatchingCodeChange: (String) -> Unit, onNavigateToMatching: () -> Unit, - onNavigateToMyProfile: () -> Unit, + onNavigateToMyProfile: () -> Unit ) { Column( modifier = - Modifier - .fillMaxSize() - .padding( - top = 8.dp, - start = 20.dp, - end = 20.dp, - ), - verticalArrangement = Arrangement.spacedBy(8.dp), + Modifier + .fillMaxSize() + .padding( + top = 8.dp, + start = 20.dp, + end = 20.dp + ), + verticalArrangement = Arrangement.spacedBy(8.dp) ) { MatchingCard( value = matchingCode, onValueChange = onMatchingCodeChange, - onNavigateToMatching = onNavigateToMatching, + onNavigateToMatching = onNavigateToMatching ) Row( modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(8.dp) ) { CodeCard( modifier = Modifier.weight(1f), - myCode = myCode, + myCode = myCode ) MyProfileCard( - onMyProfileClick = onNavigateToMyProfile, + onMyProfileClick = onNavigateToMyProfile ) } ProfileViewCounterCard( - viewCount = viewCount, + viewCount = viewCount ) } } @Composable -private fun MatchingCard( - value: String, - onValueChange: (String) -> Unit, - onNavigateToMatching: () -> Unit, -) { +private fun MatchingCard(value: String, onValueChange: (String) -> Unit, onNavigateToMatching: () -> Unit) { Column( modifier = - Modifier - .fillMaxWidth() - .border( - width = 1.dp, - brush = brush, - shape = RoundedCornerShape(20.dp), - ) - .clip(RoundedCornerShape(20.dp)) - .background(Gray800) - .padding( - top = 24.dp, - bottom = 33.dp, - start = 16.dp, - end = 16.dp, - ), + Modifier + .fillMaxWidth() + .border( + width = 1.dp, + brush = brush, + shape = RoundedCornerShape(20.dp) + ) + .clip(RoundedCornerShape(20.dp)) + .background(Gray800) + .padding( + top = 24.dp, + bottom = 33.dp, + start = 16.dp, + end = 16.dp + ) ) { Text( text = stringResource(id = R.string.matching_card_title), style = FunchTheme.typography.t2, - color = White, + color = White ) Spacer(modifier = Modifier.height(2.dp)) Text( text = stringResource(id = R.string.matching_card_caption), style = FunchTheme.typography.b, - color = Gray300, + color = Gray300 ) Spacer(modifier = Modifier.height(16.dp)) FunchButtonTextField( @@ -165,103 +161,97 @@ private fun MatchingCard( backgroundColor = Gray500, onClick = onNavigateToMatching, funchIcon = - FunchIcon( - resId = FunchIconAsset.Search.search_24, - description = "", - tint = Yellow500, - ), + FunchIcon( + resId = FunchIconAsset.Search.search_24, + description = "", + tint = Yellow500 + ) ) - }, + } ) } } @Composable -private fun CodeCard( - modifier: Modifier = Modifier, - myCode: String, -) { +private fun CodeCard(modifier: Modifier = Modifier, myCode: String) { Row( modifier = - modifier - .background( - color = Gray800, - shape = FunchTheme.shapes.medium, - ) - .padding( - top = 24.dp, - bottom = 24.dp, - start = 20.dp, - ), - horizontalArrangement = Arrangement.spacedBy(space = 12.dp), + modifier + .background( + color = Gray800, + shape = FunchTheme.shapes.medium + ) + .padding( + top = 24.dp, + bottom = 24.dp, + start = 20.dp + ), + horizontalArrangement = Arrangement.spacedBy(space = 12.dp) ) { Icon( modifier = Modifier.padding(8.dp), painter = painterResource(id = FunchIconAsset.Search.search_24), contentDescription = "", - tint = Gray400, + tint = Gray400 ) Column( - verticalArrangement = Arrangement.spacedBy(space = 2.dp), + verticalArrangement = Arrangement.spacedBy(space = 2.dp) ) { Text( text = stringResource(id = R.string.my_code_card_caption), style = FunchTheme.typography.b, - color = Gray400, + color = Gray400 ) Text( text = stringResource(id = R.string.my_code, myCode), style = - TextStyle( - brush = brush, - fontStyle = FunchTheme.typography.sbt2.fontStyle, - fontFamily = FunchTheme.typography.sbt2.fontFamily, - fontWeight = FunchTheme.typography.sbt2.fontWeight, - fontSize = FunchTheme.typography.sbt2.fontSize, - letterSpacing = FunchTheme.typography.sbt2.letterSpacing, - lineHeight = FunchTheme.typography.sbt2.lineHeight, - lineHeightStyle = - LineHeightStyle( - alignment = LineHeightStyle.Alignment.Proportional, - trim = LineHeightStyle.Trim.None, - ), - ), + TextStyle( + brush = brush, + fontStyle = FunchTheme.typography.sbt2.fontStyle, + fontFamily = FunchTheme.typography.sbt2.fontFamily, + fontWeight = FunchTheme.typography.sbt2.fontWeight, + fontSize = FunchTheme.typography.sbt2.fontSize, + letterSpacing = FunchTheme.typography.sbt2.letterSpacing, + lineHeight = FunchTheme.typography.sbt2.lineHeight, + lineHeightStyle = + LineHeightStyle( + alignment = LineHeightStyle.Alignment.Proportional, + trim = LineHeightStyle.Trim.None + ) + ) ) } } } @Composable -private fun MyProfileCard( - modifier: Modifier = Modifier, - onMyProfileClick: () -> Unit, -) { +private fun MyProfileCard(modifier: Modifier = Modifier, onMyProfileClick: () -> Unit) { Column( modifier = - modifier - .background( - color = Gray800, - shape = FunchTheme.shapes.medium, - ) - .clip(FunchTheme.shapes.medium) - .clickableSingle(onClick = onMyProfileClick) - .padding( - vertical = 11.5.dp, - horizontal = 24.dp, - ), + modifier + .background( + color = Gray800, + shape = FunchTheme.shapes.medium + ) + .clip(FunchTheme.shapes.medium) + .clickableSingle(onClick = onMyProfileClick) + .padding( + vertical = 11.5.dp, + horizontal = 24.dp + ), horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.spacedBy(space = 8.dp), + verticalArrangement = Arrangement.spacedBy(space = 8.dp) ) { Icon( modifier = Modifier.padding(8.dp), painter = painterResource(id = FunchIconAsset.Search.search_24), contentDescription = "", - tint = Gray400, + tint = Gray400 ) Text( text = stringResource(id = R.string.my_profile_card_caption), style = FunchTheme.typography.b, - color = Gray400, + color = Gray400 ) } } @@ -270,37 +260,37 @@ private fun MyProfileCard( private fun ProfileViewCounterCard(viewCount: Int) { Row( modifier = - Modifier - .fillMaxWidth() - .background( - color = Gray800, - shape = FunchTheme.shapes.medium, - ) - .padding( - top = 24.dp, - bottom = 24.dp, - start = 20.dp, - ), - horizontalArrangement = Arrangement.spacedBy(space = 12.dp), + Modifier + .fillMaxWidth() + .background( + color = Gray800, + shape = FunchTheme.shapes.medium + ) + .padding( + top = 24.dp, + bottom = 24.dp, + start = 20.dp + ), + horizontalArrangement = Arrangement.spacedBy(space = 12.dp) ) { Icon( modifier = Modifier.padding(8.dp), painter = painterResource(id = FunchIconAsset.Search.search_24), contentDescription = "", - tint = Gray400, + tint = Gray400 ) Column( - verticalArrangement = Arrangement.spacedBy(space = 2.dp), + verticalArrangement = Arrangement.spacedBy(space = 2.dp) ) { Text( text = stringResource(id = R.string.profile_view_counter_caption), style = FunchTheme.typography.b, - color = Gray400, + color = Gray400 ) Text( text = stringResource(id = R.string.profile_view_counter_card_subtitle, viewCount), style = FunchTheme.typography.sbt2, - color = White, + color = White ) } } @@ -310,7 +300,7 @@ private fun ProfileViewCounterCard(viewCount: Int) { "Home UI", showBackground = true, widthDp = 360, - heightDp = 640, + heightDp = 640 ) @Composable private fun Preview1() { @@ -321,7 +311,7 @@ private fun Preview1() { val backgroundColor = LocalBackgroundTheme.current.color Surface( modifier = Modifier.fillMaxSize(), - color = backgroundColor, + color = backgroundColor ) { HomeScreen( myCode = code, @@ -329,7 +319,7 @@ private fun Preview1() { matchingCode = text, onMatchingCodeChange = { text = it }, onNavigateToMatching = {}, - onNavigateToMyProfile = {}, + onNavigateToMyProfile = {} ) } } diff --git a/feature/home/src/main/java/com/moya/funch/HomeViewModel.kt b/feature/home/src/main/java/com/moya/funch/HomeViewModel.kt index 8f1edb35..91e5b915 100644 --- a/feature/home/src/main/java/com/moya/funch/HomeViewModel.kt +++ b/feature/home/src/main/java/com/moya/funch/HomeViewModel.kt @@ -2,62 +2,61 @@ package com.moya.funch import androidx.lifecycle.ViewModel import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow -import javax.inject.Inject // @Gun Hyung TODO : 모델 모듈로 분리 data class HomeModel( val myCode: String, val viewCount: Int, - val matchingCode: String, + val matchingCode: String ) { companion object { - fun empty() = - HomeModel( - myCode = "", - viewCount = 0, - matchingCode = "", - ) + fun empty() = HomeModel( + myCode = "", + viewCount = 0, + matchingCode = "" + ) } } @HiltViewModel internal class HomeViewModel - @Inject - constructor( - // @Gun Hyung TODO : UseCase 추가 - ) : ViewModel() { - private val _homeModel = MutableStateFlow(HomeModel.empty()) // @Gun Hyung TODO : 모델 초기화 필요 - val homeModel = _homeModel.asStateFlow() - - init { - initHome() - } - - private fun initHome() { // @Gun Hyung TODO : 도메인 완성시 init 함수 제작 - // setMyCode("u23c") - // setViewCount(12) - } - - private fun setMyCode(code: String) { // @Gun Hyung TODO : 도메인에서 .uppercase() 처리 - _homeModel.value = - _homeModel.value.copy( - myCode = code.uppercase(), - ) - } - - private fun setViewCount(count: Int) { - _homeModel.value = - _homeModel.value.copy( - viewCount = count, - ) - } - - fun setMatchingCode(code: String) { - _homeModel.value = - _homeModel.value.copy( - matchingCode = code.uppercase(), - ) - } +@Inject +constructor( + // @Gun Hyung TODO : UseCase 추가 +) : ViewModel() { + private val _homeModel = MutableStateFlow(HomeModel.empty()) // @Gun Hyung TODO : 모델 초기화 필요 + val homeModel = _homeModel.asStateFlow() + + init { + initHome() + } + + private fun initHome() { // @Gun Hyung TODO : 도메인 완성시 init 함수 제작 + // setMyCode("u23c") + // setViewCount(12) + } + + private fun setMyCode(code: String) { // @Gun Hyung TODO : 도메인에서 .uppercase() 처리 + _homeModel.value = + _homeModel.value.copy( + myCode = code.uppercase() + ) } + + private fun setViewCount(count: Int) { + _homeModel.value = + _homeModel.value.copy( + viewCount = count + ) + } + + fun setMatchingCode(code: String) { + _homeModel.value = + _homeModel.value.copy( + matchingCode = code.uppercase() + ) + } +} diff --git a/feature/home/src/main/java/com/moya/funch/navigation/HomeNavigation.kt b/feature/home/src/main/java/com/moya/funch/navigation/HomeNavigation.kt index 8116a751..f8041b1f 100644 --- a/feature/home/src/main/java/com/moya/funch/navigation/HomeNavigation.kt +++ b/feature/home/src/main/java/com/moya/funch/navigation/HomeNavigation.kt @@ -7,19 +7,15 @@ import com.moya.funch.HomeRoute const val HOME_ROUTE = "home" -fun NavController.navigateToHome() = - navigate(HOME_ROUTE) { - popUpTo(graph.id) - } +fun NavController.navigateToHome() = navigate(HOME_ROUTE) { + popUpTo(graph.id) +} -fun NavGraphBuilder.homeScreen( - onNavigateToMyProfile: () -> Unit, - onNavigateToMatching: () -> Unit, -) { +fun NavGraphBuilder.homeScreen(onNavigateToMyProfile: () -> Unit, onNavigateToMatching: () -> Unit) { composable(route = HOME_ROUTE) { HomeRoute( onNavigateToMatching = onNavigateToMatching, - onNavigateToMyProfile = onNavigateToMyProfile, + onNavigateToMyProfile = onNavigateToMyProfile ) } } diff --git a/feature/profile/build.gradle.kts b/feature/profile/build.gradle.kts index 8a2f7817..cdea8f9c 100644 --- a/feature/profile/build.gradle.kts +++ b/feature/profile/build.gradle.kts @@ -1,5 +1,4 @@ plugins { - alias(libs.plugins.ktlint) alias(libs.plugins.funch.feature) alias(libs.plugins.funch.compose) } diff --git a/feature/profile/src/main/java/com/moya/funch/CreateProflieScreen.kt b/feature/profile/src/main/java/com/moya/funch/CreateProflieScreen.kt index 3c08388a..b34af6a5 100644 --- a/feature/profile/src/main/java/com/moya/funch/CreateProflieScreen.kt +++ b/feature/profile/src/main/java/com/moya/funch/CreateProflieScreen.kt @@ -13,7 +13,7 @@ fun CreateProfileScreen(onNavigateToHome: () -> Unit) { Text( text = "프로필 생성 화면", fontSize = 12.sp, - color = Color.White, + color = Color.White ) Button(onClick = onNavigateToHome) { Text(text = "프로필 생성") diff --git a/feature/profile/src/main/java/com/moya/funch/MyProfileScreen.kt b/feature/profile/src/main/java/com/moya/funch/MyProfileScreen.kt index abf32e43..531e48c4 100644 --- a/feature/profile/src/main/java/com/moya/funch/MyProfileScreen.kt +++ b/feature/profile/src/main/java/com/moya/funch/MyProfileScreen.kt @@ -13,7 +13,7 @@ fun MyProfileScreen(onCloseMyProfile: () -> Unit) { Text( text = "내 프로필 화면", fontSize = 12.sp, - color = Color.White, + color = Color.White ) Button(onClick = onCloseMyProfile) { Text(text = "홈으로 가기") diff --git a/feature/profile/src/main/java/com/moya/funch/navigation/MyProfileNavigatoin.kt b/feature/profile/src/main/java/com/moya/funch/navigation/MyProfileNavigatoin.kt index cb30556a..6881cc1d 100644 --- a/feature/profile/src/main/java/com/moya/funch/navigation/MyProfileNavigatoin.kt +++ b/feature/profile/src/main/java/com/moya/funch/navigation/MyProfileNavigatoin.kt @@ -13,22 +13,19 @@ fun NavController.navigateToMyProfile() = navigate(ProfileScreens.MyProfile.rout fun NavController.closeMyProfile() = popBackStack() // 텍스트 필드의 값을 남기기 위해 사용 -fun NavGraphBuilder.profileGraph( - onNavigateToHome: () -> Unit, - onCloseMyProfile: () -> Unit, -) { +fun NavGraphBuilder.profileGraph(onNavigateToHome: () -> Unit, onCloseMyProfile: () -> Unit) { navigation( route = PROFILE_GRAPH_ROUTE, - startDestination = ProfileScreens.Create.route, + startDestination = ProfileScreens.Create.route ) { composable(route = ProfileScreens.Create.route) { CreateProfileScreen( - onNavigateToHome = onNavigateToHome, + onNavigateToHome = onNavigateToHome ) } composable(route = ProfileScreens.MyProfile.route) { MyProfileScreen( - onCloseMyProfile = onCloseMyProfile, + onCloseMyProfile = onCloseMyProfile ) } }