From eee40f9bc0c53d39084d81537d1aae373e77b87d Mon Sep 17 00:00:00 2001 From: kele-leanes Date: Mon, 19 Feb 2024 12:24:21 -0300 Subject: [PATCH 1/7] update Package.resolved --- Package.resolved | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.resolved b/Package.resolved index 074675b4..8543b319 100644 --- a/Package.resolved +++ b/Package.resolved @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/xmtp/libxmtp-swift", "state" : { - "branch" : "92274fe", - "revision" : "92274fe0dde1fc7f8f716ebcffa3d252813be56d" + "revision" : "db13df1fef0e4a11880a889640a3df2998e4abac", + "version" : "0.4.2-beta1" } }, { From 7aa4ab53007204a3e1708789712a4ecd213d17c2 Mon Sep 17 00:00:00 2001 From: kele-leanes Date: Fri, 2 Feb 2024 16:01:34 -0300 Subject: [PATCH 2/7] feat: add shouldPush property to DecryptedMessage struct --- Sources/XMTPiOS/Messages/DecryptedMessage.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/XMTPiOS/Messages/DecryptedMessage.swift b/Sources/XMTPiOS/Messages/DecryptedMessage.swift index 2109b5b0..481cf849 100644 --- a/Sources/XMTPiOS/Messages/DecryptedMessage.swift +++ b/Sources/XMTPiOS/Messages/DecryptedMessage.swift @@ -13,4 +13,5 @@ public struct DecryptedMessage { public var senderAddress: String public var sentAt: Date public var topic: String = "" + public var shouldPush: Bool? } From 2c3dec53c8f63c0da3f270f6a7701bd0503de443 Mon Sep 17 00:00:00 2001 From: kele-leanes Date: Fri, 2 Feb 2024 16:01:48 -0300 Subject: [PATCH 3/7] feat: add shouldPush property to SendOptions struct --- Sources/XMTPiOS/SendOptions.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/XMTPiOS/SendOptions.swift b/Sources/XMTPiOS/SendOptions.swift index 15b09c0d..e6a9e74a 100644 --- a/Sources/XMTPiOS/SendOptions.swift +++ b/Sources/XMTPiOS/SendOptions.swift @@ -11,10 +11,12 @@ public struct SendOptions { public var compression: EncodedContentCompression? public var contentType: ContentTypeID? public var ephemeral: Bool = false + public var shouldPush: Bool? - public init(compression: EncodedContentCompression? = nil, contentType: ContentTypeID? = nil, ephemeral: Bool = false) { + public init(compression: EncodedContentCompression? = nil, contentType: ContentTypeID? = nil, ephemeral: Bool = false, shouldPush: Bool? = nil) { self.compression = compression self.contentType = contentType self.ephemeral = ephemeral + self.shouldPush = shouldPush } } From ff348fad6de5725ab1e99041a171f75249e42be2 Mon Sep 17 00:00:00 2001 From: kele-leanes Date: Fri, 2 Feb 2024 16:02:01 -0300 Subject: [PATCH 4/7] feat: add shouldPush parameter to MessageV2.encode() method --- Sources/XMTPiOS/Messages/MessageV2.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/XMTPiOS/Messages/MessageV2.swift b/Sources/XMTPiOS/Messages/MessageV2.swift index 5978caf9..c49114bd 100644 --- a/Sources/XMTPiOS/Messages/MessageV2.swift +++ b/Sources/XMTPiOS/Messages/MessageV2.swift @@ -58,7 +58,8 @@ extension MessageV2 { encodedContent: encodedMessage, senderAddress: try signed.sender.walletAddress, sentAt: Date(timeIntervalSince1970: Double(header.createdNs / 1_000_000) / 1000), - topic: topic + topic: topic, + shouldPush: message.shouldPush ) } @@ -80,7 +81,7 @@ extension MessageV2 { } } - static func encode(client: Client, content encodedContent: EncodedContent, topic: String, keyMaterial: Data, codec: Codec) async throws -> MessageV2 { + static func encode(client: Client, content encodedContent: EncodedContent, topic: String, keyMaterial: Data, codec: Codec, shouldPush: Bool? = nil) async throws -> MessageV2 { let payload = try encodedContent.serializedData() let date = Date() @@ -107,14 +108,13 @@ extension MessageV2 { let senderHmac = try Crypto.generateHmacSignature(secret: keyMaterial, info: infoEncoded, message: headerBytes) let decoded = try codec.decode(content: encodedContent, client: client) - let shouldPush = try codec.shouldPush(content: decoded) - + let calculatedShouldPush = try codec.shouldPush(content: decoded) return MessageV2( headerBytes: headerBytes, ciphertext: ciphertext, senderHmac: senderHmac, - shouldPush: shouldPush + shouldPush: shouldPush ?? calculatedShouldPush ) } } From bbd2d6b20cdf8cff34c02c4b7138c18852c33190 Mon Sep 17 00:00:00 2001 From: kele-leanes Date: Fri, 2 Feb 2024 16:02:16 -0300 Subject: [PATCH 5/7] feat: add shouldPush option to ConversationV2 initialization --- Sources/XMTPiOS/ConversationV2.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/XMTPiOS/ConversationV2.swift b/Sources/XMTPiOS/ConversationV2.swift index 6274dd78..947a64f6 100644 --- a/Sources/XMTPiOS/ConversationV2.swift +++ b/Sources/XMTPiOS/ConversationV2.swift @@ -85,7 +85,8 @@ public struct ConversationV2 { content: encodedContent, topic: topic, keyMaterial: keyMaterial, - codec: codec + codec: codec, + shouldPush: options?.shouldPush ) let topic = options?.ephemeral == true ? ephemeralTopic : topic From df379c31e29761d24cfaa37c5eeebd07ffbbb67e Mon Sep 17 00:00:00 2001 From: kele-leanes Date: Mon, 19 Feb 2024 12:18:35 -0300 Subject: [PATCH 6/7] fix: update SendOptions initializer parameter name --- Sources/XMTPiOS/SendOptions.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/XMTPiOS/SendOptions.swift b/Sources/XMTPiOS/SendOptions.swift index e6a9e74a..50c6ece6 100644 --- a/Sources/XMTPiOS/SendOptions.swift +++ b/Sources/XMTPiOS/SendOptions.swift @@ -13,10 +13,10 @@ public struct SendOptions { public var ephemeral: Bool = false public var shouldPush: Bool? - public init(compression: EncodedContentCompression? = nil, contentType: ContentTypeID? = nil, ephemeral: Bool = false, shouldPush: Bool? = nil) { + public init(compression: EncodedContentCompression? = nil, contentType: ContentTypeID? = nil, ephemeral: Bool = false, __shouldPush: Bool? = nil) { self.compression = compression self.contentType = contentType self.ephemeral = ephemeral - self.shouldPush = shouldPush + self.shouldPush = __shouldPush } } From 8a02e8dc92f332462d77f8f3ec507f497bcc97dc Mon Sep 17 00:00:00 2001 From: Ethan Mateja Date: Tue, 20 Feb 2024 10:53:09 -0800 Subject: [PATCH 7/7] Fix Sample App WalletConnect.configure Signature This was overlooked by me in another PR. Fixing here now prior to merging. --- XMTPiOSExample/XMTPiOSExample/Views/LoginView.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/XMTPiOSExample/XMTPiOSExample/Views/LoginView.swift b/XMTPiOSExample/XMTPiOSExample/Views/LoginView.swift index 38f46ad0..9a779009 100644 --- a/XMTPiOSExample/XMTPiOSExample/Views/LoginView.swift +++ b/XMTPiOSExample/XMTPiOSExample/Views/LoginView.swift @@ -128,7 +128,11 @@ struct LoginView: View { name: "XMTP Chat", description: "It's a chat app.", url: "https://localhost:4567", - icons: [] + icons: [], + redirect: AppMetadata.Redirect( + native: "", + universal: nil + ) ) )