From 06e4df029fce17e0ead9a355c2ddf2274c8c54ad Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Mon, 29 Jan 2024 20:55:46 -0800 Subject: [PATCH] fix up the library linting issues --- .../xmtp/android/library/GroupMembershipChangeTest.kt | 5 ++--- .../java/org/xmtp/android/library/GroupTest.kt | 4 ++-- library/src/main/java/org/xmtp/android/library/Client.kt | 2 +- .../main/java/org/xmtp/android/library/Conversation.kt | 4 +--- .../main/java/org/xmtp/android/library/Conversations.kt | 4 +--- library/src/main/java/org/xmtp/android/library/Group.kt | 9 +-------- .../android/library/codecs/GroupMembershipChangeCodec.kt | 3 +-- .../org/xmtp/android/library/libxmtp/GroupEmitter.kt | 2 +- .../java/org/xmtp/android/library/libxmtp/Message.kt | 2 +- .../org/xmtp/android/library/libxmtp/MessageEmitter.kt | 3 +-- 10 files changed, 12 insertions(+), 26 deletions(-) diff --git a/library/src/androidTest/java/org/xmtp/android/library/GroupMembershipChangeTest.kt b/library/src/androidTest/java/org/xmtp/android/library/GroupMembershipChangeTest.kt index 32353f53e..027b5b78e 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/GroupMembershipChangeTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/GroupMembershipChangeTest.kt @@ -2,8 +2,7 @@ package org.xmtp.android.library import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry -import kotlinx.coroutines.runBlocking -import org.junit.Assert.* +import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -94,4 +93,4 @@ class GroupMembershipChangeTest { ) assert(content?.membersAddedList.isNullOrEmpty()) } -} \ No newline at end of file +} diff --git a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt index 3c1b2b836..c4b434f65 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt @@ -4,7 +4,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry import app.cash.turbine.test import kotlinx.coroutines.ExperimentalCoroutinesApi -import org.junit.Assert.* +import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -201,4 +201,4 @@ class GroupTest { awaitComplete() } } -} \ No newline at end of file +} diff --git a/library/src/main/java/org/xmtp/android/library/Client.kt b/library/src/main/java/org/xmtp/android/library/Client.kt index 7a682d4d3..c98a632eb 100644 --- a/library/src/main/java/org/xmtp/android/library/Client.kt +++ b/library/src/main/java/org/xmtp/android/library/Client.kt @@ -156,7 +156,7 @@ class Client() { apiClient: ApiClient, libXMTPClient: FfiXmtpClient? = null, ) : this() { - this.address = libXMTPClient?.accountAddress() ?: address + this.address = address this.privateKeyBundleV1 = privateKeyBundleV1 this.apiClient = apiClient this.contacts = Contacts(client = this) diff --git a/library/src/main/java/org/xmtp/android/library/Conversation.kt b/library/src/main/java/org/xmtp/android/library/Conversation.kt index ce1a4037a..f8a37ef8b 100644 --- a/library/src/main/java/org/xmtp/android/library/Conversation.kt +++ b/library/src/main/java/org/xmtp/android/library/Conversation.kt @@ -3,16 +3,15 @@ package org.xmtp.android.library import android.util.Log import com.google.protobuf.kotlin.toByteString import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.flowOf import org.xmtp.android.library.codecs.EncodedContent import org.xmtp.android.library.libxmtp.Message +import org.xmtp.android.library.messages.DecryptedMessage import org.xmtp.android.library.messages.Envelope import org.xmtp.android.library.messages.PagingInfoSortDirection import org.xmtp.proto.keystore.api.v1.Keystore.TopicMap.TopicData import org.xmtp.proto.message.api.v1.MessageApiOuterClass import org.xmtp.proto.message.contents.Invitation import org.xmtp.proto.message.contents.Invitation.InvitationV1.Aes256gcmHkdfsha256 -import org.xmtp.android.library.messages.DecryptedMessage import java.util.Date /** @@ -69,7 +68,6 @@ sealed class Conversation { } } - // This distinctly identifies between two addresses. // Note: this will be empty for older v1 conversations. val conversationId: String? diff --git a/library/src/main/java/org/xmtp/android/library/Conversations.kt b/library/src/main/java/org/xmtp/android/library/Conversations.kt index 7cdbd0807..b973b008e 100644 --- a/library/src/main/java/org/xmtp/android/library/Conversations.kt +++ b/library/src/main/java/org/xmtp/android/library/Conversations.kt @@ -11,8 +11,7 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import org.xmtp.android.library.GRPCApiClient.Companion.makeQueryRequest import org.xmtp.android.library.GRPCApiClient.Companion.makeSubscribeRequest -import org.xmtp.android.library.libxmtp.Message -import org.xmtp.android.library.libxmtp.MessageEmitter +import org.xmtp.android.library.messages.DecryptedMessage import org.xmtp.android.library.messages.Envelope import org.xmtp.android.library.messages.EnvelopeBuilder import org.xmtp.android.library.messages.InvitationV1 @@ -35,7 +34,6 @@ import org.xmtp.android.library.messages.walletAddress import org.xmtp.proto.keystore.api.v1.Keystore.TopicMap.TopicData import org.xmtp.proto.message.contents.Contact import org.xmtp.proto.message.contents.Invitation -import org.xmtp.android.library.messages.DecryptedMessage import uniffi.xmtpv3.FfiConversations import uniffi.xmtpv3.FfiListConversationsOptions import uniffi.xmtpv3.org.xmtp.android.library.libxmtp.GroupEmitter diff --git a/library/src/main/java/org/xmtp/android/library/Group.kt b/library/src/main/java/org/xmtp/android/library/Group.kt index e399a6d7e..da4dba509 100644 --- a/library/src/main/java/org/xmtp/android/library/Group.kt +++ b/library/src/main/java/org/xmtp/android/library/Group.kt @@ -1,6 +1,5 @@ package org.xmtp.android.library -import android.util.Log import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow @@ -12,16 +11,10 @@ import org.xmtp.android.library.codecs.compress import org.xmtp.android.library.libxmtp.Message import org.xmtp.android.library.libxmtp.MessageEmitter import org.xmtp.android.library.messages.DecryptedMessage -import org.xmtp.android.library.messages.EnvelopeBuilder -import org.xmtp.android.library.messages.MessageBuilder -import org.xmtp.android.library.messages.MessageV2Builder -import org.xmtp.android.library.messages.Pagination import org.xmtp.android.library.messages.PagingInfoSortDirection import org.xmtp.proto.message.api.v1.MessageApiOuterClass import uniffi.xmtpv3.FfiGroup import uniffi.xmtpv3.FfiListMessagesOptions -import uniffi.xmtpv3.FfiMessage -import java.security.SecureRandom import java.util.Date import kotlin.time.Duration.Companion.nanoseconds import kotlin.time.DurationUnit @@ -178,4 +171,4 @@ class Group(val client: Client, private val libXMTPGroup: FfiGroup) { libXMTPGroup.listMembers().map { it.accountAddress } } } -} \ No newline at end of file +} diff --git a/library/src/main/java/org/xmtp/android/library/codecs/GroupMembershipChangeCodec.kt b/library/src/main/java/org/xmtp/android/library/codecs/GroupMembershipChangeCodec.kt index 176266348..9d7e855fd 100644 --- a/library/src/main/java/org/xmtp/android/library/codecs/GroupMembershipChangeCodec.kt +++ b/library/src/main/java/org/xmtp/android/library/codecs/GroupMembershipChangeCodec.kt @@ -1,6 +1,5 @@ package uniffi.xmtpv3.org.xmtp.android.library.codecs -import com.google.gson.GsonBuilder import org.xmtp.android.library.codecs.ContentCodec import org.xmtp.android.library.codecs.ContentTypeId import org.xmtp.android.library.codecs.ContentTypeIdBuilder @@ -32,4 +31,4 @@ data class GroupMembershipChangeCodec(override var contentType: ContentTypeId = override fun fallback(content: GroupMembershipChanges): String? { return null } -} \ No newline at end of file +} diff --git a/library/src/main/java/org/xmtp/android/library/libxmtp/GroupEmitter.kt b/library/src/main/java/org/xmtp/android/library/libxmtp/GroupEmitter.kt index d21c26654..d74a9fd61 100644 --- a/library/src/main/java/org/xmtp/android/library/libxmtp/GroupEmitter.kt +++ b/library/src/main/java/org/xmtp/android/library/libxmtp/GroupEmitter.kt @@ -14,4 +14,4 @@ class GroupEmitter { _groups.tryEmit(conversation) } } -} \ No newline at end of file +} diff --git a/library/src/main/java/org/xmtp/android/library/libxmtp/Message.kt b/library/src/main/java/org/xmtp/android/library/libxmtp/Message.kt index 81a1c732d..0b470c4ae 100644 --- a/library/src/main/java/org/xmtp/android/library/libxmtp/Message.kt +++ b/library/src/main/java/org/xmtp/android/library/libxmtp/Message.kt @@ -32,4 +32,4 @@ data class Message(val client: Client, private val libXMTPMessage: FfiMessage) { throw XMTPException("Error decoding message", e) } } -} \ No newline at end of file +} diff --git a/library/src/main/java/org/xmtp/android/library/libxmtp/MessageEmitter.kt b/library/src/main/java/org/xmtp/android/library/libxmtp/MessageEmitter.kt index 1cc19d5be..d0afb444f 100644 --- a/library/src/main/java/org/xmtp/android/library/libxmtp/MessageEmitter.kt +++ b/library/src/main/java/org/xmtp/android/library/libxmtp/MessageEmitter.kt @@ -1,6 +1,5 @@ package org.xmtp.android.library.libxmtp -import android.util.Log import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.asSharedFlow import uniffi.xmtpv3.FfiMessage @@ -15,4 +14,4 @@ class MessageEmitter { _messages.tryEmit(message) } } -} \ No newline at end of file +}