Skip to content

Commit

Permalink
clean up redundent consent code (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer authored Jan 15, 2025
1 parent fc83757 commit 9ec2055
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ data class Conversations(
return dm
}

suspend fun listGroups(
fun listGroups(
after: Date? = null,
before: Date? = null,
limit: Int? = null,
Expand All @@ -190,7 +190,7 @@ data class Conversations(
}
}

suspend fun listDms(
fun listDms(
after: Date? = null,
before: Date? = null,
limit: Int? = null,
Expand Down
9 changes: 0 additions & 9 deletions library/src/main/java/org/xmtp/android/library/Dm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ class Dm(private val clientInboxId: String, private val libXMTPGroup: FfiConvers
}

suspend fun send(encodedContent: EncodedContent): String {
if (consentState() == ConsentState.UNKNOWN) {
updateConsentState(ConsentState.ALLOWED)
}
val messageId = libXMTPGroup.send(contentBytes = encodedContent.toByteArray())
return messageId.toHex()
}
Expand Down Expand Up @@ -81,16 +78,10 @@ class Dm(private val clientInboxId: String, private val libXMTPGroup: FfiConvers
}

fun prepareMessage(encodedContent: EncodedContent): String {
if (consentState() == ConsentState.UNKNOWN) {
updateConsentState(ConsentState.ALLOWED)
}
return libXMTPGroup.sendOptimistic(encodedContent.toByteArray()).toHex()
}

fun <T> prepareMessage(content: T, options: SendOptions? = null): String {
if (consentState() == ConsentState.UNKNOWN) {
updateConsentState(ConsentState.ALLOWED)
}
val encodeContent = encodeContent(content = content, options = options)
return libXMTPGroup.sendOptimistic(encodeContent.toByteArray()).toHex()
}
Expand Down
9 changes: 0 additions & 9 deletions library/src/main/java/org/xmtp/android/library/Group.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ class Group(
}

suspend fun send(encodedContent: EncodedContent): String {
if (consentState() == ConsentState.UNKNOWN) {
updateConsentState(ConsentState.ALLOWED)
}
val messageId = libXMTPGroup.send(contentBytes = encodedContent.toByteArray())
return messageId.toHex()
}
Expand Down Expand Up @@ -103,16 +100,10 @@ class Group(
}

fun prepareMessage(encodedContent: EncodedContent): String {
if (consentState() == ConsentState.UNKNOWN) {
updateConsentState(ConsentState.ALLOWED)
}
return libXMTPGroup.sendOptimistic(encodedContent.toByteArray()).toHex()
}

fun <T> prepareMessage(content: T, options: SendOptions? = null): String {
if (consentState() == ConsentState.UNKNOWN) {
updateConsentState(ConsentState.ALLOWED)
}
val encodeContent = encodeContent(content = content, options = options)
return libXMTPGroup.sendOptimistic(encodeContent.toByteArray()).toHex()
}
Expand Down

0 comments on commit 9ec2055

Please sign in to comment.