Skip to content

Commit

Permalink
Merge pull request #435 from BCSDLab/release
Browse files Browse the repository at this point in the history
Update v4.0.4
  • Loading branch information
hsgo2430 authored Oct 26, 2024
2 parents 5023d13 + a484a7c commit 33fb448
Show file tree
Hide file tree
Showing 17 changed files with 304 additions and 74 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ buildscript {
}

extra.apply {
set("versionName", "4.0.3")
set("versionCode", 40003)
set("versionName", "4.0.4")
set("versionCode", 40004)
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ fun StartInsertScreen(
modifier = modifier
.width(40.dp)
.height(40.dp)
.clickable { }
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import `in`.koreatech.koin.domain.util.onFailure
import `in`.koreatech.koin.domain.util.onSuccess
import kotlinx.coroutines.launch
import org.orbitmvi.orbit.ContainerHost
import org.orbitmvi.orbit.syntax.simple.blockingIntent
import org.orbitmvi.orbit.syntax.simple.intent
import org.orbitmvi.orbit.syntax.simple.postSideEffect
import org.orbitmvi.orbit.syntax.simple.reduce
Expand All @@ -26,11 +27,11 @@ class SignInViewModel @Inject constructor(
SignInState()
)

fun insertId(id: String) = intent{
fun insertId(id: String) = blockingIntent{
reduce { state.copy(id = id) }
}

fun insertPassword(password: String) = intent{
fun insertPassword(password: String) = blockingIntent{
reduce { state.copy(password = password) }
}
fun navigateToSignUp() = intent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ fun ModifyInfoScreen(
viewModel: ModifyInfoViewModel = hiltViewModel(),
storeInfoViewModel: MyStoreDetailViewModel = hiltViewModel(),
onSettingOperatingClicked: () -> Unit = {},
onModifyButtonClicked: () -> Unit = {}
) {
val state = viewModel.collectAsState().value
val storeInfoState = storeInfoViewModel.collectAsState().value
Expand Down Expand Up @@ -249,7 +250,6 @@ fun ModifyInfoScreen(
storeInfoState.storeId,
state.storeInfo
)
viewModel.onBackButtonClicked()
},
modifier = Modifier
.width(130.dp)
Expand Down Expand Up @@ -279,7 +279,11 @@ fun ModifyInfoScreen(
when (it) {
ModifyInfoSideEffect.NavigateToBackScreen -> onBackClicked()
ModifyInfoSideEffect.NavigateToSettingOperatingTime -> onSettingOperatingClicked()
else -> {}
ModifyInfoSideEffect.NavigateToMyStoreScreen -> {
storeInfoViewModel.modifyStoreInfo(state.storeInfo)
storeInfoViewModel.refreshStoreList()
onModifyButtonClicked()
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ package `in`.koreatech.business.feature.store.modifyinfo
sealed class ModifyInfoSideEffect {
data object NavigateToBackScreen : ModifyInfoSideEffect()
data object NavigateToSettingOperatingTime : ModifyInfoSideEffect()
data object NavigateToMyStoreScreen : ModifyInfoSideEffect()
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package `in`.koreatech.business.feature.store.modifyinfo

import android.graphics.Bitmap
import android.net.Uri
import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.chargemap.compose.numberpicker.FullHours
Expand Down Expand Up @@ -176,11 +177,15 @@ class ModifyInfoViewModel @Inject constructor(
}

fun modifyStoreInfo(storeId: Int, storeDetailInfo: StoreDetailInfo) {
viewModelScope.launch {
modifyInfoUseCase.invoke(
storeId,
storeDetailInfo,
)
intent {
viewModelScope.launch {
modifyInfoUseCase.invoke(
storeId,
storeDetailInfo,
).apply {
this ?: postSideEffect(ModifyInfoSideEffect.NavigateToMyStoreScreen)
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import org.orbitmvi.orbit.compose.collectSideEffect
@Composable
fun ModifyOperatingTimeScreen(
modifier: Modifier = Modifier,
myStoreDetailViewModel: MyStoreDetailViewModel = hiltViewModel(),
viewModel: ModifyInfoViewModel = hiltViewModel(),
onBackClicked: () -> Unit = {},
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package `in`.koreatech.business.feature.store.navigator

import android.os.Bundle
import android.util.Log
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import androidx.navigation.NavGraph
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.NavOptions
import androidx.navigation.Navigator
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navigation
import `in`.koreatech.business.feature.store.modifyinfo.ModifyInfoScreen
import `in`.koreatech.business.feature.store.modifyinfo.ModifyInfoViewModel
Expand All @@ -19,6 +20,7 @@ import `in`.koreatech.business.feature.store.storedetail.MyStoreDetailScreen
import `in`.koreatech.business.feature.store.storedetail.MyStoreDetailViewModel
import `in`.koreatech.business.navigation.MYSTORESCREEN
import `in`.koreatech.business.navigation.REGISTERSTORESCREEN
import `in`.koreatech.business.navigation.navigate
import `in`.koreatech.business.navigation.sharedHiltViewModel
import `in`.koreatech.business.navigation.toNavigateModifyMenuScreen
import `in`.koreatech.business.navigation.toNavigateRegisterMenuScreen
Expand All @@ -38,7 +40,9 @@ fun NavGraphBuilder.myStoreScreen(
val modifyInfoViewModel: ModifyInfoViewModel = it.sharedHiltViewModel(navController = navController)
MyStoreDetailScreen(
modifier = Modifier.fillMaxSize(),
navigateToModifyScreen = { navController.navigate(StoreRoute.MODIFY_INFO.name) },
navigateToModifyScreen = {storeId ->
navController.navigate(StoreRoute.MODIFY_INFO.name)
},
viewModel = myStoreInfoViewModel,
modifyInfoViewModel = modifyInfoViewModel,
navigateToRegisterStoreScreen = {
Expand All @@ -58,11 +62,20 @@ fun NavGraphBuilder.myStoreScreen(
route = StoreRoute.MODIFY_INFO.name
) {
val modifyInfoViewModel: ModifyInfoViewModel = it.sharedHiltViewModel(navController = navController)
val myStoreInfoViewModel: MyStoreDetailViewModel = it.sharedHiltViewModel(navController = navController)

ModifyInfoScreen(
viewModel = modifyInfoViewModel,
storeInfoViewModel= myStoreInfoViewModel,
onSettingOperatingClicked = { navController.navigate(StoreRoute.SETTING_OPERATING_TIME.name) },
onBackClicked = { navController.popBackStack() }
onBackClicked = { navController.popBackStack() },
onModifyButtonClicked = {
navController.navigate(StoreRoute.MY_STORE.name){
popUpTo(StoreRoute.MODIFY_INFO.name){
inclusive = true
}
}
}
)
}

Expand All @@ -77,4 +90,24 @@ fun NavGraphBuilder.myStoreScreen(
)
}
}
}

fun NavController.toNaviGateModifyStoreScreen(storeId: Int){
val bundle = Bundle().apply {
putInt("storeId", storeId)
}
navigate(StoreRoute.MODIFY_INFO.name, bundle)
}
fun NavController.navigate(
route: String,
args: Bundle,
navOptions: NavOptions? = null,
navigatorExtras: Navigator.Extras? = null
) {
val nodes = graph.findNode(MYSTORESCREEN) as? NavGraph

val nodeId = nodes?.findNode(route)?.id
if (nodeId != null) {
navigate(nodeId, args, navOptions, navigatorExtras)
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package `in`.koreatech.business.feature.store.storedetail

import android.annotation.SuppressLint
import android.util.Log
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
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.layout.width
Expand All @@ -22,8 +19,6 @@ import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Divider
import androidx.compose.material.Tab
import androidx.compose.material.TabRow
Expand All @@ -43,13 +38,13 @@ import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.zIndex
import `in`.koreatech.business.R
import `in`.koreatech.business.feature.store.OwnerStoreAppBar
import `in`.koreatech.business.feature.store.modifyinfo.ModifyInfoViewModel
import `in`.koreatech.business.feature.store.storedetail.dialog.MyStoreSelectDialog
import `in`.koreatech.business.feature.store.storedetail.event.EventScreen
import `in`.koreatech.business.feature.store.storedetail.menu.MenuScreen
import `in`.koreatech.business.ui.theme.Blue2
Expand All @@ -70,7 +65,7 @@ fun MyStoreDetailScreen(
modifyInfoViewModel: ModifyInfoViewModel,
navigateToLoginScreen: () -> Unit = {},
navigateToUploadEventScreen: () -> Unit = {},
navigateToModifyScreen: () -> Unit = {},
navigateToModifyScreen: (Int) -> Unit = {},
navigateToRegisterStoreScreen: () -> Unit = {},
navigateToManageMenuScreen: () -> Unit = {},
navigateToRegisterMenuScreen: (Int) -> Unit = {},
Expand All @@ -83,14 +78,19 @@ fun MyStoreDetailScreen(
val context = LocalContext.current

LaunchedEffect(state.storeInfo) {
viewModel.initOwnerShopList()
modifyInfoViewModel.initStoreInfo(state.storeInfo ?: return@LaunchedEffect)
}

Column(
modifier = Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally,
) {
OwnerStoreAppBar(stringResource(R.string.my_shop))
MyStoreSelectDialog(
dialogVisibility = state.selectDialogVisibility,
storeList = state.storeList,
onClickCancel = viewModel::closeSelectStoreDialog,
selectStore = viewModel::changeMyStoreInfo
)
MyStoreScrollScreen(
state = state,
listState = listState,
Expand All @@ -113,8 +113,8 @@ fun MyStoreDetailScreen(
}

MyStoreDetailSideEffect.NavigateToUploadEventScreen -> navigateToUploadEventScreen()
MyStoreDetailSideEffect.NavigateToModifyScreen -> {
navigateToModifyScreen()
is MyStoreDetailSideEffect.NavigateToModifyScreen -> {
navigateToModifyScreen(it.storeId)
}
MyStoreDetailSideEffect.NavigateToRegisterStoreScreen -> navigateToRegisterStoreScreen()
MyStoreDetailSideEffect.NavigateToManageMenuScreen -> navigateToManageMenuScreen()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package `in`.koreatech.business.feature.store.storedetail

sealed class MyStoreDetailSideEffect {
data object NavigateToUploadEventScreen : MyStoreDetailSideEffect()
data object NavigateToModifyScreen : MyStoreDetailSideEffect()
data class NavigateToModifyScreen(val storeId: Int) : MyStoreDetailSideEffect()
data object NavigateToManageMenuScreen : MyStoreDetailSideEffect()
data object NavigateToRegisterMenuScreen : MyStoreDetailSideEffect()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import `in`.koreatech.koin.domain.model.owner.StoreDetailInfo
import `in`.koreatech.koin.domain.model.store.ShopEvent
import `in`.koreatech.koin.domain.model.store.Store
import `in`.koreatech.koin.domain.model.store.StoreMenuCategories
import `in`.koreatech.koin.domain.model.store.StoreWithMenu
import kotlinx.collections.immutable.ImmutableList

data class MyStoreDetailState(
Expand All @@ -14,6 +13,7 @@ data class MyStoreDetailState(
val storeEvent: ImmutableList<ShopEvent>? = null,
val storeMenu: ImmutableList<StoreMenuCategories>? = null,
val dialogVisibility: Boolean = false,
val selectDialogVisibility: Boolean = false,
val isEventExpanded: List<Boolean> = List(storeEvent?.size ?: 0) { false },
val isAllEventSelected: Boolean = false,
val isSelectedEvent: MutableList<Int> = mutableListOf(),
Expand Down
Loading

0 comments on commit 33fb448

Please sign in to comment.