From 1aa48801114d02e547fb1007baf64d0ccdb29b0b Mon Sep 17 00:00:00 2001 From: s9hn Date: Wed, 25 Sep 2024 16:23:52 +0900 Subject: [PATCH 01/66] =?UTF-8?q?feat:=20TodayFortuneBox=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 --- .../component/FortuneDetailBox.kt | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/FortuneDetailBox.kt diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/FortuneDetailBox.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/FortuneDetailBox.kt new file mode 100644 index 000000000..70cb3e548 --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/FortuneDetailBox.kt @@ -0,0 +1,43 @@ +package org.sopt.official.feature.fortune.feature.fortundDetail.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.sopt.official.designsystem.Gray700 + +@Composable +internal fun TodayFortuneBox( + content: @Composable () -> Unit, + modifier: Modifier = Modifier, +) { + Box( + contentAlignment = Alignment.Center, + modifier = modifier + .fillMaxWidth() + .padding(horizontal = 20.dp) + .background( + color = Gray700, + shape = RoundedCornerShape(12.dp), + ), + ) { + content() + } +} + +@Preview(showBackground = true) +@Composable +private fun TodayFortuneBoxPreview() { + TodayFortuneBox( + content = { Text("123") }, + modifier = Modifier.background(color = Color.White), + ) +} From 427fcc11481660cfefb06b78b0e6ff933858e05c Mon Sep 17 00:00:00 2001 From: s9hn Date: Wed, 25 Sep 2024 16:24:15 +0900 Subject: [PATCH 02/66] =?UTF-8?q?feat:=20=EC=98=A4=EB=8A=98=EC=9D=98=20?= =?UTF-8?q?=EC=9A=B4=EC=84=B8(TodayFortuneDashboard)=20UI=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 --- .../component/TodayFortuneDashboard.kt | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/TodayFortuneDashboard.kt diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/TodayFortuneDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/TodayFortuneDashboard.kt new file mode 100644 index 000000000..cc494707c --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/TodayFortuneDashboard.kt @@ -0,0 +1,83 @@ +/* + * MIT License + * Copyright 2024 SOPT - Shout Our Passion Together + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package org.sopt.official.feature.fortune.feature.fortundDetail.component + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.height +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.sopt.official.designsystem.Gray100 +import org.sopt.official.designsystem.Gray30 +import org.sopt.official.designsystem.SoptTheme +import org.sopt.official.feature.fortune.R + +@Composable +fun TodayFortuneDashboard( + date: String, + modifier: Modifier = Modifier, +) { + TodayFortuneBox( + content = { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = modifier, + ) { + Spacer(modifier = Modifier.height(height = 32.dp)) + Image( + painter = painterResource(R.drawable.img_fortune_title), + contentDescription = "오늘의 솝마디", + ) + Spacer(modifier = Modifier.height(height = 10.dp)) + Text( + text = date, + style = SoptTheme.typography.title18SB, + color = Gray100, + ) + Spacer(modifier = Modifier.height(height = 20.dp)) + Text( + text = date, + style = SoptTheme.typography.title24SB, + color = Gray30, + ) + Spacer(modifier = Modifier.height(height = 36.dp)) + } + } + ) +} + +@Preview(showBackground = true) +@Composable +private fun TodayFortuneDashboardPreview() { + SoptTheme { + TodayFortuneDashboard(date = "123") + } +} From 1a75a66bd742fa34cded156e2bfb0c32f790506a Mon Sep 17 00:00:00 2001 From: s9hn Date: Wed, 25 Sep 2024 16:24:41 +0900 Subject: [PATCH 03/66] =?UTF-8?q?feat:=20FortuneDetailRoute,=20FortuneDeta?= =?UTF-8?q?ilScreen=20=ED=8C=8C=EC=9D=BC=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortundDetail/FortuneDetailRoute.kt | 17 +++++++ .../fortundDetail/FortuneDetailScreen.kt | 45 +++++-------------- 2 files changed, 27 insertions(+), 35 deletions(-) create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailRoute.kt diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailRoute.kt new file mode 100644 index 000000000..b5f3470be --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailRoute.kt @@ -0,0 +1,17 @@ +package org.sopt.official.feature.fortune.feature.fortundDetail + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.runtime.Composable + +@Composable +internal fun FortuneDetailRoute( + paddingValue: PaddingValues, + date: String, + navigateToFortuneAmulet: () -> Unit, +) { + FortuneDetailScreen( + paddingValue = paddingValue, + date = date, + navigateToFortuneAmulet = navigateToFortuneAmulet + ) +} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailScreen.kt index a66f60442..e6eedd04c 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailScreen.kt @@ -30,65 +30,40 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Button -import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.SoptTheme +import org.sopt.official.feature.fortune.feature.fortundDetail.component.TodayFortuneDashboard @Composable -fun FortuneDetailRoute( - paddingValue: PaddingValues, - date: String, - navigateToFortuneAmulet: () -> Unit, -) { - FortuneDetailScreen( - paddingValue = paddingValue, - date = date, - navigateToFortuneAmulet = navigateToFortuneAmulet - ) -} - -@Composable -fun FortuneDetailScreen( +internal fun FortuneDetailScreen( paddingValue: PaddingValues, date: String, navigateToFortuneAmulet: () -> Unit, + modifier: Modifier = Modifier, ) { Column( - modifier = Modifier - .padding(paddingValue) + horizontalAlignment = Alignment.CenterHorizontally, + modifier = modifier + .padding(paddingValues = paddingValue) .fillMaxSize(), - horizontalAlignment = Alignment.CenterHorizontally ) { - Text( - text = "Fortune Detail Screen: $date", - color = SoptTheme.colors.onBackground - ) - - Spacer(modifier = Modifier.weight(1f)) - - Button( - onClick = navigateToFortuneAmulet - ) { - Text(text = "Go to Fortune Amulet") - } - Spacer(modifier = Modifier.height(50.dp)) + Spacer(modifier = Modifier.height(height = 16.dp)) + TodayFortuneDashboard(date) } } - @Preview @Composable -fun FortuneDetailScreenPreview() { +private fun FortuneDetailScreenPreview() { SoptTheme { FortuneDetailScreen( paddingValue = PaddingValues(16.dp), date = "2024-09-09", - navigateToFortuneAmulet = {} + navigateToFortuneAmulet = {}, ) } } From e265c4e0ed5cf3d9336fcabefbb4cc593c22c157 Mon Sep 17 00:00:00 2001 From: s9hn Date: Wed, 25 Sep 2024 16:31:40 +0900 Subject: [PATCH 04/66] =?UTF-8?q?refactor:=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/official/feature/fortune/FoundationScreen.kt | 4 ++-- .../FortuneDetailRoute.kt | 2 +- .../FortuneDetailScreen.kt | 10 +++++----- .../component/FortuneDetailBox.kt | 2 +- .../component/TodayFortuneDashboard.kt | 2 +- .../navigation/FortuneDetailNavGraph.kt | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) rename feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/{fortundDetail => fortuneDetail}/FortuneDetailRoute.kt (85%) rename feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/{fortundDetail => fortuneDetail}/FortuneDetailScreen.kt (89%) rename feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/{fortundDetail => fortuneDetail}/component/FortuneDetailBox.kt (95%) rename feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/{fortundDetail => fortuneDetail}/component/TodayFortuneDashboard.kt (97%) rename feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/{fortundDetail => fortuneDetail}/navigation/FortuneDetailNavGraph.kt (93%) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt index 9164495c1..cb155d8f6 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt @@ -37,8 +37,8 @@ import androidx.navigation.compose.NavHost import androidx.navigation.compose.rememberNavController import org.sopt.official.designsystem.SoptTheme import org.sopt.official.feature.fortune.component.FortuneTopBar -import org.sopt.official.feature.fortune.feature.fortundDetail.navigation.FortuneDetail -import org.sopt.official.feature.fortune.feature.fortundDetail.navigation.fortuneDetailNavGraph +import org.sopt.official.feature.fortune.feature.fortuneDetail.navigation.FortuneDetail +import org.sopt.official.feature.fortune.feature.fortuneDetail.navigation.fortuneDetailNavGraph import org.sopt.official.feature.fortune.feature.fortuneAmulet.navigation.FortuneAmulet import org.sopt.official.feature.fortune.feature.fortuneAmulet.navigation.fortuneAmuletNavGraph import org.sopt.official.feature.fortune.feature.home.navigation.Home diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt similarity index 85% rename from feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailRoute.kt rename to feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index b5f3470be..e18304de8 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -1,4 +1,4 @@ -package org.sopt.official.feature.fortune.feature.fortundDetail +package org.sopt.official.feature.fortune.feature.fortuneDetail import androidx.compose.foundation.layout.PaddingValues import androidx.compose.runtime.Composable diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt similarity index 89% rename from feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailScreen.kt rename to feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index e6eedd04c..a6b2f86f6 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -22,7 +22,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package org.sopt.official.feature.fortune.feature.fortundDetail +package org.sopt.official.feature.fortune.feature.fortuneDetail import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues @@ -36,7 +36,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.feature.fortune.feature.fortundDetail.component.TodayFortuneDashboard +import org.sopt.official.feature.fortune.feature.fortuneDetail.component.TodayFortuneDashboard @Composable internal fun FortuneDetailScreen( @@ -48,8 +48,8 @@ internal fun FortuneDetailScreen( Column( horizontalAlignment = Alignment.CenterHorizontally, modifier = modifier - .padding(paddingValues = paddingValue) - .fillMaxSize(), + .fillMaxSize() + .padding(paddingValues = paddingValue), ) { Spacer(modifier = Modifier.height(height = 16.dp)) TodayFortuneDashboard(date) @@ -61,7 +61,7 @@ internal fun FortuneDetailScreen( private fun FortuneDetailScreenPreview() { SoptTheme { FortuneDetailScreen( - paddingValue = PaddingValues(16.dp), + paddingValue = PaddingValues(vertical = 16.dp), date = "2024-09-09", navigateToFortuneAmulet = {}, ) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/FortuneDetailBox.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt similarity index 95% rename from feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/FortuneDetailBox.kt rename to feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt index 70cb3e548..d250065d5 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/FortuneDetailBox.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt @@ -1,4 +1,4 @@ -package org.sopt.official.feature.fortune.feature.fortundDetail.component +package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/TodayFortuneDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt similarity index 97% rename from feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/TodayFortuneDashboard.kt rename to feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt index cc494707c..7f1512b10 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/component/TodayFortuneDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt @@ -22,7 +22,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package org.sopt.official.feature.fortune.feature.fortundDetail.component +package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Column diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/navigation/FortuneDetailNavGraph.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt similarity index 93% rename from feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/navigation/FortuneDetailNavGraph.kt rename to feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt index 731995b46..c1be1f0b2 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortundDetail/navigation/FortuneDetailNavGraph.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt @@ -22,14 +22,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package org.sopt.official.feature.fortune.feature.fortundDetail.navigation +package org.sopt.official.feature.fortune.feature.fortuneDetail.navigation import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.toRoute import kotlinx.serialization.Serializable -import org.sopt.official.feature.fortune.feature.fortundDetail.FortuneDetailRoute +import org.sopt.official.feature.fortune.feature.fortuneDetail.FortuneDetailRoute @Serializable data class FortuneDetail(val date: String) From 3b483acb1ffc47584881abf48a2282b21d1794d0 Mon Sep 17 00:00:00 2001 From: s9hn Date: Wed, 25 Sep 2024 17:45:51 +0900 Subject: [PATCH 05/66] =?UTF-8?q?feat:=20fortune=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=EB=A0=88=EC=9D=B4=EC=96=B4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - di 모듈 추가 - network api 구현 --- data/fortune/.gitignore | 1 + data/fortune/build.gradle.kts | 39 +++++++++++++++++++ data/fortune/consumer-rules.pro | 0 data/fortune/src/main/AndroidManifest.xml | 4 ++ .../official/data/fortune/di/ApiModule.kt | 20 ++++++++++ .../data/fortune/di/RepositoryModule.kt | 18 +++++++++ .../data/fortune/remote/api/FortuneApi.kt | 17 ++++++++ .../response/TodayFortuneCardResponse.kt | 16 ++++++++ .../response/TodayFortuneWordResponse.kt | 12 ++++++ .../repository/DefaultFortuneRepository.kt | 17 ++++++++ settings.gradle.kts | 2 + 11 files changed, 146 insertions(+) create mode 100644 data/fortune/.gitignore create mode 100644 data/fortune/build.gradle.kts create mode 100644 data/fortune/consumer-rules.pro create mode 100644 data/fortune/src/main/AndroidManifest.xml create mode 100644 data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt create mode 100644 data/fortune/src/main/java/org/sopt/official/data/fortune/di/RepositoryModule.kt create mode 100644 data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt create mode 100644 data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneCardResponse.kt create mode 100644 data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneWordResponse.kt create mode 100644 data/fortune/src/main/java/org/sopt/official/data/fortune/repository/DefaultFortuneRepository.kt diff --git a/data/fortune/.gitignore b/data/fortune/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/data/fortune/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/data/fortune/build.gradle.kts b/data/fortune/build.gradle.kts new file mode 100644 index 000000000..99ec89b36 --- /dev/null +++ b/data/fortune/build.gradle.kts @@ -0,0 +1,39 @@ +/* + * MIT License + * Copyright 2023-2024 SOPT - Shout Our Passion Together + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +plugins { + sopt("feature") +} + +android { + namespace = "org.sopt.official.data.fortune" +} + +dependencies { + implementation(projects.core.network) + implementation(projects.core.common) + implementation(platform(libs.okhttp.bom)) + implementation(libs.bundles.okhttp) +} diff --git a/data/fortune/consumer-rules.pro b/data/fortune/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/data/fortune/src/main/AndroidManifest.xml b/data/fortune/src/main/AndroidManifest.xml new file mode 100644 index 000000000..8bdb7e14b --- /dev/null +++ b/data/fortune/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt new file mode 100644 index 000000000..a630f13b5 --- /dev/null +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt @@ -0,0 +1,20 @@ +package org.sopt.official.data.fortune.di + +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import org.sopt.official.common.di.AppRetrofit +import org.sopt.official.data.fortune.remote.api.FortuneApi +import retrofit2.Retrofit +import retrofit2.create +import javax.inject.Singleton + +@Module +@InstallIn(SingletonComponent::class) +object ApiModule { + + @Provides + @Singleton + fun provideNovelApi(@AppRetrofit retrofit: Retrofit): FortuneApi = retrofit.create() +} diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/RepositoryModule.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/RepositoryModule.kt new file mode 100644 index 000000000..99aa71255 --- /dev/null +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/RepositoryModule.kt @@ -0,0 +1,18 @@ +package org.sopt.official.data.fortune.di + +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import org.sopt.official.data.fortune.remote.api.FortuneApi +import org.sopt.official.data.fortune.repository.DefaultFortuneRepository +import javax.inject.Singleton + +@Module +@InstallIn(SingletonComponent::class) +object RepositoryModule { + + @Provides + @Singleton + fun provideDefaultFortuneRepository(fortuneApi: FortuneApi): DefaultFortuneRepository = DefaultFortuneRepository(fortuneApi) +} diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt new file mode 100644 index 000000000..3b4d0bb8f --- /dev/null +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt @@ -0,0 +1,17 @@ +package org.sopt.official.data.fortune.remote.api + +import org.sopt.official.data.fortune.remote.response.TodayFortuneCardResponse +import org.sopt.official.data.fortune.remote.response.TodayFortuneWordResponse +import retrofit2.http.GET +import retrofit2.http.Query + +interface FortuneApi { + + @GET("/api/v2/fortune/word") + suspend fun getTodayFortuneWord( + @Query("todayDate") todayDate: String, + ): TodayFortuneWordResponse + + @GET("/api/v2/fortune/card/today") + suspend fun getTodayFortuneCard(): TodayFortuneCardResponse +} diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneCardResponse.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneCardResponse.kt new file mode 100644 index 000000000..be91b4b7d --- /dev/null +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneCardResponse.kt @@ -0,0 +1,16 @@ +package org.sopt.official.data.fortune.remote.response + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class TodayFortuneCardResponse( + @SerialName("description") + val description: String, + @SerialName("imageColorCode") + val imageColorCode: String, + @SerialName("imageUrl") + val imageUrl: String, + @SerialName("name") + val name: String, +) diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneWordResponse.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneWordResponse.kt new file mode 100644 index 000000000..361442675 --- /dev/null +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneWordResponse.kt @@ -0,0 +1,12 @@ +package org.sopt.official.data.fortune.remote.response + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class TodayFortuneWordResponse( + @SerialName("userName") + val userName: String, + @SerialName("title") + val title: String, +) diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/repository/DefaultFortuneRepository.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/repository/DefaultFortuneRepository.kt new file mode 100644 index 000000000..5417f0e7e --- /dev/null +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/repository/DefaultFortuneRepository.kt @@ -0,0 +1,17 @@ +package org.sopt.official.data.fortune.repository + +import org.sopt.official.data.fortune.remote.api.FortuneApi +import javax.inject.Inject + +class DefaultFortuneRepository @Inject constructor( + private val fortuneApi: FortuneApi, +) { + + suspend fun fetchTodayFortuneWord() { + fortuneApi + } + + suspend fun fetchTodayFortuneCard() { + fortuneApi + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 81a7a14e0..d9b6f8edc 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -41,3 +41,5 @@ include( ":feature:poke", ":feature:fortune" ) +include(":domain:fortune") +include(":data:fortune") From 4241e3f8b957aaaf6cc40f2d898b3fb168036958 Mon Sep 17 00:00:00 2001 From: s9hn Date: Wed, 25 Sep 2024 18:07:44 +0900 Subject: [PATCH 06/66] =?UTF-8?q?feat:=20fortune=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=EB=A0=88=EC=9D=B4=EC=96=B4=20=EA=B5=AC=ED=98=84,=20in?= =?UTF-8?q?ternal=20=ED=82=A4=EC=9B=8C=EB=93=9C=20=EC=9D=BC=EA=B4=84=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - mapper 구현 - 레포지토리 인터페이스 생성 및 적용 - 힐트모듈 수정 --- data/fortune/build.gradle.kts | 1 + .../official/data/fortune/di/ApiModule.kt | 2 +- .../data/fortune/di/RepositoryModule.kt | 10 +++--- .../data/fortune/mapper/FortuneMapper.kt | 18 ++++++++++ .../data/fortune/remote/api/FortuneApi.kt | 6 ++-- .../response/TodayFortuneCardResponse.kt | 2 +- .../response/TodayFortuneWordResponse.kt | 2 +- .../repository/DefaultFortuneRepository.kt | 16 ++++----- domain/fortune/.gitignore | 1 + domain/fortune/build.gradle.kts | 36 +++++++++++++++++++ .../domain/fortune/model/TodayFortuneCard.kt | 8 +++++ .../domain/fortune/model/TodayFortuneWord.kt | 6 ++++ .../fortune/repository/FortuneRepository.kt | 9 +++++ settings.gradle.kts | 2 +- 14 files changed, 99 insertions(+), 20 deletions(-) create mode 100644 data/fortune/src/main/java/org/sopt/official/data/fortune/mapper/FortuneMapper.kt create mode 100644 domain/fortune/.gitignore create mode 100644 domain/fortune/build.gradle.kts create mode 100644 domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneCard.kt create mode 100644 domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneWord.kt create mode 100644 domain/fortune/src/main/java/org/sopt/official/domain/fortune/repository/FortuneRepository.kt diff --git a/data/fortune/build.gradle.kts b/data/fortune/build.gradle.kts index 99ec89b36..d16316277 100644 --- a/data/fortune/build.gradle.kts +++ b/data/fortune/build.gradle.kts @@ -32,6 +32,7 @@ android { } dependencies { + implementation(projects.domain.fortune) implementation(projects.core.network) implementation(projects.core.common) implementation(platform(libs.okhttp.bom)) diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt index a630f13b5..04178e0f3 100644 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt @@ -12,7 +12,7 @@ import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) -object ApiModule { +internal object ApiModule { @Provides @Singleton diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/RepositoryModule.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/RepositoryModule.kt index 99aa71255..d720c0933 100644 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/RepositoryModule.kt +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/RepositoryModule.kt @@ -1,18 +1,18 @@ package org.sopt.official.data.fortune.di +import dagger.Binds import dagger.Module -import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent -import org.sopt.official.data.fortune.remote.api.FortuneApi import org.sopt.official.data.fortune.repository.DefaultFortuneRepository +import org.sopt.official.domain.fortune.repository.FortuneRepository import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) -object RepositoryModule { +internal interface RepositoryModule { - @Provides + @Binds @Singleton - fun provideDefaultFortuneRepository(fortuneApi: FortuneApi): DefaultFortuneRepository = DefaultFortuneRepository(fortuneApi) + abstract fun bindDefaultFortuneRepository(defaultFortuneRepository: DefaultFortuneRepository): FortuneRepository } diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/mapper/FortuneMapper.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/mapper/FortuneMapper.kt new file mode 100644 index 000000000..bb7d2081a --- /dev/null +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/mapper/FortuneMapper.kt @@ -0,0 +1,18 @@ +package org.sopt.official.data.fortune.mapper + +import org.sopt.official.data.fortune.remote.response.TodayFortuneCardResponse +import org.sopt.official.data.fortune.remote.response.TodayFortuneWordResponse +import org.sopt.official.domain.fortune.model.TodayFortuneCard +import org.sopt.official.domain.fortune.model.TodayFortuneWord + +internal fun TodayFortuneCardResponse.toDomain(): TodayFortuneCard = TodayFortuneCard( + description = description, + imageColorCode = imageColorCode, + imageUrl = imageUrl, + name = name, +) + +internal fun TodayFortuneWordResponse.toDomain(): TodayFortuneWord = TodayFortuneWord( + userName = userName, + title = title, +) diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt index 3b4d0bb8f..7188abd12 100644 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt @@ -5,13 +5,13 @@ import org.sopt.official.data.fortune.remote.response.TodayFortuneWordResponse import retrofit2.http.GET import retrofit2.http.Query -interface FortuneApi { +internal interface FortuneApi { - @GET("/api/v2/fortune/word") + @GET("api/v2/fortune/word") suspend fun getTodayFortuneWord( @Query("todayDate") todayDate: String, ): TodayFortuneWordResponse - @GET("/api/v2/fortune/card/today") + @GET("api/v2/fortune/card/today") suspend fun getTodayFortuneCard(): TodayFortuneCardResponse } diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneCardResponse.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneCardResponse.kt index be91b4b7d..053214cb7 100644 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneCardResponse.kt +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneCardResponse.kt @@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class TodayFortuneCardResponse( +internal data class TodayFortuneCardResponse( @SerialName("description") val description: String, @SerialName("imageColorCode") diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneWordResponse.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneWordResponse.kt index 361442675..e374976c3 100644 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneWordResponse.kt +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneWordResponse.kt @@ -4,7 +4,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class TodayFortuneWordResponse( +internal data class TodayFortuneWordResponse( @SerialName("userName") val userName: String, @SerialName("title") diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/repository/DefaultFortuneRepository.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/repository/DefaultFortuneRepository.kt index 5417f0e7e..2a79bd486 100644 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/repository/DefaultFortuneRepository.kt +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/repository/DefaultFortuneRepository.kt @@ -1,17 +1,17 @@ package org.sopt.official.data.fortune.repository +import org.sopt.official.data.fortune.mapper.toDomain import org.sopt.official.data.fortune.remote.api.FortuneApi +import org.sopt.official.domain.fortune.model.TodayFortuneCard +import org.sopt.official.domain.fortune.model.TodayFortuneWord +import org.sopt.official.domain.fortune.repository.FortuneRepository import javax.inject.Inject -class DefaultFortuneRepository @Inject constructor( +internal class DefaultFortuneRepository @Inject constructor( private val fortuneApi: FortuneApi, -) { +) : FortuneRepository { - suspend fun fetchTodayFortuneWord() { - fortuneApi - } + override suspend fun fetchTodayFortuneWord(date: String): TodayFortuneWord = fortuneApi.getTodayFortuneWord(date).toDomain() - suspend fun fetchTodayFortuneCard() { - fortuneApi - } + override suspend fun fetchTodayFortuneCard(): TodayFortuneCard = fortuneApi.getTodayFortuneCard().toDomain() } diff --git a/domain/fortune/.gitignore b/domain/fortune/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/domain/fortune/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/domain/fortune/build.gradle.kts b/domain/fortune/build.gradle.kts new file mode 100644 index 000000000..0adbfe1a8 --- /dev/null +++ b/domain/fortune/build.gradle.kts @@ -0,0 +1,36 @@ +/* + * MIT License + * Copyright 2023-2024 SOPT - Shout Our Passion Together + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +plugins { + sopt("kotlin") +} + +kotlin { + jvmToolchain(17) +} + +dependencies { + implementation(libs.javax.inject) +} diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneCard.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneCard.kt new file mode 100644 index 000000000..72f7708cf --- /dev/null +++ b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneCard.kt @@ -0,0 +1,8 @@ +package org.sopt.official.domain.fortune.model + +internal data class TodayFortuneCard( + val description: String, + val imageColorCode: String, + val imageUrl: String, + val name: String, +) diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneWord.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneWord.kt new file mode 100644 index 000000000..eae07ccbe --- /dev/null +++ b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneWord.kt @@ -0,0 +1,6 @@ +package org.sopt.official.domain.fortune.model + +internal data class TodayFortuneWord( + val userName: String, + val title: String, +) diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/repository/FortuneRepository.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/repository/FortuneRepository.kt new file mode 100644 index 000000000..be260fc3d --- /dev/null +++ b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/repository/FortuneRepository.kt @@ -0,0 +1,9 @@ +package org.sopt.official.domain.fortune.repository + +import org.sopt.official.domain.fortune.model.TodayFortuneCard +import org.sopt.official.domain.fortune.model.TodayFortuneWord + +internal interface FortuneRepository { + suspend fun fetchTodayFortuneWord(date: String): TodayFortuneWord + suspend fun fetchTodayFortuneCard(): TodayFortuneCard +} diff --git a/settings.gradle.kts b/settings.gradle.kts index d9b6f8edc..afe515dab 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -41,5 +41,5 @@ include( ":feature:poke", ":feature:fortune" ) -include(":domain:fortune") include(":data:fortune") +include(":domain:fortune") From 533a29fa924626fb17826209b476f9a6e6a4b880 Mon Sep 17 00:00:00 2001 From: s9hn Date: Wed, 25 Sep 2024 18:08:00 +0900 Subject: [PATCH 07/66] =?UTF-8?q?refactor:=20internal=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/fortune/src/main/AndroidManifest.xml | 25 ++++++++++++++++++- .../domain/fortune/model/TodayFortuneCard.kt | 2 +- .../domain/fortune/model/TodayFortuneWord.kt | 2 +- .../fortune/repository/FortuneRepository.kt | 2 +- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/data/fortune/src/main/AndroidManifest.xml b/data/fortune/src/main/AndroidManifest.xml index 8bdb7e14b..3414a8184 100644 --- a/data/fortune/src/main/AndroidManifest.xml +++ b/data/fortune/src/main/AndroidManifest.xml @@ -1,4 +1,27 @@ - + + diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneCard.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneCard.kt index 72f7708cf..97c8e77ce 100644 --- a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneCard.kt +++ b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneCard.kt @@ -1,6 +1,6 @@ package org.sopt.official.domain.fortune.model -internal data class TodayFortuneCard( +data class TodayFortuneCard( val description: String, val imageColorCode: String, val imageUrl: String, diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneWord.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneWord.kt index eae07ccbe..52ef6e948 100644 --- a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneWord.kt +++ b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneWord.kt @@ -1,6 +1,6 @@ package org.sopt.official.domain.fortune.model -internal data class TodayFortuneWord( +data class TodayFortuneWord( val userName: String, val title: String, ) diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/repository/FortuneRepository.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/repository/FortuneRepository.kt index be260fc3d..7932187f2 100644 --- a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/repository/FortuneRepository.kt +++ b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/repository/FortuneRepository.kt @@ -3,7 +3,7 @@ package org.sopt.official.domain.fortune.repository import org.sopt.official.domain.fortune.model.TodayFortuneCard import org.sopt.official.domain.fortune.model.TodayFortuneWord -internal interface FortuneRepository { +interface FortuneRepository { suspend fun fetchTodayFortuneWord(date: String): TodayFortuneWord suspend fun fetchTodayFortuneCard(): TodayFortuneCard } From f655b506f54156d3be530003f58079d5bc894e2d Mon Sep 17 00:00:00 2001 From: s9hn Date: Wed, 25 Sep 2024 19:00:59 +0900 Subject: [PATCH 08/66] =?UTF-8?q?refactor:=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/sopt/official/data/fortune/di/ApiModule.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt index 04178e0f3..f76849ab5 100644 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt @@ -16,5 +16,5 @@ internal object ApiModule { @Provides @Singleton - fun provideNovelApi(@AppRetrofit retrofit: Retrofit): FortuneApi = retrofit.create() + internal fun provideFortuneApi(@AppRetrofit retrofit: Retrofit): FortuneApi = retrofit.create() } From e26989c30d507a968bb12b98ff3684763f80a9cf Mon Sep 17 00:00:00 2001 From: s9hn Date: Wed, 25 Sep 2024 19:03:57 +0900 Subject: [PATCH 09/66] =?UTF-8?q?feat:=20=EB=A0=88=EC=9D=B4=EC=96=B4=20?= =?UTF-8?q?=EC=9D=98=EC=A1=B4=EC=84=B1=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 ++ feature/fortune/build.gradle.kts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 29b900515..5c5663364 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -117,8 +117,10 @@ dependencies { implementation(projects.domain.soptamp) implementation(projects.domain.mypage) implementation(projects.domain.poke) + implementation(projects.domain.fortune) implementation(projects.domain.notification) implementation(projects.feature.soptamp) + implementation(projects.data.fortune) implementation(projects.data.soptamp) implementation(projects.data.mypage) implementation(projects.data.poke) diff --git a/feature/fortune/build.gradle.kts b/feature/fortune/build.gradle.kts index d3f4bfad3..9b444c2f2 100644 --- a/feature/fortune/build.gradle.kts +++ b/feature/fortune/build.gradle.kts @@ -32,6 +32,9 @@ android { } dependencies { + // domain + implementation(projects.domain.fortune) + // core implementation(projects.core.common) implementation(projects.core.designsystem) From 5950cecb624cc2aa53e1285385267a604f2d9dab Mon Sep 17 00:00:00 2001 From: s9hn Date: Thu, 26 Sep 2024 15:34:23 +0900 Subject: [PATCH 10/66] =?UTF-8?q?refactor:=20=EB=84=A4=ED=8A=B8=EC=9B=8C?= =?UTF-8?q?=ED=81=AC=20path=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/sopt/official/data/fortune/di/ApiModule.kt | 2 +- .../org/sopt/official/data/fortune/remote/api/FortuneApi.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt index f76849ab5..bd74040df 100644 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt @@ -16,5 +16,5 @@ internal object ApiModule { @Provides @Singleton - internal fun provideFortuneApi(@AppRetrofit retrofit: Retrofit): FortuneApi = retrofit.create() + internal fun provideFortuneApi(@AppRetrofit(true) retrofit: Retrofit): FortuneApi = retrofit.create() } diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt index 7188abd12..e7a5c4155 100644 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt +++ b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt @@ -7,11 +7,11 @@ import retrofit2.http.Query internal interface FortuneApi { - @GET("api/v2/fortune/word") + @GET("fortune/word") suspend fun getTodayFortuneWord( @Query("todayDate") todayDate: String, ): TodayFortuneWordResponse - @GET("api/v2/fortune/card/today") + @GET("fortune/card/today") suspend fun getTodayFortuneCard(): TodayFortuneCardResponse } From 71001df35d7f7b520416fbb6b7e3f0405fe369e6 Mon Sep 17 00:00:00 2001 From: s9hn Date: Thu, 26 Sep 2024 15:35:25 +0900 Subject: [PATCH 11/66] =?UTF-8?q?feat:=20=EB=84=A4=ED=8A=B8=EC=9B=8C?= =?UTF-8?q?=ED=81=AC=20=ED=86=B5=EC=8B=A0=20=EA=B5=AC=ED=98=84=20=EB=B0=8F?= =?UTF-8?q?=20state=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortuneDetail/FortuneDetailRoute.kt | 11 ++++- .../fortuneDetail/FortuneDetailScreen.kt | 30 +++++++++++-- .../fortuneDetail/FortuneDetailViewModel.kt | 45 +++++++++++++++++++ .../model/FortuneDetailUiState.kt | 23 ++++++++++ 4 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index e18304de8..6a552c62a 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -2,16 +2,23 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail import androidx.compose.foundation.layout.PaddingValues import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle @Composable internal fun FortuneDetailRoute( paddingValue: PaddingValues, date: String, - navigateToFortuneAmulet: () -> Unit, + onFortuneAmuletClick: () -> Unit, + viewModel: FortuneDetailViewModel = hiltViewModel(), ) { + val uiState by viewModel.uiState.collectAsStateWithLifecycle() + FortuneDetailScreen( paddingValue = paddingValue, date = date, - navigateToFortuneAmulet = navigateToFortuneAmulet + onFortuneAmuletClick = onFortuneAmuletClick, + uiState = uiState, ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index a6b2f86f6..69ad15cbf 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -37,13 +37,18 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.SoptTheme import org.sopt.official.feature.fortune.feature.fortuneDetail.component.TodayFortuneDashboard +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Error +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Loading +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.TodaySentence @Composable internal fun FortuneDetailScreen( paddingValue: PaddingValues, date: String, - navigateToFortuneAmulet: () -> Unit, + onFortuneAmuletClick: () -> Unit, modifier: Modifier = Modifier, + uiState: FortuneDetailUiState = Loading, ) { Column( horizontalAlignment = Alignment.CenterHorizontally, @@ -52,7 +57,22 @@ internal fun FortuneDetailScreen( .padding(paddingValues = paddingValue), ) { Spacer(modifier = Modifier.height(height = 16.dp)) - TodayFortuneDashboard(date) + when (uiState) { + is TodaySentence -> { + TodayFortuneDashboard( + date = date, + todaySentence = uiState.message, + ) + } + + is Error -> { + // 오류 처리 + } + + is Loading -> { + // 로딩 뷰 + } + } } } @@ -63,7 +83,11 @@ private fun FortuneDetailScreenPreview() { FortuneDetailScreen( paddingValue = PaddingValues(vertical = 16.dp), date = "2024-09-09", - navigateToFortuneAmulet = {}, + onFortuneAmuletClick = {}, + uiState = TodaySentence( + userName = "누누", + content = "오늘 하루종일 기분 좋을 것 같은 날이네요." + ) ) } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt new file mode 100644 index 000000000..dabecd8ac --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt @@ -0,0 +1,45 @@ +package org.sopt.official.feature.fortune.feature.fortuneDetail + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.update +import kotlinx.coroutines.launch +import org.sopt.official.domain.fortune.usecase.GetTodayFortuneUseCase +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Error +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Loading +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.TodaySentence +import javax.inject.Inject + +@HiltViewModel +class FortuneDetailViewModel @Inject constructor( + getTodayFortuneUseCase: GetTodayFortuneUseCase, +) : ViewModel() { + private val _uiState: MutableStateFlow = MutableStateFlow(Loading) + val uiState: StateFlow get() = _uiState.asStateFlow() + + init { + viewModelScope.launch { + runCatching { + getTodayFortuneUseCase() + }.onSuccess { result -> + _uiState.update { + TodaySentence( + userName = result.userName, + content = result.title, + ) + } + }.onFailure { error -> + _uiState.update { + Error(error) + } + } + } + } +} + + diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt new file mode 100644 index 000000000..0bb4e936d --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt @@ -0,0 +1,23 @@ +package org.sopt.official.feature.fortune.feature.fortuneDetail.model + +import androidx.compose.runtime.Immutable +import androidx.compose.runtime.Stable + +@Stable +sealed interface FortuneDetailUiState { + + @Immutable + data class TodaySentence( + val userName: String, + val content: String, + ) : FortuneDetailUiState { + val message: String + get() = "${userName}님,\n${content}" + } + + @Immutable + data object Loading : FortuneDetailUiState + + @Immutable + data class Error(val errorMessage: Throwable) : FortuneDetailUiState +} From 1e42c44be70d40257b6c97c8d3ad02376cc0ab6d Mon Sep 17 00:00:00 2001 From: s9hn Date: Thu, 26 Sep 2024 15:35:38 +0900 Subject: [PATCH 12/66] =?UTF-8?q?feat:=20=EC=98=A4=EB=8A=98=EC=9D=98=20?= =?UTF-8?q?=EC=86=9D=EB=A7=88=EB=94=94=20=EA=B4=80=EB=A0=A8=20=EC=9C=A0?= =?UTF-8?q?=EC=A6=88=EC=BC=80=EC=9D=B4=EC=8A=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortune/usecase/GetTodayDateUseCase.kt | 17 +++++++++++++++++ .../fortune/usecase/GetTodayFortuneUseCase.kt | 13 +++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayDateUseCase.kt create mode 100644 domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneUseCase.kt diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayDateUseCase.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayDateUseCase.kt new file mode 100644 index 000000000..0d167c1f2 --- /dev/null +++ b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayDateUseCase.kt @@ -0,0 +1,17 @@ +package org.sopt.official.domain.fortune.usecase + +import java.time.LocalDate +import javax.inject.Inject + +class GetTodayDateUseCase @Inject constructor() { + private val currentDate by lazy { LocalDate.now() } + + operator fun invoke(): String = currentDate.toFormattedDate() + + private fun LocalDate.toFormattedDate(): String { + val month = monthValue.toString().padStart(2, '0') + val day = dayOfMonth.toString().padStart(2, '0') + + return "$year-$month-$day" + } +} diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneUseCase.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneUseCase.kt new file mode 100644 index 000000000..df3d656a1 --- /dev/null +++ b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneUseCase.kt @@ -0,0 +1,13 @@ +package org.sopt.official.domain.fortune.usecase + +import org.sopt.official.domain.fortune.model.TodayFortuneWord +import org.sopt.official.domain.fortune.repository.FortuneRepository +import javax.inject.Inject + +class GetTodayFortuneUseCase @Inject constructor( + private val fortuneRepository: FortuneRepository, + private val getTodayDateUseCase: GetTodayDateUseCase, +) { + + suspend operator fun invoke(): TodayFortuneWord = fortuneRepository.fetchTodayFortuneWord(getTodayDateUseCase()) +} From 625d11ef9ba4b8cdb2a5116374266f89c7d674d5 Mon Sep 17 00:00:00 2001 From: s9hn Date: Thu, 26 Sep 2024 15:35:59 +0900 Subject: [PATCH 13/66] =?UTF-8?q?refactor:=20TodayFortuneBox=20=ED=8C=A8?= =?UTF-8?q?=EB=94=A9=EA=B0=92=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/TodayFortuneDashboard.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt index 7f1512b10..c093bf38b 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt @@ -27,12 +27,15 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.Gray100 @@ -43,6 +46,7 @@ import org.sopt.official.feature.fortune.R @Composable fun TodayFortuneDashboard( date: String, + todaySentence: String, modifier: Modifier = Modifier, ) { TodayFortuneBox( @@ -64,9 +68,13 @@ fun TodayFortuneDashboard( ) Spacer(modifier = Modifier.height(height = 20.dp)) Text( - text = date, + text = todaySentence, style = SoptTheme.typography.title24SB, color = Gray30, + textAlign = TextAlign.Center, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 68.dp), ) Spacer(modifier = Modifier.height(height = 36.dp)) } @@ -78,6 +86,9 @@ fun TodayFortuneDashboard( @Composable private fun TodayFortuneDashboardPreview() { SoptTheme { - TodayFortuneDashboard(date = "123") + TodayFortuneDashboard( + date = "2024-09-09", + todaySentence = "안녕하세우안녕하세우안녕하세우안녕하세우안녕하세우안녕하세우", + ) } } From 430b830a7d13e5a079a2eb6b810624b78780fe46 Mon Sep 17 00:00:00 2001 From: s9hn Date: Thu, 26 Sep 2024 15:36:12 +0900 Subject: [PATCH 14/66] =?UTF-8?q?refactor:=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EB=B0=8F=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt | 2 +- .../feature/fortune/feature/home/navigation/HomeNavGraph.kt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt index c1be1f0b2..25c9369e0 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt @@ -43,7 +43,7 @@ fun NavGraphBuilder.fortuneDetailNavGraph( FortuneDetailRoute( paddingValue = paddingValue, date = items.date, - navigateToFortuneAmulet = navigateToFortuneAmulet + onFortuneAmuletClick = navigateToFortuneAmulet ) } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/navigation/HomeNavGraph.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/navigation/HomeNavGraph.kt index 03473bc03..adb65ced5 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/navigation/HomeNavGraph.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/navigation/HomeNavGraph.kt @@ -28,7 +28,6 @@ import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import kotlinx.serialization.Serializable -import org.sopt.official.feature.fortune.feature.fortuneAmulet.navigation.FortuneAmulet import org.sopt.official.feature.fortune.feature.home.HomeRoute @Serializable @@ -38,7 +37,7 @@ fun NavGraphBuilder.homeNavGraph( paddingValue: PaddingValues, navigateToFortuneDetail: (String) -> Unit, ) { - composable { + composable { HomeRoute( paddingValue = paddingValue, navigateToFortuneDetail = navigateToFortuneDetail From 83c06415812e094394911e1c6c6cec0b642a41c0 Mon Sep 17 00:00:00 2001 From: s9hn Date: Thu, 26 Sep 2024 16:19:20 +0900 Subject: [PATCH 15/66] =?UTF-8?q?refactor:=20internal=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/fortuneDetail/FortuneDetailViewModel.kt | 2 +- .../fortuneDetail/component/TodayFortuneDashboard.kt | 7 +++++-- .../feature/fortuneDetail/model/FortuneDetailUiState.kt | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt index dabecd8ac..ea3ed4f87 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt @@ -16,7 +16,7 @@ import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDeta import javax.inject.Inject @HiltViewModel -class FortuneDetailViewModel @Inject constructor( +internal class FortuneDetailViewModel @Inject constructor( getTodayFortuneUseCase: GetTodayFortuneUseCase, ) : ViewModel() { private val _uiState: MutableStateFlow = MutableStateFlow(Loading) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt index c093bf38b..db25720d2 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt @@ -35,6 +35,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource +import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -44,7 +46,7 @@ import org.sopt.official.designsystem.SoptTheme import org.sopt.official.feature.fortune.R @Composable -fun TodayFortuneDashboard( +internal fun TodayFortuneDashboard( date: String, todaySentence: String, modifier: Modifier = Modifier, @@ -74,7 +76,8 @@ fun TodayFortuneDashboard( textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() - .padding(horizontal = 68.dp), + .padding(horizontal = 68.dp) + .semantics { contentDescription = "todaySentence" }, ) Spacer(modifier = Modifier.height(height = 36.dp)) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt index 0bb4e936d..9cda01651 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt @@ -4,7 +4,7 @@ import androidx.compose.runtime.Immutable import androidx.compose.runtime.Stable @Stable -sealed interface FortuneDetailUiState { +internal sealed interface FortuneDetailUiState { @Immutable data class TodaySentence( From 8d86bcbf3e6c4a1a51f30684c18c1b02ba55b6d8 Mon Sep 17 00:00:00 2001 From: s9hn Date: Thu, 26 Sep 2024 16:19:29 +0900 Subject: [PATCH 16/66] =?UTF-8?q?test:=20FortuneDetailScreenTest=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/fortune/build.gradle.kts | 1 + .../fortuneDetail/FortuneDetailScreenTest.kt | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt diff --git a/feature/fortune/build.gradle.kts b/feature/fortune/build.gradle.kts index 9b444c2f2..8fb80b142 100644 --- a/feature/fortune/build.gradle.kts +++ b/feature/fortune/build.gradle.kts @@ -25,6 +25,7 @@ plugins { sopt("feature") sopt("compose") + sopt("test") } android { diff --git a/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt b/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt new file mode 100644 index 000000000..688ff96aa --- /dev/null +++ b/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt @@ -0,0 +1,54 @@ +package org.sopt.official.feature.fortune.fortuneDetail + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.ui.semantics.SemanticsProperties +import androidx.compose.ui.semantics.getOrNull +import androidx.compose.ui.test.assertIsDisplayed +import androidx.compose.ui.test.junit4.createComposeRule +import androidx.compose.ui.test.onNodeWithContentDescription +import androidx.compose.ui.test.onNodeWithText +import org.junit.Rule +import org.junit.Test +import org.sopt.official.designsystem.SoptTheme +import org.sopt.official.feature.fortune.feature.fortuneDetail.FortuneDetailScreen +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState + +internal class FortuneDetailScreenTest { + + @get:Rule + val composeRule = createComposeRule() + + @Test + fun 서버통신이_성공하면_이름_솝마디_날짜가_노출된다() { + // given: + val date = "2024-09-26" + val name = "이현우" + val content = "안녕하세요안녕하세요안녕하세요안녕하세요안녕하세요" + + // when: + + composeRule.setContent { + SoptTheme { + FortuneDetailScreen( + paddingValue = PaddingValues(), + date = date, + onFortuneAmuletClick = { }, + uiState = FortuneDetailUiState.TodaySentence( + userName = name, + content = content, + ) + ) + } + } + + // then: + val todayFortune = composeRule.onNodeWithContentDescription("todaySentence") + .fetchSemanticsNode().config.getOrNull(SemanticsProperties.Text)?.joinToString(separator = "").orEmpty() + + composeRule.waitForIdle() + + composeRule.onNodeWithText(date).assertIsDisplayed() + assert(todayFortune.contains(name)) + assert(todayFortune.contains(content)) + } +} From 2ea3be9f1335ad9f05063ad6e09e983e3cf8235c Mon Sep 17 00:00:00 2001 From: s9hn Date: Thu, 26 Sep 2024 20:37:25 +0900 Subject: [PATCH 17/66] =?UTF-8?q?feat:=20=EC=BD=95=20=EC=B0=8C=EB=A5=B4?= =?UTF-8?q?=EA=B8=B0=20=EB=8C=80=EC=8B=9C=EB=B3=B4=EB=93=9C=20UI=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortuneDetail/FortuneDetailScreen.kt | 10 +- .../component/PokeRecommendationDashboard.kt | 140 ++++++++++++++++++ .../fortune/src/main/res/drawable/ic_poke.xml | 13 ++ 3 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt create mode 100644 feature/fortune/src/main/res/drawable/ic_poke.xml diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index 11846e10a..2ca990e1a 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -36,6 +36,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.SoptTheme +import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeRecommendationDashboard import org.sopt.official.feature.fortune.feature.fortuneDetail.component.TodayFortuneDashboard import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Error @@ -63,6 +64,13 @@ internal fun FortuneDetailScreen( date = date, todaySentence = uiState.message, ) + Spacer(modifier = Modifier.height(height = 20.dp)) + PokeRecommendationDashboard( + profile = "", + name = "", + generation = "", + onPokeClick = { -> }, + ) } is Error -> { @@ -76,7 +84,7 @@ internal fun FortuneDetailScreen( } } -@Preview +@Preview(showBackground = true) @Composable private fun FortuneDetailScreenPreview() { SoptTheme { diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt new file mode 100644 index 000000000..9866b4b85 --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt @@ -0,0 +1,140 @@ +/* + * MIT License + * Copyright 2024 SOPT - Shout Our Passion Together + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package org.sopt.official.feature.fortune.feature.fortuneDetail.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.sopt.official.designsystem.Blue400 +import org.sopt.official.designsystem.Gray10 +import org.sopt.official.designsystem.Gray100 +import org.sopt.official.designsystem.Gray30 +import org.sopt.official.designsystem.Gray300 +import org.sopt.official.designsystem.SoptTheme +import org.sopt.official.feature.fortune.R +import org.sopt.official.feature.fortune.component.UrlImage + +@Composable +internal fun PokeRecommendationDashboard( + profile: String, + name: String, + generation: String, + onPokeClick: () -> Unit, + modifier: Modifier = Modifier, +) { + TodayFortuneBox( + content = { + Column( + modifier = modifier + .fillMaxWidth() + .padding(all = 20.dp), + ) { + Text( + text = "콕 찌르기", + style = SoptTheme.typography.body14R, + color = Gray100, + ) + Text( + text = "행운이 2배가 될 솝트인을 찔러보세요", + style = SoptTheme.typography.title18SB, + color = Gray30, + ) + Spacer(modifier = Modifier.height(height = 20.dp)) + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier.fillMaxWidth(), + ) { + UrlImage( + url = profile, + contentDescription = "profileImage", + modifier = Modifier.size(size = 70.dp).border( + width = 2.dp, + color = Blue400, + shape = RoundedCornerShape(size = 100.dp), + ) + ) + Spacer(modifier = Modifier.width(width = 8.dp)) + Column { + Text( + text = name, + style = SoptTheme.typography.body18M, + color = Gray30, + ) + Text( + text = generation, + style = SoptTheme.typography.label12SB, + color = Gray300, + ) + } + Spacer(modifier = Modifier.weight(1f)) + IconButton( + onClick = onPokeClick, + modifier = Modifier + .size(size = 44.dp) + .background( + color = Gray10, + shape = RoundedCornerShape(size = 18.dp), + ), + ) { + Icon( + painter = painterResource(R.drawable.ic_poke), + contentDescription = "콕 찌르기", + ) + } + } + } + } + ) +} + +@Preview +@Composable +private fun PokeRecommendationDashboardPreview() { + SoptTheme { + PokeRecommendationDashboard( + profile = "123", + name = "이현우", + onPokeClick = { }, + generation = "1100기 iOS", + ) + } +} diff --git a/feature/fortune/src/main/res/drawable/ic_poke.xml b/feature/fortune/src/main/res/drawable/ic_poke.xml new file mode 100644 index 000000000..f64e4e209 --- /dev/null +++ b/feature/fortune/src/main/res/drawable/ic_poke.xml @@ -0,0 +1,13 @@ + + + From 37e8027daeb0f9cc1bcd6a682c420eaf677216ad Mon Sep 17 00:00:00 2001 From: s9hn Date: Thu, 26 Sep 2024 21:52:08 +0900 Subject: [PATCH 18/66] =?UTF-8?q?feat:=20=EC=BD=95=20=EC=B0=8C=EB=A5=B4?= =?UTF-8?q?=EA=B8=B0=20=EC=9C=A0=EC=A0=80=20=EC=B6=94=EC=B2=9C=20API=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../poke/implementation/PokeRepositoryImpl.kt | 6 +-- .../official/data/poke/service/PokeService.kt | 10 ++--- .../source/remote/PokeRemoteDataSource.kt | 4 +- .../domain/poke/repository/PokeRepository.kt | 8 ++-- .../GetOnboardingPokeUserListUseCase.kt | 2 +- feature/fortune/build.gradle.kts | 1 + .../fortuneDetail/FortuneDetailViewModel.kt | 37 +++++++++++++++---- 7 files changed, 46 insertions(+), 22 deletions(-) diff --git a/data/poke/src/main/java/org/sopt/official/data/poke/implementation/PokeRepositoryImpl.kt b/data/poke/src/main/java/org/sopt/official/data/poke/implementation/PokeRepositoryImpl.kt index 66b349aeb..93a675921 100644 --- a/data/poke/src/main/java/org/sopt/official/data/poke/implementation/PokeRepositoryImpl.kt +++ b/data/poke/src/main/java/org/sopt/official/data/poke/implementation/PokeRepositoryImpl.kt @@ -24,7 +24,6 @@ */ package org.sopt.official.data.poke.implementation -import javax.inject.Inject import org.sopt.official.data.poke.dto.request.GetFriendListDetailRequest import org.sopt.official.data.poke.dto.request.GetPokeMessageListRequest import org.sopt.official.data.poke.dto.request.GetPokeNotificationListRequest @@ -44,6 +43,7 @@ import org.sopt.official.domain.poke.entity.PokeUserResponse import org.sopt.official.domain.poke.repository.PokeRepository import org.sopt.official.domain.poke.type.PokeFriendType import org.sopt.official.domain.poke.type.PokeMessageType +import javax.inject.Inject class PokeRepositoryImpl @Inject constructor( private val localDataSource: PokeLocalDataSource, @@ -62,7 +62,7 @@ class PokeRepositoryImpl @Inject constructor( return remoteDataSource.checkNewInPoke() } - override suspend fun getOnboardingPokeUserList(randomType: String, size: Int): GetOnboardingPokeUserListResponse { + override suspend fun getOnboardingPokeUserList(randomType: String?, size: Int): GetOnboardingPokeUserListResponse { return remoteDataSource.getOnboardingPokeUserList(randomType, size) } @@ -110,7 +110,7 @@ class PokeRepositoryImpl @Inject constructor( ) } - override suspend fun pokeUser(userId: Int, isAnonymous: Boolean, message: String,): PokeUserResponse { + override suspend fun pokeUser(userId: Int, isAnonymous: Boolean, message: String): PokeUserResponse { return remoteDataSource.pokeUser( pokeUserRequest = PokeUserRequest( diff --git a/data/poke/src/main/java/org/sopt/official/data/poke/service/PokeService.kt b/data/poke/src/main/java/org/sopt/official/data/poke/service/PokeService.kt index f041e6dd4..50ff440f0 100644 --- a/data/poke/src/main/java/org/sopt/official/data/poke/service/PokeService.kt +++ b/data/poke/src/main/java/org/sopt/official/data/poke/service/PokeService.kt @@ -46,8 +46,8 @@ interface PokeService { @GET("poke/random") suspend fun getOnboardingPokeUserList( - @Query("randomType") randomType: String, - @Query("size") size: Int + @Query("randomType") randomType: String?, + @Query("size") size: Int, ): Response @GET("poke/to/me") @@ -60,16 +60,16 @@ interface PokeService { suspend fun getPokeFriendOfFriendList(): Response> @GET("poke/to/me/list") - suspend fun getPokeNotificationList(@Query("page") page: Int,): Response + suspend fun getPokeNotificationList(@Query("page") page: Int): Response @GET("poke/friend/list") suspend fun getFriendListSummary(): Response @GET("poke/friend/list") - suspend fun getFriendListDetail(@Query("type") type: String, @Query("page") page: Int,): Response + suspend fun getFriendListDetail(@Query("type") type: String, @Query("page") page: Int): Response @GET("poke/message") - suspend fun getPokeMessageList(@Query("messageType") messageType: String,): Response + suspend fun getPokeMessageList(@Query("messageType") messageType: String): Response @PUT("poke/{userId}") suspend fun pokeUser(@Path("userId") userId: Int, @Body pokeMessageRequest: PokeMessageRequest): Response diff --git a/data/poke/src/main/java/org/sopt/official/data/poke/source/remote/PokeRemoteDataSource.kt b/data/poke/src/main/java/org/sopt/official/data/poke/source/remote/PokeRemoteDataSource.kt index dedf8fa98..22644ead2 100644 --- a/data/poke/src/main/java/org/sopt/official/data/poke/source/remote/PokeRemoteDataSource.kt +++ b/data/poke/src/main/java/org/sopt/official/data/poke/source/remote/PokeRemoteDataSource.kt @@ -24,7 +24,6 @@ */ package org.sopt.official.data.poke.source.remote -import javax.inject.Inject import org.sopt.official.data.poke.dto.request.GetFriendListDetailRequest import org.sopt.official.data.poke.dto.request.GetPokeMessageListRequest import org.sopt.official.data.poke.dto.request.GetPokeNotificationListRequest @@ -41,6 +40,7 @@ import org.sopt.official.domain.poke.entity.GetPokeMeResponse import org.sopt.official.domain.poke.entity.GetPokeMessageListResponse import org.sopt.official.domain.poke.entity.GetPokeNotificationListResponse import org.sopt.official.domain.poke.entity.PokeUserResponse +import javax.inject.Inject class PokeRemoteDataSource @Inject constructor( private val service: PokeService, @@ -54,7 +54,7 @@ class PokeRemoteDataSource @Inject constructor( } } - suspend fun getOnboardingPokeUserList(randomType: String, size: Int): GetOnboardingPokeUserListResponse { + suspend fun getOnboardingPokeUserList(randomType: String?, size: Int): GetOnboardingPokeUserListResponse { val response = service.getOnboardingPokeUserList(randomType, size) return GetOnboardingPokeUserListResponse().apply { statusCode = response.code().toString() diff --git a/domain/poke/src/main/java/org/sopt/official/domain/poke/repository/PokeRepository.kt b/domain/poke/src/main/java/org/sopt/official/domain/poke/repository/PokeRepository.kt index e7dac6401..35c3fc4db 100644 --- a/domain/poke/src/main/java/org/sopt/official/domain/poke/repository/PokeRepository.kt +++ b/domain/poke/src/main/java/org/sopt/official/domain/poke/repository/PokeRepository.kt @@ -41,7 +41,7 @@ interface PokeRepository { suspend fun checkNewInPokeOnboarding(): Boolean suspend fun updateNewInPokeOnboarding() suspend fun checkNewInPoke(): CheckNewInPokeResponse - suspend fun getOnboardingPokeUserList(randomType: String, size: Int): GetOnboardingPokeUserListResponse + suspend fun getOnboardingPokeUserList(randomType: String? = null, size: Int): GetOnboardingPokeUserListResponse suspend fun getPokeMe(): GetPokeMeResponse suspend fun getPokeFriend(): GetPokeFriendResponse suspend fun getPokeFriendOfFriendList(): GetPokeFriendOfFriendListResponse @@ -49,9 +49,9 @@ interface PokeRepository { suspend fun getFriendListSummary(): GetFriendListSummaryResponse - suspend fun getFriendListDetail(type: PokeFriendType, page: Int,): GetFriendListDetailResponse + suspend fun getFriendListDetail(type: PokeFriendType, page: Int): GetFriendListDetailResponse - suspend fun getPokeMessageList(messageType: PokeMessageType,): GetPokeMessageListResponse + suspend fun getPokeMessageList(messageType: PokeMessageType): GetPokeMessageListResponse - suspend fun pokeUser(userId: Int, isAnonymous: Boolean, message: String,): PokeUserResponse + suspend fun pokeUser(userId: Int, isAnonymous: Boolean, message: String): PokeUserResponse } diff --git a/domain/poke/src/main/java/org/sopt/official/domain/poke/usecase/GetOnboardingPokeUserListUseCase.kt b/domain/poke/src/main/java/org/sopt/official/domain/poke/usecase/GetOnboardingPokeUserListUseCase.kt index 2d8376610..610df55a9 100644 --- a/domain/poke/src/main/java/org/sopt/official/domain/poke/usecase/GetOnboardingPokeUserListUseCase.kt +++ b/domain/poke/src/main/java/org/sopt/official/domain/poke/usecase/GetOnboardingPokeUserListUseCase.kt @@ -24,11 +24,11 @@ */ package org.sopt.official.domain.poke.usecase -import javax.inject.Inject import org.sopt.official.domain.poke.entity.ApiResult import org.sopt.official.domain.poke.entity.PokeRandomUserList import org.sopt.official.domain.poke.entity.apiResult import org.sopt.official.domain.poke.repository.PokeRepository +import javax.inject.Inject class GetOnboardingPokeUserListUseCase @Inject constructor( private val repository: PokeRepository, diff --git a/feature/fortune/build.gradle.kts b/feature/fortune/build.gradle.kts index de172d530..5f5e62f91 100644 --- a/feature/fortune/build.gradle.kts +++ b/feature/fortune/build.gradle.kts @@ -35,6 +35,7 @@ android { dependencies { // domain implementation(projects.domain.fortune) + implementation(projects.domain.poke) // core implementation(projects.core.common) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt index ea3ed4f87..33eacc229 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt @@ -3,21 +3,29 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.async +import kotlinx.coroutines.awaitAll import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch +import org.sopt.official.domain.fortune.model.TodayFortuneWord import org.sopt.official.domain.fortune.usecase.GetTodayFortuneUseCase +import org.sopt.official.domain.poke.entity.GetOnboardingPokeUserListResponse +import org.sopt.official.domain.poke.repository.PokeRepository import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Error import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Loading -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.TodaySentence +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.TodaySentence +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.UserInfo import javax.inject.Inject @HiltViewModel internal class FortuneDetailViewModel @Inject constructor( getTodayFortuneUseCase: GetTodayFortuneUseCase, + private val pokeRepository: PokeRepository, ) : ViewModel() { private val _uiState: MutableStateFlow = MutableStateFlow(Loading) val uiState: StateFlow get() = _uiState.asStateFlow() @@ -25,12 +33,29 @@ internal class FortuneDetailViewModel @Inject constructor( init { viewModelScope.launch { runCatching { - getTodayFortuneUseCase() + awaitAll( + async { getTodayFortuneUseCase() }, + async { pokeRepository.getOnboardingPokeUserList(size = 1) } + ) }.onSuccess { result -> + val todayFortune = result[0] as TodayFortuneWord + val pokeUser = result[1] as GetOnboardingPokeUserListResponse + _uiState.update { - TodaySentence( - userName = result.userName, - content = result.title, + val user = pokeUser.data?.randomInfoList?.get(0)?.userInfoList?.get(0) ?: throw IllegalArgumentException() + + Success( + todaySentence = TodaySentence( + userName = todayFortune.userName, + content = todayFortune.title, + ), + userInfo = UserInfo( + userId = user.userId.toLong(), + profile = user.profileImage, + userName = user.name, + generation = user.generation, + part = user.part, + ) ) } }.onFailure { error -> @@ -41,5 +66,3 @@ internal class FortuneDetailViewModel @Inject constructor( } } } - - From 0bde9465a4b84209e02d116a6f0b94dd62d247d1 Mon Sep 17 00:00:00 2001 From: s9hn Date: Thu, 26 Sep 2024 21:52:30 +0900 Subject: [PATCH 19/66] =?UTF-8?q?refactor:=20UI=20State=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortuneDetail/FortuneDetailRoute.kt | 1 + .../fortuneDetail/FortuneDetailScreen.kt | 35 +++++++++++++------ .../component/PokeRecommendationDashboard.kt | 6 ++-- .../model/FortuneDetailUiState.kt | 27 +++++++++++--- 4 files changed, 50 insertions(+), 19 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index 6a552c62a..dfcc96dc8 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -19,6 +19,7 @@ internal fun FortuneDetailRoute( paddingValue = paddingValue, date = date, onFortuneAmuletClick = onFortuneAmuletClick, + onPokeClick = {}, uiState = uiState, ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index 2ca990e1a..9a12e864f 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -41,13 +41,16 @@ import org.sopt.official.feature.fortune.feature.fortuneDetail.component.TodayFo import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Error import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Loading -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.TodaySentence +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.TodaySentence +import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.UserInfo @Composable internal fun FortuneDetailScreen( paddingValue: PaddingValues, date: String, onFortuneAmuletClick: () -> Unit, + onPokeClick: (userId: Long) -> Unit, modifier: Modifier = Modifier, uiState: FortuneDetailUiState = Loading, ) { @@ -59,17 +62,17 @@ internal fun FortuneDetailScreen( ) { Spacer(modifier = Modifier.height(height = 16.dp)) when (uiState) { - is TodaySentence -> { + is Success -> { TodayFortuneDashboard( date = date, - todaySentence = uiState.message, + todaySentence = uiState.todaySentence.message, ) Spacer(modifier = Modifier.height(height = 20.dp)) PokeRecommendationDashboard( - profile = "", - name = "", - generation = "", - onPokeClick = { -> }, + profile = uiState.userInfo.profile, + name = uiState.userInfo.userName, + userDescription = uiState.userInfo.userDescription, + onPokeClick = { onPokeClick(uiState.userInfo.userId) }, ) } @@ -92,10 +95,20 @@ private fun FortuneDetailScreenPreview() { paddingValue = PaddingValues(vertical = 16.dp), date = "2024-09-09", onFortuneAmuletClick = {}, - uiState = TodaySentence( - userName = "누누", - content = "오늘 하루종일 기분 좋을 것 같은 날이네요." - ) + uiState = Success( + todaySentence = TodaySentence( + userName = "이현우", + content = "사과해요나한테사과해요나한테사과해요나한테" + ), + userInfo = UserInfo( + userId = 0L, + profile = "", + userName = "동민", + generation = 111, + part = "기획 파트" + ) + ), + onPokeClick = { }, ) } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt index 9866b4b85..6023ce78a 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt @@ -57,7 +57,7 @@ import org.sopt.official.feature.fortune.component.UrlImage internal fun PokeRecommendationDashboard( profile: String, name: String, - generation: String, + userDescription: String, onPokeClick: () -> Unit, modifier: Modifier = Modifier, ) { @@ -100,7 +100,7 @@ internal fun PokeRecommendationDashboard( color = Gray30, ) Text( - text = generation, + text = userDescription, style = SoptTheme.typography.label12SB, color = Gray300, ) @@ -134,7 +134,7 @@ private fun PokeRecommendationDashboardPreview() { profile = "123", name = "이현우", onPokeClick = { }, - generation = "1100기 iOS", + userDescription = "1100기 iOS", ) } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt index 9cda01651..633f56d31 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt @@ -7,12 +7,29 @@ import androidx.compose.runtime.Stable internal sealed interface FortuneDetailUiState { @Immutable - data class TodaySentence( - val userName: String, - val content: String, + data class Success( + val todaySentence: TodaySentence, + val userInfo: UserInfo, ) : FortuneDetailUiState { - val message: String - get() = "${userName}님,\n${content}" + + @Immutable + data class TodaySentence( + val userName: String, + val content: String, + ) { + val message: String get() = "${userName}님,\n${content}" + } + + @Immutable + data class UserInfo( + val userId: Long, + val profile: String, + val userName: String, + val generation: Int, + val part: String, + ) { + val userDescription = "${generation}기 $part" + } } @Immutable From 2f9ffffbda58c4eb829ee2e92ed6ead6b59d1096 Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 27 Sep 2024 01:29:09 +0900 Subject: [PATCH 20/66] =?UTF-8?q?refactor:=20SimpleDataFormatter=EB=A1=9C?= =?UTF-8?q?=20=EB=A6=AC=ED=8C=A9=ED=84=B0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/fortune/usecase/GetTodayDateUseCase.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayDateUseCase.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayDateUseCase.kt index 0d167c1f2..b6380d578 100644 --- a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayDateUseCase.kt +++ b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayDateUseCase.kt @@ -1,17 +1,14 @@ package org.sopt.official.domain.fortune.usecase -import java.time.LocalDate +import java.text.SimpleDateFormat +import java.util.Locale import javax.inject.Inject class GetTodayDateUseCase @Inject constructor() { - private val currentDate by lazy { LocalDate.now() } - operator fun invoke(): String = currentDate.toFormattedDate() + operator fun invoke(): String { + val currentDate = System.currentTimeMillis() - private fun LocalDate.toFormattedDate(): String { - val month = monthValue.toString().padStart(2, '0') - val day = dayOfMonth.toString().padStart(2, '0') - - return "$year-$month-$day" + return SimpleDateFormat("yyyy-MM-dd", Locale.KOREAN).format(currentDate) } } From 69a0acc7c4bfd2cd74e41ed88b480cd889473961 Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 27 Sep 2024 01:37:47 +0900 Subject: [PATCH 21/66] =?UTF-8?q?refactor:=20Timber=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortuneDetail/FortuneDetailScreen.kt | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index 11846e10a..96f5fa7e2 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -41,6 +41,7 @@ import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDeta import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Error import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Loading import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.TodaySentence +import timber.log.Timber @Composable internal fun FortuneDetailScreen( @@ -52,9 +53,7 @@ internal fun FortuneDetailScreen( ) { Column( horizontalAlignment = Alignment.CenterHorizontally, - modifier = modifier - .fillMaxSize() - .padding(paddingValues = paddingValue), + modifier = modifier.fillMaxSize().padding(paddingValues = paddingValue), ) { Spacer(modifier = Modifier.height(height = 16.dp)) when (uiState) { @@ -65,10 +64,7 @@ internal fun FortuneDetailScreen( ) } - is Error -> { - // 오류 처리 - } - + is Error -> Timber.e(uiState.errorMessage) is Loading -> { // 로딩 뷰 } @@ -81,12 +77,8 @@ internal fun FortuneDetailScreen( private fun FortuneDetailScreenPreview() { SoptTheme { FortuneDetailScreen( - paddingValue = PaddingValues(vertical = 16.dp), - date = "2024-09-09", - onFortuneAmuletClick = {}, - uiState = TodaySentence( - userName = "누누", - content = "오늘 하루종일 기분 좋을 것 같은 날이네요." + paddingValue = PaddingValues(vertical = 16.dp), date = "2024-09-09", onFortuneAmuletClick = {}, uiState = TodaySentence( + userName = "누누", content = "오늘 하루종일 기분 좋을 것 같은 날이네요." ) ) } From 8981910b67ef48e23934ae915f4c9f648d52bfa7 Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 27 Sep 2024 01:43:29 +0900 Subject: [PATCH 22/66] =?UTF-8?q?build:=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index afe515dab..0340a6ea4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -30,6 +30,8 @@ include( ":data:notification", ":data:soptamp", ":data:poke", + ":data:fortune", + ":domain:fortune", ":domain:mypage", ":domain:notification", ":domain:soptamp", @@ -41,5 +43,3 @@ include( ":feature:poke", ":feature:fortune" ) -include(":data:fortune") -include(":domain:fortune") From a7c5b504998b469dfc8904d364e27c007211774a Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 27 Sep 2024 01:55:48 +0900 Subject: [PATCH 23/66] =?UTF-8?q?refactor:=20break=20strategy=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/fortuneDetail/FortuneDetailScreen.kt | 10 +++++++--- .../fortuneDetail/component/TodayFortuneDashboard.kt | 7 +++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index 96f5fa7e2..d8dac0c88 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -77,9 +77,13 @@ internal fun FortuneDetailScreen( private fun FortuneDetailScreenPreview() { SoptTheme { FortuneDetailScreen( - paddingValue = PaddingValues(vertical = 16.dp), date = "2024-09-09", onFortuneAmuletClick = {}, uiState = TodaySentence( - userName = "누누", content = "오늘 하루종일 기분 좋을 것 같은 날이네요." - ) + paddingValue = PaddingValues(vertical = 16.dp), + date = "2024-09-09", + onFortuneAmuletClick = {}, + uiState = TodaySentence( + userName = "누누", + content = "오늘 하루종일 기분 좋을 것 같은 날이네요.", + ), ) } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt index db25720d2..1d23ff55d 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt @@ -37,6 +37,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.text.style.LineBreak import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -71,7 +72,9 @@ internal fun TodayFortuneDashboard( Spacer(modifier = Modifier.height(height = 20.dp)) Text( text = todaySentence, - style = SoptTheme.typography.title24SB, + style = SoptTheme.typography.title24SB.copy( + lineBreak = LineBreak.Simple, + ), color = Gray30, textAlign = TextAlign.Center, modifier = Modifier @@ -91,7 +94,7 @@ private fun TodayFortuneDashboardPreview() { SoptTheme { TodayFortuneDashboard( date = "2024-09-09", - todaySentence = "안녕하세우안녕하세우안녕하세우안녕하세우안녕하세우안녕하세우", + todaySentence = "hi my name is Sehun kim, nice to meet you", ) } } From c2ac6eda4f1184f81064d7dae6868a02f0cc8973 Mon Sep 17 00:00:00 2001 From: s9hn Date: Sat, 28 Sep 2024 00:25:06 +0900 Subject: [PATCH 24/66] =?UTF-8?q?refactor:=20=EB=B7=B0=EB=AA=A8=EB=8D=B8?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/fortuneDetail/FortuneDetailViewModel.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt index 33eacc229..7f82bc1d9 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt @@ -5,6 +5,7 @@ import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll +import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow @@ -33,10 +34,12 @@ internal class FortuneDetailViewModel @Inject constructor( init { viewModelScope.launch { runCatching { - awaitAll( - async { getTodayFortuneUseCase() }, - async { pokeRepository.getOnboardingPokeUserList(size = 1) } - ) + coroutineScope { + awaitAll( + async { getTodayFortuneUseCase() }, + async { pokeRepository.getOnboardingPokeUserList(size = 1) } + ) + } }.onSuccess { result -> val todayFortune = result[0] as TodayFortuneWord val pokeUser = result[1] as GetOnboardingPokeUserListResponse From 4054429f06568b8abf7ebcc1828aadfe88b8e448 Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sat, 28 Sep 2024 01:34:00 +0900 Subject: [PATCH 25/66] feature #875: delete paddingValue --- .../fortuneAmulet/navigation/FortuneAmuletNavGraph.kt | 3 --- .../feature/fortune/feature/home/HomeScreen.kt | 10 ++-------- .../fortune/feature/home/navigation/HomeNavGraph.kt | 2 -- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/navigation/FortuneAmuletNavGraph.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/navigation/FortuneAmuletNavGraph.kt index e3a31b664..61b7103f8 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/navigation/FortuneAmuletNavGraph.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/navigation/FortuneAmuletNavGraph.kt @@ -24,7 +24,6 @@ */ package org.sopt.official.feature.fortune.feature.fortuneAmulet.navigation -import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import kotlinx.serialization.Serializable @@ -34,12 +33,10 @@ import org.sopt.official.feature.fortune.feature.fortuneAmulet.FortuneAmuletRout data object FortuneAmulet fun NavGraphBuilder.fortuneAmuletNavGraph( - paddingValue: PaddingValues, navigateToHome: () -> Unit, ) { composable { FortuneAmuletRoute( - paddingValue = paddingValue, navigateToHome = navigateToHome ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt index c27100c91..ae3c3ce35 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt @@ -29,7 +29,6 @@ import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -38,7 +37,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -55,13 +54,11 @@ import java.util.Locale @Composable internal fun HomeRoute( - paddingValue: PaddingValues, navigateToFortuneDetail: (String) -> Unit, ) { - val date = remember { getTodayInfo() } + val date = rememberSaveable { getTodayInfo() } HomeScreen( - paddingValue = paddingValue, date = date, navigateToFortuneDetail = { navigateToFortuneDetail(date) @@ -71,13 +68,11 @@ internal fun HomeRoute( @Composable private fun HomeScreen( - paddingValue: PaddingValues, date: String, navigateToFortuneDetail: () -> Unit = {}, ) { Column( modifier = Modifier - .padding(paddingValue) .fillMaxSize() .background(SoptTheme.colors.background), horizontalAlignment = Alignment.CenterHorizontally @@ -156,7 +151,6 @@ fun getTodayInfo(): String { fun HomeScreenPreview() { SoptTheme { HomeScreen( - paddingValue = PaddingValues(0.dp), date = getTodayInfo() ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/navigation/HomeNavGraph.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/navigation/HomeNavGraph.kt index adb65ced5..047737b66 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/navigation/HomeNavGraph.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/navigation/HomeNavGraph.kt @@ -34,12 +34,10 @@ import org.sopt.official.feature.fortune.feature.home.HomeRoute data object Home fun NavGraphBuilder.homeNavGraph( - paddingValue: PaddingValues, navigateToFortuneDetail: (String) -> Unit, ) { composable { HomeRoute( - paddingValue = paddingValue, navigateToFortuneDetail = navigateToFortuneDetail ) } From 943f65b23bbffa9167c24ae908445f6f71c9a9e1 Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sat, 28 Sep 2024 01:34:45 +0900 Subject: [PATCH 26/66] feature #875: connect TodayFortuneCard api --- .../usecase/GetTodayFortuneCardUseCase.kt | 11 ++++ .../fortuneAmulet/FortuneAmuletState.kt | 12 +++++ .../fortuneAmulet/FortuneAmuletViewModel.kt | 52 +++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneCardUseCase.kt create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletState.kt create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletViewModel.kt diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneCardUseCase.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneCardUseCase.kt new file mode 100644 index 000000000..9a78cf2cf --- /dev/null +++ b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneCardUseCase.kt @@ -0,0 +1,11 @@ +package org.sopt.official.domain.fortune.usecase + +import org.sopt.official.domain.fortune.model.TodayFortuneCard +import org.sopt.official.domain.fortune.repository.FortuneRepository +import javax.inject.Inject + +class GetTodayFortuneCardUseCase @Inject constructor( + private val fortuneRepository: FortuneRepository, +) { + suspend operator fun invoke(): TodayFortuneCard = fortuneRepository.fetchTodayFortuneCard() +} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletState.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletState.kt new file mode 100644 index 000000000..dd1586dfa --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletState.kt @@ -0,0 +1,12 @@ +package org.sopt.official.feature.fortune.feature.fortuneAmulet + +import androidx.compose.ui.graphics.Color + +data class FortuneAmuletState( + val isLoading: Boolean = false, + val isFailure: Boolean = false, + val description: String = "", + val imageColor: Color = Color.White, + val imageUrl: String = "", + val name: String = "", +) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletViewModel.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletViewModel.kt new file mode 100644 index 000000000..1f640d9a7 --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletViewModel.kt @@ -0,0 +1,52 @@ +package org.sopt.official.feature.fortune.feature.fortuneAmulet + +import androidx.compose.ui.graphics.Color +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.update +import kotlinx.coroutines.launch +import org.sopt.official.domain.fortune.usecase.GetTodayFortuneCardUseCase +import javax.inject.Inject + +@HiltViewModel +internal class FortuneAmuletViewModel @Inject constructor( + getTodayFortuneCardUseCase: GetTodayFortuneCardUseCase, +) : ViewModel() { + private val _state: MutableStateFlow = MutableStateFlow(FortuneAmuletState()) + val state: StateFlow = _state.asStateFlow() + + init { + viewModelScope.launch { + runCatching { + _state.value = _state.value.copy(isLoading = true) + getTodayFortuneCardUseCase() + }.onSuccess { todayFortuneCard -> + _state.update { + it.copy( + description = todayFortuneCard.description, + imageColor = parseColor(todayFortuneCard.imageColorCode), + imageUrl = todayFortuneCard.imageUrl, + name = todayFortuneCard.name, + isLoading = false + ) + } + }.onFailure { + _state.value = _state.value.copy(isFailure = true) + } + } + } + + private fun parseColor(colorCode: String): Color { + val color: Color = try { + Color(android.graphics.Color.parseColor(colorCode)) + } catch (e: IllegalArgumentException) { + Color.White + } + + return color + } +} From 6d0a46c41693fb555ba53545079526253c3ab1a4 Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sat, 28 Sep 2024 01:34:52 +0900 Subject: [PATCH 27/66] feature #875: connect TodayFortuneCard data --- .../fortuneAmulet/FortuneAmuletScreen.kt | 55 ++++++++++++++----- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt index 6ac63927a..980004de0 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt @@ -26,44 +26,66 @@ package org.sopt.official.feature.fortune.feature.fortuneAmulet import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import org.sopt.official.designsystem.SoptTheme import org.sopt.official.feature.fortune.component.CircleShapeBorderButton import org.sopt.official.feature.fortune.component.UrlImage @Composable internal fun FortuneAmuletRoute( - paddingValue: PaddingValues, navigateToHome: () -> Unit, + viewModel: FortuneAmuletViewModel = hiltViewModel(), ) { - FortuneAmuletScreen( - paddingValue = paddingValue, - navigateToHome = navigateToHome - ) + val state by viewModel.state.collectAsStateWithLifecycle() + + when { + state.isLoading -> { + // Loading View + } + + state.isFailure -> { + // Error View + } + + else -> { + FortuneAmuletScreen( + description = state.description, + name = state.name, + imageColor = state.imageColor, + imageUrl = state.imageUrl, + navigateToHome = navigateToHome + ) + } + } } @Composable private fun FortuneAmuletScreen( - paddingValue: PaddingValues, + description: String, + name: String, + imageColor: Color, + imageUrl: String, navigateToHome: () -> Unit, ) { Column( modifier = Modifier - .padding(paddingValue) .fillMaxSize() .background(SoptTheme.colors.background), horizontalAlignment = Alignment.CenterHorizontally @@ -71,7 +93,7 @@ private fun FortuneAmuletScreen( Spacer(modifier = Modifier.height(12.dp)) Text( - text = "어려움을 전부 극복할", // 서버에서 받아온 텍스트 + text = description, style = SoptTheme.typography.title16SB, color = SoptTheme.colors.onSurface300, ) @@ -80,8 +102,8 @@ private fun FortuneAmuletScreen( Text( text = buildAnnotatedString { - withStyle(style = SpanStyle(color = SoptTheme.colors.attention /* 서버에서 받아온 색상 */)) { - append("해결부적") // 서버에서 받아온 텍스트 + withStyle(style = SpanStyle(color = imageColor)) { + append(name) } withStyle(style = SpanStyle(color = SoptTheme.colors.onBackground)) { append("이 왔솝") @@ -92,11 +114,11 @@ private fun FortuneAmuletScreen( Spacer(modifier = Modifier.height(34.dp)) UrlImage( - url = "https://어쩌구저쩌구/test_fortune_card.png", // 서버에서 받아온 이미지 + url = imageUrl, contentDescription = null, modifier = Modifier .padding(horizontal = 33.dp) - .fillMaxHeight(0.55f) + .fillMaxWidth() ) Spacer(modifier = Modifier.weight(1f)) @@ -122,7 +144,10 @@ private fun FortuneAmuletScreen( fun PreviewFortuneAmuletScreen() { SoptTheme { FortuneAmuletScreen( - paddingValue = PaddingValues(16.dp), + description = "배고픔을 전부 극복할", + name = "맛집부적", + imageColor = Color.Blue, + imageUrl = "https://sopt-makers.s3.ap-northeast-2.amazonaws.com/mainpage/makers-app-img/test_fortune_card.png", navigateToHome = {} ) } From ec88717e5be0cfe3a7cc30b353ff01ae9f59ea39 Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sat, 28 Sep 2024 01:36:28 +0900 Subject: [PATCH 28/66] feature #875: delete paddingValue --- .../org/sopt/official/feature/fortune/FoundationScreen.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt index cb155d8f6..3d9f2aefa 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt @@ -37,10 +37,10 @@ import androidx.navigation.compose.NavHost import androidx.navigation.compose.rememberNavController import org.sopt.official.designsystem.SoptTheme import org.sopt.official.feature.fortune.component.FortuneTopBar -import org.sopt.official.feature.fortune.feature.fortuneDetail.navigation.FortuneDetail -import org.sopt.official.feature.fortune.feature.fortuneDetail.navigation.fortuneDetailNavGraph import org.sopt.official.feature.fortune.feature.fortuneAmulet.navigation.FortuneAmulet import org.sopt.official.feature.fortune.feature.fortuneAmulet.navigation.fortuneAmuletNavGraph +import org.sopt.official.feature.fortune.feature.fortuneDetail.navigation.FortuneDetail +import org.sopt.official.feature.fortune.feature.fortuneDetail.navigation.fortuneDetailNavGraph import org.sopt.official.feature.fortune.feature.home.navigation.Home import org.sopt.official.feature.fortune.feature.home.navigation.homeNavGraph @@ -67,7 +67,6 @@ fun FoundationScreen( startDestination = Home ) { homeNavGraph( - paddingValue = paddingValue, navigateToFortuneDetail = { date -> navController.navigate(FortuneDetail(date)) } @@ -81,7 +80,6 @@ fun FoundationScreen( ) fortuneAmuletNavGraph( - paddingValue = paddingValue, navigateToHome = { // TODO: Navigate to Home } From 4ae718eea62059ab19bf16c86cd122747806b722 Mon Sep 17 00:00:00 2001 From: s9hn Date: Sat, 28 Sep 2024 04:02:04 +0900 Subject: [PATCH 29/66] =?UTF-8?q?feat:=20=EC=98=A4=EB=8A=98=20=EB=B6=80?= =?UTF-8?q?=EC=A0=81=20=EB=B0=9B=EA=B8=B0=20=EB=B2=84=ED=8A=BC=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 --- .../fortuneDetail/FortuneDetailScreen.kt | 9 +++- .../component/FortuneDetailBox.kt | 1 - .../component/FortuneDetailButton.kt | 50 +++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailButton.kt diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index 25b25f2b5..6785e5633 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -36,6 +36,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.SoptTheme +import org.sopt.official.feature.fortune.feature.fortuneDetail.component.FortuneDetailButton import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeRecommendationDashboard import org.sopt.official.feature.fortune.feature.fortuneDetail.component.TodayFortuneDashboard import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState @@ -59,7 +60,8 @@ internal fun FortuneDetailScreen( horizontalAlignment = Alignment.CenterHorizontally, modifier = modifier .fillMaxSize() - .padding(paddingValues = paddingValue), + .padding(paddingValues = paddingValue) + .padding(horizontal = 20.dp), ) { Spacer(modifier = Modifier.height(height = 16.dp)) when (uiState) { @@ -75,6 +77,11 @@ internal fun FortuneDetailScreen( userDescription = uiState.userInfo.userDescription, onPokeClick = { onPokeClick(uiState.userInfo.userId) }, ) + Spacer(modifier = Modifier.weight(1f)) + FortuneDetailButton( + onButtonClick = onFortuneAmuletClick, + buttonTitle = "오늘의 부적 받기" + ) } is Error -> Timber.e(uiState.errorMessage) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt index d250065d5..36ea94200 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt @@ -23,7 +23,6 @@ internal fun TodayFortuneBox( contentAlignment = Alignment.Center, modifier = modifier .fillMaxWidth() - .padding(horizontal = 20.dp) .background( color = Gray700, shape = RoundedCornerShape(12.dp), diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailButton.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailButton.kt new file mode 100644 index 000000000..f19efba86 --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailButton.kt @@ -0,0 +1,50 @@ +package org.sopt.official.feature.fortune.feature.fortuneDetail.component + +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.sopt.official.designsystem.Black +import org.sopt.official.designsystem.SoptTheme +import org.sopt.official.designsystem.White + +@Composable +internal fun FortuneDetailButton( + onButtonClick: () -> Unit, + buttonTitle: String, + modifier: Modifier = Modifier, +) { + Button( + onClick = onButtonClick, + shape = RoundedCornerShape(size = 12.dp), + colors = ButtonDefaults.buttonColors(containerColor = White), + modifier = modifier.fillMaxWidth() + ) { + Text( + text = buttonTitle, + style = SoptTheme.typography.label18SB, + color = Black, + modifier = Modifier.padding( + horizontal = 94.dp, + vertical = 16.dp, + ) + ) + } +} + +@Preview(showBackground = true) +@Composable +private fun FortuneDetailButtonPreview() { + SoptTheme { + FortuneDetailButton( + onButtonClick = { }, + buttonTitle = "오늘 부적", + ) + } +} From a63646615ee697381e877ff7958c620995dc9fff Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sat, 28 Sep 2024 13:32:17 +0900 Subject: [PATCH 30/66] feature #875: change function name --- .../official/feature/fortune/feature/home/HomeScreen.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt index ae3c3ce35..df7f396d4 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt @@ -56,7 +56,7 @@ import java.util.Locale internal fun HomeRoute( navigateToFortuneDetail: (String) -> Unit, ) { - val date = rememberSaveable { getTodayInfo() } + val date = rememberSaveable { getToday() } HomeScreen( date = date, @@ -134,7 +134,7 @@ private fun HomeScreen( } } -fun getTodayInfo(): String { +fun getToday(): String { val today = LocalDate.now() val monthDay = today.format(DateTimeFormatter.ofPattern("M월 d일")) @@ -151,7 +151,7 @@ fun getTodayInfo(): String { fun HomeScreenPreview() { SoptTheme { HomeScreen( - date = getTodayInfo() + date = getToday() ) } } From e12c74921cd2fb1d7c388bc0003a171ce4a95dde Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sat, 28 Sep 2024 13:48:12 +0900 Subject: [PATCH 31/66] feature #875: apply typealias --- .../fortuneAmulet/FortuneAmuletViewModel.kt | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletViewModel.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletViewModel.kt index 1f640d9a7..72e339ecb 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletViewModel.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletViewModel.kt @@ -12,6 +12,8 @@ import kotlinx.coroutines.launch import org.sopt.official.domain.fortune.usecase.GetTodayFortuneCardUseCase import javax.inject.Inject +typealias GraphicColor = android.graphics.Color + @HiltViewModel internal class FortuneAmuletViewModel @Inject constructor( getTodayFortuneCardUseCase: GetTodayFortuneCardUseCase, @@ -40,13 +42,9 @@ internal class FortuneAmuletViewModel @Inject constructor( } } - private fun parseColor(colorCode: String): Color { - val color: Color = try { - Color(android.graphics.Color.parseColor(colorCode)) - } catch (e: IllegalArgumentException) { - Color.White - } - - return color + private fun parseColor(colorCode: String): Color = try { + Color(GraphicColor.parseColor(colorCode)) + } catch (e: IllegalArgumentException) { + Color.White } } From b7c1897dfc98e8b48c60652d0c64ac7e48e3e079 Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sat, 28 Sep 2024 14:25:18 +0900 Subject: [PATCH 32/66] feature #875: apply slot for amuletDescription --- .../fortuneAmulet/FortuneAmuletScreen.kt | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt index 980004de0..b7592f592 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt @@ -26,6 +26,7 @@ package org.sopt.official.feature.fortune.feature.fortuneAmulet import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -67,8 +68,19 @@ internal fun FortuneAmuletRoute( else -> { FortuneAmuletScreen( description = state.description, - name = state.name, - imageColor = state.imageColor, + amuletDescription = { + Text( + text = buildAnnotatedString { + withStyle(style = SpanStyle(color = state.imageColor)) { + append(state.name) + } + withStyle(style = SpanStyle(color = SoptTheme.colors.onBackground)) { + append("이 왔솝") + } + }, + style = SoptTheme.typography.heading28B, + ) + }, imageUrl = state.imageUrl, navigateToHome = navigateToHome ) @@ -79,8 +91,7 @@ internal fun FortuneAmuletRoute( @Composable private fun FortuneAmuletScreen( description: String, - name: String, - imageColor: Color, + amuletDescription: @Composable ColumnScope.() -> Unit, imageUrl: String, navigateToHome: () -> Unit, ) { @@ -100,17 +111,8 @@ private fun FortuneAmuletScreen( Spacer(modifier = Modifier.height(2.dp)) - Text( - text = buildAnnotatedString { - withStyle(style = SpanStyle(color = imageColor)) { - append(name) - } - withStyle(style = SpanStyle(color = SoptTheme.colors.onBackground)) { - append("이 왔솝") - } - }, - style = SoptTheme.typography.heading28B, - ) + amuletDescription() + Spacer(modifier = Modifier.height(34.dp)) UrlImage( @@ -145,8 +147,19 @@ fun PreviewFortuneAmuletScreen() { SoptTheme { FortuneAmuletScreen( description = "배고픔을 전부 극복할", - name = "맛집부적", - imageColor = Color.Blue, + amuletDescription = { + Text( + text = buildAnnotatedString { + withStyle(style = SpanStyle(color = Color.Red)) { + append("포만감") + } + withStyle(style = SpanStyle(color = Color.White)) { + append("이 왔솝") + } + }, + style = SoptTheme.typography.heading28B, + ) + }, imageUrl = "https://sopt-makers.s3.ap-northeast-2.amazonaws.com/mainpage/makers-app-img/test_fortune_card.png", navigateToHome = {} ) From 82bc6b82dac8e20a6bf92db0ce77778a8ceccd79 Mon Sep 17 00:00:00 2001 From: s9hn Date: Sat, 28 Sep 2024 17:53:39 +0900 Subject: [PATCH 33/66] =?UTF-8?q?feat:=20=EC=BD=95=20=EC=B0=8C=EB=A5=B4?= =?UTF-8?q?=EA=B8=B0=20=EB=B0=94=ED=85=80=EC=8B=9C=ED=8A=B8=20UI=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortuneDetail/FortuneDetailRoute.kt | 25 +++- .../component/PokeMessageBottomSheet.kt | 117 ++++++++++++++++++ .../component/PokeMessageItem.kt | 57 +++++++++ .../src/main/res/drawable/ic_checkbox_off.xml | 9 ++ .../src/main/res/drawable/ic_checkbox_on.xml | 16 +++ 5 files changed, 223 insertions(+), 1 deletion(-) create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt create mode 100644 feature/fortune/src/main/res/drawable/ic_checkbox_off.xml create mode 100644 feature/fortune/src/main/res/drawable/ic_checkbox_on.xml diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index dfcc96dc8..1363d9d41 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -1,11 +1,20 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.foundation.interaction.collectIsPressedAsState import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle +import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeMessageBottomSheetScreen +@OptIn(ExperimentalMaterial3Api::class) @Composable internal fun FortuneDetailRoute( paddingValue: PaddingValues, @@ -14,12 +23,26 @@ internal fun FortuneDetailRoute( viewModel: FortuneDetailViewModel = hiltViewModel(), ) { val uiState by viewModel.uiState.collectAsStateWithLifecycle() + val interactionSource = remember { MutableInteractionSource() } + val isPressed by interactionSource.collectIsPressedAsState() + var showBottomSheet by remember { mutableStateOf(false) } + val bottomSheetState = rememberModalBottomSheetState(confirmValueChange = { false }) + + if (showBottomSheet) { + PokeMessageBottomSheetScreen( + sheetState = bottomSheetState, + onDismissRequest = {}, + isPressed = isPressed, + selectedIndex = 3, + onItemClick = {}, + ) + } FortuneDetailScreen( paddingValue = paddingValue, date = date, onFortuneAmuletClick = onFortuneAmuletClick, - onPokeClick = {}, + onPokeClick = { showBottomSheet = !showBottomSheet }, uiState = uiState, ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt new file mode 100644 index 000000000..461ba027d --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt @@ -0,0 +1,117 @@ +package org.sopt.official.feature.fortune.feature.fortuneDetail.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.itemsIndexed +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.ModalBottomSheet +import androidx.compose.material3.SheetState +import androidx.compose.material3.Text +import androidx.compose.material3.rememberModalBottomSheetState +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.sopt.official.designsystem.Gray10 +import org.sopt.official.designsystem.Gray30 +import org.sopt.official.designsystem.Gray800 +import org.sopt.official.designsystem.SoptTheme +import org.sopt.official.feature.fortune.R.drawable.ic_checkbox_off +import org.sopt.official.feature.fortune.R.drawable.ic_checkbox_on + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +internal fun PokeMessageBottomSheetScreen( + sheetState: SheetState, + onDismissRequest: () -> Unit, + isPressed: Boolean, + selectedIndex: Int, + onItemClick: (selectedIndex: Int) -> Unit, + modifier: Modifier = Modifier, +) { + ModalBottomSheet( + containerColor = Gray800, + sheetState = sheetState, + onDismissRequest = onDismissRequest, + dragHandle = null, + ) { + Column( + modifier = modifier.fillMaxWidth() + .padding(horizontal = 20.dp) + .padding(top = 24.dp, bottom = 12.dp) + .background(color = Gray800), + ) { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween, + modifier = Modifier.fillMaxWidth() + ) { + Text( + text = "함께 보낼 메시지를 선택해주세요", + style = SoptTheme.typography.heading20B, + color = Gray30, + ) + Spacer(modifier = Modifier.weight(weight = 1f)) + Icon( + painter = if (isPressed) painterResource(id = ic_checkbox_on) else painterResource(ic_checkbox_off), + contentDescription = "익명 체크박스" + ) + Spacer(modifier = Modifier.width(width = 8.dp)) + Text( + text = "익명", + style = SoptTheme.typography.title16SB, + color = Gray10, + ) + } + Spacer(modifier = Modifier.height(height = 12.dp)) + LazyColumn( + contentPadding = PaddingValues(vertical = 4.dp), + ) { + val messages = listOf( + "안녕하세요? I AM 35기에요", + "친해지고 싶어서 DM 드려요 ^^~", + "이야기 해보고 싶었어요!!", + "모각작 하실래요?", + "콕 \uD83D\uDC48", + ) + + itemsIndexed(messages) { index, message -> + PokeMessageItem( + message = message, + isSelected = index == selectedIndex, + onItemClick = { onItemClick(index) }, + ) + } + } + } + } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Preview +@Composable +private fun PokeMessageBottomSheetScreenPreview() { + SoptTheme { + PokeMessageBottomSheetScreen( + sheetState = rememberModalBottomSheetState( + confirmValueChange = { true }, + ), + onDismissRequest = { }, + isPressed = false, + selectedIndex = 0, + onItemClick = { }, + ) + } +} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt new file mode 100644 index 000000000..76e6e4fc3 --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt @@ -0,0 +1,57 @@ +package org.sopt.official.feature.fortune.feature.fortuneDetail.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.sopt.official.designsystem.Gray10 +import org.sopt.official.designsystem.Gray700 +import org.sopt.official.designsystem.Gray800 +import org.sopt.official.designsystem.SoptTheme + +@Composable +internal fun PokeMessageItem( + message: String, + isSelected: Boolean, + onItemClick: () -> Unit, + modifier: Modifier = Modifier, +) { + Box( + modifier = modifier + .fillMaxWidth() + .background( + color = if (isSelected) Gray700 else Gray800, + shape = RoundedCornerShape(size = 6.dp), + ) + .clickable { onItemClick() }, + ) { + Text( + text = message, + style = SoptTheme.typography.body16M, + color = Gray10, + modifier = Modifier + .padding(vertical = 12.dp) + .padding(horizontal = 8.dp), + ) + } +} + +@Preview(showBackground = true) +@Composable +private fun PokeMessageItemPreview() { + SoptTheme { + PokeMessageItem( + message = "123", + isSelected = true, + onItemClick = { }, + ) + } +} + diff --git a/feature/fortune/src/main/res/drawable/ic_checkbox_off.xml b/feature/fortune/src/main/res/drawable/ic_checkbox_off.xml new file mode 100644 index 000000000..1c24380c3 --- /dev/null +++ b/feature/fortune/src/main/res/drawable/ic_checkbox_off.xml @@ -0,0 +1,9 @@ + + + diff --git a/feature/fortune/src/main/res/drawable/ic_checkbox_on.xml b/feature/fortune/src/main/res/drawable/ic_checkbox_on.xml new file mode 100644 index 000000000..00691e219 --- /dev/null +++ b/feature/fortune/src/main/res/drawable/ic_checkbox_on.xml @@ -0,0 +1,16 @@ + + + + From 28009d3f4aa04527fa2e3bff80293dff2f8782b5 Mon Sep 17 00:00:00 2001 From: s9hn Date: Sat, 28 Sep 2024 18:19:25 +0900 Subject: [PATCH 34/66] =?UTF-8?q?refactor:=20=ED=81=B4=EB=A6=AD=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=EB=84=88=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/fortuneDetail/FortuneDetailRoute.kt | 17 ++++++++++------- .../component/PokeMessageBottomSheet.kt | 17 +++++++++++------ .../fortuneDetail/component/PokeMessageItem.kt | 5 ++++- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index 1363d9d41..b7bc1729a 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -1,12 +1,12 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail -import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.interaction.collectIsPressedAsState +import android.util.Log import androidx.compose.foundation.layout.PaddingValues import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @@ -23,18 +23,21 @@ internal fun FortuneDetailRoute( viewModel: FortuneDetailViewModel = hiltViewModel(), ) { val uiState by viewModel.uiState.collectAsStateWithLifecycle() - val interactionSource = remember { MutableInteractionSource() } - val isPressed by interactionSource.collectIsPressedAsState() + var isSelected by remember { mutableStateOf(false) } var showBottomSheet by remember { mutableStateOf(false) } + var selectedIndex by remember { mutableIntStateOf(-1) } val bottomSheetState = rememberModalBottomSheetState(confirmValueChange = { false }) if (showBottomSheet) { PokeMessageBottomSheetScreen( sheetState = bottomSheetState, onDismissRequest = {}, - isPressed = isPressed, - selectedIndex = 3, - onItemClick = {}, + isSelected = isSelected, + selectedIndex = selectedIndex, + onItemClick = { newSelectedIndex -> + selectedIndex = newSelectedIndex + }, + onIconClick = { isSelected = !isSelected }, ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt index 461ba027d..ab224ffcf 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt @@ -1,6 +1,8 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail.component +import androidx.compose.foundation.Image import androidx.compose.foundation.background +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues @@ -13,7 +15,6 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Icon import androidx.compose.material3.ModalBottomSheet import androidx.compose.material3.SheetState import androidx.compose.material3.Text @@ -36,9 +37,10 @@ import org.sopt.official.feature.fortune.R.drawable.ic_checkbox_on internal fun PokeMessageBottomSheetScreen( sheetState: SheetState, onDismissRequest: () -> Unit, - isPressed: Boolean, + isSelected: Boolean, selectedIndex: Int, onItemClick: (selectedIndex: Int) -> Unit, + onIconClick: () -> Unit, modifier: Modifier = Modifier, ) { ModalBottomSheet( @@ -64,9 +66,11 @@ internal fun PokeMessageBottomSheetScreen( color = Gray30, ) Spacer(modifier = Modifier.weight(weight = 1f)) - Icon( - painter = if (isPressed) painterResource(id = ic_checkbox_on) else painterResource(ic_checkbox_off), - contentDescription = "익명 체크박스" + Image( + painter = if (isSelected) painterResource(id = ic_checkbox_on) + else painterResource(id = ic_checkbox_off), + contentDescription = "익명 체크박스", + modifier = Modifier.clickable { onIconClick() } ) Spacer(modifier = Modifier.width(width = 8.dp)) Text( @@ -109,9 +113,10 @@ private fun PokeMessageBottomSheetScreenPreview() { confirmValueChange = { true }, ), onDismissRequest = { }, - isPressed = false, + isSelected = false, selectedIndex = 0, onItemClick = { }, + onIconClick = { }, ) } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt index 76e6e4fc3..3b5aacbd7 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt @@ -30,7 +30,10 @@ internal fun PokeMessageItem( color = if (isSelected) Gray700 else Gray800, shape = RoundedCornerShape(size = 6.dp), ) - .clickable { onItemClick() }, + .clickable( + indication = null, + interactionSource = null, + ) { onItemClick() }, ) { Text( text = message, From af5b4371b3a4ab54aca631914cd7afdc780e76c2 Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sat, 28 Sep 2024 18:25:47 +0900 Subject: [PATCH 35/66] feature #875: connect navigation --- .../feature/fortune/FortuneActivity.kt | 19 ++++++++++++++++++- .../feature/fortune/FoundationScreen.kt | 17 ++++++++++------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt index b488d9946..81fb42b11 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt @@ -30,8 +30,18 @@ import android.os.Bundle import androidx.activity.compose.setContent import androidx.appcompat.app.AppCompatActivity import dagger.hilt.android.AndroidEntryPoint +import dagger.hilt.android.EntryPointAccessors +import org.sopt.official.common.context.appContext +import org.sopt.official.common.navigator.NavigatorEntryPoint import org.sopt.official.designsystem.SoptTheme +private val navigator by lazy { + EntryPointAccessors.fromApplication( + appContext, + NavigatorEntryPoint::class.java + ).navigatorProvider() +} + @AndroidEntryPoint class FortuneActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { @@ -39,7 +49,14 @@ class FortuneActivity : AppCompatActivity() { setContent { SoptTheme { - FoundationScreen() + FoundationScreen( + navigateToNotification = { + startActivity(navigator.getNotificationActivityIntent()) + }, + navigateToHome = { + startActivity(navigator.getAuthActivityIntent()) + }, + ) } } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt index 3d9f2aefa..14108e739 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt @@ -46,14 +46,16 @@ import org.sopt.official.feature.fortune.feature.home.navigation.homeNavGraph @Composable fun FoundationScreen( + navigateToNotification: () -> Unit, + navigateToHome: () -> Unit, navController: NavHostController = rememberNavController(), ) { Scaffold( modifier = Modifier.fillMaxSize(), topBar = { - FortuneTopBar { - // TODO: Navigate to NotificationActivity - } + FortuneTopBar( + onClickNavigationIcon = navigateToNotification + ) }, content = { paddingValue -> Box( @@ -80,9 +82,7 @@ fun FoundationScreen( ) fortuneAmuletNavGraph( - navigateToHome = { - // TODO: Navigate to Home - } + navigateToHome = navigateToHome ) } } @@ -94,6 +94,9 @@ fun FoundationScreen( @Composable fun FoundationScreenPreview() { SoptTheme { - FoundationScreen() + FoundationScreen( + navigateToNotification = {}, + navigateToHome = {} + ) } } From 712a7702c3e2e0a570e420d439ee6dafa6b31a2b Mon Sep 17 00:00:00 2001 From: s9hn Date: Sat, 28 Sep 2024 18:38:41 +0900 Subject: [PATCH 36/66] =?UTF-8?q?feat:=20=EC=BD=95=20=EC=B0=8C=EB=A5=B4?= =?UTF-8?q?=EA=B8=B0=20=EC=84=9C=EB=B2=84=ED=86=B5=EC=8B=A0=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 --- .../fortuneDetail/FortuneDetailRoute.kt | 16 +++++++---- .../fortuneDetail/FortuneDetailViewModel.kt | 28 +++++++++++++++---- .../component/PokeMessageBottomSheet.kt | 6 ++-- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index b7bc1729a..9334e0256 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -1,6 +1,5 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail -import android.util.Log import androidx.compose.foundation.layout.PaddingValues import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.rememberModalBottomSheetState @@ -9,9 +8,11 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle +import kotlinx.coroutines.launch import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeMessageBottomSheetScreen @OptIn(ExperimentalMaterial3Api::class) @@ -27,15 +28,20 @@ internal fun FortuneDetailRoute( var showBottomSheet by remember { mutableStateOf(false) } var selectedIndex by remember { mutableIntStateOf(-1) } val bottomSheetState = rememberModalBottomSheetState(confirmValueChange = { false }) + val scope = rememberCoroutineScope() if (showBottomSheet) { PokeMessageBottomSheetScreen( sheetState = bottomSheetState, - onDismissRequest = {}, + onDismissRequest = { showBottomSheet = false }, isSelected = isSelected, selectedIndex = selectedIndex, - onItemClick = { newSelectedIndex -> - selectedIndex = newSelectedIndex + onItemClick = { newSelectedIndex, message -> + scope.launch { + selectedIndex = newSelectedIndex + viewModel.poke(message) + showBottomSheet = false + } }, onIconClick = { isSelected = !isSelected }, ) @@ -45,7 +51,7 @@ internal fun FortuneDetailRoute( paddingValue = paddingValue, date = date, onFortuneAmuletClick = onFortuneAmuletClick, - onPokeClick = { showBottomSheet = !showBottomSheet }, + onPokeClick = { showBottomSheet = true }, uiState = uiState, ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt index 7f82bc1d9..80e003156 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt @@ -31,6 +31,9 @@ internal class FortuneDetailViewModel @Inject constructor( private val _uiState: MutableStateFlow = MutableStateFlow(Loading) val uiState: StateFlow get() = _uiState.asStateFlow() + private var isAnonymous: Boolean = false + private var userId = -1 + init { viewModelScope.launch { runCatching { @@ -43,10 +46,9 @@ internal class FortuneDetailViewModel @Inject constructor( }.onSuccess { result -> val todayFortune = result[0] as TodayFortuneWord val pokeUser = result[1] as GetOnboardingPokeUserListResponse - + val user = pokeUser.data?.randomInfoList?.get(0)?.userInfoList?.get(0) ?: throw IllegalArgumentException() + userId = user.userId _uiState.update { - val user = pokeUser.data?.randomInfoList?.get(0)?.userInfoList?.get(0) ?: throw IllegalArgumentException() - Success( todaySentence = TodaySentence( userName = todayFortune.userName, @@ -62,9 +64,23 @@ internal class FortuneDetailViewModel @Inject constructor( ) } }.onFailure { error -> - _uiState.update { - Error(error) - } + _uiState.update { Error(error) } + } + } + } + + fun poke(message: String) { + viewModelScope.launch { + runCatching { + pokeRepository.pokeUser( + userId = userId, + isAnonymous = isAnonymous, + message = message + ) + }.onSuccess { + _uiState.update { uiState.value as Success } + }.onFailure { error -> + _uiState.update { Error(error) } } } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt index ab224ffcf..7d636d896 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt @@ -39,7 +39,7 @@ internal fun PokeMessageBottomSheetScreen( onDismissRequest: () -> Unit, isSelected: Boolean, selectedIndex: Int, - onItemClick: (selectedIndex: Int) -> Unit, + onItemClick: (selectedIndex: Int, message: String) -> Unit, onIconClick: () -> Unit, modifier: Modifier = Modifier, ) { @@ -95,7 +95,7 @@ internal fun PokeMessageBottomSheetScreen( PokeMessageItem( message = message, isSelected = index == selectedIndex, - onItemClick = { onItemClick(index) }, + onItemClick = { onItemClick(index, message) }, ) } } @@ -115,7 +115,7 @@ private fun PokeMessageBottomSheetScreenPreview() { onDismissRequest = { }, isSelected = false, selectedIndex = 0, - onItemClick = { }, + onItemClick = { _, _ -> }, onIconClick = { }, ) } From ec46f95ca3c7bb1558552b93ee3d8ee2641dc8ff Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sun, 29 Sep 2024 01:24:22 +0900 Subject: [PATCH 37/66] feature #875: connect navigator with DeepLink --- .../navigator/NavigatorProviderIntent.kt | 73 +++++----- .../official/common/navigator/DeepLinkType.kt | 131 ++++++++++-------- .../common/navigator/NavigatorProvider.kt | 33 ++--- 3 files changed, 127 insertions(+), 110 deletions(-) diff --git a/app/src/main/java/org/sopt/official/feature/navigator/NavigatorProviderIntent.kt b/app/src/main/java/org/sopt/official/feature/navigator/NavigatorProviderIntent.kt index c0ce58b88..2879ce8ae 100644 --- a/app/src/main/java/org/sopt/official/feature/navigator/NavigatorProviderIntent.kt +++ b/app/src/main/java/org/sopt/official/feature/navigator/NavigatorProviderIntent.kt @@ -33,6 +33,7 @@ import org.sopt.official.common.navigator.DeepLinkType import org.sopt.official.common.navigator.NavigatorProvider import org.sopt.official.feature.attendance.AttendanceActivity import org.sopt.official.feature.auth.AuthActivity +import org.sopt.official.feature.fortune.FortuneActivity import org.sopt.official.feature.home.HomeActivity import org.sopt.official.feature.mypage.mypage.MyPageActivity import org.sopt.official.feature.notification.SchemeActivity @@ -43,48 +44,50 @@ import org.sopt.official.stamp.SoptampActivity import javax.inject.Inject class NavigatorProviderIntent @Inject constructor( - @ApplicationContext private val context: Context + @ApplicationContext private val context: Context, ) : NavigatorProvider { - override fun getAuthActivityIntent(): Intent = AuthActivity.newInstance(context) - override fun getNotificationActivityIntent() = NotificationActivity.newInstance(context) - override fun getNotificationDetailActivityIntent(notificationId: String) = NotificationDetailActivity.getIntent( - context, - notificationId - ) + override fun getAuthActivityIntent(): Intent = AuthActivity.newInstance(context) + override fun getNotificationActivityIntent() = NotificationActivity.newInstance(context) + override fun getNotificationDetailActivityIntent(notificationId: String) = NotificationDetailActivity.getIntent( + context, + notificationId + ) + + override fun getMyPageActivityIntent(name: String) = MyPageActivity.getIntent( + context, + MyPageActivity.StartArgs(UserActiveState.valueOf(name)) + ) - override fun getMyPageActivityIntent(name: String) = MyPageActivity.getIntent( - context, - MyPageActivity.StartArgs(UserActiveState.valueOf(name)) - ) + override fun getAttendanceActivityIntent() = AttendanceActivity.newInstance(context) - override fun getAttendanceActivityIntent() = AttendanceActivity.newInstance(context) + override fun getSoptampActivityIntent() = SoptampActivity.getIntent(context) - override fun getSoptampActivityIntent() = SoptampActivity.getIntent(context) + override fun getPokeNotificationActivityIntent(name: String) = PokeNotificationActivity.getIntent( + context, + PokeNotificationActivity.Argument(name) + ) - override fun getPokeNotificationActivityIntent(name: String) = PokeNotificationActivity.getIntent( - context, - PokeNotificationActivity.Argument(name) - ) + override fun getFortuneActivityIntent(): Intent = FortuneActivity.getIntent(context) - override fun getSchemeActivityIntent( - notificationId: String, - link: String - ) = SchemeActivity.getIntent( - context, - SchemeActivity.Argument( - notificationId, - link + override fun getSchemeActivityIntent( + notificationId: String, + link: String, + ) = SchemeActivity.getIntent( + context, + SchemeActivity.Argument( + notificationId, + link + ) ) - ) - override fun getHomeActivityIntent( - userStatus: UserStatus, - deepLinkType: DeepLinkType? - ) = HomeActivity.getIntent( - context, - HomeActivity.StartArgs( - userStatus, - deepLinkType + override fun getHomeActivityIntent( + userStatus: UserStatus, + deepLinkType: DeepLinkType?, + ) = HomeActivity.getIntent( + context, + HomeActivity.StartArgs( + userStatus, + deepLinkType + ) ) - ) } diff --git a/core/common/src/main/java/org/sopt/official/common/navigator/DeepLinkType.kt b/core/common/src/main/java/org/sopt/official/common/navigator/DeepLinkType.kt index aab4f064b..272a928cc 100644 --- a/core/common/src/main/java/org/sopt/official/common/navigator/DeepLinkType.kt +++ b/core/common/src/main/java/org/sopt/official/common/navigator/DeepLinkType.kt @@ -33,72 +33,85 @@ import org.sopt.official.common.util.extractQueryParameter import timber.log.Timber internal val navigator by lazy { - EntryPointAccessors.fromApplication(appContext, NavigatorEntryPoint::class.java).navigatorProvider() + EntryPointAccessors.fromApplication(appContext, NavigatorEntryPoint::class.java).navigatorProvider() } enum class DeepLinkType( - val link: String + val link: String, ) { - HOME("home") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = getHomeIntent(userStatus) - }, - NOTIFICATION_LIST("home/notification") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = userStatus.setIntent(navigator.getNotificationActivityIntent()) - }, - NOTIFICATION_DETAIL("home/notification/detail") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String): Intent { - val notificationId = deepLink.extractQueryParameter("id") - return userStatus.setIntent(navigator.getNotificationDetailActivityIntent(notificationId)) - } - }, - MY_PAGE("home/mypage") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = userStatus.setIntent(navigator.getMyPageActivityIntent(userStatus.name)) - }, - ATTENDANCE("home/attendance") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = userStatus.setIntent(navigator.getAttendanceActivityIntent()) - }, - ATTENDANCE_MODAL("home/attendance/attendance-modal") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = userStatus.setIntent(navigator.getAttendanceActivityIntent()) - }, - SOPTAMP("home/soptamp") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = userStatus.setIntent(navigator.getSoptampActivityIntent()) - }, - SOPTAMP_ENTIRE_RANKING("home/soptamp/entire-ranking") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = userStatus.setIntent(navigator.getSoptampActivityIntent()) - }, - SOPTAMP_CURRENT_GENERATION_RANKING("home/soptamp/current-generation-ranking") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = userStatus.setIntent(navigator.getSoptampActivityIntent()) - }, - POKE_NOTIFICATION_LIST("home/poke/notification-list") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = userStatus.setIntent(navigator.getPokeNotificationActivityIntent(userStatus.name)) - }, - UNKNOWN("unknown-deep-link") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = getHomeIntent(userStatus, UNKNOWN) - }, - EXPIRED("expired") { - override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = getHomeIntent(userStatus, EXPIRED) - }; + HOME("home") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = getHomeIntent(userStatus) + }, + NOTIFICATION_LIST("home/notification") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = + userStatus.setIntent(navigator.getNotificationActivityIntent()) + }, + NOTIFICATION_DETAIL("home/notification/detail") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String): Intent { + val notificationId = deepLink.extractQueryParameter("id") + return userStatus.setIntent(navigator.getNotificationDetailActivityIntent(notificationId)) + } + }, + MY_PAGE("home/mypage") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = + userStatus.setIntent(navigator.getMyPageActivityIntent(userStatus.name)) + }, + ATTENDANCE("home/attendance") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = + userStatus.setIntent(navigator.getAttendanceActivityIntent()) + }, + ATTENDANCE_MODAL("home/attendance/attendance-modal") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = + userStatus.setIntent(navigator.getAttendanceActivityIntent()) + }, + SOPTAMP("home/soptamp") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = + userStatus.setIntent(navigator.getSoptampActivityIntent()) + }, + SOPTAMP_ENTIRE_RANKING("home/soptamp/entire-ranking") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = + userStatus.setIntent(navigator.getSoptampActivityIntent()) + }, + SOPTAMP_CURRENT_GENERATION_RANKING("home/soptamp/current-generation-ranking") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = + userStatus.setIntent(navigator.getSoptampActivityIntent()) + }, + POKE_NOTIFICATION_LIST("home/poke/notification-list") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = + userStatus.setIntent(navigator.getPokeNotificationActivityIntent(userStatus.name)) + }, + FORTUNE("home/fortune") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = + userStatus.setIntent(navigator.getFortuneActivityIntent()) + }, + UNKNOWN("unknown-deep-link") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = getHomeIntent(userStatus, UNKNOWN) + }, + EXPIRED("expired") { + override fun getIntent(context: Context, userStatus: UserStatus, deepLink: String) = getHomeIntent(userStatus, EXPIRED) + }; - abstract fun getIntent(context: Context, userStatus: UserStatus, deepLink: String): Intent + abstract fun getIntent(context: Context, userStatus: UserStatus, deepLink: String): Intent - companion object { - private fun UserStatus.setIntent(intent: Intent): Intent { - return when (this == UserStatus.UNAUTHENTICATED) { - true -> navigator.getAuthActivityIntent() - false -> intent - } - } + companion object { + private fun UserStatus.setIntent(intent: Intent): Intent { + return when (this == UserStatus.UNAUTHENTICATED) { + true -> navigator.getAuthActivityIntent() + false -> intent + } + } - fun getHomeIntent(userStatus: UserStatus, deepLinkType: DeepLinkType? = null) = userStatus.setIntent(navigator.getHomeActivityIntent(userStatus, deepLinkType)) + fun getHomeIntent(userStatus: UserStatus, deepLinkType: DeepLinkType? = null) = + userStatus.setIntent(navigator.getHomeActivityIntent(userStatus, deepLinkType)) - fun of(deepLink: String): DeepLinkType { - return try { - val link = deepLink.split("?")[0] - entries.find { it.link == link } ?: UNKNOWN - } catch (exception: Exception) { - Timber.e(exception) - UNKNOWN - } + fun of(deepLink: String): DeepLinkType { + return try { + val link = deepLink.split("?")[0] + entries.find { it.link == link } ?: UNKNOWN + } catch (exception: Exception) { + Timber.e(exception) + UNKNOWN + } + } } - } } diff --git a/core/common/src/main/java/org/sopt/official/common/navigator/NavigatorProvider.kt b/core/common/src/main/java/org/sopt/official/common/navigator/NavigatorProvider.kt index 399c4d02a..f7c2a6086 100644 --- a/core/common/src/main/java/org/sopt/official/common/navigator/NavigatorProvider.kt +++ b/core/common/src/main/java/org/sopt/official/common/navigator/NavigatorProvider.kt @@ -31,26 +31,27 @@ import dagger.hilt.components.SingletonComponent import org.sopt.official.auth.model.UserStatus interface NavigatorProvider { - fun getAuthActivityIntent(): Intent - fun getNotificationActivityIntent(): Intent - fun getNotificationDetailActivityIntent(notificationId: String): Intent - fun getMyPageActivityIntent(name: String): Intent - fun getAttendanceActivityIntent(): Intent - fun getSoptampActivityIntent(): Intent - fun getPokeNotificationActivityIntent(name: String): Intent - fun getHomeActivityIntent( - userStatus: UserStatus, - deepLinkType: DeepLinkType? - ): Intent + fun getAuthActivityIntent(): Intent + fun getNotificationActivityIntent(): Intent + fun getNotificationDetailActivityIntent(notificationId: String): Intent + fun getMyPageActivityIntent(name: String): Intent + fun getAttendanceActivityIntent(): Intent + fun getSoptampActivityIntent(): Intent + fun getPokeNotificationActivityIntent(name: String): Intent + fun getFortuneActivityIntent(): Intent + fun getHomeActivityIntent( + userStatus: UserStatus, + deepLinkType: DeepLinkType?, + ): Intent - fun getSchemeActivityIntent( - notificationId: String, - link: String - ): Intent + fun getSchemeActivityIntent( + notificationId: String, + link: String, + ): Intent } @InstallIn(SingletonComponent::class) @EntryPoint interface NavigatorEntryPoint { - fun navigatorProvider(): NavigatorProvider + fun navigatorProvider(): NavigatorProvider } From a5a28a5d55718787b552abb6a3b21a67ffd8e2a4 Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sun, 29 Sep 2024 01:25:15 +0900 Subject: [PATCH 38/66] feature #875: apply finishActivity --- .../org/sopt/official/feature/fortune/FortuneActivity.kt | 4 +--- .../org/sopt/official/feature/fortune/FoundationScreen.kt | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt index 81fb42b11..26b3cf332 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt @@ -50,9 +50,7 @@ class FortuneActivity : AppCompatActivity() { setContent { SoptTheme { FoundationScreen( - navigateToNotification = { - startActivity(navigator.getNotificationActivityIntent()) - }, + finishActivity = this::finish, navigateToHome = { startActivity(navigator.getAuthActivityIntent()) }, diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt index 14108e739..3919554c4 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt @@ -46,7 +46,7 @@ import org.sopt.official.feature.fortune.feature.home.navigation.homeNavGraph @Composable fun FoundationScreen( - navigateToNotification: () -> Unit, + finishActivity: () -> Unit, navigateToHome: () -> Unit, navController: NavHostController = rememberNavController(), ) { @@ -54,7 +54,7 @@ fun FoundationScreen( modifier = Modifier.fillMaxSize(), topBar = { FortuneTopBar( - onClickNavigationIcon = navigateToNotification + onClickNavigationIcon = finishActivity ) }, content = { paddingValue -> @@ -75,7 +75,6 @@ fun FoundationScreen( ) fortuneDetailNavGraph( - paddingValue = paddingValue, navigateToFortuneAmulet = { navController.navigate(FortuneAmulet) } @@ -95,7 +94,7 @@ fun FoundationScreen( fun FoundationScreenPreview() { SoptTheme { FoundationScreen( - navigateToNotification = {}, + finishActivity = {}, navigateToHome = {} ) } From 1bec46f0a22bf81bc7d13231934b373dfad26329 Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sun, 29 Sep 2024 01:25:35 +0900 Subject: [PATCH 39/66] feature #875: apply FortuneButton component --- .../fortune/component/FortuneButton.kt | 38 +++++++++++++++++++ .../fortune/feature/home/HomeScreen.kt | 32 ++++------------ 2 files changed, 46 insertions(+), 24 deletions(-) create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt new file mode 100644 index 000000000..0017aae82 --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt @@ -0,0 +1,38 @@ +package org.sopt.official.feature.fortune.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.unit.dp +import org.sopt.official.designsystem.SoptTheme + +@Composable +fun FortuneButton( + title: String, + onClick: () -> Unit, + modifier: Modifier = Modifier, +) { + Box( + modifier = modifier + .fillMaxWidth() + .clip(RoundedCornerShape(12.dp)) + .background(SoptTheme.colors.primary) + .clickable(onClick = onClick), + contentAlignment = Alignment.Center + ) { + Text( + text = title, + style = SoptTheme.typography.label18SB, + color = SoptTheme.colors.onPrimary, + modifier = Modifier.padding(horizontal = 26.dp, vertical = 16.dp) + ) + } +} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt index df7f396d4..93e716d2f 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt @@ -26,27 +26,23 @@ package org.sopt.official.feature.fortune.feature.home import androidx.compose.foundation.Image import androidx.compose.foundation.background -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.SoptTheme import org.sopt.official.feature.fortune.R +import org.sopt.official.feature.fortune.component.FortuneButton import java.time.LocalDate import java.time.format.DateTimeFormatter import java.time.format.TextStyle @@ -74,6 +70,7 @@ private fun HomeScreen( Column( modifier = Modifier .fillMaxSize() + .padding(horizontal = 20.dp) .background(SoptTheme.colors.background), horizontalAlignment = Alignment.CenterHorizontally ) { @@ -98,8 +95,7 @@ private fun HomeScreen( Image( imageVector = ImageVector.vectorResource(id = R.drawable.img_fortune_title), contentDescription = null, - modifier = Modifier - .padding(horizontal = 45.dp) + modifier = Modifier.padding(horizontal = 25.dp) ) Spacer(modifier = Modifier.height(10.dp)) @@ -108,27 +104,15 @@ private fun HomeScreen( imageVector = ImageVector.vectorResource(id = R.drawable.img_fortune_three_cards), contentDescription = null, modifier = Modifier - .padding(horizontal = 26.dp) + .padding(horizontal = 6.dp) ) Spacer(modifier = Modifier.weight(1f)) - Box( - modifier = Modifier - .padding(horizontal = 20.dp) - .fillMaxWidth() - .clip(RoundedCornerShape(12.dp)) - .background(SoptTheme.colors.primary) - .clickable(onClick = navigateToFortuneDetail), - contentAlignment = Alignment.Center - ) { - Text( - text = "오늘의 운세 보러가기", - style = SoptTheme.typography.label18SB, - color = SoptTheme.colors.onPrimary, - modifier = Modifier.padding(horizontal = 26.dp, vertical = 16.dp) - ) - } + FortuneButton( + title = "오늘의 운세 보러 가기", + onClick = navigateToFortuneDetail, + ) Spacer(modifier = Modifier.height(36.dp)) } From e464262fa05073234616e7f115f3b0528f1eb35d Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sun, 29 Sep 2024 01:25:54 +0900 Subject: [PATCH 40/66] feature #875: add contentDescription --- .../fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt index b7592f592..1132af6fb 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt @@ -117,7 +117,7 @@ private fun FortuneAmuletScreen( UrlImage( url = imageUrl, - contentDescription = null, + contentDescription = "Fortune Amulet", modifier = Modifier .padding(horizontal = 33.dp) .fillMaxWidth() From 7328ea81988ed7d348f9586462575426c206f4de Mon Sep 17 00:00:00 2001 From: Dongmin Date: Sun, 29 Sep 2024 01:26:26 +0900 Subject: [PATCH 41/66] feature #875: apply design --- .../fortuneDetail/FortuneDetailRoute.kt | 3 -- .../fortuneDetail/FortuneDetailScreen.kt | 13 ++--- .../component/FortuneDetailButton.kt | 50 ------------------- .../component/PokeRecommendationDashboard.kt | 11 ++-- .../navigation/FortuneDetailNavGraph.kt | 2 - 5 files changed, 9 insertions(+), 70 deletions(-) delete mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailButton.kt diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index 9334e0256..0d816509d 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -1,6 +1,5 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable @@ -18,7 +17,6 @@ import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeMes @OptIn(ExperimentalMaterial3Api::class) @Composable internal fun FortuneDetailRoute( - paddingValue: PaddingValues, date: String, onFortuneAmuletClick: () -> Unit, viewModel: FortuneDetailViewModel = hiltViewModel(), @@ -48,7 +46,6 @@ internal fun FortuneDetailRoute( } FortuneDetailScreen( - paddingValue = paddingValue, date = date, onFortuneAmuletClick = onFortuneAmuletClick, onPokeClick = { showBottomSheet = true }, diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index 6785e5633..645989ca0 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -25,7 +25,6 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height @@ -36,7 +35,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.feature.fortune.feature.fortuneDetail.component.FortuneDetailButton +import org.sopt.official.feature.fortune.component.FortuneButton import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeRecommendationDashboard import org.sopt.official.feature.fortune.feature.fortuneDetail.component.TodayFortuneDashboard import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState @@ -49,7 +48,6 @@ import timber.log.Timber @Composable internal fun FortuneDetailScreen( - paddingValue: PaddingValues, date: String, onFortuneAmuletClick: () -> Unit, onPokeClick: (userId: Long) -> Unit, @@ -60,7 +58,6 @@ internal fun FortuneDetailScreen( horizontalAlignment = Alignment.CenterHorizontally, modifier = modifier .fillMaxSize() - .padding(paddingValues = paddingValue) .padding(horizontal = 20.dp), ) { Spacer(modifier = Modifier.height(height = 16.dp)) @@ -78,10 +75,11 @@ internal fun FortuneDetailScreen( onPokeClick = { onPokeClick(uiState.userInfo.userId) }, ) Spacer(modifier = Modifier.weight(1f)) - FortuneDetailButton( - onButtonClick = onFortuneAmuletClick, - buttonTitle = "오늘의 부적 받기" + FortuneButton( + title = "오늘의 부적 받기", + onClick = onFortuneAmuletClick, ) + Spacer(modifier = Modifier.height(height = 14.dp)) } is Error -> Timber.e(uiState.errorMessage) @@ -97,7 +95,6 @@ internal fun FortuneDetailScreen( private fun FortuneDetailScreenPreview() { SoptTheme { FortuneDetailScreen( - paddingValue = PaddingValues(vertical = 16.dp), date = "2024-09-09", onFortuneAmuletClick = {}, uiState = Success( diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailButton.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailButton.kt deleted file mode 100644 index f19efba86..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailButton.kt +++ /dev/null @@ -1,50 +0,0 @@ -package org.sopt.official.feature.fortune.feature.fortuneDetail.component - -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Button -import androidx.compose.material3.ButtonDefaults -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.Black -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.designsystem.White - -@Composable -internal fun FortuneDetailButton( - onButtonClick: () -> Unit, - buttonTitle: String, - modifier: Modifier = Modifier, -) { - Button( - onClick = onButtonClick, - shape = RoundedCornerShape(size = 12.dp), - colors = ButtonDefaults.buttonColors(containerColor = White), - modifier = modifier.fillMaxWidth() - ) { - Text( - text = buttonTitle, - style = SoptTheme.typography.label18SB, - color = Black, - modifier = Modifier.padding( - horizontal = 94.dp, - vertical = 16.dp, - ) - ) - } -} - -@Preview(showBackground = true) -@Composable -private fun FortuneDetailButtonPreview() { - SoptTheme { - FortuneDetailButton( - onButtonClick = { }, - buttonTitle = "오늘 부적", - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt index 6023ce78a..62d5c30b8 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt @@ -25,7 +25,6 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.background -import androidx.compose.foundation.border import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -41,10 +40,10 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.Blue400 import org.sopt.official.designsystem.Gray10 import org.sopt.official.designsystem.Gray100 import org.sopt.official.designsystem.Gray30 @@ -86,11 +85,9 @@ internal fun PokeRecommendationDashboard( UrlImage( url = profile, contentDescription = "profileImage", - modifier = Modifier.size(size = 70.dp).border( - width = 2.dp, - color = Blue400, - shape = RoundedCornerShape(size = 100.dp), - ) + modifier = Modifier + .size(size = 70.dp) + .clip(RoundedCornerShape(size = 100.dp)), ) Spacer(modifier = Modifier.width(width = 8.dp)) Column { diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt index 25c9369e0..701722797 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt @@ -35,13 +35,11 @@ import org.sopt.official.feature.fortune.feature.fortuneDetail.FortuneDetailRout data class FortuneDetail(val date: String) fun NavGraphBuilder.fortuneDetailNavGraph( - paddingValue: PaddingValues, navigateToFortuneAmulet: () -> Unit, ) { composable { backStackEntry -> val items = backStackEntry.toRoute() FortuneDetailRoute( - paddingValue = paddingValue, date = items.date, onFortuneAmuletClick = navigateToFortuneAmulet ) From 48e66489a991ede09daf4775730809196b6d8387 Mon Sep 17 00:00:00 2001 From: s9hn Date: Tue, 1 Oct 2024 16:46:39 +0900 Subject: [PATCH 42/66] =?UTF-8?q?refactor:=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=82=AC=EC=A7=84=20=EC=82=AC=EC=9D=B4=EC=A6=88=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/PokeRecommendationDashboard.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt index 6023ce78a..3e79cb464 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt @@ -25,7 +25,6 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.background -import androidx.compose.foundation.border import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -41,10 +40,10 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.Blue400 import org.sopt.official.designsystem.Gray10 import org.sopt.official.designsystem.Gray100 import org.sopt.official.designsystem.Gray30 @@ -86,11 +85,9 @@ internal fun PokeRecommendationDashboard( UrlImage( url = profile, contentDescription = "profileImage", - modifier = Modifier.size(size = 70.dp).border( - width = 2.dp, - color = Blue400, - shape = RoundedCornerShape(size = 100.dp), - ) + modifier = Modifier + .size(size = 72.dp) + .clip(shape = RoundedCornerShape(size = 100.dp)), ) Spacer(modifier = Modifier.width(width = 8.dp)) Column { From 9a2ae03ef060039a98e329b5774f2d9600be4716 Mon Sep 17 00:00:00 2001 From: s9hn Date: Tue, 1 Oct 2024 17:44:49 +0900 Subject: [PATCH 43/66] =?UTF-8?q?refactor:=20=EB=B0=B0=EA=B2=BD=EC=83=89?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/fortuneDetail/component/FortuneDetailBox.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt index d720e9ec6..10d4e5288 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt @@ -36,7 +36,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.Gray700 +import org.sopt.official.designsystem.Gray900 @Composable internal fun TodayFortuneBox( @@ -49,7 +49,7 @@ internal fun TodayFortuneBox( .fillMaxWidth() .padding(horizontal = 20.dp) .background( - color = Gray700, + color = Gray900, shape = RoundedCornerShape(12.dp), ), ) { From 20b6face1203e6af5975732433d7559cde0deea4 Mon Sep 17 00:00:00 2001 From: s9hn Date: Tue, 1 Oct 2024 17:45:53 +0900 Subject: [PATCH 44/66] =?UTF-8?q?feat:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=ED=94=8C=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EA=B7=B8=EB=9D=BC=EC=9A=B4=EB=93=9C=EB=A1=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortuneDetail/FortuneDetailRoute.kt | 9 ++ .../fortuneDetail/FortuneDetailScreen.kt | 3 + .../component/PokeRecommendationDashboard.kt | 104 +++++++++--------- 3 files changed, 62 insertions(+), 54 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index d6b6b7ed4..9bdcba6fe 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -24,9 +24,12 @@ */ package org.sopt.official.feature.fortune.feature.fortuneDetail +import android.content.Intent +import android.net.Uri import androidx.compose.foundation.layout.PaddingValues import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.ui.platform.LocalContext import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -37,6 +40,7 @@ internal fun FortuneDetailRoute( onFortuneAmuletClick: () -> Unit, viewModel: FortuneDetailViewModel = hiltViewModel(), ) { + val context = LocalContext.current val uiState by viewModel.uiState.collectAsStateWithLifecycle() FortuneDetailScreen( @@ -44,6 +48,11 @@ internal fun FortuneDetailRoute( date = date, onFortuneAmuletClick = onFortuneAmuletClick, onPokeClick = {}, + onProfileClick = { userId -> + context.startActivity( + Intent(Intent.ACTION_VIEW, Uri.parse("https://playground.sopt.org/members/${userId}")) + ) + }, uiState = uiState, ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index 25b25f2b5..fa91303f7 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -52,6 +52,7 @@ internal fun FortuneDetailScreen( date: String, onFortuneAmuletClick: () -> Unit, onPokeClick: (userId: Long) -> Unit, + onProfileClick: (userId: Long) -> Unit, modifier: Modifier = Modifier, uiState: FortuneDetailUiState = Loading, ) { @@ -74,6 +75,7 @@ internal fun FortuneDetailScreen( name = uiState.userInfo.userName, userDescription = uiState.userInfo.userDescription, onPokeClick = { onPokeClick(uiState.userInfo.userId) }, + onProfileClick = { onProfileClick(uiState.userInfo.userId) } ) } @@ -107,6 +109,7 @@ private fun FortuneDetailScreenPreview() { ) ), onPokeClick = { }, + onProfileClick = { }, ) } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt index 3e79cb464..1dc72fa3b 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt @@ -25,6 +25,7 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.background +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -58,69 +59,63 @@ internal fun PokeRecommendationDashboard( name: String, userDescription: String, onPokeClick: () -> Unit, + onProfileClick: () -> Unit, modifier: Modifier = Modifier, ) { - TodayFortuneBox( - content = { - Column( - modifier = modifier - .fillMaxWidth() - .padding(all = 20.dp), + TodayFortuneBox(content = { + Column( + modifier = modifier.fillMaxWidth().padding(all = 20.dp), + ) { + Text( + text = "콕 찌르기", + style = SoptTheme.typography.body14R, + color = Gray100, + ) + Text( + text = "행운이 2배가 될 솝트인을 찔러보세요", + style = SoptTheme.typography.title18SB, + color = Gray30, + ) + Spacer(modifier = Modifier.height(height = 28.dp)) + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier.fillMaxWidth(), ) { - Text( - text = "콕 찌르기", - style = SoptTheme.typography.body14R, - color = Gray100, + UrlImage( + url = profile, + contentDescription = "profileImage", + modifier = Modifier.size(size = 72.dp).clip(shape = RoundedCornerShape(size = 100.dp)).clickable { onProfileClick() }, ) - Text( - text = "행운이 2배가 될 솝트인을 찔러보세요", - style = SoptTheme.typography.title18SB, - color = Gray30, - ) - Spacer(modifier = Modifier.height(height = 20.dp)) - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.fillMaxWidth(), + Spacer(modifier = Modifier.width(width = 8.dp)) + Column( + modifier = Modifier.weight(1f), + ) { + Text( + text = name, + style = SoptTheme.typography.body18M, + color = Gray30, + ) + Text( + text = userDescription, + style = SoptTheme.typography.label12SB, + color = Gray300, + ) + } + IconButton( + onClick = onPokeClick, + modifier = Modifier.size(size = 44.dp).background( + color = Gray10, + shape = RoundedCornerShape(size = 18.dp), + ), ) { - UrlImage( - url = profile, - contentDescription = "profileImage", - modifier = Modifier - .size(size = 72.dp) - .clip(shape = RoundedCornerShape(size = 100.dp)), + Icon( + painter = painterResource(R.drawable.ic_poke), + contentDescription = "콕 찌르기", ) - Spacer(modifier = Modifier.width(width = 8.dp)) - Column { - Text( - text = name, - style = SoptTheme.typography.body18M, - color = Gray30, - ) - Text( - text = userDescription, - style = SoptTheme.typography.label12SB, - color = Gray300, - ) - } - Spacer(modifier = Modifier.weight(1f)) - IconButton( - onClick = onPokeClick, - modifier = Modifier - .size(size = 44.dp) - .background( - color = Gray10, - shape = RoundedCornerShape(size = 18.dp), - ), - ) { - Icon( - painter = painterResource(R.drawable.ic_poke), - contentDescription = "콕 찌르기", - ) - } } } } - ) + }) } @Preview @@ -131,6 +126,7 @@ private fun PokeRecommendationDashboardPreview() { profile = "123", name = "이현우", onPokeClick = { }, + onProfileClick = { }, userDescription = "1100기 iOS", ) } From 6b37380d032f958017c7b266315d79fed527feac Mon Sep 17 00:00:00 2001 From: s9hn Date: Tue, 1 Oct 2024 18:35:02 +0900 Subject: [PATCH 45/66] =?UTF-8?q?feat:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=20=EC=9D=B4=EB=AF=B8=EC=A7=80=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 --- .../fortuneDetail/FortuneDetailScreen.kt | 1 + .../component/PokeRecommendationDashboard.kt | 19 ++++---- .../PokeRecommendationUserProfileImage.kt | 46 +++++++++++++++++++ .../model/FortuneDetailUiState.kt | 1 + .../main/res/drawable/ic_empty_profile.xml | 37 +++++++++++++++ 5 files changed, 95 insertions(+), 9 deletions(-) create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt create mode 100644 feature/fortune/src/main/res/drawable/ic_empty_profile.xml diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index fa91303f7..b7c2eb06b 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -74,6 +74,7 @@ internal fun FortuneDetailScreen( profile = uiState.userInfo.profile, name = uiState.userInfo.userName, userDescription = uiState.userInfo.userDescription, + isEmptyProfile = uiState.userInfo.isEmptyProfile, onPokeClick = { onPokeClick(uiState.userInfo.userId) }, onProfileClick = { onProfileClick(uiState.userInfo.userId) } ) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt index 1dc72fa3b..cb64d4b8d 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt @@ -51,13 +51,13 @@ import org.sopt.official.designsystem.Gray30 import org.sopt.official.designsystem.Gray300 import org.sopt.official.designsystem.SoptTheme import org.sopt.official.feature.fortune.R -import org.sopt.official.feature.fortune.component.UrlImage @Composable internal fun PokeRecommendationDashboard( profile: String, name: String, userDescription: String, + isEmptyProfile: Boolean, onPokeClick: () -> Unit, onProfileClick: () -> Unit, modifier: Modifier = Modifier, @@ -79,17 +79,16 @@ internal fun PokeRecommendationDashboard( Spacer(modifier = Modifier.height(height = 28.dp)) Row( verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.fillMaxWidth(), ) { - UrlImage( - url = profile, - contentDescription = "profileImage", - modifier = Modifier.size(size = 72.dp).clip(shape = RoundedCornerShape(size = 100.dp)).clickable { onProfileClick() }, + PokeRecommendationUserProfileImage( + profile = profile, + isEmptyProfile = isEmptyProfile, + modifier = Modifier.size(size = 72.dp) + .clip(shape = RoundedCornerShape(size = 100.dp)) + .clickable { onProfileClick() }, ) Spacer(modifier = Modifier.width(width = 8.dp)) - Column( - modifier = Modifier.weight(1f), - ) { + Column { Text( text = name, style = SoptTheme.typography.body18M, @@ -101,6 +100,7 @@ internal fun PokeRecommendationDashboard( color = Gray300, ) } + Spacer(modifier = Modifier.weight(weight = 1f)) IconButton( onClick = onPokeClick, modifier = Modifier.size(size = 44.dp).background( @@ -125,6 +125,7 @@ private fun PokeRecommendationDashboardPreview() { PokeRecommendationDashboard( profile = "123", name = "이현우", + isEmptyProfile = false, onPokeClick = { }, onProfileClick = { }, userDescription = "1100기 iOS", diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt new file mode 100644 index 000000000..c9f4e2c9c --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt @@ -0,0 +1,46 @@ +package org.sopt.official.feature.fortune.feature.fortuneDetail.component + +import androidx.compose.foundation.Image +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import org.sopt.official.designsystem.SoptTheme +import org.sopt.official.feature.fortune.R.drawable.ic_empty_profile +import org.sopt.official.feature.fortune.component.UrlImage + +@Composable +internal fun PokeRecommendationUserProfileImage( + profile: String, + isEmptyProfile: Boolean, + modifier: Modifier = Modifier, +) { + when (isEmptyProfile) { + true -> { + Image( + painter = painterResource(ic_empty_profile), + contentDescription = "profileImageEmpty", + modifier = modifier, + ) + } + + false -> { + UrlImage( + url = profile, + contentDescription = "profileImage", + modifier = modifier, + ) + } + } +} + +@Preview +@Composable +private fun PokeRecommendationUserProfileImagePreview() { + SoptTheme { + PokeRecommendationUserProfileImage( + profile = "", + isEmptyProfile = false, + ) + } +} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt index 73964eb3b..ae69e9086 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt @@ -53,6 +53,7 @@ internal sealed interface FortuneDetailUiState { val part: String, ) { val userDescription = "${generation}기 $part" + val isEmptyProfile = profile.isEmpty() } } diff --git a/feature/fortune/src/main/res/drawable/ic_empty_profile.xml b/feature/fortune/src/main/res/drawable/ic_empty_profile.xml new file mode 100644 index 000000000..d3cb45931 --- /dev/null +++ b/feature/fortune/src/main/res/drawable/ic_empty_profile.xml @@ -0,0 +1,37 @@ + + + + + + From 3f160429a81e19c427e1879d2fde0c485d83a22a Mon Sep 17 00:00:00 2001 From: s9hn Date: Tue, 1 Oct 2024 18:38:33 +0900 Subject: [PATCH 46/66] =?UTF-8?q?refactor:=20=EC=9E=90=EC=9E=98=ED=95=9C?= =?UTF-8?q?=20=EA=B0=9C=ED=96=89=20=EB=B0=8F=20import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/PokeRecommendationDashboard.kt | 12 ++++-------- .../fortuneDetail/component/TodayFortuneDashboard.kt | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt index cb64d4b8d..155bdff07 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt @@ -50,7 +50,7 @@ import org.sopt.official.designsystem.Gray100 import org.sopt.official.designsystem.Gray30 import org.sopt.official.designsystem.Gray300 import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.feature.fortune.R +import org.sopt.official.feature.fortune.R.drawable.ic_poke @Composable internal fun PokeRecommendationDashboard( @@ -63,9 +63,7 @@ internal fun PokeRecommendationDashboard( modifier: Modifier = Modifier, ) { TodayFortuneBox(content = { - Column( - modifier = modifier.fillMaxWidth().padding(all = 20.dp), - ) { + Column(modifier = modifier.fillMaxWidth().padding(all = 20.dp)) { Text( text = "콕 찌르기", style = SoptTheme.typography.body14R, @@ -77,9 +75,7 @@ internal fun PokeRecommendationDashboard( color = Gray30, ) Spacer(modifier = Modifier.height(height = 28.dp)) - Row( - verticalAlignment = Alignment.CenterVertically, - ) { + Row(verticalAlignment = Alignment.CenterVertically) { PokeRecommendationUserProfileImage( profile = profile, isEmptyProfile = isEmptyProfile, @@ -109,7 +105,7 @@ internal fun PokeRecommendationDashboard( ), ) { Icon( - painter = painterResource(R.drawable.ic_poke), + painter = painterResource(ic_poke), contentDescription = "콕 찌르기", ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt index 1d23ff55d..47fe62764 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt @@ -44,7 +44,7 @@ import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.Gray100 import org.sopt.official.designsystem.Gray30 import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.feature.fortune.R +import org.sopt.official.feature.fortune.R.drawable.img_fortune_title @Composable internal fun TodayFortuneDashboard( @@ -60,7 +60,7 @@ internal fun TodayFortuneDashboard( ) { Spacer(modifier = Modifier.height(height = 32.dp)) Image( - painter = painterResource(R.drawable.img_fortune_title), + painter = painterResource(img_fortune_title), contentDescription = "오늘의 솝마디", ) Spacer(modifier = Modifier.height(height = 10.dp)) From 1291338765123cf9f3c08a7af0369e717377e642 Mon Sep 17 00:00:00 2001 From: s9hn Date: Thu, 3 Oct 2024 23:56:02 +0900 Subject: [PATCH 47/66] =?UTF-8?q?test:=20=EA=B8=B0=EB=B3=B8=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortune/ExampleInstrumentedTest.kt | 48 ------------------- 1 file changed, 48 deletions(-) delete mode 100644 feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/ExampleInstrumentedTest.kt diff --git a/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/ExampleInstrumentedTest.kt b/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/ExampleInstrumentedTest.kt deleted file mode 100644 index 4378322dc..000000000 --- a/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * MIT License - * Copyright 2023-2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("org.sopt.official.feature.fortune.test", appContext.packageName) - } -} From 95bce58af349b0b6e4401120611fc19f360b7f02 Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 4 Oct 2024 16:26:56 +0900 Subject: [PATCH 48/66] =?UTF-8?q?refactor:=20=EC=B6=94=EC=B2=9C=EC=9D=B8?= =?UTF-8?q?=20=EC=9D=B4=EB=A6=84=20=EA=B8=80=EC=9E=90=EC=88=98=20=EC=A0=9C?= =?UTF-8?q?=ED=95=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/PokeRecommendationDashboard.kt | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt index 155bdff07..c83476e30 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt @@ -43,6 +43,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.Gray10 @@ -63,7 +64,11 @@ internal fun PokeRecommendationDashboard( modifier: Modifier = Modifier, ) { TodayFortuneBox(content = { - Column(modifier = modifier.fillMaxWidth().padding(all = 20.dp)) { + Column( + modifier = modifier + .fillMaxWidth() + .padding(all = 20.dp), + ) { Text( text = "콕 찌르기", style = SoptTheme.typography.body14R, @@ -75,7 +80,10 @@ internal fun PokeRecommendationDashboard( color = Gray30, ) Spacer(modifier = Modifier.height(height = 28.dp)) - Row(verticalAlignment = Alignment.CenterVertically) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier.fillMaxWidth(), + ) { PokeRecommendationUserProfileImage( profile = profile, isEmptyProfile = isEmptyProfile, @@ -84,10 +92,16 @@ internal fun PokeRecommendationDashboard( .clickable { onProfileClick() }, ) Spacer(modifier = Modifier.width(width = 8.dp)) - Column { + Column( + modifier = Modifier + .weight(weight = 1f) + .padding(end = 30.dp), + ) { Text( text = name, style = SoptTheme.typography.body18M, + overflow = TextOverflow.Ellipsis, + maxLines = 1, color = Gray30, ) Text( @@ -96,7 +110,6 @@ internal fun PokeRecommendationDashboard( color = Gray300, ) } - Spacer(modifier = Modifier.weight(weight = 1f)) IconButton( onClick = onPokeClick, modifier = Modifier.size(size = 44.dp).background( @@ -120,7 +133,7 @@ private fun PokeRecommendationDashboardPreview() { SoptTheme { PokeRecommendationDashboard( profile = "123", - name = "이현우", + name = "이현우이현우이현우이현우이현우", isEmptyProfile = false, onPokeClick = { }, onProfileClick = { }, From f2dc7b74ac60cbad042e26c590a1b7d615e4df55 Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 4 Oct 2024 16:48:10 +0900 Subject: [PATCH 49/66] =?UTF-8?q?test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt b/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt index db4dc9677..c599a6530 100644 --- a/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt +++ b/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt @@ -59,6 +59,7 @@ internal class FortuneDetailScreenTest { date = date, onFortuneAmuletClick = { }, onPokeClick = { }, + onProfileClick = { }, uiState = Success( todaySentence = TodaySentence( userName = name, From 7e404109e0cdb7346ace970050362c660d5144af Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 4 Oct 2024 17:00:52 +0900 Subject: [PATCH 50/66] =?UTF-8?q?refactor:=20uimodel=EC=9D=98=20isEmpty=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=8D=BC=ED=8B=B0=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortune/feature/fortuneDetail/FortuneDetailScreen.kt | 1 - .../component/PokeRecommendationDashboard.kt | 3 --- .../component/PokeRecommendationUserProfileImage.kt | 8 ++------ .../feature/fortuneDetail/model/FortuneDetailUiState.kt | 1 - 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index b7c2eb06b..fa91303f7 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -74,7 +74,6 @@ internal fun FortuneDetailScreen( profile = uiState.userInfo.profile, name = uiState.userInfo.userName, userDescription = uiState.userInfo.userDescription, - isEmptyProfile = uiState.userInfo.isEmptyProfile, onPokeClick = { onPokeClick(uiState.userInfo.userId) }, onProfileClick = { onProfileClick(uiState.userInfo.userId) } ) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt index c83476e30..4930b3484 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt @@ -58,7 +58,6 @@ internal fun PokeRecommendationDashboard( profile: String, name: String, userDescription: String, - isEmptyProfile: Boolean, onPokeClick: () -> Unit, onProfileClick: () -> Unit, modifier: Modifier = Modifier, @@ -86,7 +85,6 @@ internal fun PokeRecommendationDashboard( ) { PokeRecommendationUserProfileImage( profile = profile, - isEmptyProfile = isEmptyProfile, modifier = Modifier.size(size = 72.dp) .clip(shape = RoundedCornerShape(size = 100.dp)) .clickable { onProfileClick() }, @@ -134,7 +132,6 @@ private fun PokeRecommendationDashboardPreview() { PokeRecommendationDashboard( profile = "123", name = "이현우이현우이현우이현우이현우", - isEmptyProfile = false, onPokeClick = { }, onProfileClick = { }, userDescription = "1100기 iOS", diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt index c9f4e2c9c..578269fdf 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt @@ -12,10 +12,9 @@ import org.sopt.official.feature.fortune.component.UrlImage @Composable internal fun PokeRecommendationUserProfileImage( profile: String, - isEmptyProfile: Boolean, modifier: Modifier = Modifier, ) { - when (isEmptyProfile) { + when (profile.isEmpty()) { true -> { Image( painter = painterResource(ic_empty_profile), @@ -38,9 +37,6 @@ internal fun PokeRecommendationUserProfileImage( @Composable private fun PokeRecommendationUserProfileImagePreview() { SoptTheme { - PokeRecommendationUserProfileImage( - profile = "", - isEmptyProfile = false, - ) + PokeRecommendationUserProfileImage(profile = "") } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt index ae69e9086..73964eb3b 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt @@ -53,7 +53,6 @@ internal sealed interface FortuneDetailUiState { val part: String, ) { val userDescription = "${generation}기 $part" - val isEmptyProfile = profile.isEmpty() } } From 55b2a1229e136ecd1b335b0c65414d00da8b601a Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 4 Oct 2024 17:31:32 +0900 Subject: [PATCH 51/66] =?UTF-8?q?refactor:=20paddingValues=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/sopt/official/feature/fortune/FoundationScreen.kt | 1 - .../fortune/feature/fortuneDetail/FortuneDetailRoute.kt | 5 +---- .../fortune/feature/fortuneDetail/FortuneDetailScreen.kt | 4 ---- .../fortuneDetail/navigation/FortuneDetailNavGraph.kt | 3 --- 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt index 14108e739..848a2a819 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt @@ -75,7 +75,6 @@ fun FoundationScreen( ) fortuneDetailNavGraph( - paddingValue = paddingValue, navigateToFortuneAmulet = { navController.navigate(FortuneAmulet) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index 94aea0297..62a33d584 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -26,17 +26,16 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail import android.content.Intent import android.net.Uri -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.ui.platform.LocalContext import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue +import androidx.compose.ui.platform.LocalContext import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import kotlinx.coroutines.launch @@ -45,7 +44,6 @@ import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeMes @OptIn(ExperimentalMaterial3Api::class) @Composable internal fun FortuneDetailRoute( - paddingValue: PaddingValues, date: String, onFortuneAmuletClick: () -> Unit, viewModel: FortuneDetailViewModel = hiltViewModel(), @@ -76,7 +74,6 @@ internal fun FortuneDetailRoute( } FortuneDetailScreen( - paddingValue = paddingValue, date = date, onFortuneAmuletClick = onFortuneAmuletClick, onProfileClick = { userId -> diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index 5a5a595ba..99f6d3412 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -45,12 +45,10 @@ import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDeta import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.TodaySentence import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.UserInfo -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.TodaySentence import timber.log.Timber @Composable internal fun FortuneDetailScreen( - paddingValue: PaddingValues, date: String, onFortuneAmuletClick: () -> Unit, onPokeClick: (userId: Long) -> Unit, @@ -62,7 +60,6 @@ internal fun FortuneDetailScreen( horizontalAlignment = Alignment.CenterHorizontally, modifier = modifier .fillMaxSize() - .padding(paddingValues = paddingValue) .padding(horizontal = 20.dp), ) { Spacer(modifier = Modifier.height(height = 16.dp)) @@ -100,7 +97,6 @@ internal fun FortuneDetailScreen( private fun FortuneDetailScreenPreview() { SoptTheme { FortuneDetailScreen( - paddingValue = PaddingValues(vertical = 16.dp), date = "2024-09-09", onFortuneAmuletClick = {}, uiState = Success( diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt index 25c9369e0..60e14b9ba 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt @@ -24,7 +24,6 @@ */ package org.sopt.official.feature.fortune.feature.fortuneDetail.navigation -import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.toRoute @@ -35,13 +34,11 @@ import org.sopt.official.feature.fortune.feature.fortuneDetail.FortuneDetailRout data class FortuneDetail(val date: String) fun NavGraphBuilder.fortuneDetailNavGraph( - paddingValue: PaddingValues, navigateToFortuneAmulet: () -> Unit, ) { composable { backStackEntry -> val items = backStackEntry.toRoute() FortuneDetailRoute( - paddingValue = paddingValue, date = items.date, onFortuneAmuletClick = navigateToFortuneAmulet ) From aa49859bfee04439490fc7521cb16b668dba4402 Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 4 Oct 2024 17:42:13 +0900 Subject: [PATCH 52/66] =?UTF-8?q?refactor:=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20bottomsheet=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EC=BD=94=EB=A3=A8=ED=8B=B4=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortuneDetail/FortuneDetailRoute.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index 62a33d584..9c1bd96b7 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -50,26 +50,28 @@ internal fun FortuneDetailRoute( ) { val context = LocalContext.current val uiState by viewModel.uiState.collectAsStateWithLifecycle() - var isSelected by remember { mutableStateOf(false) } - var showBottomSheet by remember { mutableStateOf(false) } + var isItemSelected by remember { mutableStateOf(false) } + var isShowBottomSheet by remember { mutableStateOf(false) } var selectedIndex by remember { mutableIntStateOf(-1) } val bottomSheetState = rememberModalBottomSheetState(confirmValueChange = { false }) val scope = rememberCoroutineScope() - if (showBottomSheet) { + if (isShowBottomSheet) { PokeMessageBottomSheetScreen( sheetState = bottomSheetState, - onDismissRequest = { showBottomSheet = false }, - isSelected = isSelected, + onDismissRequest = { isShowBottomSheet = false }, + isSelected = isItemSelected, selectedIndex = selectedIndex, onItemClick = { newSelectedIndex, message -> scope.launch { selectedIndex = newSelectedIndex viewModel.poke(message) - showBottomSheet = false + bottomSheetState.hide() + }.invokeOnCompletion { + if (!bottomSheetState.isVisible) isShowBottomSheet = false } }, - onIconClick = { isSelected = !isSelected }, + onIconClick = { isItemSelected = !isItemSelected }, ) } @@ -81,7 +83,7 @@ internal fun FortuneDetailRoute( Intent(Intent.ACTION_VIEW, Uri.parse("https://playground.sopt.org/members/${userId}")) ) }, - onPokeClick = { showBottomSheet = true }, + onPokeClick = { isShowBottomSheet = true }, uiState = uiState, ) } From cc1e6628185f786b5aae084d8ee208500363b2e8 Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 4 Oct 2024 17:42:24 +0900 Subject: [PATCH 53/66] =?UTF-8?q?refactor:=20immutableListOf=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/fortuneDetail/component/PokeMessageBottomSheet.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt index 7d636d896..d084a40fe 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt @@ -25,6 +25,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import okhttp3.internal.immutableListOf import org.sopt.official.designsystem.Gray10 import org.sopt.official.designsystem.Gray30 import org.sopt.official.designsystem.Gray800 @@ -83,7 +84,7 @@ internal fun PokeMessageBottomSheetScreen( LazyColumn( contentPadding = PaddingValues(vertical = 4.dp), ) { - val messages = listOf( + val messages = immutableListOf( "안녕하세요? I AM 35기에요", "친해지고 싶어서 DM 드려요 ^^~", "이야기 해보고 싶었어요!!", From 813e7358714e48c1e5955895cc5253a1d9f57f3b Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 4 Oct 2024 19:05:02 +0900 Subject: [PATCH 54/66] =?UTF-8?q?refactor:=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=95=84=20=EC=82=AC=EC=A7=84=20crop=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/sopt/official/feature/fortune/component/UrlImage.kt | 3 +++ .../component/PokeRecommendationUserProfileImage.kt | 2 ++ 2 files changed, 5 insertions(+) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/UrlImage.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/UrlImage.kt index 2b5a1276f..7c19b414d 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/UrlImage.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/UrlImage.kt @@ -26,6 +26,7 @@ package org.sopt.official.feature.fortune.component import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.tooling.preview.Preview import coil.compose.AsyncImage @@ -33,11 +34,13 @@ import coil.compose.AsyncImage fun UrlImage( url: String, modifier: Modifier = Modifier, + contentScale: ContentScale = ContentScale.Fit, contentDescription: String? = null, ) { AsyncImage( model = url, contentDescription = contentDescription, + contentScale = contentScale, modifier = modifier ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt index c5683b3b0..20634c3da 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt @@ -28,6 +28,7 @@ import androidx.compose.foundation.Image import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import org.sopt.official.designsystem.SoptTheme @@ -52,6 +53,7 @@ internal fun PokeRecommendationUserProfileImage( UrlImage( url = profile, contentDescription = "profileImage", + contentScale = ContentScale.Crop, modifier = modifier, ) } From 4210c892f1c1231ba90a383431be408541839c0b Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 4 Oct 2024 19:11:40 +0900 Subject: [PATCH 55/66] =?UTF-8?q?refactor:=20=EC=BD=95=EC=B0=8C=EB=A5=B4?= =?UTF-8?q?=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20=EB=A6=AC=ED=94=8C=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/PokeRecommendationDashboard.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt index 45a03073d..f6c23984d 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt @@ -26,6 +26,7 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.background import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -36,7 +37,6 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -109,14 +109,14 @@ internal fun PokeRecommendationDashboard( color = Gray300, ) } - IconButton( - onClick = onPokeClick, + Box( + contentAlignment = Alignment.Center, modifier = Modifier .size(size = 44.dp) .background( color = Gray10, shape = RoundedCornerShape(size = 18.dp), - ), + ).clickable { onPokeClick() }, ) { Icon( imageVector = ImageVector.vectorResource(ic_poke), From 2b06df8e95f3f63fad7ca2144ae815c10e6fa5f5 Mon Sep 17 00:00:00 2001 From: s9hn Date: Fri, 4 Oct 2024 19:15:02 +0900 Subject: [PATCH 56/66] =?UTF-8?q?refactor:=20=EC=9D=B5=EB=AA=85=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EA=B8=B0?= =?UTF-8?q?=EB=B3=B8=EA=B0=92=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/fortuneDetail/FortuneDetailRoute.kt | 6 +++--- .../fortuneDetail/component/PokeMessageBottomSheet.kt | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index f9ef92a2d..b23e57d18 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -26,7 +26,7 @@ internal fun FortuneDetailRoute( ) { val context = LocalContext.current val uiState by viewModel.uiState.collectAsStateWithLifecycle() - var isItemSelected by remember { mutableStateOf(false) } + var isAnonymous by remember { mutableStateOf(true) } var isShowBottomSheet by remember { mutableStateOf(false) } var selectedIndex by remember { mutableIntStateOf(-1) } val bottomSheetState = rememberModalBottomSheetState(confirmValueChange = { false }) @@ -36,7 +36,6 @@ internal fun FortuneDetailRoute( PokeMessageBottomSheetScreen( sheetState = bottomSheetState, onDismissRequest = { isShowBottomSheet = false }, - isSelected = isItemSelected, selectedIndex = selectedIndex, onItemClick = { newSelectedIndex, message -> scope.launch { @@ -47,7 +46,8 @@ internal fun FortuneDetailRoute( if (!bottomSheetState.isVisible) isShowBottomSheet = false } }, - onIconClick = { isItemSelected = !isItemSelected }, + onIconClick = { isAnonymous = !isAnonymous }, + isAnonymous = isAnonymous, ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt index d084a40fe..e5518ae5b 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt @@ -22,7 +22,8 @@ import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import okhttp3.internal.immutableListOf @@ -38,7 +39,7 @@ import org.sopt.official.feature.fortune.R.drawable.ic_checkbox_on internal fun PokeMessageBottomSheetScreen( sheetState: SheetState, onDismissRequest: () -> Unit, - isSelected: Boolean, + isAnonymous: Boolean, selectedIndex: Int, onItemClick: (selectedIndex: Int, message: String) -> Unit, onIconClick: () -> Unit, @@ -68,8 +69,8 @@ internal fun PokeMessageBottomSheetScreen( ) Spacer(modifier = Modifier.weight(weight = 1f)) Image( - painter = if (isSelected) painterResource(id = ic_checkbox_on) - else painterResource(id = ic_checkbox_off), + imageVector = if (isAnonymous) ImageVector.vectorResource(id = ic_checkbox_on) + else ImageVector.vectorResource(id = ic_checkbox_off), contentDescription = "익명 체크박스", modifier = Modifier.clickable { onIconClick() } ) @@ -114,7 +115,7 @@ private fun PokeMessageBottomSheetScreenPreview() { confirmValueChange = { true }, ), onDismissRequest = { }, - isSelected = false, + isAnonymous = false, selectedIndex = 0, onItemClick = { _, _ -> }, onIconClick = { }, From f6c4312d5fba25b2b71887a87b49e60276887506 Mon Sep 17 00:00:00 2001 From: s9hn Date: Sat, 5 Oct 2024 00:20:44 +0900 Subject: [PATCH 57/66] =?UTF-8?q?feat:=20=EC=99=B8=EB=B6=80=20=EC=98=81?= =?UTF-8?q?=EC=97=AD=20=ED=84=B0=EC=B9=98=20=EB=B0=8F=20=ED=95=98=EB=8B=A8?= =?UTF-8?q?=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EC=8B=9C=20bottomsheet=20hide?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortuneDetail/FortuneDetailRoute.kt | 70 ++++++----- .../component/PokeMessageBottomSheet.kt | 112 +++++++----------- 2 files changed, 83 insertions(+), 99 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index b23e57d18..389ca3d05 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -2,8 +2,10 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail import android.content.Intent import android.net.Uri -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.rememberModalBottomSheetState +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.ModalBottomSheetLayout +import androidx.compose.material.ModalBottomSheetValue +import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf @@ -12,12 +14,13 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import kotlinx.coroutines.launch +import org.sopt.official.designsystem.Gray800 import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeMessageBottomSheetScreen -@OptIn(ExperimentalMaterial3Api::class) @Composable internal fun FortuneDetailRoute( date: String, @@ -27,39 +30,42 @@ internal fun FortuneDetailRoute( val context = LocalContext.current val uiState by viewModel.uiState.collectAsStateWithLifecycle() var isAnonymous by remember { mutableStateOf(true) } - var isShowBottomSheet by remember { mutableStateOf(false) } var selectedIndex by remember { mutableIntStateOf(-1) } - val bottomSheetState = rememberModalBottomSheetState(confirmValueChange = { false }) + val bottomSheetState = rememberModalBottomSheetState(initialValue = ModalBottomSheetValue.Hidden) val scope = rememberCoroutineScope() - if (isShowBottomSheet) { - PokeMessageBottomSheetScreen( - sheetState = bottomSheetState, - onDismissRequest = { isShowBottomSheet = false }, - selectedIndex = selectedIndex, - onItemClick = { newSelectedIndex, message -> - scope.launch { - selectedIndex = newSelectedIndex - viewModel.poke(message) - bottomSheetState.hide() - }.invokeOnCompletion { - if (!bottomSheetState.isVisible) isShowBottomSheet = false - } + ModalBottomSheetLayout( + sheetState = bottomSheetState, + sheetShape = RoundedCornerShape( + topStart = 20.dp, + topEnd = 20.dp, + ), + sheetBackgroundColor = Gray800, + sheetContent = { + PokeMessageBottomSheetScreen( + selectedIndex = selectedIndex, + onItemClick = { newSelectedIndex, message -> + scope.launch { + selectedIndex = newSelectedIndex + bottomSheetState.hide() + viewModel.poke(message) + } + }, + onIconClick = { isAnonymous = !isAnonymous }, + isAnonymous = isAnonymous, + ) + }, + ) { + FortuneDetailScreen( + date = date, + onFortuneAmuletClick = onFortuneAmuletClick, + onProfileClick = { userId -> + context.startActivity( + Intent(Intent.ACTION_VIEW, Uri.parse("https://playground.sopt.org/members/${userId}")) + ) }, - onIconClick = { isAnonymous = !isAnonymous }, - isAnonymous = isAnonymous, + onPokeClick = { scope.launch { bottomSheetState.show() } }, + uiState = uiState, ) } - - FortuneDetailScreen( - date = date, - onFortuneAmuletClick = onFortuneAmuletClick, - onProfileClick = { userId -> - context.startActivity( - Intent(Intent.ACTION_VIEW, Uri.parse("https://playground.sopt.org/members/${userId}")) - ) - }, - onPokeClick = { isShowBottomSheet = true }, - uiState = uiState, - ) } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt index e5518ae5b..0b837bf6f 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt @@ -1,7 +1,6 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.Image -import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -14,11 +13,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.itemsIndexed -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.ModalBottomSheet -import androidx.compose.material3.SheetState import androidx.compose.material3.Text -import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -29,93 +24,76 @@ import androidx.compose.ui.unit.dp import okhttp3.internal.immutableListOf import org.sopt.official.designsystem.Gray10 import org.sopt.official.designsystem.Gray30 -import org.sopt.official.designsystem.Gray800 import org.sopt.official.designsystem.SoptTheme import org.sopt.official.feature.fortune.R.drawable.ic_checkbox_off import org.sopt.official.feature.fortune.R.drawable.ic_checkbox_on -@OptIn(ExperimentalMaterial3Api::class) @Composable internal fun PokeMessageBottomSheetScreen( - sheetState: SheetState, - onDismissRequest: () -> Unit, isAnonymous: Boolean, selectedIndex: Int, onItemClick: (selectedIndex: Int, message: String) -> Unit, onIconClick: () -> Unit, modifier: Modifier = Modifier, ) { - ModalBottomSheet( - containerColor = Gray800, - sheetState = sheetState, - onDismissRequest = onDismissRequest, - dragHandle = null, + Column( + modifier = modifier.fillMaxWidth() + .padding(horizontal = 20.dp) + .padding(top = 24.dp, bottom = 12.dp), ) { - Column( - modifier = modifier.fillMaxWidth() - .padding(horizontal = 20.dp) - .padding(top = 24.dp, bottom = 12.dp) - .background(color = Gray800), + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween, + modifier = Modifier.fillMaxWidth(), ) { - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween, - modifier = Modifier.fillMaxWidth() - ) { - Text( - text = "함께 보낼 메시지를 선택해주세요", - style = SoptTheme.typography.heading20B, - color = Gray30, - ) - Spacer(modifier = Modifier.weight(weight = 1f)) - Image( - imageVector = if (isAnonymous) ImageVector.vectorResource(id = ic_checkbox_on) - else ImageVector.vectorResource(id = ic_checkbox_off), - contentDescription = "익명 체크박스", - modifier = Modifier.clickable { onIconClick() } - ) - Spacer(modifier = Modifier.width(width = 8.dp)) - Text( - text = "익명", - style = SoptTheme.typography.title16SB, - color = Gray10, - ) - } - Spacer(modifier = Modifier.height(height = 12.dp)) - LazyColumn( - contentPadding = PaddingValues(vertical = 4.dp), - ) { - val messages = immutableListOf( - "안녕하세요? I AM 35기에요", - "친해지고 싶어서 DM 드려요 ^^~", - "이야기 해보고 싶었어요!!", - "모각작 하실래요?", - "콕 \uD83D\uDC48", - ) + Text( + text = "함께 보낼 메시지를 선택해주세요", + style = SoptTheme.typography.heading20B, + color = Gray30, + ) + Spacer(modifier = Modifier.weight(weight = 1f)) + Image( + imageVector = if (isAnonymous) ImageVector.vectorResource(id = ic_checkbox_on) + else ImageVector.vectorResource(id = ic_checkbox_off), + contentDescription = "익명 체크박스", + modifier = Modifier.clickable { onIconClick() }, + ) + Spacer(modifier = Modifier.width(width = 8.dp)) + Text( + text = "익명", + style = SoptTheme.typography.title16SB, + color = Gray10, + ) + } + Spacer(modifier = Modifier.height(height = 12.dp)) + LazyColumn( + contentPadding = PaddingValues(vertical = 4.dp), + ) { + val messages = immutableListOf( + "안녕하세요? I AM 35기에요", + "친해지고 싶어서 DM 드려요 ^^~", + "이야기 해보고 싶었어요!!", + "모각작 하실래요?", + "콕 \uD83D\uDC48", + ) - itemsIndexed(messages) { index, message -> - PokeMessageItem( - message = message, - isSelected = index == selectedIndex, - onItemClick = { onItemClick(index, message) }, - ) - } + itemsIndexed(messages) { index, message -> + PokeMessageItem( + message = message, + isSelected = index == selectedIndex, + onItemClick = { onItemClick(index, message) }, + ) } } } } -@OptIn(ExperimentalMaterial3Api::class) @Preview @Composable private fun PokeMessageBottomSheetScreenPreview() { SoptTheme { PokeMessageBottomSheetScreen( - sheetState = rememberModalBottomSheetState( - confirmValueChange = { true }, - ), - onDismissRequest = { }, - isAnonymous = false, + isAnonymous = true, selectedIndex = 0, onItemClick = { _, _ -> }, onIconClick = { }, From fdf1b301742c014a8f60a728eac862c2effbde7f Mon Sep 17 00:00:00 2001 From: s9hn Date: Sat, 5 Oct 2024 16:19:06 +0900 Subject: [PATCH 58/66] =?UTF-8?q?refactor:=20=ED=8F=AC=EB=A7=A4=ED=8C=85?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortuneDetail/component/PokeMessageBottomSheet.kt | 9 +++++---- .../feature/fortuneDetail/component/PokeMessageItem.kt | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt index 0b837bf6f..51a73c01f 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt @@ -39,7 +39,10 @@ internal fun PokeMessageBottomSheetScreen( Column( modifier = modifier.fillMaxWidth() .padding(horizontal = 20.dp) - .padding(top = 24.dp, bottom = 12.dp), + .padding( + top = 24.dp, + bottom = 12.dp, + ), ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -66,9 +69,7 @@ internal fun PokeMessageBottomSheetScreen( ) } Spacer(modifier = Modifier.height(height = 12.dp)) - LazyColumn( - contentPadding = PaddingValues(vertical = 4.dp), - ) { + LazyColumn(contentPadding = PaddingValues(vertical = 4.dp)) { val messages = immutableListOf( "안녕하세요? I AM 35기에요", "친해지고 싶어서 DM 드려요 ^^~", diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt index 6b4569b34..7e22cc992 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt @@ -39,7 +39,10 @@ internal fun PokeMessageItem( text = message, style = SoptTheme.typography.body16M, color = Gray10, - modifier = Modifier.padding(vertical = 12.dp, horizontal = 8.dp), + modifier = Modifier.padding( + vertical = 14.dp, + horizontal = 8.dp, + ), ) } } From 6a91521a08e7729d7ba798e8137743ec7d3728c2 Mon Sep 17 00:00:00 2001 From: s9hn Date: Sun, 6 Oct 2024 20:33:19 +0900 Subject: [PATCH 59/66] =?UTF-8?q?feat:=20snackbar=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortuneDetail/FortuneDetailRoute.kt | 84 ++++++++++++------- .../fortuneDetail/component/PokeSnackBar.kt | 57 +++++++++++++ .../src/main/res/drawable/ic_alert.xml | 43 ++++++++++ 3 files changed, 154 insertions(+), 30 deletions(-) create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt create mode 100644 feature/fortune/src/main/res/drawable/ic_alert.xml diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index 389ca3d05..c2fb1c2c0 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -2,10 +2,15 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail import android.content.Intent import android.net.Uri +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue import androidx.compose.material.rememberModalBottomSheetState +import androidx.compose.material3.SnackbarDuration +import androidx.compose.material3.SnackbarHost +import androidx.compose.material3.SnackbarHostState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf @@ -13,6 +18,8 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel @@ -20,6 +27,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import kotlinx.coroutines.launch import org.sopt.official.designsystem.Gray800 import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeMessageBottomSheetScreen +import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeSnackBar @Composable internal fun FortuneDetailRoute( @@ -32,40 +40,56 @@ internal fun FortuneDetailRoute( var isAnonymous by remember { mutableStateOf(true) } var selectedIndex by remember { mutableIntStateOf(-1) } val bottomSheetState = rememberModalBottomSheetState(initialValue = ModalBottomSheetValue.Hidden) + val snackBarHostState = remember { SnackbarHostState() } val scope = rememberCoroutineScope() - ModalBottomSheetLayout( - sheetState = bottomSheetState, - sheetShape = RoundedCornerShape( - topStart = 20.dp, - topEnd = 20.dp, - ), - sheetBackgroundColor = Gray800, - sheetContent = { - PokeMessageBottomSheetScreen( - selectedIndex = selectedIndex, - onItemClick = { newSelectedIndex, message -> - scope.launch { - selectedIndex = newSelectedIndex - bottomSheetState.hide() - viewModel.poke(message) - } - }, - onIconClick = { isAnonymous = !isAnonymous }, - isAnonymous = isAnonymous, - ) - }, - ) { - FortuneDetailScreen( - date = date, - onFortuneAmuletClick = onFortuneAmuletClick, - onProfileClick = { userId -> - context.startActivity( - Intent(Intent.ACTION_VIEW, Uri.parse("https://playground.sopt.org/members/${userId}")) + Box(modifier = Modifier.fillMaxSize()) { + ModalBottomSheetLayout( + sheetState = bottomSheetState, + sheetShape = RoundedCornerShape( + topStart = 20.dp, + topEnd = 20.dp, + ), + sheetBackgroundColor = Gray800, + sheetContent = { + PokeMessageBottomSheetScreen( + selectedIndex = selectedIndex, + onItemClick = { newSelectedIndex, message -> + scope.launch { + selectedIndex = newSelectedIndex + bottomSheetState.hide() + viewModel.poke(message) + } + }, + onIconClick = { + isAnonymous = !isAnonymous + if (isAnonymous.not()) scope.launch { + snackBarHostState.showSnackbar( + message = "", + duration = SnackbarDuration.Short, + ) + } + }, + isAnonymous = isAnonymous, ) }, - onPokeClick = { scope.launch { bottomSheetState.show() } }, - uiState = uiState, + ) { + FortuneDetailScreen( + date = date, + onFortuneAmuletClick = onFortuneAmuletClick, + onProfileClick = { userId -> + context.startActivity( + Intent(Intent.ACTION_VIEW, Uri.parse("https://playground.sopt.org/members/${userId}")) + ) + }, + onPokeClick = { scope.launch { bottomSheetState.show() } }, + uiState = uiState, + ) + } + SnackbarHost( + hostState = snackBarHostState, + modifier = Modifier.align(alignment = Alignment.TopCenter), + snackbar = { PokeSnackBar() }, ) } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt new file mode 100644 index 000000000..0929a341b --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt @@ -0,0 +1,57 @@ +package org.sopt.official.feature.fortune.feature.fortuneDetail.component + +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.sopt.official.designsystem.Gray10 +import org.sopt.official.designsystem.Gray900 +import org.sopt.official.designsystem.SoptTheme +import org.sopt.official.feature.fortune.R.drawable.ic_alert + +@Composable +internal fun PokeSnackBar() { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp) + .background( + color = Gray10, + shape = RoundedCornerShape(18.dp), + ) + ) { + Spacer(modifier = Modifier.width(width = 16.dp)) + Image( + imageVector = ImageVector.vectorResource(ic_alert), + contentDescription = null, + ) + Spacer(modifier = Modifier.width(width = 8.dp)) + Text( + text = "익명 해제 시, 상대방이 나를 알 수 있어요.", + style = SoptTheme.typography.title14SB, + color = Gray900, + modifier = Modifier.padding(vertical = 16.dp), + ) + } +} + +@Preview +@Composable +private fun PokeSnackBarPreview() { + SoptTheme { + PokeSnackBar() + } +} diff --git a/feature/fortune/src/main/res/drawable/ic_alert.xml b/feature/fortune/src/main/res/drawable/ic_alert.xml new file mode 100644 index 000000000..7914b80d6 --- /dev/null +++ b/feature/fortune/src/main/res/drawable/ic_alert.xml @@ -0,0 +1,43 @@ + + + + + + + + + + From 9b3a44a6a536d27c9efd2521467b63e3fa69ca34 Mon Sep 17 00:00:00 2001 From: s9hn Date: Mon, 7 Oct 2024 17:42:48 +0900 Subject: [PATCH 60/66] =?UTF-8?q?refactor:=20Icon=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/fortuneDetail/component/PokeSnackBar.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt index 0929a341b..35ce7119f 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt @@ -1,6 +1,5 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail.component -import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -8,12 +7,14 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Icon import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.res.* import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.Gray10 @@ -34,8 +35,9 @@ internal fun PokeSnackBar() { ) ) { Spacer(modifier = Modifier.width(width = 16.dp)) - Image( + Icon( imageVector = ImageVector.vectorResource(ic_alert), + tint = Color.Unspecified, contentDescription = null, ) Spacer(modifier = Modifier.width(width = 8.dp)) From c08676e146f67e97fbb69e8e20227f9192295a81 Mon Sep 17 00:00:00 2001 From: s9hn Date: Mon, 7 Oct 2024 18:20:07 +0900 Subject: [PATCH 61/66] =?UTF-8?q?refactor:=20topAppBar=20Dim=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EB=B0=8F=20snackBar=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/fortune/FoundationScreen.kt | 32 +++++- .../fortune/component/FortuneTopBar.kt | 21 ++-- .../fortuneDetail/FortuneDetailRoute.kt | 105 +++++++++--------- .../navigation/FortuneDetailNavGraph.kt | 7 +- 4 files changed, 100 insertions(+), 65 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt index 848a2a819..bb8d95b8a 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt @@ -29,9 +29,17 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material3.Scaffold +import androidx.compose.material3.SnackbarHost +import androidx.compose.material3.SnackbarHostState import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController import androidx.navigation.compose.NavHost import androidx.navigation.compose.rememberNavController @@ -39,6 +47,7 @@ import org.sopt.official.designsystem.SoptTheme import org.sopt.official.feature.fortune.component.FortuneTopBar import org.sopt.official.feature.fortune.feature.fortuneAmulet.navigation.FortuneAmulet import org.sopt.official.feature.fortune.feature.fortuneAmulet.navigation.fortuneAmuletNavGraph +import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeSnackBar import org.sopt.official.feature.fortune.feature.fortuneDetail.navigation.FortuneDetail import org.sopt.official.feature.fortune.feature.fortuneDetail.navigation.fortuneDetailNavGraph import org.sopt.official.feature.fortune.feature.home.navigation.Home @@ -50,11 +59,26 @@ fun FoundationScreen( navigateToHome: () -> Unit, navController: NavHostController = rememberNavController(), ) { + var isBottomSheetVisible by remember { mutableStateOf(false) } + val snackBarHostState = remember { SnackbarHostState() } + Scaffold( + snackbarHost = { + Box(modifier = Modifier.fillMaxSize()) { + SnackbarHost( + hostState = snackBarHostState, + modifier = Modifier + .padding(top = 16.dp) + .align(alignment = Alignment.TopCenter), + snackbar = { PokeSnackBar() }, + ) + } + }, modifier = Modifier.fillMaxSize(), topBar = { FortuneTopBar( - onClickNavigationIcon = navigateToNotification + onClickNavigationIcon = navigateToNotification, + isEnabled = !isBottomSheetVisible, ) }, content = { paddingValue -> @@ -77,7 +101,11 @@ fun FoundationScreen( fortuneDetailNavGraph( navigateToFortuneAmulet = { navController.navigate(FortuneAmulet) - } + }, + isBottomSheetVisible = { + isBottomSheetVisible = it + }, + snackBarHostState = snackBarHostState, ) fortuneAmuletNavGraph( diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneTopBar.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneTopBar.kt index 0f6ea637c..cf6c80f2c 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneTopBar.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneTopBar.kt @@ -35,32 +35,33 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import org.sopt.official.designsystem.Gray200 import org.sopt.official.designsystem.SoptTheme @Composable fun FortuneTopBar( - modifier: Modifier = Modifier, onClickNavigationIcon: () -> Unit, + modifier: Modifier = Modifier, + isEnabled: Boolean = true, ) { Box(modifier = modifier.fillMaxWidth()) { Icon( imageVector = Icons.Filled.Close, + tint = if (!isEnabled) Gray200 else SoptTheme.colors.onBackground, contentDescription = null, - modifier = Modifier - .padding(start = 8.dp, top = 2.dp, bottom = 2.dp) - .padding(8.dp) - .clickable(onClick = onClickNavigationIcon), - tint = SoptTheme.colors.onBackground + modifier = Modifier.padding(start = 8.dp, top = 2.dp, bottom = 2.dp).padding(8.dp) + .clickable { if (isEnabled) onClickNavigationIcon() }, ) } } -@Preview +@Preview(showBackground = true) @Composable fun FortuneTopBarPreview() { SoptTheme { - FortuneTopBar { - - } + FortuneTopBar( + onClickNavigationIcon = { }, + isEnabled = false, + ) } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index c2fb1c2c0..279d6dd71 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -2,24 +2,20 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail import android.content.Intent import android.net.Uri -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.material3.SnackbarDuration -import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHostState import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel @@ -27,12 +23,13 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import kotlinx.coroutines.launch import org.sopt.official.designsystem.Gray800 import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeMessageBottomSheetScreen -import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeSnackBar @Composable internal fun FortuneDetailRoute( date: String, onFortuneAmuletClick: () -> Unit, + isBottomSheetVisible: (isVisible: Boolean) -> Unit, + snackBarHostState: SnackbarHostState, viewModel: FortuneDetailViewModel = hiltViewModel(), ) { val context = LocalContext.current @@ -40,56 +37,60 @@ internal fun FortuneDetailRoute( var isAnonymous by remember { mutableStateOf(true) } var selectedIndex by remember { mutableIntStateOf(-1) } val bottomSheetState = rememberModalBottomSheetState(initialValue = ModalBottomSheetValue.Hidden) - val snackBarHostState = remember { SnackbarHostState() } val scope = rememberCoroutineScope() - Box(modifier = Modifier.fillMaxSize()) { - ModalBottomSheetLayout( - sheetState = bottomSheetState, - sheetShape = RoundedCornerShape( - topStart = 20.dp, - topEnd = 20.dp, - ), - sheetBackgroundColor = Gray800, - sheetContent = { - PokeMessageBottomSheetScreen( - selectedIndex = selectedIndex, - onItemClick = { newSelectedIndex, message -> - scope.launch { - selectedIndex = newSelectedIndex - bottomSheetState.hide() - viewModel.poke(message) - } - }, - onIconClick = { - isAnonymous = !isAnonymous - if (isAnonymous.not()) scope.launch { - snackBarHostState.showSnackbar( - message = "", - duration = SnackbarDuration.Short, - ) - } - }, - isAnonymous = isAnonymous, - ) - }, - ) { - FortuneDetailScreen( - date = date, - onFortuneAmuletClick = onFortuneAmuletClick, - onProfileClick = { userId -> - context.startActivity( - Intent(Intent.ACTION_VIEW, Uri.parse("https://playground.sopt.org/members/${userId}")) - ) + LaunchedEffect(bottomSheetState.currentValue) { + if (bottomSheetState.currentValue == ModalBottomSheetValue.Hidden) isBottomSheetVisible(false) + } + + ModalBottomSheetLayout( + sheetState = bottomSheetState, + sheetShape = RoundedCornerShape( + topStart = 20.dp, + topEnd = 20.dp, + ), + sheetBackgroundColor = Gray800, + sheetContent = { + PokeMessageBottomSheetScreen( + selectedIndex = selectedIndex, + onItemClick = { newSelectedIndex, message -> + scope.launch { + selectedIndex = newSelectedIndex + bottomSheetState.hide() + viewModel.poke(message) + }.invokeOnCompletion { + isBottomSheetVisible(false) + } }, - onPokeClick = { scope.launch { bottomSheetState.show() } }, - uiState = uiState, + onIconClick = { + isAnonymous = !isAnonymous + if (isAnonymous.not()) scope.launch { + snackBarHostState.showSnackbar( + message = "", + duration = SnackbarDuration.Short, + ) + } + }, + isAnonymous = isAnonymous, ) - } - SnackbarHost( - hostState = snackBarHostState, - modifier = Modifier.align(alignment = Alignment.TopCenter), - snackbar = { PokeSnackBar() }, + }, + ) { + FortuneDetailScreen( + date = date, + onFortuneAmuletClick = onFortuneAmuletClick, + onProfileClick = { userId -> + context.startActivity( + Intent(Intent.ACTION_VIEW, Uri.parse("https://playground.sopt.org/members/${userId}")) + ) + }, + onPokeClick = { + scope.launch { + bottomSheetState.show() + }.invokeOnCompletion { + isBottomSheetVisible(true) + } + }, + uiState = uiState, ) } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt index 60e14b9ba..a92ff6815 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt @@ -24,6 +24,7 @@ */ package org.sopt.official.feature.fortune.feature.fortuneDetail.navigation +import androidx.compose.material3.SnackbarHostState import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.toRoute @@ -35,12 +36,16 @@ data class FortuneDetail(val date: String) fun NavGraphBuilder.fortuneDetailNavGraph( navigateToFortuneAmulet: () -> Unit, + snackBarHostState: SnackbarHostState, + isBottomSheetVisible: (isVisible: Boolean) -> Unit, ) { composable { backStackEntry -> val items = backStackEntry.toRoute() FortuneDetailRoute( date = items.date, - onFortuneAmuletClick = navigateToFortuneAmulet + onFortuneAmuletClick = navigateToFortuneAmulet, + isBottomSheetVisible = isBottomSheetVisible, + snackBarHostState = snackBarHostState, ) } } From 8adbf83bc9750c295b40976568e770531cac89fc Mon Sep 17 00:00:00 2001 From: Dongmin Date: Tue, 8 Oct 2024 15:37:27 +0900 Subject: [PATCH 62/66] feature #875: change naming --- .../org/sopt/official/feature/fortune/FortuneActivity.kt | 2 +- .../org/sopt/official/feature/fortune/FoundationScreen.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt index 81fb42b11..9dd5b529c 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt @@ -50,7 +50,7 @@ class FortuneActivity : AppCompatActivity() { setContent { SoptTheme { FoundationScreen( - navigateToNotification = { + onClickLeadingIcon = { startActivity(navigator.getNotificationActivityIntent()) }, navigateToHome = { diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt index 848a2a819..903ab2db6 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt @@ -46,7 +46,7 @@ import org.sopt.official.feature.fortune.feature.home.navigation.homeNavGraph @Composable fun FoundationScreen( - navigateToNotification: () -> Unit, + onClickLeadingIcon: () -> Unit, navigateToHome: () -> Unit, navController: NavHostController = rememberNavController(), ) { @@ -54,7 +54,7 @@ fun FoundationScreen( modifier = Modifier.fillMaxSize(), topBar = { FortuneTopBar( - onClickNavigationIcon = navigateToNotification + onClickNavigationIcon = onClickLeadingIcon ) }, content = { paddingValue -> @@ -94,7 +94,7 @@ fun FoundationScreen( fun FoundationScreenPreview() { SoptTheme { FoundationScreen( - navigateToNotification = {}, + onClickLeadingIcon = {}, navigateToHome = {} ) } From 3b9c97a6d161913e54769bbbb63f116b8236e706 Mon Sep 17 00:00:00 2001 From: Dongmin Date: Tue, 8 Oct 2024 15:38:37 +0900 Subject: [PATCH 63/66] feature #875: add preview --- .../official/feature/fortune/component/FortuneButton.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt index 0017aae82..9a419f357 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt @@ -11,6 +11,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.SoptTheme @@ -36,3 +37,11 @@ fun FortuneButton( ) } } + +@Preview +@Composable +fun FortuneButtonPreview() { + SoptTheme { + FortuneButton(title = "오늘의 부적 받기", onClick = {}) + } +} From 69afa3ec8415f453871afbef32b31d3573f4f09e Mon Sep 17 00:00:00 2001 From: s9hn Date: Wed, 9 Oct 2024 04:05:18 +0900 Subject: [PATCH 64/66] =?UTF-8?q?refactor:=20custom=20breaking=20word=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortuneDetail/FortuneDetailScreen.kt | 3 +- .../component/TodayFortuneDashboard.kt | 26 ++--- .../component/TodayFortuneText.kt | 97 +++++++++++++++++++ .../model/FortuneDetailUiState.kt | 4 +- 4 files changed, 107 insertions(+), 23 deletions(-) create mode 100644 feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneText.kt diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt index 1905af140..5efecc526 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt @@ -66,7 +66,8 @@ internal fun FortuneDetailScreen( is Success -> { TodayFortuneDashboard( date = date, - todaySentence = uiState.todaySentence.message, + todaySentence = uiState.todaySentence.content, + name = uiState.todaySentence.userName, ) Spacer(modifier = Modifier.height(height = 20.dp)) PokeRecommendationDashboard( diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt index 7a18490c6..c1f70e3c7 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt @@ -27,23 +27,16 @@ package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.semantics.contentDescription -import androidx.compose.ui.semantics.semantics -import androidx.compose.ui.text.style.LineBreak -import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.sopt.official.designsystem.Gray100 -import org.sopt.official.designsystem.Gray30 import org.sopt.official.designsystem.SoptTheme import org.sopt.official.feature.fortune.R.drawable.img_fortune_title @@ -51,6 +44,7 @@ import org.sopt.official.feature.fortune.R.drawable.img_fortune_title internal fun TodayFortuneDashboard( date: String, todaySentence: String, + name: String, modifier: Modifier = Modifier, ) { TodayFortuneBox( @@ -71,17 +65,9 @@ internal fun TodayFortuneDashboard( color = Gray100, ) Spacer(modifier = Modifier.height(height = 20.dp)) - Text( - text = todaySentence, - style = SoptTheme.typography.title24SB.copy( - lineBreak = LineBreak.Simple, - ), - color = Gray30, - textAlign = TextAlign.Center, - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 68.dp) - .semantics { contentDescription = "todaySentence" }, + TodayFortuneText( + todaySentence = todaySentence, + name = name, ) Spacer(modifier = Modifier.height(height = 36.dp)) } @@ -89,13 +75,15 @@ internal fun TodayFortuneDashboard( ) } + @Preview(showBackground = true) @Composable private fun TodayFortuneDashboardPreview() { SoptTheme { TodayFortuneDashboard( date = "2024-09-09", - todaySentence = "hi my name is Sehun kim, nice to meet you", + todaySentence = "예상치 못한 칭찬을 받게 되겠솝", + name = "김세훈", ) } } diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneText.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneText.kt new file mode 100644 index 000000000..79bbe9941 --- /dev/null +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneText.kt @@ -0,0 +1,97 @@ +package org.sopt.official.feature.fortune.feature.fortuneDetail.component + +import android.graphics.Paint +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalConfiguration +import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.text.style.LineBreak +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import org.sopt.official.designsystem.Gray30 +import org.sopt.official.designsystem.SoptTheme + +@Composable +internal fun TodayFortuneText( + todaySentence: String, + name: String, + modifier: Modifier = Modifier, +) { + val currentDensity = LocalDensity.current + val currentConfiguration = LocalConfiguration.current + val textPaint = remember { Paint().apply { textSize = with(currentDensity) { 24.sp.toPx() } } } + val screenWidth = remember { with(currentDensity) { (currentConfiguration.screenWidthDp.dp - (88.dp * 2)).toPx() } } + val formattedSentence = remember { todaySentence.toLineBreakingSentence(textPaint, screenWidth) } + + Column( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = modifier + .fillMaxWidth() + .padding(horizontal = 68.dp) + .semantics { contentDescription = "todaySentence" }, + ) { + Text( + text = "${name}님,", + style = SoptTheme.typography.title24SB, + color = Gray30, + maxLines = 1, + textAlign = TextAlign.Center, + ) + Text( + text = formattedSentence, + style = SoptTheme.typography.title24SB.copy( + lineBreak = LineBreak.Simple, + ), + color = Gray30, + maxLines = 4, + textAlign = TextAlign.Center, + softWrap = true, + ) + } +} + +private fun String.toLineBreakingSentence(textPaint: Paint, screenWidth: Float): String { + var resultSentence = "" + var sentenceLineWidth = 0f + val words = split(" ") + val spaceWidth = textPaint.measureText(" ") + + words.forEach { word -> + val wordWidth = textPaint.measureText(word) + + when (sentenceLineWidth + wordWidth + spaceWidth > screenWidth) { + true -> { + resultSentence += "\n$word" + sentenceLineWidth = wordWidth + } + + false -> { + resultSentence = if (resultSentence.isBlank()) word else "$resultSentence $word" + sentenceLineWidth += wordWidth + spaceWidth + } + } + } + + return resultSentence +} + +@Preview +@Composable +private fun TodayFortuneTextPreview() { + SoptTheme { + TodayFortuneText( + todaySentence = "저 근데 진짜 발 딛는 것도 처음이라 좀 수치스러울 것 같은데 옆에서 카공하다", + name = "김세훈", + ) + } +} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt index 73964eb3b..66bf3286e 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt @@ -40,9 +40,7 @@ internal sealed interface FortuneDetailUiState { data class TodaySentence( val userName: String, val content: String, - ) { - val message: String get() = "${userName}님,\n${content}" - } + ) @Immutable data class UserInfo( From 969eeede3e4e792c673c1756fa49a01549cfc70a Mon Sep 17 00:00:00 2001 From: s9hn Date: Wed, 9 Oct 2024 04:07:30 +0900 Subject: [PATCH 65/66] =?UTF-8?q?refactor:=20=EB=A7=A4=EC=A7=81=EB=84=98?= =?UTF-8?q?=EB=B2=84=20=EC=83=81=EC=88=98=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fortune/feature/fortuneDetail/FortuneDetailViewModel.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt index 128363ca7..514613f78 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt @@ -56,7 +56,7 @@ internal class FortuneDetailViewModel @Inject constructor( val uiState: StateFlow get() = _uiState.asStateFlow() private var isAnonymous: Boolean = false - private var userId = -1 + private var userId = DEFAULT_ID init { viewModelScope.launch { @@ -108,4 +108,8 @@ internal class FortuneDetailViewModel @Inject constructor( } } } + + companion object { + private const val DEFAULT_ID = -1 + } } From d2fdcd689754ffe6ed1f0d76645657ebec0e7472 Mon Sep 17 00:00:00 2001 From: s9hn Date: Sat, 12 Oct 2024 15:05:49 +0900 Subject: [PATCH 66/66] build: baseline-prof & spotless --- .../baselineProfiles/baseline-prof.txt | 61 ++++++++----------- .../baselineProfiles/startup-prof.txt | 61 ++++++++----------- .../model/response/UserGenerationResponse.kt | 2 +- .../data/mypage/source/UserDataSource.kt | 2 +- .../mypage/repository/UserRepository.kt | 2 +- .../domain/soptamp/fake/FakeUserRepository.kt | 2 +- .../fortune/component/FortuneButton.kt | 24 ++++++++ .../fortuneDetail/FortuneDetailRoute.kt | 24 ++++++++ .../component/PokeMessageBottomSheet.kt | 24 ++++++++ .../component/PokeMessageItem.kt | 25 +++++++- .../fortuneDetail/component/PokeSnackBar.kt | 24 ++++++++ .../component/TodayFortuneDashboard.kt | 2 +- .../component/TodayFortuneText.kt | 24 ++++++++ .../src/main/res/drawable/ic_checkbox_off.xml | 24 ++++++++ .../src/main/res/drawable/ic_checkbox_on.xml | 24 ++++++++ 15 files changed, 251 insertions(+), 74 deletions(-) diff --git a/app/src/release/generated/baselineProfiles/baseline-prof.txt b/app/src/release/generated/baselineProfiles/baseline-prof.txt index a5df04ead..67e0f2505 100644 --- a/app/src/release/generated/baselineProfiles/baseline-prof.txt +++ b/app/src/release/generated/baselineProfiles/baseline-prof.txt @@ -1060,7 +1060,6 @@ Landroidx/core/provider/FontProvider$ContentQueryWrapper; HSPLandroidx/core/provider/FontProvider$ContentQueryWrapper;->make(Landroid/content/Context;Landroid/net/Uri;)Landroidx/core/provider/FontProvider$ContentQueryWrapper; Landroidx/core/provider/FontProvider$ContentQueryWrapperApi24Impl; HSPLandroidx/core/provider/FontProvider$ContentQueryWrapperApi24Impl;->(Landroid/content/Context;Landroid/net/Uri;)V -HSPLandroidx/core/provider/FontProvider$ContentQueryWrapperApi24Impl;->close()V HSPLandroidx/core/provider/FontProvider$ContentQueryWrapperApi24Impl;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/database/Cursor; Landroidx/core/provider/FontRequest; HSPLandroidx/core/provider/FontRequest;->(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;)V @@ -1073,13 +1072,9 @@ Landroidx/core/provider/FontsContractCompat; HSPLandroidx/core/provider/FontsContractCompat;->buildTypeface(Landroid/content/Context;Landroid/os/CancellationSignal;[Landroidx/core/provider/FontsContractCompat$FontInfo;)Landroid/graphics/Typeface; HSPLandroidx/core/provider/FontsContractCompat;->fetchFonts(Landroid/content/Context;Landroid/os/CancellationSignal;Landroidx/core/provider/FontRequest;)Landroidx/core/provider/FontsContractCompat$FontFamilyResult; Landroidx/core/provider/FontsContractCompat$FontFamilyResult; -HSPLandroidx/core/provider/FontsContractCompat$FontFamilyResult;->(I[Landroidx/core/provider/FontsContractCompat$FontInfo;)V -HSPLandroidx/core/provider/FontsContractCompat$FontFamilyResult;->create(I[Landroidx/core/provider/FontsContractCompat$FontInfo;)Landroidx/core/provider/FontsContractCompat$FontFamilyResult; HSPLandroidx/core/provider/FontsContractCompat$FontFamilyResult;->getFonts()[Landroidx/core/provider/FontsContractCompat$FontInfo; HSPLandroidx/core/provider/FontsContractCompat$FontFamilyResult;->getStatusCode()I Landroidx/core/provider/FontsContractCompat$FontInfo; -HSPLandroidx/core/provider/FontsContractCompat$FontInfo;->(Landroid/net/Uri;IIZI)V -HSPLandroidx/core/provider/FontsContractCompat$FontInfo;->create(Landroid/net/Uri;IIZI)Landroidx/core/provider/FontsContractCompat$FontInfo; HSPLandroidx/core/provider/FontsContractCompat$FontInfo;->getResultCode()I HSPLandroidx/core/provider/FontsContractCompat$FontInfo;->getTtcIndex()I HSPLandroidx/core/provider/FontsContractCompat$FontInfo;->getUri()Landroid/net/Uri; @@ -2679,8 +2674,6 @@ PLandroidx/profileinstaller/ProfileVerifier;->setCompilationStatus(IZZZ)Landroid PLandroidx/profileinstaller/ProfileVerifier;->writeProfileVerification(Landroid/content/Context;Z)Landroidx/profileinstaller/ProfileVerifier$CompilationStatus; PLandroidx/profileinstaller/ProfileVerifier$Api33Impl;->getPackageInfo(Landroid/content/pm/PackageManager;Landroid/content/Context;)Landroid/content/pm/PackageInfo; PLandroidx/profileinstaller/ProfileVerifier$Cache;->(IIJJ)V -PLandroidx/profileinstaller/ProfileVerifier$Cache;->equals(Ljava/lang/Object;)Z -PLandroidx/profileinstaller/ProfileVerifier$Cache;->readFromFile(Ljava/io/File;)Landroidx/profileinstaller/ProfileVerifier$Cache; PLandroidx/profileinstaller/ProfileVerifier$Cache;->writeOnFile(Ljava/io/File;)V PLandroidx/profileinstaller/ProfileVerifier$CompilationStatus;->(IZZZ)V Landroidx/savedstate/R$id; @@ -3404,12 +3397,11 @@ HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSch HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoScheduler;->schedule(Lcom/google/android/datatransport/runtime/TransportContext;I)V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoScheduler;->schedule(Lcom/google/android/datatransport/runtime/TransportContext;IZ)V Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->()V -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->lambda$onStartJob$0$com-google-android-datatransport-runtime-scheduling-jobscheduling-JobInfoSchedulerService(Landroid/app/job/JobParameters;)V -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->onStartJob(Landroid/app/job/JobParameters;)Z -Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService$$ExternalSyntheticLambda0; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService$$ExternalSyntheticLambda0;->(Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;Landroid/app/job/JobParameters;)V -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService$$ExternalSyntheticLambda0;->run()V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->()V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->lambda$onStartJob$0$com-google-android-datatransport-runtime-scheduling-jobscheduling-JobInfoSchedulerService(Landroid/app/job/JobParameters;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->onStartJob(Landroid/app/job/JobParameters;)Z +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService$$ExternalSyntheticLambda0;->(Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;Landroid/app/job/JobParameters;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService$$ExternalSyntheticLambda0;->run()V Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/SchedulerConfig; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/SchedulerConfig;->()V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/SchedulerConfig;->adjustedExponentialBackoff(IJ)J @@ -3436,24 +3428,22 @@ HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/SchedulerC Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->(Landroid/content/Context;Lcom/google/android/datatransport/runtime/backends/BackendRegistry;Lcom/google/android/datatransport/runtime/scheduling/persistence/EventStore;Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/WorkScheduler;Ljava/util/concurrent/Executor;Lcom/google/android/datatransport/runtime/synchronization/SynchronizationGuard;Lcom/google/android/datatransport/runtime/time/Clock;Lcom/google/android/datatransport/runtime/time/Clock;Lcom/google/android/datatransport/runtime/scheduling/persistence/ClientHealthMetricsStore;)V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->createMetricsEvent(Lcom/google/android/datatransport/runtime/backends/TransportBackend;)Lcom/google/android/datatransport/runtime/EventInternal; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->isNetworkAvailable()Z +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->isNetworkAvailable()Z HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$logAndUpdateState$2$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Lcom/google/android/datatransport/runtime/TransportContext;)Ljava/lang/Boolean; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$logAndUpdateState$3$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Lcom/google/android/datatransport/runtime/TransportContext;)Ljava/lang/Iterable; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$logAndUpdateState$5$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Ljava/lang/Iterable;)Ljava/lang/Object; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$logAndUpdateState$6$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader()Ljava/lang/Object; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$logAndUpdateState$8$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Lcom/google/android/datatransport/runtime/TransportContext;J)Ljava/lang/Object; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$upload$1$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$upload$1$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->logAndUpdateState(Lcom/google/android/datatransport/runtime/TransportContext;I)Lcom/google/android/datatransport/runtime/backends/BackendResponse; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->upload(Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V -Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda0; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda0;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/EventStore;)V -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda0;->execute()Ljava/lang/Object; +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->upload(Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda0;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/EventStore;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda0;->execute()Ljava/lang/Object; Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda1; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda1;->(Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;Lcom/google/android/datatransport/runtime/TransportContext;J)V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda1;->execute()Ljava/lang/Object; -Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda3; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda3;->(Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda3;->run()V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda3;->(Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda3;->run()V Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda4; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda4;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/ClientHealthMetricsStore;)V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda4;->execute()Ljava/lang/Object; @@ -3496,7 +3486,7 @@ Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/WorkScheduler Lcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->(JIIJI)V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->(JIIJILcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig$1;)V -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->getEventCleanUpAge()J +PLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->getEventCleanUpAge()J HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->getLoadBatchSize()I HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->getMaxBlobByteSizePerRow()I HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->getMaxStorageSizeInBytes()J @@ -3565,7 +3555,7 @@ HSPLcom/google/android/datatransport/runtime/scheduling/persistence/PersistedEve Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->()V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->(Lcom/google/android/datatransport/runtime/time/Clock;Lcom/google/android/datatransport/runtime/time/Clock;Lcom/google/android/datatransport/runtime/scheduling/persistence/EventStoreConfig;Lcom/google/android/datatransport/runtime/scheduling/persistence/SchemaManager;Ljavax/inject/Provider;)V -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->cleanUp()I +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->cleanUp()I HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->ensureBeginTransaction(Landroid/database/sqlite/SQLiteDatabase;)V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->ensureTransportContext(Landroid/database/sqlite/SQLiteDatabase;Lcom/google/android/datatransport/runtime/TransportContext;)J HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->getByteSize()J @@ -3580,8 +3570,8 @@ HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventS HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->inTransaction(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$Function;)Ljava/lang/Object; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->isStorageAtLimit()Z HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->join(Ljava/util/List;Ljava/util/Map;)Ljava/util/List; -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$cleanUp$11$com-google-android-datatransport-runtime-scheduling-persistence-SQLiteEventStore(Landroid/database/Cursor;)Ljava/lang/Object; -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$cleanUp$12$com-google-android-datatransport-runtime-scheduling-persistence-SQLiteEventStore(JLandroid/database/sqlite/SQLiteDatabase;)Ljava/lang/Integer; +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$cleanUp$11$com-google-android-datatransport-runtime-scheduling-persistence-SQLiteEventStore(Landroid/database/Cursor;)Ljava/lang/Object; +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$cleanUp$12$com-google-android-datatransport-runtime-scheduling-persistence-SQLiteEventStore(JLandroid/database/sqlite/SQLiteDatabase;)Ljava/lang/Integer; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$ensureBeginTransaction$24(Landroid/database/sqlite/SQLiteDatabase;)Ljava/lang/Object; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$getNextCallTime$5(Landroid/database/Cursor;)Ljava/lang/Long; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$getTimeWindow$21(JLandroid/database/Cursor;)Lcom/google/android/datatransport/runtime/firebase/transport/TimeWindow; @@ -3619,9 +3609,8 @@ HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventS Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda1; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda1;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;Ljava/util/List;Lcom/google/android/datatransport/runtime/TransportContext;)V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda1;->apply(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda10; -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda10;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;J)V -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda10;->apply(Ljava/lang/Object;)Ljava/lang/Object; +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda10;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;J)V +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda10;->apply(Ljava/lang/Object;)Ljava/lang/Object; Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda13; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda13;->()V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda13;->apply(Ljava/lang/Object;)Ljava/lang/Object; @@ -3637,9 +3626,8 @@ HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventS Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda18; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda18;->(J)V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda18;->apply(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda19; -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda19;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;)V -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda19;->apply(Ljava/lang/Object;)Ljava/lang/Object; +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda19;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;)V +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda19;->apply(Ljava/lang/Object;)Ljava/lang/Object; Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda2; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda2;->()V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda2;->apply(Ljava/lang/Object;)Ljava/lang/Object; @@ -3749,7 +3737,7 @@ HSPLcom/google/android/datatransport/runtime/time/WallTimeClock;->getTime()J Lcom/google/android/datatransport/runtime/util/PriorityMapping; HSPLcom/google/android/datatransport/runtime/util/PriorityMapping;->()V HSPLcom/google/android/datatransport/runtime/util/PriorityMapping;->toInt(Lcom/google/android/datatransport/Priority;)I -HSPLcom/google/android/datatransport/runtime/util/PriorityMapping;->valueOf(I)Lcom/google/android/datatransport/Priority; +PLcom/google/android/datatransport/runtime/util/PriorityMapping;->valueOf(I)Lcom/google/android/datatransport/Priority; Lcom/google/android/gms/cloudmessaging/Rpc; HSPLcom/google/android/gms/cloudmessaging/Rpc;->()V HSPLcom/google/android/gms/cloudmessaging/Rpc;->(Landroid/content/Context;)V @@ -3892,6 +3880,7 @@ Lcom/google/android/gms/common/internal/GmsClientSupervisor; HSPLcom/google/android/gms/common/internal/GmsClientSupervisor;->()V HSPLcom/google/android/gms/common/internal/GmsClientSupervisor;->()V HSPLcom/google/android/gms/common/internal/GmsClientSupervisor;->getInstance(Landroid/content/Context;)Lcom/google/android/gms/common/internal/GmsClientSupervisor; +PLcom/google/android/gms/common/internal/GmsClientSupervisor;->zzb(Ljava/lang/String;Ljava/lang/String;ILandroid/content/ServiceConnection;Ljava/lang/String;Z)V Lcom/google/android/gms/common/internal/IGmsCallbacks; Lcom/google/android/gms/common/internal/IGmsServiceBroker; Lcom/google/android/gms/common/internal/Objects; @@ -5121,6 +5110,7 @@ HSPLcom/google/android/gms/measurement/internal/zzhv;->(Lcom/google/androi HSPLcom/google/android/gms/measurement/internal/zzhv;->zza(Lcom/google/android/gms/measurement/internal/zzhw;)V HSPLcom/google/android/gms/measurement/internal/zzhv;->zzb(Ljava/lang/Runnable;)V HSPLcom/google/android/gms/measurement/internal/zzhv;->zzc()Ljava/util/concurrent/atomic/AtomicLong; +HSPLcom/google/android/gms/measurement/internal/zzhv;->zzc(Lcom/google/android/gms/measurement/internal/zzhv;)Ljava/lang/Object; HSPLcom/google/android/gms/measurement/internal/zzhv;->zzd(Lcom/google/android/gms/measurement/internal/zzhv;)Ljava/util/concurrent/Semaphore; HSPLcom/google/android/gms/measurement/internal/zzhv;->zze(Lcom/google/android/gms/measurement/internal/zzhv;)Z HSPLcom/google/android/gms/measurement/internal/zzhv;->zzh()Z @@ -6508,14 +6498,15 @@ HSPLcom/google/firebase/crashlytics/internal/common/FirebaseInstallationId;->get Lcom/google/firebase/crashlytics/internal/common/IdManager; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->()V HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->(Landroid/content/Context;Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsApi;Lcom/google/firebase/crashlytics/internal/common/DataCollectionArbiter;)V +HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->createAndCacheCrashlyticsInstallId(Ljava/lang/String;Landroid/content/SharedPreferences;)Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->fetchTrueFid(Z)Lcom/google/firebase/crashlytics/internal/common/FirebaseInstallationId; +HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->formatId(Ljava/lang/String;)Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getAppIdentifier()Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getInstallIds()Lcom/google/firebase/crashlytics/internal/common/InstallIdProvider$InstallIds; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getInstallerPackageName()Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getModelName()Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getOsBuildVersionString()Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getOsDisplayVersionString()Ljava/lang/String; -HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->readCachedCrashlyticsInstallId(Landroid/content/SharedPreferences;)Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->removeForwardSlashesIn(Ljava/lang/String;)Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->shouldRefresh()Z Lcom/google/firebase/crashlytics/internal/common/InstallIdProvider; @@ -6720,6 +6711,7 @@ HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->getCustomKe HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->getInternalKeys()Ljava/util/Map; HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->getRolloutsState()Ljava/util/List; HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->loadFromExistingSession(Ljava/lang/String;Lcom/google/firebase/crashlytics/internal/persistence/FileStore;Lcom/google/firebase/crashlytics/internal/concurrency/CrashlyticsWorkers;)Lcom/google/firebase/crashlytics/internal/metadata/UserMetadata; +HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->readUserId(Ljava/lang/String;Lcom/google/firebase/crashlytics/internal/persistence/FileStore;)Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->setInternalKey(Ljava/lang/String;Ljava/lang/String;)Z Lcom/google/firebase/crashlytics/internal/metadata/UserMetadata$SerializeableKeysMap; HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata$SerializeableKeysMap;->(Lcom/google/firebase/crashlytics/internal/metadata/UserMetadata;Z)V @@ -7360,6 +7352,7 @@ HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersis HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->getOpenSessionIds()Ljava/util/SortedSet; HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->getStartTimestampMillis(Ljava/lang/String;)J HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->hasFinalizedReports()Z +HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->isHighPriorityEventFile(Ljava/lang/String;)Z HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->isNormalPriorityEventFile(Ljava/io/File;Ljava/lang/String;)Z HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->lambda$static$1(Ljava/io/File;Ljava/lang/String;)Z HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->loadFinalizedReports()Ljava/util/List; diff --git a/app/src/release/generated/baselineProfiles/startup-prof.txt b/app/src/release/generated/baselineProfiles/startup-prof.txt index a5df04ead..67e0f2505 100644 --- a/app/src/release/generated/baselineProfiles/startup-prof.txt +++ b/app/src/release/generated/baselineProfiles/startup-prof.txt @@ -1060,7 +1060,6 @@ Landroidx/core/provider/FontProvider$ContentQueryWrapper; HSPLandroidx/core/provider/FontProvider$ContentQueryWrapper;->make(Landroid/content/Context;Landroid/net/Uri;)Landroidx/core/provider/FontProvider$ContentQueryWrapper; Landroidx/core/provider/FontProvider$ContentQueryWrapperApi24Impl; HSPLandroidx/core/provider/FontProvider$ContentQueryWrapperApi24Impl;->(Landroid/content/Context;Landroid/net/Uri;)V -HSPLandroidx/core/provider/FontProvider$ContentQueryWrapperApi24Impl;->close()V HSPLandroidx/core/provider/FontProvider$ContentQueryWrapperApi24Impl;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/database/Cursor; Landroidx/core/provider/FontRequest; HSPLandroidx/core/provider/FontRequest;->(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;)V @@ -1073,13 +1072,9 @@ Landroidx/core/provider/FontsContractCompat; HSPLandroidx/core/provider/FontsContractCompat;->buildTypeface(Landroid/content/Context;Landroid/os/CancellationSignal;[Landroidx/core/provider/FontsContractCompat$FontInfo;)Landroid/graphics/Typeface; HSPLandroidx/core/provider/FontsContractCompat;->fetchFonts(Landroid/content/Context;Landroid/os/CancellationSignal;Landroidx/core/provider/FontRequest;)Landroidx/core/provider/FontsContractCompat$FontFamilyResult; Landroidx/core/provider/FontsContractCompat$FontFamilyResult; -HSPLandroidx/core/provider/FontsContractCompat$FontFamilyResult;->(I[Landroidx/core/provider/FontsContractCompat$FontInfo;)V -HSPLandroidx/core/provider/FontsContractCompat$FontFamilyResult;->create(I[Landroidx/core/provider/FontsContractCompat$FontInfo;)Landroidx/core/provider/FontsContractCompat$FontFamilyResult; HSPLandroidx/core/provider/FontsContractCompat$FontFamilyResult;->getFonts()[Landroidx/core/provider/FontsContractCompat$FontInfo; HSPLandroidx/core/provider/FontsContractCompat$FontFamilyResult;->getStatusCode()I Landroidx/core/provider/FontsContractCompat$FontInfo; -HSPLandroidx/core/provider/FontsContractCompat$FontInfo;->(Landroid/net/Uri;IIZI)V -HSPLandroidx/core/provider/FontsContractCompat$FontInfo;->create(Landroid/net/Uri;IIZI)Landroidx/core/provider/FontsContractCompat$FontInfo; HSPLandroidx/core/provider/FontsContractCompat$FontInfo;->getResultCode()I HSPLandroidx/core/provider/FontsContractCompat$FontInfo;->getTtcIndex()I HSPLandroidx/core/provider/FontsContractCompat$FontInfo;->getUri()Landroid/net/Uri; @@ -2679,8 +2674,6 @@ PLandroidx/profileinstaller/ProfileVerifier;->setCompilationStatus(IZZZ)Landroid PLandroidx/profileinstaller/ProfileVerifier;->writeProfileVerification(Landroid/content/Context;Z)Landroidx/profileinstaller/ProfileVerifier$CompilationStatus; PLandroidx/profileinstaller/ProfileVerifier$Api33Impl;->getPackageInfo(Landroid/content/pm/PackageManager;Landroid/content/Context;)Landroid/content/pm/PackageInfo; PLandroidx/profileinstaller/ProfileVerifier$Cache;->(IIJJ)V -PLandroidx/profileinstaller/ProfileVerifier$Cache;->equals(Ljava/lang/Object;)Z -PLandroidx/profileinstaller/ProfileVerifier$Cache;->readFromFile(Ljava/io/File;)Landroidx/profileinstaller/ProfileVerifier$Cache; PLandroidx/profileinstaller/ProfileVerifier$Cache;->writeOnFile(Ljava/io/File;)V PLandroidx/profileinstaller/ProfileVerifier$CompilationStatus;->(IZZZ)V Landroidx/savedstate/R$id; @@ -3404,12 +3397,11 @@ HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSch HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoScheduler;->schedule(Lcom/google/android/datatransport/runtime/TransportContext;I)V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoScheduler;->schedule(Lcom/google/android/datatransport/runtime/TransportContext;IZ)V Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->()V -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->lambda$onStartJob$0$com-google-android-datatransport-runtime-scheduling-jobscheduling-JobInfoSchedulerService(Landroid/app/job/JobParameters;)V -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->onStartJob(Landroid/app/job/JobParameters;)Z -Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService$$ExternalSyntheticLambda0; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService$$ExternalSyntheticLambda0;->(Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;Landroid/app/job/JobParameters;)V -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService$$ExternalSyntheticLambda0;->run()V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->()V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->lambda$onStartJob$0$com-google-android-datatransport-runtime-scheduling-jobscheduling-JobInfoSchedulerService(Landroid/app/job/JobParameters;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;->onStartJob(Landroid/app/job/JobParameters;)Z +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService$$ExternalSyntheticLambda0;->(Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService;Landroid/app/job/JobParameters;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/JobInfoSchedulerService$$ExternalSyntheticLambda0;->run()V Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/SchedulerConfig; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/SchedulerConfig;->()V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/SchedulerConfig;->adjustedExponentialBackoff(IJ)J @@ -3436,24 +3428,22 @@ HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/SchedulerC Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->(Landroid/content/Context;Lcom/google/android/datatransport/runtime/backends/BackendRegistry;Lcom/google/android/datatransport/runtime/scheduling/persistence/EventStore;Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/WorkScheduler;Ljava/util/concurrent/Executor;Lcom/google/android/datatransport/runtime/synchronization/SynchronizationGuard;Lcom/google/android/datatransport/runtime/time/Clock;Lcom/google/android/datatransport/runtime/time/Clock;Lcom/google/android/datatransport/runtime/scheduling/persistence/ClientHealthMetricsStore;)V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->createMetricsEvent(Lcom/google/android/datatransport/runtime/backends/TransportBackend;)Lcom/google/android/datatransport/runtime/EventInternal; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->isNetworkAvailable()Z +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->isNetworkAvailable()Z HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$logAndUpdateState$2$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Lcom/google/android/datatransport/runtime/TransportContext;)Ljava/lang/Boolean; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$logAndUpdateState$3$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Lcom/google/android/datatransport/runtime/TransportContext;)Ljava/lang/Iterable; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$logAndUpdateState$5$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Ljava/lang/Iterable;)Ljava/lang/Object; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$logAndUpdateState$6$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader()Ljava/lang/Object; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$logAndUpdateState$8$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Lcom/google/android/datatransport/runtime/TransportContext;J)Ljava/lang/Object; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$upload$1$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->lambda$upload$1$com-google-android-datatransport-runtime-scheduling-jobscheduling-Uploader(Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->logAndUpdateState(Lcom/google/android/datatransport/runtime/TransportContext;I)Lcom/google/android/datatransport/runtime/backends/BackendResponse; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->upload(Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V -Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda0; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda0;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/EventStore;)V -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda0;->execute()Ljava/lang/Object; +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;->upload(Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda0;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/EventStore;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda0;->execute()Ljava/lang/Object; Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda1; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda1;->(Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;Lcom/google/android/datatransport/runtime/TransportContext;J)V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda1;->execute()Ljava/lang/Object; -Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda3; -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda3;->(Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V -HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda3;->run()V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda3;->(Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader;Lcom/google/android/datatransport/runtime/TransportContext;ILjava/lang/Runnable;)V +PLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda3;->run()V Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda4; HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda4;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/ClientHealthMetricsStore;)V HSPLcom/google/android/datatransport/runtime/scheduling/jobscheduling/Uploader$$ExternalSyntheticLambda4;->execute()Ljava/lang/Object; @@ -3496,7 +3486,7 @@ Lcom/google/android/datatransport/runtime/scheduling/jobscheduling/WorkScheduler Lcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->(JIIJI)V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->(JIIJILcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig$1;)V -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->getEventCleanUpAge()J +PLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->getEventCleanUpAge()J HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->getLoadBatchSize()I HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->getMaxBlobByteSizePerRow()I HSPLcom/google/android/datatransport/runtime/scheduling/persistence/AutoValue_EventStoreConfig;->getMaxStorageSizeInBytes()J @@ -3565,7 +3555,7 @@ HSPLcom/google/android/datatransport/runtime/scheduling/persistence/PersistedEve Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->()V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->(Lcom/google/android/datatransport/runtime/time/Clock;Lcom/google/android/datatransport/runtime/time/Clock;Lcom/google/android/datatransport/runtime/scheduling/persistence/EventStoreConfig;Lcom/google/android/datatransport/runtime/scheduling/persistence/SchemaManager;Ljavax/inject/Provider;)V -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->cleanUp()I +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->cleanUp()I HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->ensureBeginTransaction(Landroid/database/sqlite/SQLiteDatabase;)V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->ensureTransportContext(Landroid/database/sqlite/SQLiteDatabase;Lcom/google/android/datatransport/runtime/TransportContext;)J HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->getByteSize()J @@ -3580,8 +3570,8 @@ HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventS HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->inTransaction(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$Function;)Ljava/lang/Object; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->isStorageAtLimit()Z HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->join(Ljava/util/List;Ljava/util/Map;)Ljava/util/List; -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$cleanUp$11$com-google-android-datatransport-runtime-scheduling-persistence-SQLiteEventStore(Landroid/database/Cursor;)Ljava/lang/Object; -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$cleanUp$12$com-google-android-datatransport-runtime-scheduling-persistence-SQLiteEventStore(JLandroid/database/sqlite/SQLiteDatabase;)Ljava/lang/Integer; +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$cleanUp$11$com-google-android-datatransport-runtime-scheduling-persistence-SQLiteEventStore(Landroid/database/Cursor;)Ljava/lang/Object; +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$cleanUp$12$com-google-android-datatransport-runtime-scheduling-persistence-SQLiteEventStore(JLandroid/database/sqlite/SQLiteDatabase;)Ljava/lang/Integer; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$ensureBeginTransaction$24(Landroid/database/sqlite/SQLiteDatabase;)Ljava/lang/Object; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$getNextCallTime$5(Landroid/database/Cursor;)Ljava/lang/Long; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;->lambda$getTimeWindow$21(JLandroid/database/Cursor;)Lcom/google/android/datatransport/runtime/firebase/transport/TimeWindow; @@ -3619,9 +3609,8 @@ HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventS Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda1; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda1;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;Ljava/util/List;Lcom/google/android/datatransport/runtime/TransportContext;)V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda1;->apply(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda10; -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda10;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;J)V -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda10;->apply(Ljava/lang/Object;)Ljava/lang/Object; +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda10;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;J)V +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda10;->apply(Ljava/lang/Object;)Ljava/lang/Object; Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda13; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda13;->()V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda13;->apply(Ljava/lang/Object;)Ljava/lang/Object; @@ -3637,9 +3626,8 @@ HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventS Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda18; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda18;->(J)V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda18;->apply(Ljava/lang/Object;)Ljava/lang/Object; -Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda19; -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda19;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;)V -HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda19;->apply(Ljava/lang/Object;)Ljava/lang/Object; +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda19;->(Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore;)V +PLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda19;->apply(Ljava/lang/Object;)Ljava/lang/Object; Lcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda2; HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda2;->()V HSPLcom/google/android/datatransport/runtime/scheduling/persistence/SQLiteEventStore$$ExternalSyntheticLambda2;->apply(Ljava/lang/Object;)Ljava/lang/Object; @@ -3749,7 +3737,7 @@ HSPLcom/google/android/datatransport/runtime/time/WallTimeClock;->getTime()J Lcom/google/android/datatransport/runtime/util/PriorityMapping; HSPLcom/google/android/datatransport/runtime/util/PriorityMapping;->()V HSPLcom/google/android/datatransport/runtime/util/PriorityMapping;->toInt(Lcom/google/android/datatransport/Priority;)I -HSPLcom/google/android/datatransport/runtime/util/PriorityMapping;->valueOf(I)Lcom/google/android/datatransport/Priority; +PLcom/google/android/datatransport/runtime/util/PriorityMapping;->valueOf(I)Lcom/google/android/datatransport/Priority; Lcom/google/android/gms/cloudmessaging/Rpc; HSPLcom/google/android/gms/cloudmessaging/Rpc;->()V HSPLcom/google/android/gms/cloudmessaging/Rpc;->(Landroid/content/Context;)V @@ -3892,6 +3880,7 @@ Lcom/google/android/gms/common/internal/GmsClientSupervisor; HSPLcom/google/android/gms/common/internal/GmsClientSupervisor;->()V HSPLcom/google/android/gms/common/internal/GmsClientSupervisor;->()V HSPLcom/google/android/gms/common/internal/GmsClientSupervisor;->getInstance(Landroid/content/Context;)Lcom/google/android/gms/common/internal/GmsClientSupervisor; +PLcom/google/android/gms/common/internal/GmsClientSupervisor;->zzb(Ljava/lang/String;Ljava/lang/String;ILandroid/content/ServiceConnection;Ljava/lang/String;Z)V Lcom/google/android/gms/common/internal/IGmsCallbacks; Lcom/google/android/gms/common/internal/IGmsServiceBroker; Lcom/google/android/gms/common/internal/Objects; @@ -5121,6 +5110,7 @@ HSPLcom/google/android/gms/measurement/internal/zzhv;->(Lcom/google/androi HSPLcom/google/android/gms/measurement/internal/zzhv;->zza(Lcom/google/android/gms/measurement/internal/zzhw;)V HSPLcom/google/android/gms/measurement/internal/zzhv;->zzb(Ljava/lang/Runnable;)V HSPLcom/google/android/gms/measurement/internal/zzhv;->zzc()Ljava/util/concurrent/atomic/AtomicLong; +HSPLcom/google/android/gms/measurement/internal/zzhv;->zzc(Lcom/google/android/gms/measurement/internal/zzhv;)Ljava/lang/Object; HSPLcom/google/android/gms/measurement/internal/zzhv;->zzd(Lcom/google/android/gms/measurement/internal/zzhv;)Ljava/util/concurrent/Semaphore; HSPLcom/google/android/gms/measurement/internal/zzhv;->zze(Lcom/google/android/gms/measurement/internal/zzhv;)Z HSPLcom/google/android/gms/measurement/internal/zzhv;->zzh()Z @@ -6508,14 +6498,15 @@ HSPLcom/google/firebase/crashlytics/internal/common/FirebaseInstallationId;->get Lcom/google/firebase/crashlytics/internal/common/IdManager; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->()V HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->(Landroid/content/Context;Ljava/lang/String;Lcom/google/firebase/installations/FirebaseInstallationsApi;Lcom/google/firebase/crashlytics/internal/common/DataCollectionArbiter;)V +HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->createAndCacheCrashlyticsInstallId(Ljava/lang/String;Landroid/content/SharedPreferences;)Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->fetchTrueFid(Z)Lcom/google/firebase/crashlytics/internal/common/FirebaseInstallationId; +HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->formatId(Ljava/lang/String;)Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getAppIdentifier()Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getInstallIds()Lcom/google/firebase/crashlytics/internal/common/InstallIdProvider$InstallIds; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getInstallerPackageName()Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getModelName()Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getOsBuildVersionString()Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->getOsDisplayVersionString()Ljava/lang/String; -HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->readCachedCrashlyticsInstallId(Landroid/content/SharedPreferences;)Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->removeForwardSlashesIn(Ljava/lang/String;)Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/common/IdManager;->shouldRefresh()Z Lcom/google/firebase/crashlytics/internal/common/InstallIdProvider; @@ -6720,6 +6711,7 @@ HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->getCustomKe HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->getInternalKeys()Ljava/util/Map; HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->getRolloutsState()Ljava/util/List; HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->loadFromExistingSession(Ljava/lang/String;Lcom/google/firebase/crashlytics/internal/persistence/FileStore;Lcom/google/firebase/crashlytics/internal/concurrency/CrashlyticsWorkers;)Lcom/google/firebase/crashlytics/internal/metadata/UserMetadata; +HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->readUserId(Ljava/lang/String;Lcom/google/firebase/crashlytics/internal/persistence/FileStore;)Ljava/lang/String; HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata;->setInternalKey(Ljava/lang/String;Ljava/lang/String;)Z Lcom/google/firebase/crashlytics/internal/metadata/UserMetadata$SerializeableKeysMap; HSPLcom/google/firebase/crashlytics/internal/metadata/UserMetadata$SerializeableKeysMap;->(Lcom/google/firebase/crashlytics/internal/metadata/UserMetadata;Z)V @@ -7360,6 +7352,7 @@ HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersis HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->getOpenSessionIds()Ljava/util/SortedSet; HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->getStartTimestampMillis(Ljava/lang/String;)J HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->hasFinalizedReports()Z +HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->isHighPriorityEventFile(Ljava/lang/String;)Z HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->isNormalPriorityEventFile(Ljava/io/File;Ljava/lang/String;)Z HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->lambda$static$1(Ljava/io/File;Ljava/lang/String;)Z HSPLcom/google/firebase/crashlytics/internal/persistence/CrashlyticsReportPersistence;->loadFinalizedReports()Ljava/util/List; diff --git a/data/mypage/src/main/java/org/sopt/official/data/mypage/model/response/UserGenerationResponse.kt b/data/mypage/src/main/java/org/sopt/official/data/mypage/model/response/UserGenerationResponse.kt index d198401e5..908fe8f02 100644 --- a/data/mypage/src/main/java/org/sopt/official/data/mypage/model/response/UserGenerationResponse.kt +++ b/data/mypage/src/main/java/org/sopt/official/data/mypage/model/response/UserGenerationResponse.kt @@ -1,6 +1,6 @@ /* * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together + * Copyright 2023-2024 SOPT - Shout Our Passion Together * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/data/mypage/src/main/java/org/sopt/official/data/mypage/source/UserDataSource.kt b/data/mypage/src/main/java/org/sopt/official/data/mypage/source/UserDataSource.kt index aacaa58ff..98211ccdd 100644 --- a/data/mypage/src/main/java/org/sopt/official/data/mypage/source/UserDataSource.kt +++ b/data/mypage/src/main/java/org/sopt/official/data/mypage/source/UserDataSource.kt @@ -1,6 +1,6 @@ /* * MIT License - * Copyright 2023 SOPT - Shout Our Passion Together + * Copyright 2023-2024 SOPT - Shout Our Passion Together * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/domain/mypage/src/main/kotlin/org/sopt/official/domain/mypage/repository/UserRepository.kt b/domain/mypage/src/main/kotlin/org/sopt/official/domain/mypage/repository/UserRepository.kt index 6ea8b85c7..e61c80335 100644 --- a/domain/mypage/src/main/kotlin/org/sopt/official/domain/mypage/repository/UserRepository.kt +++ b/domain/mypage/src/main/kotlin/org/sopt/official/domain/mypage/repository/UserRepository.kt @@ -1,6 +1,6 @@ /* * MIT License - * Copyright 2023 SOPT - Shout Our Passion Together + * Copyright 2023-2024 SOPT - Shout Our Passion Together * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/domain/soptamp/src/main/kotlin/org/sopt/official/domain/soptamp/fake/FakeUserRepository.kt b/domain/soptamp/src/main/kotlin/org/sopt/official/domain/soptamp/fake/FakeUserRepository.kt index 3958a159c..2b604543b 100644 --- a/domain/soptamp/src/main/kotlin/org/sopt/official/domain/soptamp/fake/FakeUserRepository.kt +++ b/domain/soptamp/src/main/kotlin/org/sopt/official/domain/soptamp/fake/FakeUserRepository.kt @@ -1,6 +1,6 @@ /* * MIT License - * Copyright 2023 SOPT - Shout Our Passion Together + * Copyright 2023-2024 SOPT - Shout Our Passion Together * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt index 9a419f357..ceed410da 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * Copyright 2024 SOPT - Shout Our Passion Together + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ package org.sopt.official.feature.fortune.component import androidx.compose.foundation.background diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt index 279d6dd71..644bbccc9 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * Copyright 2024 SOPT - Shout Our Passion Together + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ package org.sopt.official.feature.fortune.feature.fortuneDetail import android.content.Intent diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt index 51a73c01f..8b7a76552 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * Copyright 2024 SOPT - Shout Our Passion Together + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.Image diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt index 7e22cc992..b2092ec2b 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * Copyright 2024 SOPT - Shout Our Passion Together + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.background @@ -58,4 +82,3 @@ private fun PokeMessageItemPreview() { ) } } - diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt index 35ce7119f..74ff577de 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * Copyright 2024 SOPT - Shout Our Passion Together + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ package org.sopt.official.feature.fortune.feature.fortuneDetail.component import androidx.compose.foundation.background diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt index c1f70e3c7..3a61f37ee 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt @@ -1,6 +1,6 @@ /* * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together + * Copyright 2023-2024 SOPT - Shout Our Passion Together * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneText.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneText.kt index 79bbe9941..77b03e9a4 100644 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneText.kt +++ b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneText.kt @@ -1,3 +1,27 @@ +/* + * MIT License + * Copyright 2024 SOPT - Shout Our Passion Together + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ package org.sopt.official.feature.fortune.feature.fortuneDetail.component import android.graphics.Paint diff --git a/feature/fortune/src/main/res/drawable/ic_checkbox_off.xml b/feature/fortune/src/main/res/drawable/ic_checkbox_off.xml index 1c24380c3..b5b5e14ab 100644 --- a/feature/fortune/src/main/res/drawable/ic_checkbox_off.xml +++ b/feature/fortune/src/main/res/drawable/ic_checkbox_off.xml @@ -1,3 +1,27 @@ + + +