-
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
[IDLE-443] 채팅방 목록 UI 구현 #128
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
51a1391
[IDLE-443] Chatting 모듈 추가
tgyuuAn 1667322
[IDLE-443] WorkerChatting, CenterChatting 모듈 분리
tgyuuAn 6c9b640
[IDLE-443] Center Chatting, Worker Chatting 채팅 홈화면 UI 구현
tgyuuAn 1edf97c
[IDLE-443] ChattingDetail 모듈 추가
tgyuuAn 46d68d1
[IDLE-443] ChattingDetail 모듈 추가
tgyuuAn ba0f512
[IDLE-443] ChattingDetail TextField UI 구현
tgyuuAn 6e02734
[IDLE-443] Resolve conflict
tgyuuAn bfe3b87
[IDLE-443] ChatRoom Entity 추가
tgyuuAn 8fcff45
[IDLE-443] TimeUtil 생성 및 테스트 코드 위치 변경
tgyuuAn 742c877
[IDLE-443] 채팅방 목록 UI 완성
tgyuuAn 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
13 changes: 13 additions & 0 deletions
13
core/designresource/src/main/res/drawable/ic_send_message.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="32dp" | ||
android:height="32dp" | ||
android:viewportWidth="32" | ||
android:viewportHeight="32"> | ||
<path | ||
android:pathData="M13.332,18.667L27.998,4M13.332,18.667L17.998,28C18.057,28.128 18.151,28.236 18.269,28.312C18.387,28.388 18.524,28.428 18.665,28.428C18.805,28.428 18.943,28.388 19.061,28.312C19.179,28.236 19.273,28.128 19.331,28L27.998,4M13.332,18.667L3.998,14C3.87,13.941 3.762,13.848 3.686,13.729C3.611,13.611 3.57,13.474 3.57,13.333C3.57,13.193 3.611,13.055 3.686,12.937C3.762,12.819 3.87,12.725 3.998,12.667L27.998,4" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="2" | ||
android:fillColor="#00000000" | ||
android:strokeColor="#4B515C" | ||
android:strokeLineCap="round"/> | ||
</vector> |
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
24 changes: 24 additions & 0 deletions
24
core/domain/src/main/kotlin/com/idle/domain/model/chatting/ChatMessage.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,24 @@ | ||
package com.idle.domain.model.chatting | ||
|
||
import java.time.LocalDateTime | ||
|
||
data class ChatMessage( | ||
val id: String, | ||
val roomId: String, | ||
val senderType: SenderType, | ||
val contents: List<Content>, | ||
val createdAt: LocalDateTime, | ||
) | ||
|
||
data class Content( | ||
val type: ContentType, | ||
val value: String, | ||
) | ||
|
||
enum class SenderType { | ||
USER, | ||
} | ||
|
||
enum class ContentType { | ||
TEXT, IMAGE; | ||
} |
14 changes: 14 additions & 0 deletions
14
core/domain/src/main/kotlin/com/idle/domain/model/chatting/ChatRoom.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,14 @@ | ||
package com.idle.domain.model.chatting | ||
|
||
import java.time.LocalDateTime | ||
|
||
data class ChatRoom( | ||
val id: String, | ||
val sender: String, | ||
val receiver: String, | ||
val createdAt: LocalDateTime, | ||
val lastMessage: String, | ||
val lastSentAt: LocalDateTime, | ||
val unReadMessageCount: Int, | ||
val profileImageUrl: String, | ||
) |
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
63 changes: 63 additions & 0 deletions
63
core/domain/src/main/kotlin/com/idle/domain/usecase/chatting/GetChatRoomListUseCase.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,63 @@ | ||
package com.idle.domain.usecase.chatting | ||
|
||
import com.idle.domain.model.chatting.ChatRoom | ||
import java.time.LocalDateTime | ||
import javax.inject.Inject | ||
|
||
class GetChatRoomListUseCase @Inject constructor( | ||
) { | ||
suspend operator fun invoke(): Result<List<ChatRoom>> = Result.success( | ||
listOf( | ||
ChatRoom( | ||
id = "1", | ||
sender = "user1", | ||
receiver = "user2", | ||
createdAt = LocalDateTime.now().minusDays(1), | ||
lastMessage = "안녕하세요!안녕하세요!안녕하세요!안녕하세요!안녕하세요!안녕하세요!", | ||
lastSentAt = LocalDateTime.now().minusHours(1), | ||
unReadMessageCount = 3, | ||
profileImageUrl = "", | ||
), | ||
ChatRoom( | ||
id = "2", | ||
sender = "user3", | ||
receiver = "user4", | ||
createdAt = LocalDateTime.now().minusDays(3), | ||
lastMessage = "오늘 만날 수 있을까요?", | ||
lastSentAt = LocalDateTime.now().minusHours(5), | ||
unReadMessageCount = 2, | ||
profileImageUrl = "", | ||
), | ||
ChatRoom( | ||
id = "3", | ||
sender = "user5", | ||
receiver = "user6", | ||
createdAt = LocalDateTime.now().minusDays(7), | ||
lastMessage = "네, 좋습니다!", | ||
lastSentAt = LocalDateTime.now().minusDays(1).minusHours(2), | ||
unReadMessageCount = 1, | ||
profileImageUrl = "", | ||
), | ||
ChatRoom( | ||
id = "4", | ||
sender = "user7user7user7user7user7user7user7user7user7user7user7user7", | ||
receiver = "user8", | ||
createdAt = LocalDateTime.now().minusHours(2), | ||
lastMessage = "곧 출발합니다.곧 출발합니다.곧 출발합니다.곧 출발합니다.곧 출발합니다.곧 출발합니다.곧 출발합니다.곧 출발합니다.", | ||
lastSentAt = LocalDateTime.now().minusMinutes(30), | ||
unReadMessageCount = 0, | ||
profileImageUrl = "", | ||
), | ||
ChatRoom( | ||
id = "5", | ||
sender = "user9", | ||
receiver = "user10", | ||
createdAt = LocalDateTime.now().minusWeeks(1), | ||
lastMessage = "다음 주에 봐요!", | ||
lastSentAt = LocalDateTime.now().minusDays(3), | ||
unReadMessageCount = 0, | ||
profileImageUrl = "https://cdn.pixabay.com/photo/2020/05/17/20/21/cat-5183427_1280.jpg", | ||
) | ||
) | ||
) | ||
} | ||
52 changes: 52 additions & 0 deletions
52
core/domain/src/main/kotlin/com/idle/domain/util/TimeUtil.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,52 @@ | ||
package com.idle.domain.util | ||
|
||
import java.time.LocalDateTime | ||
import java.time.ZoneId | ||
import java.time.format.DateTimeFormatter | ||
import java.time.temporal.ChronoUnit | ||
|
||
private val seoulZone = ZoneId.of("Asia/Seoul") | ||
|
||
fun LocalDateTime.formatRelativeDateTime(): String { | ||
val nowInSeoul = LocalDateTime.now(seoulZone) | ||
|
||
return when { | ||
this.isAfter(nowInSeoul) -> "미래" | ||
|
||
ChronoUnit.DAYS.between(this.toLocalDate(), nowInSeoul.toLocalDate()) < 1 -> { | ||
// 하루 이내일 경우: "오후 XX시 XX분" | ||
val formatter = DateTimeFormatter.ofPattern("a hh:mm").withZone(seoulZone) | ||
|
||
this.format(formatter) | ||
.replace("AM", "오전") | ||
.replace("PM", "오후") | ||
} | ||
|
||
else -> { | ||
// 하루 이상일 경우: "X월 X일" | ||
val formatter = DateTimeFormatter.ofPattern("M월 d일").withZone(seoulZone) | ||
|
||
this.format(formatter) | ||
} | ||
} | ||
} | ||
|
||
fun LocalDateTime.formatRelativeTimeDescription(): String { | ||
val currentTime = LocalDateTime.now(seoulZone) | ||
|
||
if (this.isAfter(currentTime)) { | ||
return "미래" | ||
} | ||
|
||
val minutesDifference = ChronoUnit.MINUTES.between(this, currentTime) | ||
val hoursDifference = ChronoUnit.HOURS.between(this, currentTime) | ||
val daysDifference = ChronoUnit.DAYS.between(this, currentTime) | ||
|
||
return when { | ||
minutesDifference <= 1 -> "방금 전" | ||
minutesDifference < 60 -> "${minutesDifference}분 전" | ||
hoursDifference < 24 -> "${hoursDifference}시간 전" | ||
daysDifference < 7 -> "${daysDifference}일 전" | ||
else -> "${daysDifference / 7}주 전" | ||
} | ||
} |
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.
더미 데이터