Skip to content

Commit

Permalink
make public and move to companion object
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Jul 31, 2024
1 parent 773eb34 commit ffe8392
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions library/src/main/java/org/xmtp/android/library/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Client() {
val libXMTPVersion: String = getVersionInfo()
var installationId: String = ""
private var v3Client: FfiXmtpClient? = null
private var dbPath: String = ""
var dbPath: String = ""
lateinit var inboxId: String

companion object {
Expand All @@ -96,6 +96,19 @@ class Client() {
registry
}

suspend fun getOrCreateInboxId(options: ClientOptions, address: String): String {
var inboxId = getInboxIdForAddress(
logger = XMTPLogger(),
host = options.api.env.getUrl(),
isSecure = options.api.isSecure,
accountAddress = address
)
if (inboxId.isNullOrBlank()) {
inboxId = generateInboxId(address, 0.toULong())
}
return inboxId
}

fun register(codec: ContentCodec<*>) {
codecRegistry.register(codec = codec)
}
Expand Down Expand Up @@ -620,19 +633,6 @@ class Client() {
v3Client?.dbReconnect() ?: throw XMTPException("Error no V3 client initialized")
}

suspend fun getOrCreateInboxId(options: ClientOptions, address: String): String {
var inboxId = getInboxIdForAddress(
logger = logger,
host = options.api.env.getUrl(),
isSecure = options.api.isSecure,
accountAddress = address
)
if (inboxId.isNullOrBlank()) {
inboxId = generateInboxId(address, 0.toULong())
}
return inboxId
}

suspend fun requestMessageHistorySync() {
v3Client?.requestHistorySync() ?: throw XMTPException("Error no V3 client initialized")
}
Expand Down

0 comments on commit ffe8392

Please sign in to comment.