Skip to content

Commit

Permalink
add functions to disconnect and reconnect the database
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed May 23, 2024
1 parent d36194c commit 5b8fcdd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Sources/XMTPiOS/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,21 @@ public final class Client {
let fm = FileManager.default
try fm.removeItem(atPath: dbPath)
}

@available(*, deprecated, message: "This function is delicate and should be used with caution. App will error if database not properly reconnected. See: reconnectLocalDatabase()")
public func dropLocalDatabaseConnection() throws {
guard let client = v3Client else {
throw ClientError.noV3Client("Error no V3 client initialized")
}
try client.releaseDbConnection()
}

public func reconnectLocalDatabase() async throws {
guard let client = v3Client else {
throw ClientError.noV3Client("Error no V3 client initialized")
}
try await client.dbReconnect()
}

func getUserContact(peerAddress: String) async throws -> ContactBundle? {
let peerAddress = EthereumAddress(peerAddress).toChecksumAddress()
Expand Down

0 comments on commit 5b8fcdd

Please sign in to comment.