diff --git a/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreen.kt b/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreen.kt index 5f81830b7..de1555965 100644 --- a/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreen.kt +++ b/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreen.kt @@ -4,7 +4,6 @@ import androidx.compose.foundation.Image 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.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize @@ -13,9 +12,7 @@ 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.layout.wrapContentSize import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.text.BasicTextField import androidx.compose.material.Button import androidx.compose.material.ButtonDefaults import androidx.compose.material.Text @@ -24,12 +21,9 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.RectangleShape -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight -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.dp @@ -57,9 +51,10 @@ fun FinalCheckStoreScreen( FinalCheckStoreScreenImpl( state = state, - goToFinishScreen = { + navigateToFinishScreen = { viewModel.registerStore() - } + }, + onBackPressed = onBackPressed ) HandleSideEffects(viewModel, navigateToFinishScreen) @@ -69,7 +64,7 @@ fun FinalCheckStoreScreen( @Composable fun FinalCheckStoreScreenImpl( modifier: Modifier = Modifier, - goToFinishScreen: () -> Unit = {}, + navigateToFinishScreen: () -> Unit = {}, onBackPressed: () -> Unit = {}, state: FinalCheckStoreScreenState = FinalCheckStoreScreenState() ) { @@ -125,7 +120,7 @@ fun FinalCheckStoreScreenImpl( item { NameTextField( textString = stringResource(id = R.string.category), - outputString = state.storeCategory.toString(), + outputString = state.storeCategoryString, paddingTopValue = 32.dp ) } @@ -235,7 +230,7 @@ fun FinalCheckStoreScreenImpl( item { Button( - onClick = goToFinishScreen, + onClick = navigateToFinishScreen, colors = ButtonDefaults.buttonColors(ColorPrimary), shape = RectangleShape, modifier = Modifier @@ -312,8 +307,7 @@ private fun HandleSideEffects(viewModel: FinalCheckStoreScreenViewModel, navigat viewModel.collectSideEffect { sideEffect -> when (sideEffect) { is FinalCheckStoreScreenSideEffect.GoToFinishScreen -> navigateToFinishScreen() - is FinalCheckStoreScreenSideEffect.GoToFinishScreen -> ToastUtil.getInstance().makeShort(R.string.insert_store_null_store_phone_number) - else -> {} + is FinalCheckStoreScreenSideEffect.FailRegisterStore -> ToastUtil.getInstance().makeShort(R.string.insert_store_fail_register_store) } } } diff --git a/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenSideEffect.kt b/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenSideEffect.kt index fd82b5058..d83795ff5 100644 --- a/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenSideEffect.kt +++ b/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenSideEffect.kt @@ -1,7 +1,5 @@ package `in`.koreatech.business.feature.insertstore.finalcheckstore -import `in`.koreatech.business.feature.insertstore.selectcategory.SelectCategoryScreenSideEffect - sealed class FinalCheckStoreScreenSideEffect { object GoToFinishScreen: FinalCheckStoreScreenSideEffect() object FailRegisterStore: FinalCheckStoreScreenSideEffect() diff --git a/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenState.kt b/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenState.kt index d8e79d993..5156ffac9 100644 --- a/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenState.kt +++ b/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenState.kt @@ -1,6 +1,5 @@ package `in`.koreatech.business.feature.insertstore.finalcheckstore -import android.net.Uri import android.os.Parcelable import `in`.koreatech.business.feature.insertstore.insertdetailinfo.operatingTime.OperatingTimeState import kotlinx.parcelize.Parcelize @@ -9,6 +8,7 @@ import kotlinx.parcelize.Parcelize @Parcelize data class FinalCheckStoreScreenState( val storeCategory: Int = -1, + val storeCategoryString: String ="", val storeName: String = "", val storeAddress: String = "", val storeImage: String = "", diff --git a/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenViewmodel.kt b/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenViewmodel.kt index 4bf14a9f9..e98b3ec62 100644 --- a/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenViewmodel.kt +++ b/business/src/main/java/in/koreatech/business/feature/insertstore/finalcheckstore/FinalCheckStoreScreenViewmodel.kt @@ -4,12 +4,13 @@ import android.util.Log import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.chargemap.compose.numberpicker.Hours import dagger.hilt.android.lifecycle.HiltViewModel import `in`.koreatech.business.feature.insertstore.insertdetailinfo.InsertDetailInfoScreenState import `in`.koreatech.business.feature.insertstore.insertdetailinfo.operatingTime.OperatingTimeState import `in`.koreatech.koin.domain.model.owner.insertstore.OperatingTime +import `in`.koreatech.koin.domain.model.store.StoreCategories import `in`.koreatech.koin.domain.usecase.business.store.RegisterStoreUseCase +import `in`.koreatech.koin.domain.usecase.store.GetStoreCategoriesUseCase import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.launch @@ -24,7 +25,8 @@ import javax.inject.Inject @HiltViewModel class FinalCheckStoreScreenViewModel @Inject constructor( savedStateHandle: SavedStateHandle, - private val registerStoreUseCase : RegisterStoreUseCase + private val registerStoreUseCase : RegisterStoreUseCase, + private val getStoreCategoriesUseCase: GetStoreCategoriesUseCase ): ViewModel(), ContainerHost { override val container: Container = container(FinalCheckStoreScreenState(), savedStateHandle = savedStateHandle) { @@ -63,6 +65,7 @@ class FinalCheckStoreScreenViewModel @Inject constructor( operatingTimeList = storeInfo.operatingTimeList ) } + getCategory() } } @@ -92,6 +95,19 @@ class FinalCheckStoreScreenViewModel @Inject constructor( } } + private fun getCategory() { + intent { + viewModelScope.launch { + val categories = getStoreCategoriesUseCase() + reduce { + state.copy( + storeCategoryString = categories[state.storeCategory - 1].name + ) + } + } + } + } + fun registerStore() { intent { viewModelScope.launch { diff --git a/business/src/main/java/in/koreatech/business/feature/insertstore/finishregisterstore/FinishRegisterStore.kt b/business/src/main/java/in/koreatech/business/feature/insertstore/finishregisterstore/FinishRegisterStore.kt new file mode 100644 index 000000000..54a7cc59f --- /dev/null +++ b/business/src/main/java/in/koreatech/business/feature/insertstore/finishregisterstore/FinishRegisterStore.kt @@ -0,0 +1,121 @@ +package `in`.koreatech.business.feature.insertstore.finishregisterstore + +import androidx.compose.foundation.Image +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +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.layout.width +import androidx.compose.material.Button +import androidx.compose.material.ButtonDefaults +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.RectangleShape +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontWeight +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 `in`.koreatech.koin.core.R +import `in`.koreatech.business.ui.theme.Blue1 +import `in`.koreatech.business.ui.theme.ColorPrimary + +@Composable +fun FinishRegisterScreen( + modifier: Modifier = Modifier, + goToMainScreen: () -> Unit, + onBackPressed: () -> Unit +) { + Column( + modifier = modifier.fillMaxSize() + ) { + Box( + modifier = modifier + .padding(top = 56.dp, start = 10.dp , bottom = 18.dp) + .width(40.dp) + .height(40.dp) + .clickable { onBackPressed } + + ) { + Image( + painter = painterResource(R.drawable.ic_arrow_left), + contentDescription = "backArrow", + modifier = modifier + .width(40.dp) + .height(40.dp) + .clickable { } + ) + } + + Image( + painter = painterResource(id = R.drawable.ic_finish_check), + contentDescription = "finish_mark", + alignment = Alignment.Center, + modifier = modifier + .fillMaxWidth() + .padding(top = 103.dp, bottom = 30.dp) + .height(55.dp) + .width(55.dp) + ) + + Text( + text = stringResource(R.string.insert_store_finish), + fontSize = 24.sp, + color = ColorPrimary, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center, + modifier = modifier + .fillMaxWidth() + .padding(horizontal = 46.dp) + .padding(bottom = 16.dp) + ) + + Text( + text = stringResource(R.string.insert_store_finish_guide), + fontSize = 16.sp, + color = Blue1, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center, + modifier = modifier + .fillMaxWidth() + .padding(horizontal = 46.dp) + .padding(bottom = 51.dp) + ) + + Button( + onClick = goToMainScreen, + colors = ButtonDefaults.buttonColors(ColorPrimary), + shape = RectangleShape, + modifier = modifier + .fillMaxWidth() + .padding(horizontal = 33.dp) + .height(44.dp) + ) { + Text( + text = stringResource(id = R.string.go_to_main_screen), + fontSize = 15.sp, + fontWeight = FontWeight.Bold, + color = Color.White + ) + } + } +} + + +@Preview +@Composable +fun PreviewStartInsertScreen(){ + FinishRegisterScreen( + modifier = Modifier, + goToMainScreen = {} , + onBackPressed = {} + ) +} \ No newline at end of file diff --git a/business/src/main/java/in/koreatech/business/feature/insertstore/navigator/InsertStoreRouteNavigator.kt b/business/src/main/java/in/koreatech/business/feature/insertstore/navigator/InsertStoreRouteNavigator.kt index 2a64ff184..b1b773676 100644 --- a/business/src/main/java/in/koreatech/business/feature/insertstore/navigator/InsertStoreRouteNavigator.kt +++ b/business/src/main/java/in/koreatech/business/feature/insertstore/navigator/InsertStoreRouteNavigator.kt @@ -16,6 +16,7 @@ import androidx.navigation.compose.rememberNavController import androidx.navigation.navArgument import `in`.koreatech.business.feature.insertstore.finalcheckstore.FinalCheckStoreScreen import `in`.koreatech.business.feature.insertstore.finalcheckstore.FinalCheckStoreScreenImpl +import `in`.koreatech.business.feature.insertstore.finishregisterstore.FinishRegisterScreen import `in`.koreatech.business.feature.insertstore.insertdetailinfo.InsertDetailInfoScreen import `in`.koreatech.business.feature.insertstore.insertdetailinfo.InsertDetailInfoScreenState import `in`.koreatech.business.feature.insertstore.insertdetailinfo.InsertDetailInfoScreenViewModel @@ -131,7 +132,22 @@ fun InsertStoreNavigator( onBackPressed = { navController.navigateUp() }, - navigateToFinishScreen = {} + navigateToFinishScreen = { + navController.navigate(InsertStoreRoute.FINISH_SCREEN.name) + } + ) + } + + composable( + route = InsertStoreRoute.FINISH_SCREEN.name, + ) { + FinishRegisterScreen( + goToMainScreen = { + + }, + onBackPressed = { + navController.navigateUp() + } ) } } diff --git a/core/src/main/res/drawable/ic_finish_check.xml b/core/src/main/res/drawable/ic_finish_check.xml new file mode 100644 index 000000000..ba540aec5 --- /dev/null +++ b/core/src/main/res/drawable/ic_finish_check.xml @@ -0,0 +1,17 @@ + + + + diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index e0bd3968d..45b2cec74 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -29,6 +29,7 @@ 휴일 개점시간 폐점시간 + 메인 화면 바로가기 @@ -126,4 +127,8 @@ 4. 가게 정보 확인 입력하신 정보가 맞습니까? + 가게를 등록하는데 실패하였습니다. + + 가게 등록 완료 + 가게 등록이 완료되었습니다.\n업체 정보 수정은 내 상점에서 가능합니다. diff --git a/data/src/main/java/in/koreatech/koin/data/source/local/UploadImageLocalDataSource.kt b/data/src/main/java/in/koreatech/koin/data/source/local/UploadImageLocalDataSource.kt index 474d6d203..75165897b 100644 --- a/data/src/main/java/in/koreatech/koin/data/source/local/UploadImageLocalDataSource.kt +++ b/data/src/main/java/in/koreatech/koin/data/source/local/UploadImageLocalDataSource.kt @@ -36,7 +36,7 @@ class UploadImageLocalDataSource @Inject constructor( ExifInterface.ORIENTATION_ROTATE_90 -> bitmap?.rotateBitmap(90f) ExifInterface.ORIENTATION_ROTATE_180 -> bitmap?.rotateBitmap(180f) ExifInterface.ORIENTATION_ROTATE_270 -> bitmap?.rotateBitmap(270f) - else -> bitmap?.rotateBitmap(90f) + else -> bitmap } if(rotatedBitmap != null){ imageBitmap = rotatedBitmap