Fix mark message as read feature
This commit is contained in:
parent
bd8f30d69a
commit
4e0ff49e0a
4 changed files with 10 additions and 5 deletions
|
@ -116,7 +116,7 @@ class Api {
|
|||
|
||||
fun getDeletedMessages(startDate: LocalDateTime? = null, endDate: LocalDateTime? = null) = messages.getDeletedMessages(startDate, endDate)
|
||||
|
||||
fun getMessage(id: Int, folderId: Int, read: Boolean = false) = messages.getMessage(id, folderId, read)
|
||||
fun getMessage(messageId: Int, folderId: Int, read: Boolean = false, id: Int? = null) = messages.getMessage(messageId, folderId, read, id)
|
||||
|
||||
fun getTimetable(startDate: LocalDate, endDate: LocalDate? = null) = snp.getTimetable(startDate, endDate)
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ class MessagesRepository(private val userId: Int, private val api: MessagesServi
|
|||
.map { res -> res.data?.sortedBy { it.date } }
|
||||
}
|
||||
|
||||
fun getMessage(id: Int, folderId: Int, read: Boolean): Single<Message> {
|
||||
return api.getMessage(id, folderId, read).map { it.data }
|
||||
fun getMessage(messageId: Int, folderId: Int, read: Boolean, id: Int?): Single<Message> {
|
||||
return api.getMessage(messageId, folderId, read, id).map { it.data }
|
||||
}
|
||||
|
||||
private fun getDate(date: LocalDateTime?): String {
|
||||
|
|
|
@ -26,5 +26,10 @@ interface MessagesService {
|
|||
|
||||
@POST("Wiadomosc.mvc/GetTrescWiadomosci")
|
||||
@FormUrlEncoded
|
||||
fun getMessage(@Field("idWiadomosc") id: Int, @Field("Folder") folderId: Int, @Field("Nieprzeczytana") read: Boolean): Single<MessagesResponse<Message>>
|
||||
fun getMessage(
|
||||
@Field("idWiadomosc") messageId: Int,
|
||||
@Field("Folder") folderId: Int,
|
||||
@Field("Nieprzeczytana") read: Boolean,
|
||||
@Field("idWiadomoscAdresat") id: Int?
|
||||
): Single<MessagesResponse<Message>>
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class MessagesTest : BaseTest() {
|
|||
server.enqueue(MockResponse().setBody(MessagesTest::class.java.getResource("Wiadomosc.json").readText()))
|
||||
server.start(3000)
|
||||
|
||||
assertEquals(27214, api.getMessage(1, 1, false).blockingGet().id)
|
||||
assertEquals(27214, api.getMessage(1, 1, false, 0).blockingGet().id)
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
Loading…
Reference in a new issue