-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature/#154] 제보 상세조회 화면 구현 #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0cfd13e
Feat: 제보 상세조회 화면 UI 구현
l5x5l 4c5ffd2
Feat: 제보 상세조회 화면 ViewModel, 제보 상세조회 UseCase 및 Repository 메서드 구현
l5x5l a5971a2
FIX: 제보 이미지 표시 방식을 ContentScale.Crop으로 통일
l5x5l d51fc2a
FIX: 역지오코딩에서 roadAddress가 null로 들어올 때 파싱 에러가 발생해 주소가 불러와지지 않는 문제 수정
l5x5l faaf271
FIX: 제보 상세 화면 상단 toolbar에 적용된 horizontal 패딩 제거
l5x5l File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
data/src/main/java/com/threegap/bitnagil/data/report/datasource/ReportDataSource.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| package com.threegap.bitnagil.data.report.datasource | ||
|
|
||
| import com.threegap.bitnagil.data.report.model.request.ReportRequestDto | ||
| import com.threegap.bitnagil.data.report.model.response.ReportDetailDto | ||
| import com.threegap.bitnagil.data.report.model.response.ReportHistoriesPerDateDto | ||
|
|
||
| interface ReportDataSource { | ||
| suspend fun submitReport(reportRequestDto: ReportRequestDto): Result<Long> | ||
| suspend fun getReports(): Result<ReportHistoriesPerDateDto> | ||
| suspend fun getReport(reportId: String): Result<ReportDetailDto> | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
data/src/main/java/com/threegap/bitnagil/data/report/model/response/ReportDetailDto.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package com.threegap.bitnagil.data.report.model.response | ||
|
|
||
| import com.threegap.bitnagil.domain.report.model.ReportCategory | ||
| import com.threegap.bitnagil.domain.report.model.ReportDetail | ||
| import com.threegap.bitnagil.domain.report.model.ReportStatus | ||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
| import java.time.LocalDate | ||
|
|
||
| @Serializable | ||
| class ReportDetailDto( | ||
| @SerialName("reportDate") | ||
| val reportDate: String, | ||
| @SerialName("reportStatus") | ||
| val reportStatus: String, | ||
| @SerialName("reportTitle") | ||
| val reportTitle: String, | ||
| @SerialName("reportContent") | ||
| val reportContent: String, | ||
| @SerialName("reportCategory") | ||
| val reportCategory: String, | ||
| @SerialName("reportLocation") | ||
| val reportLocation: String, | ||
| @SerialName("reportImageUrls") | ||
| val reportImageUrls: List<String>, | ||
| ) | ||
|
|
||
| fun ReportDetailDto.toDomain(id: String?): ReportDetail = | ||
| ReportDetail( | ||
| id = id ?: "", | ||
l5x5l marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| date = LocalDate.parse(this.reportDate), | ||
| status = ReportStatus.fromString(this.reportStatus), | ||
| title = this.reportTitle, | ||
| content = this.reportContent, | ||
| category = ReportCategory.fromString(this.reportCategory), | ||
| address = this.reportLocation, | ||
| imageUrls = this.reportImageUrls, | ||
| ) | ||
l5x5l marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
domain/src/main/java/com/threegap/bitnagil/domain/report/model/ReportDetail.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.threegap.bitnagil.domain.report.model | ||
|
|
||
| import java.time.LocalDate | ||
|
|
||
| data class ReportDetail( | ||
| val id: String, | ||
| val title: String, | ||
| val content: String, | ||
| val category: ReportCategory, | ||
| val status: ReportStatus, | ||
| val imageUrls: List<String>, | ||
| val address: String, | ||
| val date: LocalDate, | ||
| ) |
2 changes: 2 additions & 0 deletions
2
domain/src/main/java/com/threegap/bitnagil/domain/report/repository/ReportRepository.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| package com.threegap.bitnagil.domain.report.repository | ||
|
|
||
| import com.threegap.bitnagil.domain.report.model.Report | ||
| import com.threegap.bitnagil.domain.report.model.ReportDetail | ||
| import com.threegap.bitnagil.domain.report.model.ReportItem | ||
| import java.time.LocalDate | ||
|
|
||
| interface ReportRepository { | ||
| suspend fun submitReport(report: Report): Result<Long> | ||
| suspend fun getReportHistories(): Result<Map<LocalDate, List<ReportItem>>> | ||
| suspend fun getReport(reportId: String): Result<ReportDetail> | ||
| } |
13 changes: 13 additions & 0 deletions
13
domain/src/main/java/com/threegap/bitnagil/domain/report/usecase/GetReportUseCase.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.threegap.bitnagil.domain.report.usecase | ||
|
|
||
| import com.threegap.bitnagil.domain.report.model.ReportDetail | ||
| import com.threegap.bitnagil.domain.report.repository.ReportRepository | ||
| import javax.inject.Inject | ||
|
|
||
| class GetReportUseCase @Inject constructor( | ||
| private val reportRepository: ReportRepository, | ||
| ) { | ||
| suspend operator fun invoke(id: String): Result<ReportDetail> { | ||
| return reportRepository.getReport(reportId = id) | ||
| } | ||
| } |
150 changes: 150 additions & 0 deletions
150
...ation/src/main/java/com/threegap/bitnagil/presentation/reportdetail/ReportDetailScreen.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| package com.threegap.bitnagil.presentation.reportdetail | ||
|
|
||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| 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.size | ||
| import androidx.compose.foundation.layout.statusBarsPadding | ||
| import androidx.compose.foundation.rememberScrollState | ||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.foundation.verticalScroll | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.draw.clip | ||
| import androidx.compose.ui.layout.ContentScale | ||
| import androidx.compose.ui.platform.LocalContext | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import coil3.compose.AsyncImage | ||
| import coil3.request.ImageRequest | ||
| import com.threegap.bitnagil.designsystem.BitnagilTheme | ||
| import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar | ||
| import com.threegap.bitnagil.presentation.reportdetail.component.atom.ReportProcessBadge | ||
| import com.threegap.bitnagil.presentation.reportdetail.component.block.ReportDetailLabeledContent | ||
| import com.threegap.bitnagil.presentation.reportdetail.model.mvi.ReportDetailState | ||
| import com.threegap.bitnagil.presentation.reportdetail.util.toPresentationFormatInReportDetail | ||
| import org.orbitmvi.orbit.compose.collectAsState | ||
|
|
||
| @Composable | ||
| fun ReportDetailScreenContainer( | ||
| viewModel: ReportDetailViewModel, | ||
| navigateToBack: () -> Unit, | ||
| ) { | ||
| val state by viewModel.collectAsState() | ||
|
|
||
| ReportDetailScreen( | ||
| state = state, | ||
| onClickPreviousButton = navigateToBack, | ||
| ) | ||
| } | ||
|
|
||
| @Composable | ||
| private fun ReportDetailScreen( | ||
| modifier: Modifier = Modifier, | ||
| onClickPreviousButton: () -> Unit, | ||
| state: ReportDetailState, | ||
| ) { | ||
| val verticalScrollState = rememberScrollState() | ||
|
|
||
| Column( | ||
| modifier = modifier | ||
| .fillMaxSize() | ||
| .background(color = BitnagilTheme.colors.white) | ||
| .statusBarsPadding(), | ||
| ) { | ||
| BitnagilTopBar( | ||
| title = "제보하기", | ||
| showBackButton = true, | ||
| onBackClick = onClickPreviousButton, | ||
| ) | ||
|
|
||
| Column( | ||
| modifier = Modifier | ||
| .weight(1f) | ||
| .verticalScroll(verticalScrollState) | ||
| .padding(horizontal = 20.dp), | ||
| ) { | ||
| Spacer(modifier = Modifier.height(20.dp)) | ||
|
|
||
| ReportProcessBadge(reportProcess = state.reportProcess) | ||
|
|
||
| Spacer(modifier = Modifier.height(6.dp)) | ||
|
|
||
| Text( | ||
| text = state.date.toPresentationFormatInReportDetail(), | ||
| style = BitnagilTheme.typography.subtitle1SemiBold, | ||
| ) | ||
|
|
||
| Spacer(modifier = Modifier.height(14.dp)) | ||
|
|
||
| Row { | ||
| state.imageUrls.forEach { imageUrl -> | ||
| AsyncImage( | ||
| model = ImageRequest.Builder(LocalContext.current) | ||
| .data(imageUrl) | ||
| .build(), | ||
| modifier = Modifier | ||
| .size(74.dp) | ||
| .clip(shape = RoundedCornerShape(9.dp)) | ||
| .background(color = BitnagilTheme.colors.black), | ||
| contentScale = ContentScale.Crop, | ||
| contentDescription = null, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| Spacer(modifier = Modifier.height(24.dp)) | ||
|
|
||
| Column( | ||
| modifier = Modifier.fillMaxWidth(), | ||
| verticalArrangement = Arrangement.spacedBy(28.dp), | ||
| ) { | ||
| ReportDetailLabeledContent( | ||
| label = "제목", | ||
| content = state.reportTitle, | ||
| ) | ||
|
|
||
| ReportDetailLabeledContent( | ||
| label = "카테고리", | ||
| content = state.reportCategory.title, | ||
| ) | ||
|
|
||
| ReportDetailLabeledContent( | ||
| label = "상세 제목 내용", | ||
| content = state.reportContent, | ||
| ) | ||
|
|
||
| ReportDetailLabeledContent( | ||
| label = "내 위치", | ||
| content = state.location, | ||
| ) | ||
| } | ||
|
|
||
| Spacer(modifier = Modifier.height(36.dp)) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Composable | ||
| @Preview | ||
| private fun ReportDetailScreenPreview() { | ||
| BitnagilTheme { | ||
| ReportDetailScreen( | ||
| state = ReportDetailState.Init.copy( | ||
| reportContent = "Lorem ipsum dolor sit amet, " + | ||
| "consectetur adipiscing elit," + | ||
| " sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " + | ||
| "Nisl tincidunt eget nullam non.", | ||
| ), | ||
| onClickPreviousButton = {}, | ||
| ) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.