Skip to content

Commit

Permalink
Fix group consent (#265)
Browse files Browse the repository at this point in the history
* add hex util to make group comparison easier

* fix up group consent

* optimize
  • Loading branch information
nplasterer authored Jul 1, 2024
1 parent 7cd738b commit 9ee782f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/src/main/java/org/xmtp/android/library/Contacts.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.xmtp.android.library

import com.google.protobuf.kotlin.toByteStringUtf8
import com.google.protobuf.kotlin.toByteString
import kotlinx.coroutines.runBlocking
import org.xmtp.android.library.messages.ContactBundle
import org.xmtp.android.library.messages.ContactBundleBuilder
Expand Down Expand Up @@ -41,7 +41,7 @@ data class ConsentListEntry(
groupId: ByteArray,
type: ConsentState = ConsentState.UNKNOWN,
): ConsentListEntry {
return ConsentListEntry(String(groupId), EntryType.GROUP_ID, type)
return ConsentListEntry(groupId.toHex(), EntryType.GROUP_ID, type)
}

fun inboxId(
Expand Down Expand Up @@ -152,13 +152,13 @@ class ConsentList(
ConsentState.ALLOWED ->
it.setAllowGroup(
PrivatePreferencesAction.AllowGroup.newBuilder()
.addGroupIds(entry.value.toByteStringUtf8()),
.addGroupIds(entry.value.hexToByteArray().toByteString()),
)

ConsentState.DENIED ->
it.setDenyGroup(
PrivatePreferencesAction.DenyGroup.newBuilder()
.addGroupIds(entry.value.toByteStringUtf8()),
.addGroupIds(entry.value.hexToByteArray().toByteString()),
)

ConsentState.UNKNOWN -> it.clearMessageType()
Expand Down

0 comments on commit 9ee782f

Please sign in to comment.