Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SQL App Group Crash #339

Merged
merged 3 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let package = Package(
.package(url: "https://github.com/1024jp/GzipSwift", from: "5.2.0"),
.package(url: "https://github.com/bufbuild/connect-swift", exact: "0.12.0"),
.package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.0.0"),
.package(url: "https://github.com/xmtp/libxmtp-swift", exact: "0.4.4-beta5"),
.package(url: "https://github.com/xmtp/libxmtp-swift", exact: "0.4.4-beta6"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
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()")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@insipx was able to mark this function as delicate to warn developers before using.

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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be any reason to mark this as delicate because if they try to reconnect a already connected database nothing bad should happen right?

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
4 changes: 2 additions & 2 deletions XMTP.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |spec|
#

spec.name = "XMTP"
spec.version = "0.10.11"
spec.version = "0.10.12"
spec.summary = "XMTP SDK Cocoapod"

# This description is used to generate tags and improve search results.
Expand Down Expand Up @@ -44,5 +44,5 @@ Pod::Spec.new do |spec|
spec.dependency "web3.swift"
spec.dependency "GzipSwift"
spec.dependency "Connect-Swift", "= 0.12.0"
spec.dependency 'LibXMTP', '= 0.4.4-beta5'
spec.dependency 'LibXMTP', '= 0.4.4-beta6'
end
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/xmtp/libxmtp-swift",
"state" : {
"revision" : "f2b73d14be21b64feecfa70c789b3302525975ab",
"version" : "0.4.4-beta5"
"revision" : "11ac13baf3b2d36571a8ad5b0d8bda3017635563",
"version" : "0.4.4-beta6"
}
},
{
Expand Down
Loading