From eb06f62ab63a5cbf0bd793f3669c6fdd6bb4af01 Mon Sep 17 00:00:00 2001 From: NoeyhOj <118670117+NoeyhOj@users.noreply.github.com> Date: Mon, 22 Jun 2026 16:59:52 +0900 Subject: [PATCH 1/9] =?UTF-8?q?build:=20Supabase=20=EC=97=B0=EB=8F=99?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EB=B0=8F=20=ED=99=98=EA=B2=BD=20=EB=B3=80=EC=88=98=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 14 ++++++++++++++ gradle/libs.versions.toml | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8a0331c..3bc7b94 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,3 +1,5 @@ +import java.util.Properties + plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.compose) @@ -21,6 +23,12 @@ android { versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + val properties = Properties() + properties.load(project.rootProject.file("local.properties").inputStream()) + + buildConfigField("String", "SUPABASE_URL", "\"${properties.getProperty("SUPABASE_URL")}\"") + buildConfigField("String", "SUPABASE_ANON_KEY", "\"${properties.getProperty("SUPABASE_ANON_KEY")}\"") } buildTypes { @@ -38,6 +46,7 @@ android { } buildFeatures { compose = true + buildConfig = true } } @@ -75,6 +84,11 @@ dependencies { implementation(libs.coil.compose) implementation(libs.coil.network.okhttp) + // Supabase + implementation(platform(libs.bom)) + implementation(libs.postgrest.kt) + implementation(libs.ktor.client.android) + testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 442c728..0812a54 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,6 @@ [versions] agp = "9.2.1" +bom = "3.6.0" coilCompose = "3.5.0" converterKotlinxSerialization = "2.11.0" coreKtx = "1.16.0" @@ -9,6 +10,7 @@ espressoCore = "3.7.0" kotlinxCoroutinesAndroid = "1.11.0" kotlinxCoroutinesCore = "1.11.0" kotlinxSerializationJson = "1.11.0" +ktorClientAndroid = "3.5.0" lifecycleRuntimeKtx = "2.10.0" activityCompose = "1.13.0" kotlin = "2.4.0" @@ -24,6 +26,7 @@ androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-ru androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleRuntimeKtx" } androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycleRuntimeKtx" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationCompose" } +bom = { module = "io.github.jan-tennert.supabase:bom", version.ref = "bom" } coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilCompose" } coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coilCompose" } converter-kotlinx-serialization = { module = "com.squareup.retrofit2:converter-kotlinx-serialization", version.ref = "converterKotlinxSerialization" } @@ -43,7 +46,9 @@ androidx-compose-material3 = { group = "androidx.compose.material3", name = "mat kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } +ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktorClientAndroid" } logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptor" } +postgrest-kt = { module = "io.github.jan-tennert.supabase:postgrest-kt" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } [plugins] From ced37688317c764ad33c880b54f379e9dc6c480f Mon Sep 17 00:00:00 2001 From: NoeyhOj <118670117+NoeyhOj@users.noreply.github.com> Date: Tue, 23 Jun 2026 14:05:25 +0900 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20Supabase=20=EB=84=A4=ED=8A=B8?= =?UTF-8?q?=EC=9B=8C=ED=81=AC=20=EC=84=A4=EC=A0=95=20=EB=B0=8F=20Gundam,?= =?UTF-8?q?=20Armament=20DTO=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/network/SupabaseNetwork.kt | 17 +++++ .../data/network/dto/ArmamentDto.kt | 21 ++++++ .../data/network/dto/GundamDto.kt | 68 +++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 app/src/main/java/com/example/gundamdexapp/data/network/SupabaseNetwork.kt create mode 100644 app/src/main/java/com/example/gundamdexapp/data/network/dto/ArmamentDto.kt create mode 100644 app/src/main/java/com/example/gundamdexapp/data/network/dto/GundamDto.kt diff --git a/app/src/main/java/com/example/gundamdexapp/data/network/SupabaseNetwork.kt b/app/src/main/java/com/example/gundamdexapp/data/network/SupabaseNetwork.kt new file mode 100644 index 0000000..276a616 --- /dev/null +++ b/app/src/main/java/com/example/gundamdexapp/data/network/SupabaseNetwork.kt @@ -0,0 +1,17 @@ +package com.example.gundamdexapp.data.network + +import com.example.gundamdexapp.BuildConfig +import io.github.jan.supabase.SupabaseClient +import io.github.jan.supabase.createSupabaseClient +import io.github.jan.supabase.postgrest.Postgrest + +object SupabaseNetwork { + val client: SupabaseClient by lazy { + createSupabaseClient( + supabaseUrl = BuildConfig.SUPABASE_URL, + supabaseKey = BuildConfig.SUPABASE_ANON_KEY + ) { + install(Postgrest) + } + } +} diff --git a/app/src/main/java/com/example/gundamdexapp/data/network/dto/ArmamentDto.kt b/app/src/main/java/com/example/gundamdexapp/data/network/dto/ArmamentDto.kt new file mode 100644 index 0000000..6fc2eb1 --- /dev/null +++ b/app/src/main/java/com/example/gundamdexapp/data/network/dto/ArmamentDto.kt @@ -0,0 +1,21 @@ +package com.example.gundamdexapp.data.network.dto + +import com.example.gundamdexapp.domain.model.Armament +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class ArmamentDto( + @SerialName("gundam_id") + val gundamId: String, + val name: String, + val details: String? = null, + @SerialName("indicator_color") + val indicatorColor: String +) { + fun toDomain(): Armament = Armament( + name = this.name, + details = this.details ?: "", + indicatorColor = this.indicatorColor + ) +} diff --git a/app/src/main/java/com/example/gundamdexapp/data/network/dto/GundamDto.kt b/app/src/main/java/com/example/gundamdexapp/data/network/dto/GundamDto.kt new file mode 100644 index 0000000..d1cda74 --- /dev/null +++ b/app/src/main/java/com/example/gundamdexapp/data/network/dto/GundamDto.kt @@ -0,0 +1,68 @@ +package com.example.gundamdexapp.data.network.dto + +import com.example.gundamdexapp.domain.model.Armaments +import com.example.gundamdexapp.domain.model.Dimensions +import com.example.gundamdexapp.domain.model.GundamInfo +import com.example.gundamdexapp.domain.model.TechnicalSpecifications +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class GundamDto( + val id: String, + @SerialName("model_number") + val modelNumber: String? = null, + val name: String, + val series: String, + @SerialName("image_url") + val imageUrl: String? = null, + val era: String, + val faction: String, + val pilot: String? = null, + val description: String, + @SerialName("dim_weight") + val weight: String? = null, + @SerialName("dim_height") + val height: String? = null, + @SerialName("tech_generator_output") + val generatorOutput: String? = null, + @SerialName("tech_armor_material") + val armorMaterial: String? = null, + @SerialName("tech_total_trust") + val totalTrust: String? = null, + @SerialName("tech_sensor_radius") + val sensorRadius: String? = null, + @SerialName("tech_crew") + val crew: String? = null, + val armaments: List = emptyList(), +) { + fun toDomain(): GundamInfo = GundamInfo( + id = this.id, + modelNumber = this.modelNumber ?: MISSING_TEXT, + name = this.name, + series = this.series, + imageUrl = this.imageUrl ?: MISSING_URL, + era = this.era, + faction = this.faction, + pilot = this.pilot ?: MISSING_TEXT, + description = this.description, + dimensions = Dimensions( + height = this.height ?: MISSING_TEXT, + weight = this.weight ?: MISSING_TEXT, + ), + technicalSpecifications = TechnicalSpecifications( + generatorOutput = this.generatorOutput ?: MISSING_TEXT, + armorMaterial = this.armorMaterial ?: MISSING_TEXT, + totalTrust = this.totalTrust ?: MISSING_TEXT, + sensorRadius = this.sensorRadius ?: MISSING_TEXT, + crew = this.crew ?: MISSING_TEXT, + ), + armaments = Armaments(this.armaments.map { it.toDomain() }), + ) + + companion object { + const val MISSING_TEXT = "[ ? ]" + const val MISSING_URL = + "https://imgfiles-cdn.plaync.com/file/BladeNSoul/download/20190802085052-S4BOYrvsgcmithzSaShj0-v4" + } +} From 7eba75be68bfef934df77083d27121719ade4012 Mon Sep 17 00:00:00 2001 From: NoeyhOj <118670117+NoeyhOj@users.noreply.github.com> Date: Thu, 25 Jun 2026 12:43:14 +0900 Subject: [PATCH 3/9] =?UTF-8?q?feat:=20Retrofit=20=EA=B8=B0=EB=B0=98=20?= =?UTF-8?q?=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC=20=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=96=B4=20=EB=B0=8F=20=EB=A6=AC=ED=8F=AC=EC=A7=80=ED=86=A0?= =?UTF-8?q?=EB=A6=AC=20=ED=8C=A8=ED=84=B4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 1 + .../example/gundamdexapp/GundamApplication.kt | 13 +++++++ .../gundamdexapp/data/network/AppContainer.kt | 10 ++++++ .../data/network/SupabaseNetwork.kt | 36 +++++++++++++------ .../data/network/api/GundamApi.kt | 17 +++++++++ .../repositoryImpl/GundamRepositoryImpl.kt | 26 ++++++++++++++ .../domain/repository/GundamRepository.kt | 7 ++++ 7 files changed, 100 insertions(+), 10 deletions(-) create mode 100644 app/src/main/java/com/example/gundamdexapp/GundamApplication.kt create mode 100644 app/src/main/java/com/example/gundamdexapp/data/network/AppContainer.kt create mode 100644 app/src/main/java/com/example/gundamdexapp/data/network/api/GundamApi.kt create mode 100644 app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt create mode 100644 app/src/main/java/com/example/gundamdexapp/domain/repository/GundamRepository.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6d91e7b..e133306 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,6 +5,7 @@ > +} diff --git a/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt b/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt new file mode 100644 index 0000000..37773d7 --- /dev/null +++ b/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt @@ -0,0 +1,26 @@ +package com.example.gundamdexapp.data.network.repositoryImpl + +import com.example.gundamdexapp.data.network.api.GundamApi +import com.example.gundamdexapp.domain.model.GundamInfo +import com.example.gundamdexapp.domain.repository.GundamRepository + +class GundamRepositoryImpl( + private val api: GundamApi +) : GundamRepository { + override suspend fun getGundamList(): Result> { + return try { + val response = api.getGundams() + + if (response.isSuccessful) { + val dtoList = response.body() ?: emptyList() + + val domainList = dtoList.map { it.toDomain() } + Result.success(domainList) + } else { + Result.failure(Exception("서버 통신 실패 : ${response.code()}")) + } + } catch (e: Exception) { + Result.failure(e) + } + } +} diff --git a/app/src/main/java/com/example/gundamdexapp/domain/repository/GundamRepository.kt b/app/src/main/java/com/example/gundamdexapp/domain/repository/GundamRepository.kt new file mode 100644 index 0000000..f20470c --- /dev/null +++ b/app/src/main/java/com/example/gundamdexapp/domain/repository/GundamRepository.kt @@ -0,0 +1,7 @@ +package com.example.gundamdexapp.domain.repository + +import com.example.gundamdexapp.domain.model.GundamInfo + +interface GundamRepository { + suspend fun getGundamList(): Result> +} From 811c20292241e122db728a150acaee17f36155e9 Mon Sep 17 00:00:00 2001 From: NoeyhOj <118670117+NoeyhOj@users.noreply.github.com> Date: Thu, 25 Jun 2026 13:39:33 +0900 Subject: [PATCH 4/9] =?UTF-8?q?chore:=20activity-ktx=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EB=B0=8F=20=EB=B2=84=EC=A0=84=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 1 + gradle/libs.versions.toml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3bc7b94..0227d27 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -54,6 +54,7 @@ dependencies { implementation(libs.androidx.core.ktx) implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.androidx.activity.compose) + implementation(libs.activity.ktx) implementation(platform(libs.androidx.compose.bom)) implementation(libs.androidx.compose.ui) implementation(libs.androidx.compose.ui.graphics) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0812a54..e41dfd0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,4 +1,5 @@ [versions] +activityKtx = "1.13.0" agp = "9.2.1" bom = "3.6.0" coilCompose = "3.5.0" @@ -21,6 +22,7 @@ retrofit = "2.11.0" ktlint = "14.2.0" [libraries] +activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityKtx" } androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycleRuntimeKtx" } androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleRuntimeKtx" } From 580c6e3ef85a95255701531d525f4777485a4e92 Mon Sep 17 00:00:00 2001 From: NoeyhOj <118670117+NoeyhOj@users.noreply.github.com> Date: Thu, 25 Jun 2026 16:05:28 +0900 Subject: [PATCH 5/9] =?UTF-8?q?chore:=20activity-ktx=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EB=B0=8F=20=EB=B2=84=EC=A0=84=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 2 +- gradle/libs.versions.toml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 0227d27..caae2a6 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -54,7 +54,7 @@ dependencies { implementation(libs.androidx.core.ktx) implementation(libs.androidx.lifecycle.runtime.ktx) implementation(libs.androidx.activity.compose) - implementation(libs.activity.ktx) + implementation(libs.androidx.activity.ktx) implementation(platform(libs.androidx.compose.bom)) implementation(libs.androidx.compose.ui) implementation(libs.androidx.compose.ui.graphics) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e41dfd0..0b3023c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,4 @@ [versions] -activityKtx = "1.13.0" agp = "9.2.1" bom = "3.6.0" coilCompose = "3.5.0" @@ -22,7 +21,7 @@ retrofit = "2.11.0" ktlint = "14.2.0" [libraries] -activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityKtx" } +androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityCompose" } androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycleRuntimeKtx" } androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleRuntimeKtx" } From a81678852f17475fd5b60b0b72615ebdb4bde8d5 Mon Sep 17 00:00:00 2001 From: NoeyhOj <118670117+NoeyhOj@users.noreply.github.com> Date: Thu, 25 Jun 2026 16:06:00 +0900 Subject: [PATCH 6/9] =?UTF-8?q?feat:=20GundamdexHomeViewModel=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=B0=8F=20Repository=20=EA=B8=B0=EB=B0=98=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=A1=9C=EB=94=A9=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/gundamdexapp/MainActivity.kt | 13 ++++- .../repositoryImpl/GundamRepositoryImpl.kt | 24 ++++---- .../feature/home/GundamdexHomeStatHolder.kt | 26 --------- .../feature/home/GundamdexHomeViewModel.kt | 55 +++++++++++++++++++ .../feature/navigation/GundamdexNavigation.kt | 11 ++-- 5 files changed, 85 insertions(+), 44 deletions(-) delete mode 100644 app/src/main/java/com/example/gundamdexapp/feature/home/GundamdexHomeStatHolder.kt create mode 100644 app/src/main/java/com/example/gundamdexapp/feature/home/GundamdexHomeViewModel.kt diff --git a/app/src/main/java/com/example/gundamdexapp/MainActivity.kt b/app/src/main/java/com/example/gundamdexapp/MainActivity.kt index ffb9058..296df77 100644 --- a/app/src/main/java/com/example/gundamdexapp/MainActivity.kt +++ b/app/src/main/java/com/example/gundamdexapp/MainActivity.kt @@ -4,16 +4,27 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge +import androidx.activity.viewModels +import com.example.gundamdexapp.feature.home.GundamdexHomeViewModel import com.example.gundamdexapp.feature.navigation.GundamdexNavigation import com.example.gundamdexapp.ui.theme.GundamdexAppTheme +import kotlin.getValue class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge() + + val application = application as GundamApplication + val gundamRepository = application.appContainer.gundamRepository + + val gundamdexHomeViewModel by viewModels { GundamdexHomeViewModel.Factory } + setContent { GundamdexAppTheme { - GundamdexNavigation() + GundamdexNavigation( + gundamdexHomeViewModel = gundamdexHomeViewModel, + ) } } } diff --git a/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt b/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt index 37773d7..0aab797 100644 --- a/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt +++ b/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt @@ -5,22 +5,20 @@ import com.example.gundamdexapp.domain.model.GundamInfo import com.example.gundamdexapp.domain.repository.GundamRepository class GundamRepositoryImpl( - private val api: GundamApi + private val api: GundamApi, ) : GundamRepository { - override suspend fun getGundamList(): Result> { - return try { - val response = api.getGundams() + override suspend fun getGundamList(): Result> = try { + val response = api.getGundams() - if (response.isSuccessful) { - val dtoList = response.body() ?: emptyList() + if (response.isSuccessful) { + val dtoList = response.body() ?: emptyList() - val domainList = dtoList.map { it.toDomain() } - Result.success(domainList) - } else { - Result.failure(Exception("서버 통신 실패 : ${response.code()}")) - } - } catch (e: Exception) { - Result.failure(e) + val domainList = dtoList.map { it.toDomain() } + Result.success(domainList) + } else { + Result.failure(Exception("서버 통신 실패 : ${response.code()}")) } + } catch (e: Exception) { + Result.failure(e) } } diff --git a/app/src/main/java/com/example/gundamdexapp/feature/home/GundamdexHomeStatHolder.kt b/app/src/main/java/com/example/gundamdexapp/feature/home/GundamdexHomeStatHolder.kt deleted file mode 100644 index 19ecc12..0000000 --- a/app/src/main/java/com/example/gundamdexapp/feature/home/GundamdexHomeStatHolder.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.gundamdexapp.feature.home - -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.setValue -import com.example.gundamdexapp.domain.model.GundamInfo - -class GundamdexHomeStatHolder( - gundamData: List, -) { - var uiState by mutableStateOf(GundamdexHomeUiState()) - - init { - uiState = uiState.copy( - gundamInfoList = gundamData.map { - GundamdexHomeUiModel( - id = it.id, - modelNumber = it.modelNumber, - name = it.name, - series = it.series, - imageUrl = it.imageUrl, - ) - }, - ) - } -} diff --git a/app/src/main/java/com/example/gundamdexapp/feature/home/GundamdexHomeViewModel.kt b/app/src/main/java/com/example/gundamdexapp/feature/home/GundamdexHomeViewModel.kt new file mode 100644 index 0000000..50d94f5 --- /dev/null +++ b/app/src/main/java/com/example/gundamdexapp/feature/home/GundamdexHomeViewModel.kt @@ -0,0 +1,55 @@ +package com.example.gundamdexapp.feature.home + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory.Companion.APPLICATION_KEY +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory +import com.example.gundamdexapp.GundamApplication +import com.example.gundamdexapp.domain.repository.GundamRepository +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.update +import kotlinx.coroutines.launch + +class GundamdexHomeViewModel( + private val gundamRepository: GundamRepository, +) : ViewModel() { + private val _uiState = MutableStateFlow(GundamdexHomeUiState()) + val uiState: StateFlow = _uiState.asStateFlow() + + init { + getGundamList() + } + + fun getGundamList() { + viewModelScope.launch { + _uiState.update { + it.copy( + gundamInfoList = gundamRepository.getGundamList() + .getOrThrow().map { gundamInfo -> + GundamdexHomeUiModel( + id = gundamInfo.id, + modelNumber = gundamInfo.modelNumber, + name = gundamInfo.name, + series = gundamInfo.series, + imageUrl = gundamInfo.imageUrl, + ) + }, + ) + } + } + } + + companion object { + val Factory = viewModelFactory { + initializer { + val application = this[APPLICATION_KEY] as GundamApplication + val repository = application.appContainer.gundamRepository + + GundamdexHomeViewModel(gundamRepository = repository) + } + } + } +} diff --git a/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt b/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt index 8ab25d4..7650d13 100644 --- a/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt +++ b/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt @@ -2,6 +2,8 @@ package com.example.gundamdexapp.feature.navigation import androidx.compose.animation.SharedTransitionLayout import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable @@ -11,10 +13,12 @@ import com.example.gundamdexapp.data.mock.GundamMockData import com.example.gundamdexapp.feature.detail.GundamdexDetail import com.example.gundamdexapp.feature.detail.GundamdexDetailStateHolder import com.example.gundamdexapp.feature.home.GundamdexHome -import com.example.gundamdexapp.feature.home.GundamdexHomeStatHolder +import com.example.gundamdexapp.feature.home.GundamdexHomeViewModel @Composable -fun GundamdexNavigation() { +fun GundamdexNavigation( + gundamdexHomeViewModel: GundamdexHomeViewModel, +) { val navController = rememberNavController() val gundamData = GundamMockData.mockGundams @@ -24,8 +28,7 @@ fun GundamdexNavigation() { startDestination = HomeRoute, ) { composable { - val gundamdexHomeStateHolder = remember { GundamdexHomeStatHolder(gundamData = gundamData) } - val uiState = gundamdexHomeStateHolder.uiState + val uiState by gundamdexHomeViewModel.uiState.collectAsState() GundamdexHome( gundamdexHomeUiState = uiState, From 3f694bc330ee9fc0b594a377eb9d824d60136ff4 Mon Sep 17 00:00:00 2001 From: NoeyhOj <118670117+NoeyhOj@users.noreply.github.com> Date: Thu, 25 Jun 2026 17:19:33 +0900 Subject: [PATCH 7/9] =?UTF-8?q?feat:=20=EA=B1=B4=EB=8B=B4=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20ViewModel=20=EA=B5=AC=ED=98=84=20=EB=B0=8F?= =?UTF-8?q?=20API=20=EC=97=B0=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/network/api/GundamApi.kt | 10 +- .../repositoryImpl/GundamRepositoryImpl.kt | 17 ++++ .../domain/repository/GundamRepository.kt | 1 + .../detail/GundamdexDetailStateHolder.kt | 62 ------------ .../detail/GundamdexDetailViewModel.kt | 96 +++++++++++++++++++ .../feature/navigation/GundamdexNavigation.kt | 15 ++- 6 files changed, 130 insertions(+), 71 deletions(-) delete mode 100644 app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailStateHolder.kt create mode 100644 app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt diff --git a/app/src/main/java/com/example/gundamdexapp/data/network/api/GundamApi.kt b/app/src/main/java/com/example/gundamdexapp/data/network/api/GundamApi.kt index 21db6b4..62acdd0 100644 --- a/app/src/main/java/com/example/gundamdexapp/data/network/api/GundamApi.kt +++ b/app/src/main/java/com/example/gundamdexapp/data/network/api/GundamApi.kt @@ -12,6 +12,14 @@ interface GundamApi { suspend fun getGundams( @Header("apikey") apikey: String = BuildConfig.SUPABASE_ANON_KEY, @Header("Authorization") auth: String = "Bearer ${BuildConfig.SUPABASE_ANON_KEY}", - @Query("select") selectQuery: String = "*, armaments(*)" + @Query("select") selectQuery: String = "*, armaments(*)", + ): Response> + + @GET("rest/v1/gundams") + suspend fun getGundamDetail( + @Header("apikey") apikey: String = BuildConfig.SUPABASE_ANON_KEY, + @Header("Authorization") auth: String = "Bearer ${BuildConfig.SUPABASE_ANON_KEY}", + @Query("id") idFilter: String, + @Query("select") selectQuery: String = "*, armaments(*)", ): Response> } diff --git a/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt b/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt index 0aab797..8ef9621 100644 --- a/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt +++ b/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt @@ -1,5 +1,6 @@ package com.example.gundamdexapp.data.network.repositoryImpl +import android.util.Log import com.example.gundamdexapp.data.network.api.GundamApi import com.example.gundamdexapp.domain.model.GundamInfo import com.example.gundamdexapp.domain.repository.GundamRepository @@ -21,4 +22,20 @@ class GundamRepositoryImpl( } catch (e: Exception) { Result.failure(e) } + + override suspend fun getGundamDetail(id: String): Result> = try { + val response = api.getGundamDetail(idFilter = "eq.$id") + + if (response.isSuccessful) { + val gundamDto = response.body() ?: emptyList() + + val domainList = gundamDto.map { it.toDomain() } + Result.success(domainList) + } else { + Result.failure(Exception("서버 통신 실패 : ${response.code()}")) + } + + } catch (e: Exception) { + Result.failure(e) + } } diff --git a/app/src/main/java/com/example/gundamdexapp/domain/repository/GundamRepository.kt b/app/src/main/java/com/example/gundamdexapp/domain/repository/GundamRepository.kt index f20470c..23dc82d 100644 --- a/app/src/main/java/com/example/gundamdexapp/domain/repository/GundamRepository.kt +++ b/app/src/main/java/com/example/gundamdexapp/domain/repository/GundamRepository.kt @@ -4,4 +4,5 @@ import com.example.gundamdexapp.domain.model.GundamInfo interface GundamRepository { suspend fun getGundamList(): Result> + suspend fun getGundamDetail(id: String): Result> } diff --git a/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailStateHolder.kt b/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailStateHolder.kt deleted file mode 100644 index 4943dfa..0000000 --- a/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailStateHolder.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.example.gundamdexapp.feature.detail - -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.setValue -import com.example.gundamdexapp.domain.model.GundamInfo -import com.example.gundamdexapp.feature.detail.uimodel.ArmamentUiModel -import com.example.gundamdexapp.feature.detail.uimodel.DimensionsUiModel -import com.example.gundamdexapp.feature.detail.uimodel.GundamdexDetailUiModel -import com.example.gundamdexapp.feature.detail.uimodel.IndicatorColor -import com.example.gundamdexapp.feature.detail.uimodel.TechnicalSpecificationsUiModel - -class GundamdexDetailStateHolder( - id: String, - gundamData: List, -) { - var uiState by mutableStateOf(GundamdexDetailUiState()) - - init { - uiState = ( - gundamData.firstOrNull { it.id == id }?.let { - uiState.copy( - id = id, - gundamdexDetailUiModel = GundamdexDetailUiModel( - modelNumber = it.modelNumber, - name = it.name, - series = it.series, - imageUrl = it.imageUrl, - era = it.era, - faction = it.faction, - pilot = it.pilot, - description = it.description, - dimensions = it.dimensions.let { data -> - DimensionsUiModel( - height = data.height, - weight = data.weight, - ) - }, - technicalSpecifications = it.technicalSpecifications.let { data -> - TechnicalSpecificationsUiModel( - generatorOutput = data.generatorOutput, - armorMaterial = data.armorMaterial, - totalTrust = data.totalTrust, - sensorRadius = data.sensorRadius, - crew = data.crew, - ) - }, - armaments = it.armaments.let { data -> - data.value.map { - ArmamentUiModel( - name = it.name, - details = it.details, - indicatorColor = IndicatorColor.dataToIndicatorColor(it.indicatorColor), - ) - } - }, - ), - ) - } ?: throw IllegalArgumentException("해당 카드의 id는 존재하지 않습니다.") - ) - } -} diff --git a/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt b/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt new file mode 100644 index 0000000..65d0eac --- /dev/null +++ b/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt @@ -0,0 +1,96 @@ +package com.example.gundamdexapp.feature.detail + +import android.util.Log +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory.Companion.APPLICATION_KEY +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.CreationExtras +import com.example.gundamdexapp.GundamApplication +import com.example.gundamdexapp.domain.model.GundamInfo +import com.example.gundamdexapp.domain.repository.GundamRepository +import com.example.gundamdexapp.feature.detail.uimodel.ArmamentUiModel +import com.example.gundamdexapp.feature.detail.uimodel.DimensionsUiModel +import com.example.gundamdexapp.feature.detail.uimodel.GundamdexDetailUiModel +import com.example.gundamdexapp.feature.detail.uimodel.IndicatorColor +import com.example.gundamdexapp.feature.detail.uimodel.TechnicalSpecificationsUiModel +import kotlin.time.Duration.Companion.milliseconds +import kotlinx.coroutines.delay +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.update +import kotlinx.coroutines.launch + +class GundamdexDetailViewModel( + private val id: String, + private val repository: GundamRepository, +) : ViewModel() { + private val _uiState = MutableStateFlow(GundamdexDetailUiState()) + val uiState: StateFlow = _uiState.asStateFlow() + + init { + viewModelScope.launch { + val gundamInfo = getGundamDetail(id) + setUiState(gundamInfo) + } + } + + suspend fun getGundamDetail(id: String): GundamInfo? { + return repository.getGundamDetail(id).getOrNull()?.firstOrNull() + } + + suspend fun setUiState(gundamInfo: GundamInfo?) { + gundamInfo?.let { gundamInfo -> + _uiState.update { + it.copy( + id = id, + gundamdexDetailUiModel = GundamdexDetailUiModel( + modelNumber = gundamInfo.modelNumber, + name = gundamInfo.name, + series = gundamInfo.series, + imageUrl = gundamInfo.imageUrl, + era = gundamInfo.era, + faction = gundamInfo.faction, + pilot = gundamInfo.pilot, + description = gundamInfo.description, + dimensions = gundamInfo.dimensions.let { data -> + DimensionsUiModel( + height = data.height, + weight = data.weight, + ) + }, + technicalSpecifications = gundamInfo.technicalSpecifications.let { data -> + TechnicalSpecificationsUiModel( + generatorOutput = data.generatorOutput, + armorMaterial = data.armorMaterial, + totalTrust = data.totalTrust, + sensorRadius = data.sensorRadius, + crew = data.crew, + ) + }, + armaments = gundamInfo.armaments.let { data -> + data.value.map { value -> + ArmamentUiModel( + name = value.name, + details = value.details, + indicatorColor = IndicatorColor.dataToIndicatorColor(value.indicatorColor), + ) + } + }, + ), + ) + } + } ?: throw IllegalArgumentException("해당 id를 가진 건담에 대한 정보가 존재하지 않습니다.") + } + + class Factory(private val id: String) : ViewModelProvider.Factory { + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class, extras: CreationExtras): T { + val application = checkNotNull(extras[APPLICATION_KEY]) as GundamApplication + val repository = application.appContainer.gundamRepository + + return GundamdexDetailViewModel(id = id, repository = repository) as T + } + } +} diff --git a/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt b/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt index 7650d13..78fddb6 100644 --- a/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt +++ b/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt @@ -5,13 +5,14 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember +import androidx.lifecycle.viewmodel.compose.viewModel import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController import androidx.navigation.toRoute import com.example.gundamdexapp.data.mock.GundamMockData import com.example.gundamdexapp.feature.detail.GundamdexDetail -import com.example.gundamdexapp.feature.detail.GundamdexDetailStateHolder +import com.example.gundamdexapp.feature.detail.GundamdexDetailViewModel import com.example.gundamdexapp.feature.home.GundamdexHome import com.example.gundamdexapp.feature.home.GundamdexHomeViewModel @@ -20,7 +21,6 @@ fun GundamdexNavigation( gundamdexHomeViewModel: GundamdexHomeViewModel, ) { val navController = rememberNavController() - val gundamData = GundamMockData.mockGundams SharedTransitionLayout { NavHost( @@ -44,13 +44,12 @@ fun GundamdexNavigation( val routeData = backStackEntity.toRoute() val id = routeData.id - val gundamdexDetailStateHolder = remember { - GundamdexDetailStateHolder( + val viewModel: GundamdexDetailViewModel = viewModel( + factory = GundamdexDetailViewModel.Factory( id = id, - gundamData = gundamData, - ) - } - val uiState = remember { gundamdexDetailStateHolder.uiState } + ), + ) + val uiState by viewModel.uiState.collectAsState() GundamdexDetail( gundamdexDetailUiState = uiState, From 43b9c15e019c40853e0681919ca4abe4d42dae1c Mon Sep 17 00:00:00 2001 From: NoeyhOj <118670117+NoeyhOj@users.noreply.github.com> Date: Thu, 25 Jun 2026 17:20:37 +0900 Subject: [PATCH 8/9] =?UTF-8?q?chore:=20ktlint=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=ED=8F=AC=EB=A7=B7=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/gundamdexapp/data/network/dto/ArmamentDto.kt | 4 ++-- .../data/network/repositoryImpl/GundamRepositoryImpl.kt | 2 -- .../feature/detail/GundamdexDetailViewModel.kt | 7 +------ .../feature/detail/mapper/IndicatorColorMapper.kt | 4 ++-- .../gundamdexapp/feature/detail/uimodel/IndicatorColor.kt | 4 ++-- .../gundamdexapp/feature/navigation/GundamdexNavigation.kt | 2 -- .../gundamdexapp/feature/utils/SharedTransitionKey.kt | 5 +++-- 7 files changed, 10 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/example/gundamdexapp/data/network/dto/ArmamentDto.kt b/app/src/main/java/com/example/gundamdexapp/data/network/dto/ArmamentDto.kt index 6fc2eb1..75e2e3c 100644 --- a/app/src/main/java/com/example/gundamdexapp/data/network/dto/ArmamentDto.kt +++ b/app/src/main/java/com/example/gundamdexapp/data/network/dto/ArmamentDto.kt @@ -11,11 +11,11 @@ data class ArmamentDto( val name: String, val details: String? = null, @SerialName("indicator_color") - val indicatorColor: String + val indicatorColor: String, ) { fun toDomain(): Armament = Armament( name = this.name, details = this.details ?: "", - indicatorColor = this.indicatorColor + indicatorColor = this.indicatorColor, ) } diff --git a/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt b/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt index 8ef9621..db0e60f 100644 --- a/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt +++ b/app/src/main/java/com/example/gundamdexapp/data/network/repositoryImpl/GundamRepositoryImpl.kt @@ -1,6 +1,5 @@ package com.example.gundamdexapp.data.network.repositoryImpl -import android.util.Log import com.example.gundamdexapp.data.network.api.GundamApi import com.example.gundamdexapp.domain.model.GundamInfo import com.example.gundamdexapp.domain.repository.GundamRepository @@ -34,7 +33,6 @@ class GundamRepositoryImpl( } else { Result.failure(Exception("서버 통신 실패 : ${response.code()}")) } - } catch (e: Exception) { Result.failure(e) } diff --git a/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt b/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt index 65d0eac..7329564 100644 --- a/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt +++ b/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt @@ -1,6 +1,5 @@ package com.example.gundamdexapp.feature.detail -import android.util.Log import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory.Companion.APPLICATION_KEY @@ -14,8 +13,6 @@ import com.example.gundamdexapp.feature.detail.uimodel.DimensionsUiModel import com.example.gundamdexapp.feature.detail.uimodel.GundamdexDetailUiModel import com.example.gundamdexapp.feature.detail.uimodel.IndicatorColor import com.example.gundamdexapp.feature.detail.uimodel.TechnicalSpecificationsUiModel -import kotlin.time.Duration.Companion.milliseconds -import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow @@ -36,9 +33,7 @@ class GundamdexDetailViewModel( } } - suspend fun getGundamDetail(id: String): GundamInfo? { - return repository.getGundamDetail(id).getOrNull()?.firstOrNull() - } + suspend fun getGundamDetail(id: String): GundamInfo? = repository.getGundamDetail(id).getOrNull()?.firstOrNull() suspend fun setUiState(gundamInfo: GundamInfo?) { gundamInfo?.let { gundamInfo -> diff --git a/app/src/main/java/com/example/gundamdexapp/feature/detail/mapper/IndicatorColorMapper.kt b/app/src/main/java/com/example/gundamdexapp/feature/detail/mapper/IndicatorColorMapper.kt index 3680bc3..6ae7c1e 100644 --- a/app/src/main/java/com/example/gundamdexapp/feature/detail/mapper/IndicatorColorMapper.kt +++ b/app/src/main/java/com/example/gundamdexapp/feature/detail/mapper/IndicatorColorMapper.kt @@ -3,11 +3,11 @@ package com.example.gundamdexapp.feature.detail.mapper import androidx.compose.ui.graphics.Color import com.example.gundamdexapp.feature.detail.uimodel.IndicatorColor import com.example.gundamdexapp.feature.detail.uimodel.IndicatorColor.BLUE -import com.example.gundamdexapp.feature.detail.uimodel.IndicatorColor.GRAY +import com.example.gundamdexapp.feature.detail.uimodel.IndicatorColor.GREY import com.example.gundamdexapp.feature.detail.uimodel.IndicatorColor.RED fun IndicatorColor.toColor(): Color = when (this) { RED -> Color.Red BLUE -> Color.Blue - GRAY -> Color.Gray + GREY -> Color.Gray } diff --git a/app/src/main/java/com/example/gundamdexapp/feature/detail/uimodel/IndicatorColor.kt b/app/src/main/java/com/example/gundamdexapp/feature/detail/uimodel/IndicatorColor.kt index c9e8748..f691990 100644 --- a/app/src/main/java/com/example/gundamdexapp/feature/detail/uimodel/IndicatorColor.kt +++ b/app/src/main/java/com/example/gundamdexapp/feature/detail/uimodel/IndicatorColor.kt @@ -3,14 +3,14 @@ package com.example.gundamdexapp.feature.detail.uimodel enum class IndicatorColor { RED, BLUE, - GRAY, + GREY, ; companion object { fun dataToIndicatorColor(value: String): IndicatorColor = when (value) { "red" -> RED "blue" -> BLUE - "gray" -> GRAY + "grey" -> GREY else -> throw IllegalArgumentException("잘못된 indicator color 입력 값을 전달받았습니다.") } } diff --git a/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt b/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt index 78fddb6..4d4b810 100644 --- a/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt +++ b/app/src/main/java/com/example/gundamdexapp/feature/navigation/GundamdexNavigation.kt @@ -4,13 +4,11 @@ import androidx.compose.animation.SharedTransitionLayout import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue -import androidx.compose.runtime.remember import androidx.lifecycle.viewmodel.compose.viewModel import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController import androidx.navigation.toRoute -import com.example.gundamdexapp.data.mock.GundamMockData import com.example.gundamdexapp.feature.detail.GundamdexDetail import com.example.gundamdexapp.feature.detail.GundamdexDetailViewModel import com.example.gundamdexapp.feature.home.GundamdexHome diff --git a/app/src/main/java/com/example/gundamdexapp/feature/utils/SharedTransitionKey.kt b/app/src/main/java/com/example/gundamdexapp/feature/utils/SharedTransitionKey.kt index 3e8a1ae..4163467 100644 --- a/app/src/main/java/com/example/gundamdexapp/feature/utils/SharedTransitionKey.kt +++ b/app/src/main/java/com/example/gundamdexapp/feature/utils/SharedTransitionKey.kt @@ -2,9 +2,10 @@ package com.example.gundamdexapp.feature.utils data class SharedTransitionKey( val id: String, - val type: SharedType + val type: SharedType, ) enum class SharedType { - COMPOSABLE, IMAGE + COMPOSABLE, + IMAGE, } From 888defba48979e47d44fa9a038838be47eec71fe Mon Sep 17 00:00:00 2001 From: NoeyhOj <118670117+NoeyhOj@users.noreply.github.com> Date: Thu, 25 Jun 2026 17:22:22 +0900 Subject: [PATCH 9/9] =?UTF-8?q?refactor:=20GundamdexDetailViewModel?= =?UTF-8?q?=EC=9D=98=20setUiState=20=ED=95=A8=EC=88=98=EC=97=90=EC=84=9C?= =?UTF-8?q?=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20suspend=20=ED=82=A4?= =?UTF-8?q?=EC=9B=8C=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gundamdexapp/feature/detail/GundamdexDetailViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt b/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt index 7329564..321989e 100644 --- a/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt +++ b/app/src/main/java/com/example/gundamdexapp/feature/detail/GundamdexDetailViewModel.kt @@ -35,7 +35,7 @@ class GundamdexDetailViewModel( suspend fun getGundamDetail(id: String): GundamInfo? = repository.getGundamDetail(id).getOrNull()?.firstOrNull() - suspend fun setUiState(gundamInfo: GundamInfo?) { + fun setUiState(gundamInfo: GundamInfo?) { gundamInfo?.let { gundamInfo -> _uiState.update { it.copy(