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

Legacy improvements for forks #430

Merged
merged 5 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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.git", exact: "0.6.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.
Expand Down
2 changes: 2 additions & 0 deletions Sources/XMTPiOS/ApiClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ extension GenericErrorDescribing {
let .SignatureRequestError(message),
let .Erc1271SignatureError(message),
let .FailedToConvertToU32(message),
let .Association(message),
let .DeviceSync(message),
let .Verifier(message):
return message
}
Expand Down
14 changes: 7 additions & 7 deletions Sources/XMTPiOS/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public final class Client {
inboxId: String
) async throws -> Client {
let (libxmtpClient, dbPath) = try await initV3Client(
accountAddress: accountAddress,
accountAddress: accountAddress.lowercased(),
options: options,
privateKeyBundleV1: nil,
signingKey: signingKey,
Expand All @@ -192,7 +192,7 @@ public final class Client {
}

let client = try Client(
address: accountAddress,
address: accountAddress.lowercased(),
v3Client: v3Client,
dbPath: dbPath,
installationID: v3Client.installationId().toHex,
Expand Down Expand Up @@ -307,7 +307,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
Expand Down Expand Up @@ -445,10 +445,10 @@ public final class Client {
logger: XMTPLogger(),
host: options.api.env.url,
isSecure: options.api.env.isSecure == true,
accountAddress: address
) ?? generateInboxId(accountAddress: address, nonce: 0)
accountAddress: address.lowercased()
) ?? generateInboxId(accountAddress: address.lowercased(), nonce: 0)
} catch {
inboxId = generateInboxId(accountAddress: address, nonce: 0)
inboxId = try generateInboxId(accountAddress: address.lowercased(), nonce: 0)
}
return inboxId
}
Expand Down Expand Up @@ -882,7 +882,7 @@ public final class Client {
guard let client = v3Client else {
throw ClientError.noV3Client("Error no V3 client initialized")
}
try await client.requestHistorySync()
try await client.sendSyncRequest(kind: .messages)
}

public func revokeAllOtherInstallations(signingKey: SigningKey) async throws
Expand Down
7 changes: 3 additions & 4 deletions Sources/XMTPiOS/Conversations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,14 @@ public actor Conversations {
}
do {
let conversationType =
try conversation.groupMetadata()
.conversationType()
if conversationType == "dm" {
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(
Expand Down
2 changes: 1 addition & 1 deletion Sources/XMTPiOS/Extensions/Ffi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ extension FfiConversation {
}

func toConversation(client: Client) throws -> Conversation {
if (try groupMetadata().conversationType() == "dm") {
if (try conversationType() == .dm) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹

return Conversation.dm(self.dmFromFFI(client: client))
} else {
return Conversation.group(self.groupFromFFI(client: client))
Expand Down
2 changes: 1 addition & 1 deletion Tests/XMTPTests/DmTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,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.dms().last!
Expand Down
2 changes: 1 addition & 1 deletion Tests/XMTPTests/V3ClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class V3ClientTests: XCTestCase {
XCTAssertEqual(dmMessages.first?.body, "gm")
XCTAssertEqual(dmMessages.first?.id, messageId)
XCTAssertEqual(dmMessages.first?.deliveryStatus, .published)
XCTAssertEqual(dmMessages.count, 3)
XCTAssertEqual(dmMessages.count, 2)

try await fixtures.caroV2V3Client.conversations.sync()
let sameDm = try await fixtures.caroV2V3Client.findDm(
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.16.3"
spec.version = "0.16.4"
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.6.0'
spec.dependency 'LibXMTP', '= 3.0.1'
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.git",
"state" : {
"revision" : "91653cdaf999119f99189178867e32dcc53b11e8",
"version" : "0.6.0"
"revision" : "f495d4feaab40a0a6a48c1d5a99585de8107f5d2",
"version" : "3.0.1"
}
},
{
Expand Down
Loading