forked from github/wulkanowy-mirror
Fix marking message as read (#1960)
* Fix marking message as read * Update sdk * Update sdk * Fix tests * Use many recipients strings instead of first recipient
This commit is contained in:
parent
190f40ede8
commit
558db061f5
@ -186,7 +186,7 @@ ext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "io.github.wulkanowy:sdk:1.7.2"
|
implementation "com.github.wulkanowy:sdk:006a238bda"
|
||||||
|
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.8'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.8'
|
||||||
|
|
||||||
|
@ -64,7 +64,10 @@ class MessageRepository @Inject constructor(
|
|||||||
},
|
},
|
||||||
query = { messagesDb.loadAll(mailbox.globalKey, folder.id) },
|
query = { messagesDb.loadAll(mailbox.globalKey, folder.id) },
|
||||||
fetch = {
|
fetch = {
|
||||||
sdk.init(student).getMessages(Folder.valueOf(folder.name)).mapToEntities(mailbox)
|
sdk.init(student).getMessages(
|
||||||
|
folder = Folder.valueOf(folder.name),
|
||||||
|
mailboxKey = mailbox.globalKey,
|
||||||
|
).mapToEntities(mailbox)
|
||||||
},
|
},
|
||||||
saveFetchResult = { old, new ->
|
saveFetchResult = { old, new ->
|
||||||
messagesDb.deleteAll(old uniqueSubtract new)
|
messagesDb.deleteAll(old uniqueSubtract new)
|
||||||
@ -89,7 +92,7 @@ class MessageRepository @Inject constructor(
|
|||||||
},
|
},
|
||||||
query = { messagesDb.loadMessageWithAttachment(message.messageGlobalKey) },
|
query = { messagesDb.loadMessageWithAttachment(message.messageGlobalKey) },
|
||||||
fetch = {
|
fetch = {
|
||||||
sdk.init(student).getMessageDetails(it!!.message.messageGlobalKey)
|
sdk.init(student).getMessageDetails(it!!.message.messageGlobalKey, markAsRead)
|
||||||
},
|
},
|
||||||
saveFetchResult = { old, new ->
|
saveFetchResult = { old, new ->
|
||||||
checkNotNull(old) { "Fetched message no longer exist!" }
|
checkNotNull(old) { "Fetched message no longer exist!" }
|
||||||
@ -98,7 +101,7 @@ class MessageRepository @Inject constructor(
|
|||||||
id = message.id
|
id = message.id
|
||||||
unread = !markAsRead
|
unread = !markAsRead
|
||||||
sender = new.sender
|
sender = new.sender
|
||||||
recipients = new.recipients.firstOrNull() ?: "Wielu adresoatów"
|
recipients = new.recipients.singleOrNull() ?: "Wielu adresatów"
|
||||||
content = content.ifBlank { new.content }
|
content = content.ifBlank { new.content }
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -141,7 +141,7 @@ class MessageRepositoryTest {
|
|||||||
messageDb.loadMessageWithAttachment("v4")
|
messageDb.loadMessageWithAttachment("v4")
|
||||||
} returnsMany listOf(flowOf(mWa), flowOf(mWaWithContent))
|
} returnsMany listOf(flowOf(mWa), flowOf(mWaWithContent))
|
||||||
coEvery {
|
coEvery {
|
||||||
sdk.getMessageDetails("v4")
|
sdk.getMessageDetails("v4", any())
|
||||||
} returns mockk {
|
} returns mockk {
|
||||||
every { sender } returns ""
|
every { sender } returns ""
|
||||||
every { recipients } returns listOf("")
|
every { recipients } returns listOf("")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user