Skip to content

Commit c0903af

Browse files
authored
Merge branch 'develop' into feat/#83_API_Rooms
2 parents a7074a4 + bac1dc2 commit c0903af

27 files changed

Lines changed: 698 additions & 224 deletions

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<activity
1818
android:name=".MainActivity"
1919
android:exported="true"
20+
android:windowSoftInputMode="adjustResize"
2021
android:label="@string/app_name"
2122
android:theme="@style/Theme.Thip">
2223
<intent-filter>

app/src/main/java/com/texthip/thip/data/di/ServiceModule.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package com.texthip.thip.data.di
22

33
import com.texthip.thip.data.service.BookService
44
import com.texthip.thip.data.service.RecentSearchService
5+
import com.texthip.thip.data.service.CommentsService
6+
import com.texthip.thip.data.service.GroupService
57
import com.texthip.thip.data.service.RoomsService
68
import com.texthip.thip.data.service.UserService
79
import dagger.Module
@@ -36,4 +38,9 @@ object ServiceModule {
3638
fun provideRecentSearchService(retrofit: Retrofit): RecentSearchService {
3739
return retrofit.create(RecentSearchService::class.java)
3840
}
41+
42+
@Provides
43+
@Singleton
44+
fun providesCommentsService(retrofit: Retrofit): CommentsService =
45+
retrofit.create(CommentsService::class.java)
3946
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.texthip.thip.data.model.comments.request
2+
3+
import kotlinx.serialization.Serializable
4+
5+
@Serializable
6+
data class CommentsCreateRequest(
7+
val content: String,
8+
val isReplyRequest: Boolean,
9+
val parentId: Int? = null,
10+
val postType: String,
11+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.texthip.thip.data.model.comments.request
2+
3+
import kotlinx.serialization.Serializable
4+
5+
@Serializable
6+
data class CommentsLikesRequest(
7+
val type: Boolean
8+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.texthip.thip.data.model.comments.response
2+
3+
import kotlinx.serialization.Serializable
4+
5+
@Serializable
6+
data class CommentsCreateResponse(
7+
val commentId: Int,
8+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.texthip.thip.data.model.comments.response
2+
3+
import kotlinx.serialization.Serializable
4+
5+
@Serializable
6+
data class CommentsLikesResponse(
7+
val commentId: Int,
8+
val isLiked: Boolean,
9+
)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.texthip.thip.data.model.comments.response
2+
3+
import kotlinx.serialization.Serializable
4+
5+
@Serializable
6+
data class CommentsResponse(
7+
val commentList: List<CommentList>,
8+
val nextCursor: String?,
9+
val isLast: Boolean,
10+
)
11+
12+
@Serializable
13+
data class CommentList(
14+
val commentId: Int,
15+
val creatorId: Int,
16+
val creatorProfileImageUrl: String,
17+
val creatorNickname: String,
18+
val aliasName: String,
19+
val aliasColor: String,
20+
val postDate: String,
21+
val content: String,
22+
val likeCount: Int,
23+
val isDeleted: Boolean,
24+
val isLike: Boolean,
25+
val replyList: List<ReplyList>,
26+
)
27+
28+
@Serializable
29+
data class ReplyList(
30+
val commentId: Int,
31+
val parentCommentCreatorNickname: String,
32+
val creatorId: Int,
33+
val creatorProfileImageUrl: String,
34+
val creatorNickname: String,
35+
val aliasName: String,
36+
val aliasColor: String,
37+
val postDate: String,
38+
val content: String,
39+
val likeCount: Int,
40+
val isLike: Boolean,
41+
)

app/src/main/java/com/texthip/thip/data/model/rooms/response/RoomsPlayingResponse.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ data class RoomsPlayingResponse(
1212
val progressStartDate: String,
1313
val progressEndDate: String,
1414
val category: String,
15+
val categoryColor: String,
1516
val roomDescription: String,
1617
val memberCount: Int,
1718
val recruitCount: Int,

app/src/main/java/com/texthip/thip/data/model/rooms/response/RoomsUsersResponse.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ data class UserList(
1212
val userId: Int,
1313
val nickname: String,
1414
val imageUrl: String,
15+
val aliasColor: String,
1516
val aliasName: String,
1617
val followerCount: Int,
1718
)
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package com.texthip.thip.data.repository
2+
3+
import com.texthip.thip.data.model.base.handleBaseResponse
4+
import com.texthip.thip.data.model.comments.request.CommentsCreateRequest
5+
import com.texthip.thip.data.model.comments.request.CommentsLikesRequest
6+
import com.texthip.thip.data.service.CommentsService
7+
import javax.inject.Inject
8+
import javax.inject.Singleton
9+
10+
@Singleton
11+
class CommentsRepository @Inject constructor(
12+
private val commentsService: CommentsService,
13+
) {
14+
suspend fun getComments(
15+
postId: Long,
16+
postType: String = "RECORD",
17+
cursor: String? = null,
18+
) = runCatching {
19+
commentsService.getComments(
20+
postId = postId,
21+
postType = postType,
22+
cursor = cursor
23+
).handleBaseResponse().getOrThrow()
24+
}
25+
26+
suspend fun likeComment(
27+
commentId: Long,
28+
type: Boolean
29+
) = runCatching {
30+
commentsService.likeComment(
31+
commentId = commentId,
32+
response = CommentsLikesRequest(type)
33+
).handleBaseResponse().getOrThrow()
34+
}
35+
36+
suspend fun createComment(
37+
postId: Long,
38+
content: String,
39+
isReplyRequest: Boolean,
40+
parentId: Int? = null,
41+
postType: String = "RECORD",
42+
) = runCatching {
43+
commentsService.createComment(
44+
postId = postId,
45+
request = CommentsCreateRequest(
46+
content = content,
47+
isReplyRequest = isReplyRequest,
48+
parentId = parentId,
49+
postType = postType
50+
)
51+
).handleBaseResponse().getOrThrow()
52+
}
53+
}

0 commit comments

Comments
 (0)