Skip to content

Commit

Permalink
Fix DB Directory (#252)
Browse files Browse the repository at this point in the history
* fix the db directory

* get it passing in rn
  • Loading branch information
nplasterer authored Jun 7, 2024
1 parent ab6589e commit 6f6b5a6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions library/src/main/java/org/xmtp/android/library/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,14 @@ class Client() {

val alias = "xmtp-${options.api.env}-$inboxId"

val dbDir = if (options.dbDirectory == null) {
File(appContext?.filesDir?.absolutePath, "xmtp_db")
val mlsDbDirectory = options.dbDirectory
val directoryFile = if (mlsDbDirectory != null) {
File(mlsDbDirectory)
} else {
File(appContext?.filesDir?.absolutePath, options.dbDirectory)
File(appContext?.filesDir?.absolutePath, "xmtp_db")
}

dbDir.mkdir()
dbPath = dbDir.absolutePath + "/$alias.db3"
directoryFile.mkdir()
dbPath = directoryFile.absolutePath + "/$alias.db3"

val encryptionKey = if (options.dbEncryptionKey == null) {
val keyStore = KeyStore.getInstance("AndroidKeyStore")
Expand Down

0 comments on commit 6f6b5a6

Please sign in to comment.