This commit is contained in:
2024-07-31 14:50:55 +08:00
parent 2c79195f44
commit b17ac76005
63 changed files with 344 additions and 42 deletions

View File

@@ -21,7 +21,8 @@ interface MomentService {
suspend fun createMoment(
content: String,
authorId: Int,
imageUriList: List<String>
imageUriList: List<String>,
relPostId: Int? = null
): MomentItem
}
@@ -96,9 +97,10 @@ class TestMomentServiceImpl() : MomentService {
override suspend fun createMoment(
content: String,
authorId: Int,
imageUriList: List<String>
imageUriList: List<String>,
relPostId: Int?
): MomentItem {
return testMomentBackend.createMoment(content, authorId, imageUriList)
return testMomentBackend.createMoment(content, authorId, imageUriList, relPostId)
}
}
@@ -140,6 +142,9 @@ class TestMomentBackend(
if (myLikeIdList.contains(it.id)) {
it.liked = true
}
if (it.relPostId != null) {
it.relMoment = rawList.first { it1 -> it1.id == it.relPostId }
}
}
// delay
@@ -186,7 +191,8 @@ class TestMomentBackend(
suspend fun createMoment(
content: String,
authorId: Int,
imageUriList: List<String>
imageUriList: List<String>,
relPostId: Int?
): MomentItem {
TestDatabase.momentIdCounter += 1
val person = TestDatabase.accountData.first {
@@ -206,7 +212,8 @@ class TestMomentBackend(
shareCount = 0,
favoriteCount = 0,
images = imageUriList,
authorId = person.id
authorId = person.id,
relPostId = relPostId
)
TestDatabase.momentData += newMoment
return newMoment