diff --git a/Package.swift b/Package.swift index 3e78edad..2dae8028 100644 --- a/Package.swift +++ b/Package.swift @@ -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.git", exact: "3.0.0"), + .package(url: "https://github.com/xmtp/libxmtp-swift.git", exact: "3.0.1"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/Sources/XMTPiOS/Client.swift b/Sources/XMTPiOS/Client.swift index 3ac2bab9..8e47bcac 100644 --- a/Sources/XMTPiOS/Client.swift +++ b/Sources/XMTPiOS/Client.swift @@ -74,7 +74,7 @@ public struct ClientOptions { self.historySyncUrl = "https://message-history.production.ephemera.network/" case .local: - self.historySyncUrl = "http://0.0.0.0:5558" + self.historySyncUrl = "http://localhost:5558" default: self.historySyncUrl = "https://message-history.dev.ephemera.network/" @@ -112,14 +112,14 @@ public final class Client { inboxId: String ) async throws -> Client { let (libxmtpClient, dbPath) = try await initFFiClient( - accountAddress: accountAddress, + accountAddress: accountAddress.lowercased(), options: options, signingKey: signingKey, inboxId: inboxId ) let client = try Client( - address: accountAddress, + address: accountAddress.lowercased(), ffiClient: libxmtpClient, dbPath: dbPath, installationID: libxmtpClient.installationId().toHex, @@ -224,7 +224,7 @@ public final class Client { message: signatureRequest.signatureText()) try await signatureRequest.addScwSignature( signatureBytes: signedData, - address: signingKey.address, + address: signingKey.address.lowercased(), chainId: UInt64(chainId), blockNumber: signingKey.blockNumber.flatMap { $0 >= 0 ? UInt64($0) : nil @@ -265,10 +265,13 @@ public final class Client { logger: XMTPLogger(), host: api.env.url, isSecure: api.env.isSecure == true, - accountAddress: address - ) ?? generateInboxId(accountAddress: address, nonce: 0) + accountAddress: address.lowercased() + ) + ?? generateInboxId( + accountAddress: address.lowercased(), nonce: 0) } catch { - inboxId = try generateInboxId(accountAddress: address, nonce: 0) + inboxId = try generateInboxId( + accountAddress: address.lowercased(), nonce: 0) } return inboxId } diff --git a/Sources/XMTPiOS/Conversations.swift b/Sources/XMTPiOS/Conversations.swift index 67c1c431..e6dce22d 100644 --- a/Sources/XMTPiOS/Conversations.swift +++ b/Sources/XMTPiOS/Conversations.swift @@ -211,14 +211,13 @@ public actor Conversations { return } do { - let conversationType = try conversation.groupMetadata() - .conversationType() - if conversationType == "dm" { + let conversationType = try conversation.conversationType() + if conversationType == .dm { continuation.yield( Conversation.dm( conversation.dmFromFFI(client: self.client)) ) - } else if conversationType == "group" { + } else if conversationType == .group { continuation.yield( Conversation.group( conversation.groupFromFFI(client: self.client)) diff --git a/Sources/XMTPiOS/Extensions/Ffi.swift b/Sources/XMTPiOS/Extensions/Ffi.swift index e3135c72..743a1a4c 100644 --- a/Sources/XMTPiOS/Extensions/Ffi.swift +++ b/Sources/XMTPiOS/Extensions/Ffi.swift @@ -11,7 +11,7 @@ extension FfiConversation { } func toConversation(client: Client) throws -> Conversation { - if try groupMetadata().conversationType() == "dm" { + if try conversationType() == .dm { return Conversation.dm(self.dmFromFFI(client: client)) } else { return Conversation.group(self.groupFromFFI(client: client)) diff --git a/Tests/XMTPTests/AttachmentTests.swift b/Tests/XMTPTests/AttachmentTests.swift index c720ec30..b803f08e 100644 --- a/Tests/XMTPTests/AttachmentTests.swift +++ b/Tests/XMTPTests/AttachmentTests.swift @@ -23,7 +23,7 @@ class AttachmentsTests: XCTestCase { options: .init(contentType: ContentTypeAttachment)) let messages = try await conversation.messages() - XCTAssertEqual(2, messages.count) + XCTAssertEqual(1, messages.count) let message = messages[0] let attachment: Attachment = try message.content() diff --git a/Tests/XMTPTests/CodecTests.swift b/Tests/XMTPTests/CodecTests.swift index bb406ccf..2604a2a7 100644 --- a/Tests/XMTPTests/CodecTests.swift +++ b/Tests/XMTPTests/CodecTests.swift @@ -55,7 +55,7 @@ class CodecTests: XCTestCase { options: .init(contentType: NumberCodec().contentType)) let messages = try await alixConversation.messages() - XCTAssertEqual(messages.count, 2) + XCTAssertEqual(messages.count, 1) if messages.count == 1 { let content: Double = try messages[0].content() @@ -80,7 +80,7 @@ class CodecTests: XCTestCase { alixClient.codecRegistry.codecs.removeValue(forKey: NumberCodec().id) let messages = try await alixConversation.messages() - XCTAssertEqual(messages.count, 2) + XCTAssertEqual(messages.count, 1) let content: Double? = try? messages[0].content() XCTAssertEqual(nil, content) diff --git a/Tests/XMTPTests/ConversationTests.swift b/Tests/XMTPTests/ConversationTests.swift index f5cdf179..7eefe69e 100644 --- a/Tests/XMTPTests/ConversationTests.swift +++ b/Tests/XMTPTests/ConversationTests.swift @@ -198,10 +198,15 @@ class ConversationTests: XCTestCase { try await fixtures.boClient.conversations.sync() try await boDm?.sync() + try await alixClient.conversations.sync() try await alixClient2.conversations.sync() + try await alixClient2.syncConsent() + try await alixClient.conversations.syncAllConversations() + sleep(2) + try await alixClient2.conversations.syncAllConversations() + sleep(2) if let dm2 = try alixClient2.findConversation(conversationId: dm.id) { - try await alixClient2.syncConsent() XCTAssertEqual(try dm2.consentState(), .denied) try await alixClient2.preferences.consentList.setConsentState( diff --git a/Tests/XMTPTests/DmTests.swift b/Tests/XMTPTests/DmTests.swift index 5cb6815a..c9c0b43d 100644 --- a/Tests/XMTPTests/DmTests.swift +++ b/Tests/XMTPTests/DmTests.swift @@ -162,7 +162,7 @@ class DmTests: XCTestCase { XCTAssertEqual(firstMessage.id, messageId) XCTAssertEqual(firstMessage.deliveryStatus, .published) let messages = try await dm.messages() - XCTAssertEqual(messages.count, 3) + XCTAssertEqual(messages.count, 2) try await fixtures.alixClient.conversations.sync() let sameDm = try await fixtures.alixClient.conversations.listDms().last! diff --git a/Tests/XMTPTests/GroupTests.swift b/Tests/XMTPTests/GroupTests.swift index 82fbf816..ebd1a069 100644 --- a/Tests/XMTPTests/GroupTests.swift +++ b/Tests/XMTPTests/GroupTests.swift @@ -951,7 +951,7 @@ class GroupTests: XCTestCase { let end = Date() print(end.timeIntervalSince(start)) XCTAssert(end.timeIntervalSince(start) < 1) - XCTAssert(numGroupsSynced == 100) + XCTAssertEqual(numGroupsSynced, 101) } catch { print("Failed to list groups members: \(error)") throw error // Rethrow the error to fail the test if group creation fails @@ -973,12 +973,12 @@ class GroupTests: XCTestCase { // first syncAllGroups after removal still sync groups in order to process the removal var numGroupsSynced = try await fixtures.boClient.conversations .syncAllConversations() - XCTAssert(numGroupsSynced == 100) + XCTAssertEqual(numGroupsSynced, 101) // next syncAllGroups only will sync active groups numGroupsSynced = try await fixtures.boClient.conversations .syncAllConversations() - XCTAssert(numGroupsSynced == 0) + XCTAssertEqual(numGroupsSynced, 1) } func testCanListManyMembersInParallelInUnderASecond() async throws { diff --git a/Tests/XMTPTests/RemoteAttachmentTest.swift b/Tests/XMTPTests/RemoteAttachmentTest.swift index b9063250..8e734157 100644 --- a/Tests/XMTPTests/RemoteAttachmentTest.swift +++ b/Tests/XMTPTests/RemoteAttachmentTest.swift @@ -88,7 +88,7 @@ class RemoteAttachmentTests: XCTestCase { options: .init(contentType: ContentTypeRemoteAttachment)) let messages = try await conversation.messages() - XCTAssertEqual(2, messages.count) + XCTAssertEqual(1, messages.count) let receivedMessage = messages[0] var remoteAttachment: RemoteAttachment = try receivedMessage.content() diff --git a/XMTP.podspec b/XMTP.podspec index 1cbc7ada..2d843ca4 100644 --- a/XMTP.podspec +++ b/XMTP.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |spec| # spec.name = "XMTP" - spec.version = "3.0.4" + spec.version = "3.0.5" spec.summary = "XMTP SDK Cocoapod" # This description is used to generate tags and improve search results. @@ -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', '= 3.0.0' + spec.dependency 'LibXMTP', '= 3.0.1' end diff --git a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index b9e4d141..1e1fef94 100644 --- a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/xmtp/libxmtp-swift.git", "state" : { - "revision" : "83bd77f78de03b63cd35405567036875c3ca9b1c", - "version" : "3.0.0" + "revision" : "f495d4feaab40a0a6a48c1d5a99585de8107f5d2", + "version" : "3.0.1" } }, {