diff --git a/app/build.gradle b/app/build.gradle index 759199ca..ab8add50 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -186,7 +186,7 @@ ext { } 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' diff --git a/app/src/main/java/io/github/wulkanowy/data/repositories/MessageRepository.kt b/app/src/main/java/io/github/wulkanowy/data/repositories/MessageRepository.kt index 5a43da4e..e7428762 100644 --- a/app/src/main/java/io/github/wulkanowy/data/repositories/MessageRepository.kt +++ b/app/src/main/java/io/github/wulkanowy/data/repositories/MessageRepository.kt @@ -64,7 +64,10 @@ class MessageRepository @Inject constructor( }, query = { messagesDb.loadAll(mailbox.globalKey, folder.id) }, 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 -> messagesDb.deleteAll(old uniqueSubtract new) @@ -89,7 +92,7 @@ class MessageRepository @Inject constructor( }, query = { messagesDb.loadMessageWithAttachment(message.messageGlobalKey) }, fetch = { - sdk.init(student).getMessageDetails(it!!.message.messageGlobalKey) + sdk.init(student).getMessageDetails(it!!.message.messageGlobalKey, markAsRead) }, saveFetchResult = { old, new -> checkNotNull(old) { "Fetched message no longer exist!" } @@ -98,7 +101,7 @@ class MessageRepository @Inject constructor( id = message.id unread = !markAsRead sender = new.sender - recipients = new.recipients.firstOrNull() ?: "Wielu adresoatów" + recipients = new.recipients.singleOrNull() ?: "Wielu adresatów" content = content.ifBlank { new.content } }) ) diff --git a/app/src/test/java/io/github/wulkanowy/data/repositories/MessageRepositoryTest.kt b/app/src/test/java/io/github/wulkanowy/data/repositories/MessageRepositoryTest.kt index 24306bfe..4efc9c60 100644 --- a/app/src/test/java/io/github/wulkanowy/data/repositories/MessageRepositoryTest.kt +++ b/app/src/test/java/io/github/wulkanowy/data/repositories/MessageRepositoryTest.kt @@ -141,7 +141,7 @@ class MessageRepositoryTest { messageDb.loadMessageWithAttachment("v4") } returnsMany listOf(flowOf(mWa), flowOf(mWaWithContent)) coEvery { - sdk.getMessageDetails("v4") + sdk.getMessageDetails("v4", any()) } returns mockk { every { sender } returns "" every { recipients } returns listOf("")