Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:WalletConnect/WalletConnectSwift…
Browse files Browse the repository at this point in the history
…V2 into just-works-fix
  • Loading branch information
llbartekll committed Jan 23, 2024
2 parents bb2f36d + 880b82a commit 78f6fae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Example/IntegrationTests/Push/NotifyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ final class NotifyTests: XCTestCase {
await fulfillment(of: [subscribeExpectation], timeout: InputConfig.defaultTimeout)

try await walletNotifyClientA.fetchHistory(subscription: subscription)
XCTAssertEqual(walletNotifyClientA.getMessageHistory(topic: subscription.topic).count, 41)
XCTAssertTrue(walletNotifyClientA.getMessageHistory(topic: subscription.topic).count > 40)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,24 @@ public struct NotifyMessage: Codable, Equatable {
return Date(milliseconds: sent_at)
}

public init(id: String, title: String, body: String, icon: String, url: String, type: String, sentAt: Date) {
public init(id: String, title: String, body: String, icon: String?, url: String?, type: String, sentAt: Date) {
self.id = id
self.title = title
self.body = body
self.icon = icon
self.url = url
self.icon = icon ?? ""
self.url = url ?? ""
self.type = type
self.sent_at = UInt64(sentAt.millisecondsSince1970)
}

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.id = try container.decode(String.self, forKey: .id)
self.title = try container.decode(String.self, forKey: .title)
self.body = try container.decode(String.self, forKey: .body)
self.icon = try container.decodeIfPresent(String.self, forKey: .icon) ?? ""
self.url = try container.decodeIfPresent(String.self, forKey: .url) ?? ""
self.type = try container.decode(String.self, forKey: .type)
self.sent_at = try container.decode(UInt64.self, forKey: .sent_at)
}
}

0 comments on commit 78f6fae

Please sign in to comment.