diff --git a/app/src/main/java/com/teamwiney/winey/WineyNavHost.kt b/app/src/main/java/com/teamwiney/winey/WineyNavHost.kt index e7ebd22f..dfe4487f 100644 --- a/app/src/main/java/com/teamwiney/winey/WineyNavHost.kt +++ b/app/src/main/java/com/teamwiney/winey/WineyNavHost.kt @@ -19,7 +19,10 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.navigation.NavDestination +import androidx.navigation.NavType import androidx.navigation.compose.NavHost +import androidx.navigation.compose.composable +import androidx.navigation.navArgument import com.teamwiney.analysis.analysisGraph import com.teamwiney.auth.authGraph import com.teamwiney.core.common.WineyAppState @@ -29,6 +32,7 @@ import com.teamwiney.core.common.navigation.MapDestinations import com.teamwiney.core.common.navigation.TopLevelDestination import com.teamwiney.core.common.rememberWineyAppState import com.teamwiney.core.common.rememberWineyBottomSheetState +import com.teamwiney.home.WebViewScreen import com.teamwiney.home.homeGraph import com.teamwiney.map.mapGraph import com.teamwiney.mypage.myPageGraph @@ -101,6 +105,31 @@ fun WineyNavHost() { appState = appState, bottomSheetState = bottomSheetState ) + + composable( + route = "${HomeDestinations.WEB_VIEW}?url={url}&title={title}&subTitle={subTitle}", + arguments = listOf( + navArgument("url") { + type = NavType.StringType + defaultValue = "" + }, + navArgument("title") { + type = NavType.StringType + defaultValue = "" + }, + navArgument("subTitle") { + type = NavType.StringType + defaultValue = "" + } + ) + ) { entry -> + WebViewScreen( + appState = appState, + url = entry.arguments?.getString("url") ?: "", + title = entry.arguments?.getString("title") ?: "", + subTitle = entry.arguments?.getString("subTitle") ?: "" + ) + } } } } diff --git a/core/common/src/main/java/com/teamwiney/core/common/navigation/Destinations.kt b/core/common/src/main/java/com/teamwiney/core/common/navigation/Destinations.kt index bd8774d9..addbbedc 100644 --- a/core/common/src/main/java/com/teamwiney/core/common/navigation/Destinations.kt +++ b/core/common/src/main/java/com/teamwiney/core/common/navigation/Destinations.kt @@ -28,7 +28,7 @@ object HomeDestinations { const val HOME = "home" const val WINE_DETAIL = "detail" const val WINE_TIP = "wineTip" - const val WINE_TIP_DETAIL = "wineTipDetail" + const val WEB_VIEW = "webView" object Analysis { const val ROUTE = "analysis" @@ -63,6 +63,7 @@ object NoteDestinations { const val INFO_FLAVOR = "infoFlavor" const val INFO_VINTAGE_AND_PRICE = "infoVintageAndPrice" const val INFO_STANDARD_FLAVOR = "infoStandardFlavor" + const val COMPLETE = "noteWriteComplete" } } diff --git a/feature/home/src/main/java/com/teamwiney/analysis/AnalysisScreen.kt b/feature/home/src/main/java/com/teamwiney/analysis/AnalysisScreen.kt index 77ec09b9..d5c870f0 100644 --- a/feature/home/src/main/java/com/teamwiney/analysis/AnalysisScreen.kt +++ b/feature/home/src/main/java/com/teamwiney/analysis/AnalysisScreen.kt @@ -148,9 +148,9 @@ private fun AnalysisProgressContent( color = WineyTheme.colors.main_3 ) ) { - append("성경님 ") + append("나의 ") } - append("의 테이스팅 노트를\n분석중이예요!") + append("테이스팅 노트를\n 분석 중이에요!") }, style = WineyTheme.typography.title1.copy( color = WineyTheme.colors.gray_50 diff --git a/feature/home/src/main/java/com/teamwiney/home/HomeNavigation.kt b/feature/home/src/main/java/com/teamwiney/home/HomeNavigation.kt index 8455828d..58393ec0 100644 --- a/feature/home/src/main/java/com/teamwiney/home/HomeNavigation.kt +++ b/feature/home/src/main/java/com/teamwiney/home/HomeNavigation.kt @@ -45,20 +45,7 @@ fun NavGraphBuilder.homeGraph( ) } - composable( - route = "${HomeDestinations.WINE_TIP_DETAIL}?url={url}", - arguments = listOf( - navArgument("url") { - type = NavType.StringType - defaultValue = "" - } - ) - ) { entry -> - WebViewScreen( - appState = appState, - url = entry.arguments?.getString("url") ?: "" - ) - } + composable( route = "${HomeDestinations.WINE_DETAIL}?id={wineId}", diff --git a/feature/home/src/main/java/com/teamwiney/home/HomeViewModel.kt b/feature/home/src/main/java/com/teamwiney/home/HomeViewModel.kt index 267774f0..2f28ba04 100644 --- a/feature/home/src/main/java/com/teamwiney/home/HomeViewModel.kt +++ b/feature/home/src/main/java/com/teamwiney/home/HomeViewModel.kt @@ -47,7 +47,7 @@ class HomeViewModel @Inject constructor( } is HomeContract.Event.ShowTipDetail -> { - postEffect(HomeContract.Effect.NavigateTo("${HomeDestinations.WINE_TIP_DETAIL}?url=${event.url}")) + postEffect(HomeContract.Effect.NavigateTo("${HomeDestinations.WEB_VIEW}?url=${event.url}&title=${"와인 초보자를 위한 "}&subTitle=${"TIP"}")) } is HomeContract.Event.ShowAnalysis -> { diff --git a/feature/home/src/main/java/com/teamwiney/home/WebViewScreen.kt b/feature/home/src/main/java/com/teamwiney/home/WebViewScreen.kt index fc91d909..f4a1d2a1 100644 --- a/feature/home/src/main/java/com/teamwiney/home/WebViewScreen.kt +++ b/feature/home/src/main/java/com/teamwiney/home/WebViewScreen.kt @@ -22,11 +22,13 @@ import com.teamwiney.ui.theme.WineyTheme @Composable fun WebViewScreen( appState: WineyAppState, - url: String = "" + url: String = "", + title: String = "", + subTitle: String = "" ) { ManageBottomBarState(appState = appState) - + Column( modifier = Modifier .fillMaxSize() @@ -36,9 +38,9 @@ fun WebViewScreen( ) { TopBar( annotatedContent = buildAnnotatedString { - append("와인 초보를 위한 ") + append(title) withStyle(style = SpanStyle(WineyTheme.colors.main_2)) { - append("TIP") + append(subTitle) } }, leadingIconOnClick = { @@ -62,6 +64,10 @@ fun WebViewContent( ) webViewClient = WebViewClient() settings.javaScriptEnabled = true + settings.setSupportMultipleWindows(false) + settings.domStorageEnabled = true + settings.useWideViewPort = true + settings.loadWithOverviewMode = true loadUrl(url) } }, update = { diff --git a/feature/home/src/main/java/com/teamwiney/home/WineTipScreen.kt b/feature/home/src/main/java/com/teamwiney/home/WineTipScreen.kt index 65f2a6c4..cbd75865 100644 --- a/feature/home/src/main/java/com/teamwiney/home/WineTipScreen.kt +++ b/feature/home/src/main/java/com/teamwiney/home/WineTipScreen.kt @@ -79,6 +79,8 @@ fun TipContent( wineTips: LazyPagingItems ) { + val title = "와인 초보자를 위한 " + val subTitle = "TIP" LazyVerticalGrid( columns = GridCells.Fixed(2), contentPadding = PaddingValues(horizontal = 24.dp, vertical = 10.dp), @@ -95,7 +97,7 @@ fun TipContent( title = it.title, thumbnail = it.thumbnail, onClick = { - appState.navigate("${HomeDestinations.WINE_TIP_DETAIL}?url=${it.url}") + appState.navigate("${HomeDestinations.WEB_VIEW}?url=${it.url}&title=${title}&subTitle=${subTitle}") } ) } diff --git a/feature/mypage/src/main/java/com/teamwiney/mypage/MyPageScreen.kt b/feature/mypage/src/main/java/com/teamwiney/mypage/MyPageScreen.kt index 089f5729..1bc7deee 100644 --- a/feature/mypage/src/main/java/com/teamwiney/mypage/MyPageScreen.kt +++ b/feature/mypage/src/main/java/com/teamwiney/mypage/MyPageScreen.kt @@ -3,7 +3,6 @@ package com.teamwiney.mypage import android.content.Context import android.content.Intent import android.net.Uri -import androidx.browser.customtabs.CustomTabsIntent import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.background import androidx.compose.foundation.border @@ -42,6 +41,7 @@ import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.teamwiney.core.common.WineyAppState import com.teamwiney.core.common.model.WineGrade +import com.teamwiney.core.common.navigation.HomeDestinations import com.teamwiney.core.common.navigation.MyPageDestinations import com.teamwiney.core.common.util.Constants.FAQ_URL import com.teamwiney.data.network.model.response.WineGradeStandard @@ -76,7 +76,7 @@ fun MyPageScreen( appState.showSnackbar(effect.message) } - else -> { } + else -> {} } } } @@ -148,16 +148,7 @@ fun MyPageScreen( } HeightSpacer(height = 5.dp) MyProfileMenuItem(menu = "FAQ") { - val builder = CustomTabsIntent.Builder() - - builder.setShowTitle(true) - builder.setInstantAppsEnabled(true) - - val customBuilder = builder.build() - customBuilder.launchUrl( - context, - Uri.parse(FAQ_URL) - ) + appState.navigate("${HomeDestinations.WEB_VIEW}?url=${FAQ_URL}&title=${"FAQ"}&subTitle=${""}") } MyProfileAppVersionItem() } @@ -322,8 +313,10 @@ fun MyPageGrade( } } } else { - val nextGrade = gradeData.getOrNull(currentGradeIdx + 1)?.name ?: WineGrade.GLASS - val nextGradeMinCount = gradeData.getOrNull(currentGradeIdx + 1)?.minCount ?: 0 + val nextGrade = + gradeData.getOrNull(currentGradeIdx + 1)?.name ?: WineGrade.GLASS + val nextGradeMinCount = + gradeData.getOrNull(currentGradeIdx + 1)?.minCount ?: 0 val remainingNoteCount = nextGradeMinCount - noteCount buildAnnotatedString { @@ -389,7 +382,7 @@ fun MyProfileMenuItem( color = WineyTheme.colors.gray_400 ) ) - + Icon( modifier = Modifier .size(24.dp) diff --git a/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageAccountScreen.kt b/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageAccountScreen.kt index 22a1c05c..73fcf871 100644 --- a/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageAccountScreen.kt +++ b/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageAccountScreen.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -81,6 +82,7 @@ fun MyPageAccountScreen( Column( modifier = Modifier .fillMaxSize() + .statusBarsPadding() .background(WineyTheme.colors.background_1) ) { TopBar( diff --git a/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageWithdrawalConfirmScreen.kt b/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageWithdrawalConfirmScreen.kt index b0f24dfd..1d06f1ca 100644 --- a/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageWithdrawalConfirmScreen.kt +++ b/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageWithdrawalConfirmScreen.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Text @@ -61,7 +62,7 @@ fun MyPageWithdrawalConfirmScreen( } } - else -> { } + else -> {} } } } @@ -71,6 +72,7 @@ fun MyPageWithdrawalConfirmScreen( Column( modifier = Modifier .fillMaxSize() + .statusBarsPadding() .background(WineyTheme.colors.background_1) ) { TopBar( diff --git a/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageWithdrawalReasonSelectScreen.kt b/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageWithdrawalReasonSelectScreen.kt index 80c69bd9..325a1b46 100644 --- a/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageWithdrawalReasonSelectScreen.kt +++ b/feature/mypage/src/main/java/com/teamwiney/mypage/account/MyPageWithdrawalReasonSelectScreen.kt @@ -50,7 +50,6 @@ fun MyPageWithdrawalReasonSelectScreen( val effectFlow = viewModel.effect LaunchedEffect(true) { - viewModel.updateWithdrawalReason("이유를 선택해주세요.") effectFlow.collectLatest { effect -> when (effect) { @@ -75,7 +74,7 @@ fun MyPageWithdrawalReasonSelectScreen( } } - else -> { } + else -> {} } } } @@ -115,7 +114,7 @@ fun MyPageWithdrawalReasonSelectScreen( ) HeightSpacer(height = 30.dp) Text( - text ="계정을 삭제하려는\n이유를 알려주세요.", + text = "계정을 삭제하려는\n이유를 알려주세요.", style = WineyTheme.typography.title2.copy( color = WineyTheme.colors.gray_50 ) @@ -153,9 +152,9 @@ fun MyPageWithdrawalReasonSelectScreen( text = "다음", onClick = { appState.navigate(MyPageDestinations.WITHDRAWAL_CONFIRM) }, enabled = ( - (uiState.isWithdrawalReasonDirectInput && uiState.withdrawalReasonDirectInput.isNotEmpty()) || - (!uiState.isWithdrawalReasonDirectInput && uiState.withdrawalReason != "이유를 선택해주세요.") - ), + (uiState.isWithdrawalReasonDirectInput && uiState.withdrawalReasonDirectInput.isNotEmpty()) || + (!uiState.isWithdrawalReasonDirectInput && uiState.withdrawalReason != "이유를 선택해주세요.") + ), modifier = Modifier.padding(bottom = 20.dp) ) } diff --git a/feature/note/src/main/java/com/teamwiney/notewrite/NoteWineInfoVintageAndPriceScreen.kt b/feature/note/src/main/java/com/teamwiney/notewrite/NoteWineInfoVintageAndPriceScreen.kt index 7c50832d..ba252603 100644 --- a/feature/note/src/main/java/com/teamwiney/notewrite/NoteWineInfoVintageAndPriceScreen.kt +++ b/feature/note/src/main/java/com/teamwiney/notewrite/NoteWineInfoVintageAndPriceScreen.kt @@ -203,7 +203,7 @@ fun NoteWineInfoVintageAndPriceScreen( disableBackgroundColor = WineyTheme.colors.gray_900, disableTextColor = WineyTheme.colors.gray_600, enableTextColor = WineyTheme.colors.gray_50, - enabled = uiState.wineNote.price.isNotEmpty() && uiState.wineNote.vintage.isNotEmpty(), + enabled = uiState.wineNote.price.isNotEmpty() || uiState.wineNote.vintage.isNotEmpty(), onClick = { appState.navController.navigate(NoteDestinations.Write.INFO_COLOR_SMELL) } diff --git a/feature/note/src/main/java/com/teamwiney/notewrite/NoteWriteCompleteScreen.kt b/feature/note/src/main/java/com/teamwiney/notewrite/NoteWriteCompleteScreen.kt new file mode 100644 index 00000000..2f4c2191 --- /dev/null +++ b/feature/note/src/main/java/com/teamwiney/notewrite/NoteWriteCompleteScreen.kt @@ -0,0 +1,110 @@ +package com.teamwiney.notewrite + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +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.navigationBarsPadding +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.statusBarsPadding +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.draw.alpha +import androidx.compose.ui.draw.blur +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Brush +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.teamwiney.notewrite.components.NoteBackgroundSurface +import com.teamwiney.ui.components.WButton +import com.teamwiney.ui.theme.WineyTheme + +@Composable +@Preview +fun NoteWriteCompleteScreen( +) { + + Box( + modifier = Modifier + .background(WineyTheme.colors.background_1) + .navigationBarsPadding() + .statusBarsPadding() + ) { + NoteBackgroundSurface(modifier = Modifier.fillMaxSize()) + Column( + modifier = Modifier + .fillMaxSize() + ) { + Box( + modifier = Modifier + .weight(1f) + .fillMaxWidth(), + ) { + + Box( + modifier = Modifier + .align(Alignment.Center) + .fillMaxWidth(0.6f) + .fillMaxHeight(0.5f) + .border( + BorderStroke( + 1.dp, brush = Brush.linearGradient( + colors = listOf( + Color(0xFF9671FF), + Color(0x109671FF), + ) + ) + ), + RoundedCornerShape(7.dp) + ) + .clip(RoundedCornerShape(7.dp)) + .background( + color = Color(0x993F3F3F), + shape = RoundedCornerShape(5.dp) + ), + ) { + Box(modifier = Modifier.fillMaxSize() + .background(WineyTheme.colors.gray_900.copy(alpha = 0.3f)) + .blur(30.dp) + .alpha(0.4f) + ) { + + } + + Text( + text = "테이스팅 노트 작성이\n완료 되었어요!", + style = WineyTheme.typography.bodyB1.copy(color = WineyTheme.colors.gray_50), + modifier = Modifier + .align(Alignment.BottomCenter) + .padding(bottom = 48.dp), + textAlign = TextAlign.Center + ) + } + } + + WButton( + text = "확인", + modifier = Modifier + .padding(bottom = 40.dp) + .padding(horizontal = 24.dp) + .align(Alignment.CenterHorizontally), + enableBackgroundColor = WineyTheme.colors.main_1, + enableTextColor = WineyTheme.colors.gray_50, + onClick = { + + } + ) + } + } +} + diff --git a/feature/note/src/main/java/com/teamwiney/notewrite/NoteWriteViewModel.kt b/feature/note/src/main/java/com/teamwiney/notewrite/NoteWriteViewModel.kt index 4cf56828..57a8a678 100644 --- a/feature/note/src/main/java/com/teamwiney/notewrite/NoteWriteViewModel.kt +++ b/feature/note/src/main/java/com/teamwiney/notewrite/NoteWriteViewModel.kt @@ -36,6 +36,7 @@ class NoteWriteViewModel @Inject constructor( initialState = NoteWriteContract.State() ) { private val noteId: Int + init { noteId = savedStateHandle.get("noteId")?.toInt() ?: -1 updateState(currentState.copy(mode = if (noteId == -1) EditMode.ADD else EditMode.UPDATE)) @@ -65,7 +66,7 @@ class NoteWriteViewModel @Inject constructor( currentState.copy( wineNote = WineNote( wineId = -1L, - vintage = "${result.vintage}", + vintage = if (result.vintage == null) "" else "${result.vintage}", officialAlcohol = result.officialAlcohol?.toDouble() ?: 0.0, price = "${result.price}", color = Color(result.color.toColorInt()), @@ -83,13 +84,15 @@ class NoteWriteViewModel @Inject constructor( addImages = emptyList(), deleteImages = emptyList(), smellKeywordList = result.smellKeywordList.mapNotNull { smellKeyword -> - val wineSmell = WineSmell.values().firstOrNull { it.korName == smellKeyword } + val wineSmell = WineSmell.values() + .firstOrNull { it.korName == smellKeyword } wineSmell?.let { WineSmellOption(it.korName, it.value) } }, loadSmellKeywordList = result.smellKeywordList.mapNotNull { smellKeyword -> - val wineSmell = WineSmell.values().firstOrNull { it.korName == smellKeyword } + val wineSmell = WineSmell.values() + .firstOrNull { it.korName == smellKeyword } wineSmell?.let { WineSmellOption(it.korName, it.value) } @@ -286,9 +289,12 @@ class NoteWriteViewModel @Inject constructor( private fun removeSmellKeyword(smellKeyword: WineSmellOption) { val selectedSmellKeywords = currentState.wineNote.smellKeywordList - smellKeyword val addSmellKeywords = currentState.wineNote.addSmellKeywordList - smellKeyword - val deleteSmellKeywords = currentState.wineNote.deleteSmellKeywordList.toMutableList().apply { - if (currentState.wineNote.loadSmellKeywordList.contains(smellKeyword)) add(smellKeyword) - } + val deleteSmellKeywords = + currentState.wineNote.deleteSmellKeywordList.toMutableList().apply { + if (currentState.wineNote.loadSmellKeywordList.contains(smellKeyword)) add( + smellKeyword + ) + } updateState( currentState.copy( diff --git a/feature/note/src/main/java/com/teamwiney/notewrite/model/WineNote.kt b/feature/note/src/main/java/com/teamwiney/notewrite/model/WineNote.kt index 52dabfb3..cbe1af53 100644 --- a/feature/note/src/main/java/com/teamwiney/notewrite/model/WineNote.kt +++ b/feature/note/src/main/java/com/teamwiney/notewrite/model/WineNote.kt @@ -8,7 +8,7 @@ data class WineNote( val wineId: Long, val vintage: String, val officialAlcohol: Double?, - val price: String, + val price: String = "", val color: Color, val sweetness: Int, val acidity: Int,