From dd9fb5dd40a89eb323a04626b9d14d4a2fefa441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noe=CC=81=20Malzieu?= Date: Fri, 9 Aug 2024 17:49:16 +0200 Subject: [PATCH] Verify that the client is v3 enabled first --- ios/XMTPModule.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ios/XMTPModule.swift b/ios/XMTPModule.swift index 31e75cbfa..b859ac946 100644 --- a/ios/XMTPModule.swift +++ b/ios/XMTPModule.swift @@ -62,16 +62,20 @@ public class XMTPModule: Module { // A method to disconnect all dbs func dropAllLocalDatabaseConnections() throws { for (_, client) in clients { - // Call the method on each client - try client.dropLocalDatabaseConnection() + // Call the drop method on each v3 client + if (!client.installationID.isEmpty) { + try client.dropLocalDatabaseConnection() + } } } // A method to reconnect all dbs func reconnectAllLocalDatabaseConnections() async throws { for (_, client) in clients { - // Call the method on each client - try await client.reconnectLocalDatabase() + // Call the reconnect method on each v3 client + if (!client.installationID.isEmpty) { + try await client.reconnectLocalDatabase() + } } } }