From 00ebd34a1c42b44b0269e6ee500f1024558a9109 Mon Sep 17 00:00:00 2001 From: kwakjoohyeong Date: Tue, 2 Jul 2024 19:26:25 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=EA=B0=95=EC=A0=9C=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/withpeace/withpeace/MainActivity.kt | 96 ++++++++++++++++++- 1 file changed, 92 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/withpeace/withpeace/MainActivity.kt b/app/src/main/java/com/withpeace/withpeace/MainActivity.kt index da55c3d3..68801ddd 100644 --- a/app/src/main/java/com/withpeace/withpeace/MainActivity.kt +++ b/app/src/main/java/com/withpeace/withpeace/MainActivity.kt @@ -9,7 +9,24 @@ import androidx.activity.compose.setContent import androidx.activity.result.ActivityResult import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.viewModels +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +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.foundation.layout.width +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.material3.TextButton import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.compose.ui.window.Dialog import androidx.core.splashscreen.SplashScreen import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.view.WindowCompat @@ -56,15 +73,24 @@ class MainActivity : ComponentActivity() { lifecycleScope.launch { splashScreen = installSplashScreen() splashScreen.setKeepOnScreenCondition { true } - repeatOnLifecycle(Lifecycle.State.STARTED) { viewModel.uiState.collect { uiState -> when (uiState) { MainUiState.Home -> composeStart(HOME_ROUTE) MainUiState.Login -> composeStart(LOGIN_ROUTE) - MainUiState.Update -> {} + MainUiState.Update -> { + showForceUpdateDialog() + } - MainUiState.Error -> finish() + MainUiState.Error -> { + //TODO 에러 화면으로 이동 + Toast.makeText( + this@MainActivity, + "네트워크 상태가 원활하지 않습니다.", + Toast.LENGTH_SHORT, + ).show() + finish() + } MainUiState.Loading -> {} } splashScreen.setKeepOnScreenCondition { false } @@ -73,6 +99,68 @@ class MainActivity : ComponentActivity() { } } + private fun showForceUpdateDialog() { + setContent { + WithpeaceTheme { + Column( + modifier = Modifier + .fillMaxSize() + .background(WithpeaceTheme.colors.SystemWhite), + ) { + Dialog( + onDismissRequest = { + + }, + ) { + Surface( + modifier = Modifier + .clip(RoundedCornerShape(10.dp)) + .background(WithpeaceTheme.colors.SystemWhite) + .padding(24.dp), + ) { + Column( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = Modifier.background(WithpeaceTheme.colors.SystemWhite), + ) { + Text( + color = WithpeaceTheme.colors.SystemBlack, + text = "새로운 버전이 업데이트 되었어요", + textAlign = TextAlign.Center, + style = WithpeaceTheme.typography.title2, + ) + Spacer(modifier = Modifier.height(16.dp)) + Text( + color = WithpeaceTheme.colors.SystemGray1, + text = "더 나아진 청하를 이용하기 위해\n 지금 업데이트 해주세요.", + textAlign = TextAlign.Center, + style = WithpeaceTheme.typography.body, + ) + Spacer(modifier = Modifier.height(16.dp)) + TextButton( + onClick = { + redirectToPlayStore() + }, + modifier = Modifier + .clip(RoundedCornerShape(10.dp)) + .background(WithpeaceTheme.colors.MainPurple) + .width(264.dp), + ) { + Text( + color = WithpeaceTheme.colors.SystemWhite, + text = "업데이트하기", + textAlign = TextAlign.Center, + style = WithpeaceTheme.typography.body, + ) + } + } + } + } + } + + } + } + } + private fun ComponentActivity.composeStart(startDestination: String) { setContent { CompositionLocalProvider( @@ -94,7 +182,7 @@ class MainActivity : ComponentActivity() { startUpdateFlow(appUpdateManager, appUpdateInfo) } else { Toast.makeText(this, "앱을 사용하려면 업데이트가 필요해요!", Toast.LENGTH_LONG).show() - redirectToPlayStore() + // redirectToPlayStore() } } } From 7c718a799fe29ff242724387f9e01b7f70e284b1 Mon Sep 17 00:00:00 2001 From: kwakjoohyeong Date: Wed, 3 Jul 2024 01:00:28 +0900 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=EC=A4=91=EB=B3=B5=20=EC=BB=AC?= =?UTF-8?q?=EB=9F=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../withpeace/feature/policydetail/PolicyDetailScreen.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/feature/policydetail/src/main/java/com/withpeace/withpeace/feature/policydetail/PolicyDetailScreen.kt b/feature/policydetail/src/main/java/com/withpeace/withpeace/feature/policydetail/PolicyDetailScreen.kt index e20c399b..7b12ae66 100644 --- a/feature/policydetail/src/main/java/com/withpeace/withpeace/feature/policydetail/PolicyDetailScreen.kt +++ b/feature/policydetail/src/main/java/com/withpeace/withpeace/feature/policydetail/PolicyDetailScreen.kt @@ -234,11 +234,6 @@ fun ApplyQualificationSection( title = "거주지 및 소득", content = policy.residenceAndIncome, ) - DescriptionTitleAndContent( - modifier = modifier, - title = "거주지 및 소득", - content = policy.residenceAndIncome, - ) DescriptionTitleAndContent(modifier = modifier, title = "학력", content = policy.education) DescriptionTitleAndContent( modifier = modifier, From 646cb41d5be4dae51c0c39bab687b9970a8250e4 Mon Sep 17 00:00:00 2001 From: kwakjoohyeong Date: Wed, 3 Jul 2024 18:46:14 +0900 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20snackbar=20state=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/designsystem/ui/snackbar/SnackbarState.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/SnackbarState.kt diff --git a/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/SnackbarState.kt b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/SnackbarState.kt new file mode 100644 index 00000000..97f7e6e5 --- /dev/null +++ b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/SnackbarState.kt @@ -0,0 +1,12 @@ +package com.withpeace.withpeace.core.designsystem.ui.snackbar + +data class SnackbarState( + val message: String, + val snackbarType: SnackbarType = SnackbarType.Normal, +) + +sealed interface SnackbarType { + data object Normal : SnackbarType + data class Navigator(val actionName: String, val action: () -> Unit) : + SnackbarType +} From 863f18f8b2750a378a1ac3876173df1d2197b0eb Mon Sep 17 00:00:00 2001 From: kwakjoohyeong Date: Wed, 3 Jul 2024 19:50:28 +0900 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20=EC=83=89=EC=83=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80(Black)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/withpeace/withpeace/core/designsystem/theme/Color.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Color.kt b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Color.kt index d33e0779..ed063d26 100644 --- a/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Color.kt +++ b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/theme/Color.kt @@ -27,6 +27,8 @@ val systemError = Color(0xFFF0474B) val systemSuccess = Color(0xFF3BD569) val systemHyperLink = Color(0xFF20BCBB) +val snackbarBlack = Color(0xFF000000) + data class WithPeaceColor( val MainPurple: Color = mainPurple, val SubPurple: Color = subPurple, @@ -43,6 +45,7 @@ data class WithPeaceColor( val SystemGray4: Color = systemGray4, val SystemSuccess: Color = systemSuccess, val SystemHyperLink: Color = systemHyperLink, + val SnackbarBlack: Color = snackbarBlack, ) val lightColor = WithPeaceColor() From aea42b0cb7b8dd61b30dd68dcef2fad1f8110538 Mon Sep 17 00:00:00 2001 From: kwakjoohyeong Date: Wed, 3 Jul 2024 19:50:48 +0900 Subject: [PATCH 5/6] =?UTF-8?q?feat:=20=EA=B8=B0=EB=B3=B8=20=EC=8A=A4?= =?UTF-8?q?=EB=82=B5=EB=B0=94=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/withpeace/withpeace/WithpeaceApp.kt | 58 +++++++++++++++++-- .../withpeace/withpeace/navigation/NavHost.kt | 35 +++++------ .../ui/snackbar/CheonghaSnackbar.kt | 7 +++ 3 files changed, 77 insertions(+), 23 deletions(-) create mode 100644 core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/CheonghaSnackbar.kt diff --git a/app/src/main/java/com/withpeace/withpeace/WithpeaceApp.kt b/app/src/main/java/com/withpeace/withpeace/WithpeaceApp.kt index d70e8cf3..2d38a328 100644 --- a/app/src/main/java/com/withpeace/withpeace/WithpeaceApp.kt +++ b/app/src/main/java/com/withpeace/withpeace/WithpeaceApp.kt @@ -1,24 +1,34 @@ package com.withpeace.withpeace +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.consumeWindowInsets import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHostState +import androidx.compose.material3.SnackbarResult +import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTagsAsResourceId +import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme +import com.withpeace.withpeace.core.designsystem.ui.snackbar.SnackbarState +import com.withpeace.withpeace.core.designsystem.ui.snackbar.SnackbarType import com.withpeace.withpeace.navigation.WithpeaceNavHost import kotlinx.coroutines.launch @@ -29,9 +39,18 @@ fun WithpeaceApp( navController: NavHostController = rememberNavController(), ) { val snackBarHostState = remember { SnackbarHostState() } + var snackBarState: SnackbarState = + remember { SnackbarState("", SnackbarType.Normal) } val coroutineScope = rememberCoroutineScope() - fun showSnackBar(message: String) = coroutineScope.launch { - snackBarHostState.showSnackbar(message) + fun showSnackBar(snackbarState: SnackbarState) = coroutineScope.launch { + snackBarState = snackbarState + snackBarHostState.currentSnackbarData?.dismiss() + val snackbarResult = snackBarHostState.showSnackbar(snackbarState.message) + when (snackbarResult) { + SnackbarResult.Dismissed -> Unit + SnackbarResult.ActionPerformed -> + (snackbarState.snackbarType as SnackbarType.Navigator).action() + } } val navBackStackEntry by navController.currentBackStackEntryAsState() @@ -51,10 +70,37 @@ fun WithpeaceApp( ) } }, - modifier = Modifier.fillMaxSize().semantics { - testTagsAsResourceId = true + modifier = Modifier + .fillMaxSize() + .semantics { + testTagsAsResourceId = true + }, + snackbarHost = { + SnackbarHost(snackBarHostState) + { + when (snackBarState.snackbarType) { + is SnackbarType.Navigator -> {} + is SnackbarType.Normal -> { + Row( + modifier = Modifier + .padding(horizontal = 24.dp) + .padding(bottom = 16.dp) + .imePadding() + .fillMaxWidth() + .clip(RoundedCornerShape(4.dp)) + .background(WithpeaceTheme.colors.SnackbarBlack), + ) { + Text( + modifier = Modifier.padding(vertical = 16.dp, horizontal = 24.dp), + style = WithpeaceTheme.typography.caption, + text = it.visuals.message, + color = WithpeaceTheme.colors.SystemWhite, + ) + } + } + } + } }, - snackbarHost = { SnackbarHost(snackBarHostState) }, containerColor = WithpeaceTheme.colors.SystemWhite, ) { innerPadding -> WithpeaceNavHost( diff --git a/app/src/main/java/com/withpeace/withpeace/navigation/NavHost.kt b/app/src/main/java/com/withpeace/withpeace/navigation/NavHost.kt index 2fce60e6..0cab81e9 100644 --- a/app/src/main/java/com/withpeace/withpeace/navigation/NavHost.kt +++ b/app/src/main/java/com/withpeace/withpeace/navigation/NavHost.kt @@ -8,6 +8,7 @@ import androidx.navigation.navOptions import androidx.navigation.navigation import com.app.profileeditor.navigation.navigateProfileEditor import com.app.profileeditor.navigation.profileEditorNavGraph +import com.withpeace.withpeace.core.designsystem.ui.snackbar.SnackbarState import com.withpeace.withpeace.feature.gallery.navigation.galleryNavGraph import com.withpeace.withpeace.feature.gallery.navigation.navigateToGallery import com.withpeace.withpeace.feature.home.navigation.homeNavGraph @@ -46,7 +47,7 @@ fun WithpeaceNavHost( modifier: Modifier = Modifier, navController: NavHostController, startDestination: String = LOGIN_ROUTE, - onShowSnackBar: (message: String) -> Unit, + onShowSnackBar: (SnackbarState) -> Unit, ) { NavHost( modifier = modifier, @@ -54,7 +55,7 @@ fun WithpeaceNavHost( startDestination = startDestination, ) { loginNavGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, onSignUpNeeded = { navController.navigateToPolicyConsent() }, @@ -70,7 +71,7 @@ fun WithpeaceNavHost( }, ) policyConsentGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, onSuccessToNext = { navController.navigateSignUp() }, @@ -82,21 +83,21 @@ fun WithpeaceNavHost( }, ) termsOfServiceGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, onClickBackButton = { navController.popBackStack() }, ) privacyPolicyGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, onClickBackButton = { navController.popBackStack() }, ) signUpNavGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, onNavigateToGallery = { navController.navigateToGallery(imageLimit = 1) }, @@ -112,7 +113,7 @@ fun WithpeaceNavHost( }, ) registerPostNavGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, onCompleteRegisterPost = { postId -> navController.navigateToPostDetail( postId, @@ -160,21 +161,21 @@ fun WithpeaceNavHost( ) navController.popBackStack() }, - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, ) homeNavGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, onPolicyClick = { navController.navigateToPolicyDetail(policy = it) }, ) policyDetailNavGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, onClickBackButton = { navController.popBackStack() }, ) navigation(startDestination = MY_PAGE_ROUTE, MY_PAGE_NESTED_ROUTE) { myPageNavGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, onEditProfile = { nickname, profileImageUrl -> navController.navigateProfileEditor( nickname = nickname, @@ -204,7 +205,7 @@ fun WithpeaceNavHost( }, ) profileEditorNavGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, onClickBackButton = { navController.popBackStack() }, @@ -225,7 +226,7 @@ fun WithpeaceNavHost( ) } postDetailGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, onClickBackButton = navController::popBackStack, onClickEditButton = { navController.currentBackStackEntry?.savedStateHandle?.set( @@ -242,10 +243,10 @@ fun WithpeaceNavHost( set(POST_LIST_DELETED_POST_ID_ARGUMENT, it) } navController.popBackStack() - } + }, ) postListGraph( - onShowSnackBar = onShowSnackBar, + onShowSnackBar = { onShowSnackBar(SnackbarState(it)) }, navigateToPostDetail = navController::navigateToPostDetail, onAuthExpired = { onAuthExpired(onShowSnackBar, navController) @@ -255,10 +256,10 @@ fun WithpeaceNavHost( } private fun onAuthExpired( - onShowSnackBar: (message: String) -> Unit, + onShowSnackBar: (SnackbarState) -> Unit, navController: NavHostController, ) { - onShowSnackBar("세션이 만료되었습니다. 로그인 후 다시 시도해 주세요.") + onShowSnackBar(SnackbarState("세션이 만료되었습니다. 로그인 후 다시 시도해 주세요.")) navController.navigateLogin( navOptions = navOptions { popUpTo(navController.graph.id) { diff --git a/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/CheonghaSnackbar.kt b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/CheonghaSnackbar.kt new file mode 100644 index 00000000..d1464486 --- /dev/null +++ b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/CheonghaSnackbar.kt @@ -0,0 +1,7 @@ +package com.withpeace.withpeace.core.designsystem.ui.snackbar + +import androidx.compose.runtime.Composable + +@Composable +fun CheonghaSnackbar() { +} \ No newline at end of file From 972e3077bbd693f416b10d8cf5013ce1410930c3 Mon Sep 17 00:00:00 2001 From: kwakjoohyeong Date: Thu, 4 Jul 2024 01:57:59 +0900 Subject: [PATCH 6/6] =?UTF-8?q?feat:=20=EC=8A=A4=EB=82=B5=EB=B0=94=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 --- app/build.gradle.kts | 4 +- .../com/withpeace/withpeace/WithpeaceApp.kt | 26 +---------- .../ui/snackbar/CheonghaSnackbar.kt | 30 ++++++++++++- .../ui/snackbar/NavigatorSnackbar.kt | 44 +++++++++++++++++++ 4 files changed, 77 insertions(+), 27 deletions(-) create mode 100644 core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/NavigatorSnackbar.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index bd86b5d5..d321533f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -10,8 +10,8 @@ android { defaultConfig { applicationId = "com.withpeace.withpeace" targetSdk = 34 - versionCode = 7 - versionName = "1.0.2" + versionCode = 8 + versionName = "1.1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/app/src/main/java/com/withpeace/withpeace/WithpeaceApp.kt b/app/src/main/java/com/withpeace/withpeace/WithpeaceApp.kt index 2d38a328..c3d6e419 100644 --- a/app/src/main/java/com/withpeace/withpeace/WithpeaceApp.kt +++ b/app/src/main/java/com/withpeace/withpeace/WithpeaceApp.kt @@ -1,32 +1,25 @@ package com.withpeace.withpeace -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.consumeWindowInsets import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.SnackbarResult -import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTagsAsResourceId -import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme +import com.withpeace.withpeace.core.designsystem.ui.snackbar.CheonghaSnackbar import com.withpeace.withpeace.core.designsystem.ui.snackbar.SnackbarState import com.withpeace.withpeace.core.designsystem.ui.snackbar.SnackbarType import com.withpeace.withpeace.navigation.WithpeaceNavHost @@ -81,22 +74,7 @@ fun WithpeaceApp( when (snackBarState.snackbarType) { is SnackbarType.Navigator -> {} is SnackbarType.Normal -> { - Row( - modifier = Modifier - .padding(horizontal = 24.dp) - .padding(bottom = 16.dp) - .imePadding() - .fillMaxWidth() - .clip(RoundedCornerShape(4.dp)) - .background(WithpeaceTheme.colors.SnackbarBlack), - ) { - Text( - modifier = Modifier.padding(vertical = 16.dp, horizontal = 24.dp), - style = WithpeaceTheme.typography.caption, - text = it.visuals.message, - color = WithpeaceTheme.colors.SystemWhite, - ) - } + CheonghaSnackbar(data = it) } } } diff --git a/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/CheonghaSnackbar.kt b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/CheonghaSnackbar.kt index d1464486..7a61afb8 100644 --- a/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/CheonghaSnackbar.kt +++ b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/CheonghaSnackbar.kt @@ -1,7 +1,35 @@ package com.withpeace.withpeace.core.designsystem.ui.snackbar +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.imePadding +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.SnackbarData +import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.unit.dp +import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme @Composable -fun CheonghaSnackbar() { +fun CheonghaSnackbar(data: SnackbarData) { + Row( + modifier = Modifier + .padding(horizontal = 24.dp) + .padding(bottom = 16.dp) + .imePadding() + .fillMaxWidth() + .clip(RoundedCornerShape(4.dp)) + .background(WithpeaceTheme.colors.SnackbarBlack), + ) { + Text( + modifier = Modifier.padding(vertical = 16.dp, horizontal = 24.dp), + style = WithpeaceTheme.typography.caption, + text = data.visuals.message, + color = WithpeaceTheme.colors.SystemWhite, + ) + } } \ No newline at end of file diff --git a/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/NavigatorSnackbar.kt b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/NavigatorSnackbar.kt new file mode 100644 index 00000000..3ab5d4e3 --- /dev/null +++ b/core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/snackbar/NavigatorSnackbar.kt @@ -0,0 +1,44 @@ +package com.withpeace.withpeace.core.designsystem.ui.snackbar + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.imePadding +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.draw.clip +import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.unit.dp +import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme + +@Composable +fun NavigatorSnackbar(data: SnackbarState) { + Row( + horizontalArrangement = Arrangement.SpaceBetween, + modifier = Modifier + .padding(horizontal = 24.dp) + .padding(bottom = 16.dp) + .imePadding() + .fillMaxWidth() + .clip(RoundedCornerShape(4.dp)) + .background(WithpeaceTheme.colors.SnackbarBlack), + ) { + Text( + modifier = Modifier.padding(vertical = 16.dp, horizontal = 24.dp), + style = WithpeaceTheme.typography.caption, + text = data.message, + color = WithpeaceTheme.colors.SystemWhite, + ) + Text( + modifier = Modifier.padding(vertical = 16.dp, horizontal = 24.dp), + style = WithpeaceTheme.typography.caption, + text = data.message, + color = WithpeaceTheme.colors.SubSkyBlue, + textDecoration = TextDecoration.Underline, + ) + } +} \ No newline at end of file