@@ -133,7 +133,7 @@ public final class Client {
133
133
) async throws -> FfiXmtpClient ? {
134
134
if options? . mlsAlpha == true , options? . api. env. supportsMLS == true {
135
135
let dbURL = options? . mlsDbPath ?? URL . documentsDirectory. appendingPathComponent ( " xmtp- \( options? . api. env. rawValue ?? " " ) - \( address) .db3 " ) . path
136
-
136
+
137
137
var encryptionKey = options? . mlsEncryptionKey
138
138
if ( encryptionKey == nil ) {
139
139
let preferences = UserDefaults . standard
@@ -147,7 +147,7 @@ public final class Client {
147
147
encryptionKey = preferences. data ( forKey: key)
148
148
}
149
149
}
150
-
150
+
151
151
let v3Client = try await LibXMTP . createClient (
152
152
logger: XMTPLogger ( ) ,
153
153
host: ( options? . api. env ?? . local) . url,
@@ -169,7 +169,7 @@ public final class Client {
169
169
} else {
170
170
try await v3Client. registerIdentity ( recoverableWalletSignature: nil )
171
171
}
172
-
172
+
173
173
print ( " LibXMTP \( getVersionInfo ( ) ) " )
174
174
175
175
return v3Client
@@ -251,16 +251,15 @@ public final class Client {
251
251
252
252
return try await v3Client. canMessage ( accountAddresses: [ address] ) == [ true ]
253
253
}
254
-
254
+
255
255
public func canMessageV3( addresses: [ String ] ) async throws -> Bool {
256
256
guard let v3Client else {
257
257
return false
258
258
}
259
-
259
+
260
260
return try await !v3Client. canMessage ( accountAddresses: addresses) . contains ( false )
261
261
}
262
262
263
-
264
263
public static func from( bundle: PrivateKeyBundle , options: ClientOptions ? = nil ) async throws -> Client {
265
264
return try await from ( v1Bundle: bundle. v1, options: options)
266
265
}
@@ -281,7 +280,7 @@ public final class Client {
281
280
privateKeyBundleV1: v1Bundle,
282
281
signingKey: nil
283
282
)
284
-
283
+
285
284
let client = try await LibXMTP . createV2Client ( host: options. api. env. url, isSecure: options. api. env. isSecure)
286
285
let apiClient = try GRPCApiClient (
287
286
environment: options. api. env,
@@ -451,13 +450,15 @@ public final class Client {
451
450
public func subscribe( topics: [ Topic ] ) -> AsyncThrowingStream < Envelope , Error > {
452
451
return subscribe ( topics: topics. map ( \. description) )
453
452
}
454
-
453
+
455
454
public func deleteLocalDatabase( ) {
456
455
let fm = FileManager . default
457
456
let url = URL ( string: dbPath)
458
457
if ( url != nil ) {
459
458
do {
459
+ // swiftlint: disable force_unwrapping
460
460
try fm. removeItem ( at: url!)
461
+ // swiftlint: enable force_unwrapping
461
462
} catch {
462
463
print ( " Error deleting file: \( dbPath) " )
463
464
}
0 commit comments