Skip to content

Commit

Permalink
[chore] #176 ktlitFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
jihyunniiii committed Aug 17, 2024
1 parent 306e36d commit 1b4fe57
Show file tree
Hide file tree
Showing 21 changed files with 70 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ enum class CourseDetailUnopenedDetailType(
descriptionStringRes = R.string.course_detail_free_read_button_description,
buttonTextStringRes = R.string.course_detail_free_read_button
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ class AdvertisementContract {
sealed class AdvertisementEvent : UiEvent {
data class FetchAdvertisementDetail(val loadState: LoadState, val advertisementDetail: AdvertisementDetail) : AdvertisementEvent()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ fun AdvertisementScreen(
onLeftIconClick = onTopBarIconClicked
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package org.sopt.dateroad.presentation.ui.advertisement

import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.launch
import org.sopt.dateroad.domain.usecase.GetAdvertisementDetailUseCase
import org.sopt.dateroad.presentation.util.base.BaseViewModel
import org.sopt.dateroad.presentation.util.view.LoadState
import javax.inject.Inject

@HiltViewModel
class AdvertisementViewModel @Inject constructor(
private val getAdvertisementDetailUseCase: GetAdvertisementDetailUseCase,
private val getAdvertisementDetailUseCase: GetAdvertisementDetailUseCase
) : BaseViewModel<AdvertisementContract.AdvertisementUiState, AdvertisementContract.AdvertisementSideEffect, AdvertisementContract.AdvertisementEvent>() {
override fun createInitialState(): AdvertisementContract.AdvertisementUiState = AdvertisementContract.AdvertisementUiState()

Expand All @@ -30,4 +30,4 @@ class AdvertisementViewModel @Inject constructor(
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ fun AdvertisementDetail(
)
Spacer(modifier = Modifier.height(54.dp))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ object AdvertisementRoute {
const val ID = "id"
const val ROUTE_WITH_ARGUMENT = "$ROUTE/{$ID}"
fun route(advertisementId: Int) = "$ROUTE/$advertisementId"
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package org.sopt.dateroad.presentation.ui.component.pager

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
Expand All @@ -23,7 +20,6 @@ import org.sopt.dateroad.R
import org.sopt.dateroad.presentation.type.TagType
import org.sopt.dateroad.presentation.ui.component.tag.DateRoadImageTag
import org.sopt.dateroad.presentation.ui.component.tag.DateRoadTextTag
import org.sopt.dateroad.ui.theme.DateRoadTheme

@OptIn(ExperimentalPagerApi::class)
@Composable
Expand All @@ -32,7 +28,7 @@ fun DateRoadImagePager(
pagerState: PagerState,
images: List<String>,
userScrollEnabled: Boolean,
like: String?,
like: String?
) {
Box(modifier = Modifier.fillMaxWidth()) {
HorizontalPager(
Expand Down Expand Up @@ -73,4 +69,4 @@ fun DateRoadImagePager(
.align(Alignment.BottomEnd)
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ fun DateRoadScrollResponsiveTopBar(
}
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.sopt.dateroad.presentation.ui.coursedetail

import org.sopt.dateroad.domain.model.AdvertisementDetail
import org.sopt.dateroad.domain.model.CourseDetail
import org.sopt.dateroad.presentation.type.EnrollType
import org.sopt.dateroad.presentation.util.base.UiEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.sopt.dateroad.presentation.ui.coursedetail

import androidx.compose.foundation.background
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.height
Expand Down Expand Up @@ -104,7 +103,7 @@ fun CourseDetailRoute(
onEditBottomSheet = { viewModel.setEvent(CourseDetailContract.CourseDetailEvent.OnEditBottomSheet) },
dismissEditBottomSheet = { viewModel.setEvent(CourseDetailContract.CourseDetailEvent.DismissEditBottomSheet) },
enrollSchedule = { viewModel.setSideEffect(CourseDetailContract.CourseDetailSideEffect.NavigateToEnroll(EnrollType.TIMELINE, courseId)) },
onTopBarIconClicked = popBackStack,
onTopBarIconClicked = { viewModel.setSideEffect(CourseDetailContract.CourseDetailSideEffect.PopBackStack) },
openCourseDetail = {
viewModel.setEvent(CourseDetailContract.CourseDetailEvent.OpenCourse)
viewModel.postUsePoint(courseId = courseId)
Expand Down Expand Up @@ -154,68 +153,62 @@ fun CourseDetailScreen(
val courseDetailUnopenedType = if (courseDetailUiState.courseDetail.free > 0) CourseDetailUnopenedDetailType.FREE else CourseDetailUnopenedDetailType.POINT

Box(modifier = Modifier.fillMaxSize()) {
Column(
LazyColumn(
state = scrollState,
modifier = Modifier
.fillMaxSize()
.background(DateRoadTheme.colors.white)
) {
LazyColumn(
state = scrollState,
modifier = Modifier
.fillMaxSize()
.background(DateRoadTheme.colors.white)
) {
with(courseDetailUiState.courseDetail) {
item {
DateRoadImagePager(
modifier = Modifier
.onGloballyPositioned { coordinates ->
imageHeight = coordinates.size.height
},
pagerState = PagerState(),
images = courseDetailUiState.courseDetail.images,
userScrollEnabled = isViewable,
like = courseDetailUiState.courseDetail.like.toString()
)
}
with(courseDetailUiState.courseDetail) {
item {
DateRoadImagePager(
modifier = Modifier
.onGloballyPositioned { coordinates ->
imageHeight = coordinates.size.height
},
pagerState = PagerState(),
images = courseDetailUiState.courseDetail.images,
userScrollEnabled = isViewable,
like = courseDetailUiState.courseDetail.like.toString()
)
}

item {
CourseDetailBasicInfo(
date = date,
title = title,
totalTime = totalTime,
item {
CourseDetailBasicInfo(
date = date,
title = title,
totalTime = totalTime,
totalCost = totalCost,
city = city
)
}

when (isViewable) {
true -> {
courseDetailOpenedDetail(
description = description,
places = places,
totalCost = totalCost,
city = city
tags = tags.mapNotNull { tag -> tag.getDateTagTypeByName() }
)
}

when (isViewable) {
true -> {
courseDetailOpenedDetail(
description = description,
places = places,
totalCost = totalCost,
tags = tags.mapNotNull { tag -> tag.getDateTagTypeByName() }
)
if (!isCourseMine) {
item {
Spacer(modifier = Modifier.height(86.dp))
}
if (!isCourseMine) {
item {
Spacer(modifier = Modifier.height(86.dp))
}
}
}

false -> {
item {
CourseDetailUnopenedDetail(
text = description,
free = free,
courseDetailUnopenedDetailType = courseDetailUnopenedType,
onButtonClicked = when(courseDetailUnopenedType) {
CourseDetailUnopenedDetailType.FREE -> onDialogLookedForFree
CourseDetailUnopenedDetailType.POINT -> onDialogLookedByPoint
}
)
}
false -> {
item {
CourseDetailUnopenedDetail(
text = description,
free = free,
courseDetailUnopenedDetailType = courseDetailUnopenedType,
onButtonClicked = when (courseDetailUnopenedType) {
CourseDetailUnopenedDetailType.FREE -> onDialogLookedForFree
CourseDetailUnopenedDetailType.POINT -> onDialogLookedByPoint
}
)
}
}
}
Expand All @@ -229,7 +222,7 @@ fun CourseDetailScreen(
rightIconResource = if (isViewable) R.drawable.btn_course_detail_more_white else null
)

if (isViewable && !courseDetailUiState.courseDetail.isCourseMine){
if (isViewable && !courseDetailUiState.courseDetail.isCourseMine) {
CourseDetailBottomBar(
modifier = Modifier.align(Alignment.BottomCenter),
isUserLiked = courseDetailUiState.courseDetail.isUserLiked,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import kotlinx.coroutines.launch
import org.sopt.dateroad.domain.model.UsePoint
import org.sopt.dateroad.domain.usecase.DeleteCourseLikeUseCase
import org.sopt.dateroad.domain.usecase.DeleteCourseUseCase
import org.sopt.dateroad.domain.usecase.GetAdvertisementDetailUseCase
import org.sopt.dateroad.domain.usecase.GetCourseDetailUseCase
import org.sopt.dateroad.domain.usecase.PostCourseLikeUseCase
import org.sopt.dateroad.domain.usecase.PostUsePointUseCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ fun CourseDetailBasicInfo(
city = city
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ fun CourseDetailBottomBar(
onClick = onEnrollButtonClicked
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ fun CourseDetailCost(
.background(DateRoadTheme.colors.gray100)
.padding(start = 20.dp, top = 15.dp, end = 5.dp, bottom = 17.dp)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ fun LazyListScope.courseDetailOpenedDetail(
item {
CourseDetailTag(tags = tags)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ fun CourseDetailTag(
}
Spacer(modifier = Modifier.height(30.dp))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -37,4 +36,4 @@ fun LazyListScope.courseDetailTimeline(
)
Spacer(modifier = Modifier.height(16.dp))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fun CourseDetailUnopenedDetail(
maxLines = 3,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp),
.padding(horizontal = 16.dp)
)
}

Expand Down Expand Up @@ -87,7 +87,7 @@ fun CourseDetailUnopenedDetail(
modifier = Modifier
.align(Alignment.CenterHorizontally),
isEnabled = true,
textContent = when(courseDetailUnopenedDetailType) {
textContent = when (courseDetailUnopenedDetailType) {
CourseDetailUnopenedDetailType.FREE -> stringResource(id = courseDetailUnopenedDetailType.buttonTextStringRes, free)
CourseDetailUnopenedDetailType.POINT -> stringResource(id = courseDetailUnopenedDetailType.buttonTextStringRes)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class HomeContract {
data object NavigateToLook : HomeSideEffect
data object NavigateToTimeline : HomeSideEffect
data class NavigateToEnroll(val enrollType: EnrollType, val id: Int?) : HomeSideEffect
data class NavigateToAdvertisementDetail(val advertisementId: Int): HomeSideEffect
data class NavigateToAdvertisementDetail(val advertisementId: Int) : HomeSideEffect
data class NavigateToCourseDetail(val courseId: Int) : HomeSideEffect
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ import org.sopt.dateroad.presentation.ui.component.button.DateRoadTextButton
import org.sopt.dateroad.presentation.ui.component.card.DateRoadCourseCard
import org.sopt.dateroad.presentation.ui.component.partialcolortext.PartialColorText
import org.sopt.dateroad.presentation.ui.component.tag.DateRoadTextTag
import org.sopt.dateroad.presentation.ui.home.component.DateRoadHomeTopBar
import org.sopt.dateroad.presentation.ui.component.view.DateRoadErrorView
import org.sopt.dateroad.presentation.ui.component.view.DateRoadIdleView
import org.sopt.dateroad.presentation.ui.component.view.DateRoadLoadingView
import org.sopt.dateroad.presentation.ui.home.component.DateRoadHomeTopBar
import org.sopt.dateroad.presentation.ui.home.component.HomeAdvertisement
import org.sopt.dateroad.presentation.ui.home.component.HomeHotCourseCard
import org.sopt.dateroad.presentation.ui.home.component.HomeTimeLineCard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fun MainNavHost(
startDestination = navigator.startDestination
) {
advertisementGraph(
popBackStack = navigator:: popBackStackIfNotHome
popBackStack = navigator::popBackStackIfNotHome
)

courseDetailGraph(
Expand Down

0 comments on commit 1b4fe57

Please sign in to comment.