-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat/#57-게시글 목록 조회 UI를 구현한다 #60
Merged
The head ref may contain hidden characters: "Feat/57-\uAC8C\uC2DC\uAE00_\uBAA9\uB85D_\uC870\uD68C_ui\uB97C_\uAD6C\uD604\uD55C\uB2E4"
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b4868ff
feat : 게시글 등록 모듈 생성
chws0508 27c6192
feat : 게시글 등록 기능 UI 구현 완료
chws0508 038eb3c
feat : UI기능 전까지 완료
chws0508 16fadaa
feat : 커스텀 갤러리 기능 구현
chws0508 10a6e5f
feat : 갤러리에서 선택한 이미지를 게시글에서 받도록 구현
chws0508 d7c8136
feat : 게시글 등록 API 연동 구현
chws0508 a09216d
feat : StringResource 리팩토링
chws0508 5f024c0
feat : Dependency Graph 모듈 볼수 있는 플러그인 추가
chws0508 f206048
feat : 화면 회전시 앱이 안보이는 버그 수정
chws0508 0454238
feat : GetAlbumImagesUseCase로 네이밍 수정
chws0508 1e7f6a7
feat : GetAlbumImagesUseCase에서 ImagePagingInfo를 주도록 변경
chws0508 92d3e28
feat : GalleryViewModel Test 작성
chws0508 700f690
feat : 앱 난독화 적용
chws0508 7929d99
test : RegisterPostViewModel 테스트 작성
chws0508 b969197
feat : core-ui 모듈 추가 및 PostTopicUiState core-ui로 이동
chws0508 4a19142
refactor : Rebase 충돌 수정
chws0508 6b02cfe
refactor : 모듈을 post에서 postList로 수정
chws0508 29611b1
refactor : material3 버젼 업
chws0508 419f456
feat : 게시글 목록 화면 탭 UI 구현
chws0508 94865c7
feat : Tab에 viewModel 상태 적용
chws0508 5940514
feat : 게시글 목록 UI 구현 완료
chws0508 2153afc
feat : Date 계산 로직 도메인으로 이동
chws0508 022192c
feat : 사진 변경사항 적용
chws0508 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 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 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 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 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 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 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
41 changes: 41 additions & 0 deletions
41
core/designsystem/src/main/java/com/withpeace/withpeace/core/designsystem/ui/Card.kt
This file contains 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,41 @@ | ||
package com.withpeace.withpeace.core.designsystem.ui | ||
|
||
import androidx.compose.foundation.BorderStroke | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.withpeace.withpeace.core.designsystem.theme.WithpeaceTheme | ||
|
||
@Composable | ||
fun WithpeaceCard( | ||
modifier: Modifier = Modifier, | ||
content: @Composable () -> Unit, | ||
) { | ||
Card( | ||
modifier = modifier, | ||
shape = RoundedCornerShape(5.dp), | ||
border = BorderStroke(width = 1.dp, color = WithpeaceTheme.colors.SystemGray2), | ||
colors = CardDefaults.cardColors( | ||
containerColor = WithpeaceTheme.colors.SystemWhite, | ||
), | ||
) { | ||
content() | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
private fun WithpeaceCardPreview() { | ||
WithpeaceTheme { | ||
WithpeaceCard { | ||
Text("haha") | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
core/domain/src/main/java/com/withpeace/withpeace/core/domain/model/date/Date.kt
This file contains 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,10 @@ | ||
package com.withpeace.withpeace.core.domain.model.date; | ||
|
||
import java.time.LocalDateTime | ||
|
||
data class Date( | ||
val date: LocalDateTime, | ||
) { | ||
val durationFromNow: DurationFromNow | ||
get() = DurationFromNow.from(date) | ||
} |
44 changes: 44 additions & 0 deletions
44
core/domain/src/main/java/com/withpeace/withpeace/core/domain/model/date/DurationFromNow.kt
This file contains 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,44 @@ | ||
package com.withpeace.withpeace.core.domain.model.date | ||
|
||
import java.time.Duration | ||
import java.time.LocalDateTime | ||
|
||
sealed class DurationFromNow( | ||
val value: Duration, | ||
) { | ||
data class LessThanOneMinute(val duration: Duration) : DurationFromNow(duration) | ||
data class OneMinuteToOneHour(val duration: Duration) : DurationFromNow(duration) | ||
data class OneHourToOneDay(val duration: Duration) : DurationFromNow(duration) | ||
data class OneDayToSevenDay(val duration: Duration) : DurationFromNow(duration) | ||
data class SevenDayToOneYear(val duration: Duration) : DurationFromNow(duration) | ||
data class OverOneYear(val duration: Duration) : DurationFromNow(duration) | ||
|
||
val seconds = value.seconds | ||
val minutes = value.toMinutes() | ||
val hours = value.toHours() | ||
val days = value.toDays() | ||
val years = value.toDays() / DAYS_FOR_YEAR | ||
|
||
companion object { | ||
fun from(date: LocalDateTime): DurationFromNow { | ||
val duration = Duration.between(date, LocalDateTime.now()) | ||
return when { | ||
duration.isLessThanOneMinute() -> LessThanOneMinute(duration) | ||
duration.isLessThanOneHour() -> OneMinuteToOneHour(duration) | ||
duration.isLessThanOneDay() -> OneHourToOneDay(duration) | ||
duration.isLessThanWeekDays() -> OneDayToSevenDay(duration) | ||
duration.isLessOneYear() -> SevenDayToOneYear(duration) | ||
else -> OverOneYear(duration) | ||
} | ||
} | ||
|
||
private fun Duration.isLessThanOneMinute() = toMinutes() < 1 | ||
private fun Duration.isLessThanOneHour() = toHours() < 1 | ||
private fun Duration.isLessThanOneDay() = toDays() < 1 | ||
private fun Duration.isLessThanWeekDays() = toDays() < DAYS_FOR_WEEK | ||
private fun Duration.isLessOneYear() = toDays() < DAYS_FOR_YEAR | ||
|
||
private const val DAYS_FOR_YEAR = 365 | ||
private const val DAYS_FOR_WEEK = 7 | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
core/domain/src/main/java/com/withpeace/withpeace/core/domain/model/post/Post.kt
This file contains 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,5 +1,12 @@ | ||
package com.withpeace.withpeace.core.domain.model.post | ||
|
||
import com.withpeace.withpeace.core.domain.model.date.Date | ||
|
||
data class Post( | ||
val postId: Long, | ||
val title: String, | ||
val content: String, | ||
val postTopic: PostTopic, | ||
val createDate: Date, | ||
val postImageUrl: String?, | ||
) |
6 changes: 5 additions & 1 deletion
6
core/domain/src/main/java/com/withpeace/withpeace/core/domain/model/post/PostTopic.kt
This file contains 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,5 +1,9 @@ | ||
package com.withpeace.withpeace.core.domain.model.post | ||
|
||
enum class PostTopic { | ||
FREEDOM, INFORMATION, QUESTION, LIVING, HOBBY, ECONOMY | ||
FREEDOM, INFORMATION, QUESTION, LIVING, HOBBY, ECONOMY; | ||
|
||
companion object { | ||
fun findIndex(postTopic: PostTopic) = entries.indexOf(postTopic) | ||
} | ||
} |
File renamed without changes.
This file contains 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 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("convention.android.base") | ||
id("convention.android.compose") | ||
} | ||
|
||
android { | ||
namespace = "com.withpeace.withpeace.core.ui" | ||
} | ||
|
||
dependencies { | ||
implementation(project(":core:domain")) | ||
} |
File renamed without changes.
File renamed without changes.
This file contains 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: 1 addition & 1 deletion
2
feature/post/src/main/AndroidManifest.xml → core/ui/src/main/AndroidManifest.xml
This file contains 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,4 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> | ||
</manifest> |
37 changes: 37 additions & 0 deletions
37
core/ui/src/main/java/com/withpeace/withpeace/core/ui/DateUiState.kt
This file contains 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,37 @@ | ||
package com.withpeace.withpeace.core.ui | ||
|
||
import android.content.Context | ||
import com.withpeace.withpeace.core.domain.model.date.Date | ||
import com.withpeace.withpeace.core.domain.model.date.DurationFromNow | ||
import java.time.format.DateTimeFormatter | ||
|
||
fun Date.toRelativeString(context: Context): String { | ||
return when (durationFromNow) { | ||
is DurationFromNow.LessThanOneMinute -> { | ||
context.getString( | ||
R.string.second_format, | ||
durationFromNow.seconds, | ||
) | ||
} | ||
|
||
is DurationFromNow.OneMinuteToOneHour -> context.getString( | ||
R.string.minute_format, | ||
durationFromNow.minutes, | ||
) | ||
is DurationFromNow.OneHourToOneDay -> context.getString( | ||
R.string.hour_format, | ||
durationFromNow.hours, | ||
) | ||
is DurationFromNow.OneDayToSevenDay -> context.getString( | ||
R.string.day_format, | ||
durationFromNow.days, | ||
) | ||
is DurationFromNow.SevenDayToOneYear -> date.format(DateTimeFormatter.ofPattern(DATE_FORMAT)) | ||
is DurationFromNow.OverOneYear -> context.getString( | ||
R.string.years_format, | ||
durationFromNow.years, | ||
) | ||
} | ||
} | ||
|
||
private const val DATE_FORMAT = "MM월 DD일" |
18 changes: 9 additions & 9 deletions
18
...ature/registerpost/RegisterPostUiState.kt → ...ace/withpeace/core/ui/PostTopicUiState.kt
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어디에 쓰이는 카드인가요?!
캡쳐 해주시면 감사합니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
게시글 내용을 감싸는 테두리 라고 생각하시면 될 것 같습니다! 보통 저 테두리는 공통으로 쓰이기 때문에 designSystem으로 빼놨습니다