diff --git a/Example/IntegrationTests/Push/Publisher.swift b/Example/IntegrationTests/Push/Publisher.swift index 711c37837..50667f1ce 100644 --- a/Example/IntegrationTests/Push/Publisher.swift +++ b/Example/IntegrationTests/Push/Publisher.swift @@ -11,7 +11,7 @@ class Publisher { let payload = try encoder.encode(notifyRequestPayload) request.httpMethod = "POST" request.setValue("application/json", forHTTPHeaderField: "Content-Type") - request.setValue("Authorization", forHTTPHeaderField: InputConfig.gmDappProjectSecret) + request.setValue("Bearer \(InputConfig.gmDappProjectSecret)", forHTTPHeaderField: "Authorization") request.httpBody = payload let (_, response) = try await URLSession.shared.data(for: request) guard (response as? HTTPURLResponse)?.statusCode == 200 else { fatalError("Notify error") } diff --git a/Sources/Auth/Services/Wallet/WalletRequestSubscriber.swift b/Sources/Auth/Services/Wallet/WalletRequestSubscriber.swift index 3467dc57c..d1b523f4b 100644 --- a/Sources/Auth/Services/Wallet/WalletRequestSubscriber.swift +++ b/Sources/Auth/Services/Wallet/WalletRequestSubscriber.swift @@ -44,13 +44,11 @@ class WalletRequestSubscriber { let assertionId = payload.decryptedPayload.sha256().toHexString() do { let origin = try await verifyClient.verifyOrigin(assertionId: assertionId) - let verifyContext = await verifyClient.createVerifyContext( - origin: origin, - domain: payload.request.payloadParams.domain - ) + let verifyContext = verifyClient.createVerifyContext(origin: origin, domain: payload.request.payloadParams.domain) onRequest?((request, verifyContext)) } catch { - onRequest?((request, nil)) + let verifyContext = verifyClient.createVerifyContext(origin: nil, domain: payload.request.payloadParams.domain) + onRequest?((request, verifyContext)) return } } diff --git a/Sources/WalletConnectModal/Modal/ModalContainerView.swift b/Sources/WalletConnectModal/Modal/ModalContainerView.swift index d256bf328..4d96e386e 100644 --- a/Sources/WalletConnectModal/Modal/ModalContainerView.swift +++ b/Sources/WalletConnectModal/Modal/ModalContainerView.swift @@ -7,19 +7,7 @@ struct ModalContainerView: View { var body: some View { VStack(spacing: 0) { - - Color.thickOverlay - .colorScheme(.light) - .transform { - #if os(iOS) - $0.onTapGesture { - withAnimation { - showModal = false - } - } - #endif - } - .opacity(showModal ? 1 : 0) + Color.clear if showModal { ModalSheet( @@ -33,8 +21,22 @@ struct ModalContainerView: View { .animation(.spring(), value: showModal) } } - + .background( + Color.thickOverlay + .colorScheme(.light) + .opacity(showModal ? 1 : 0) + .transform { + #if os(iOS) + $0.onTapGesture { + withAnimation { + showModal = false + } + } + #endif + } + ) .edgesIgnoringSafeArea(.all) + .ignoresSafeArea(.keyboard, edges: .bottom) .onChangeBackported(of: showModal, perform: { newValue in if newValue == false { withAnimation { diff --git a/Sources/WalletConnectModal/Modal/ModalSheet.swift b/Sources/WalletConnectModal/Modal/ModalSheet.swift index 328ed5b84..0d0f0b239 100644 --- a/Sources/WalletConnectModal/Modal/ModalSheet.swift +++ b/Sources/WalletConnectModal/Modal/ModalSheet.swift @@ -3,6 +3,14 @@ import SwiftUI public struct ModalSheet: View { @ObservedObject var viewModel: ModalViewModel + @Environment(\.verticalSizeClass) var verticalSizeClass + + @State var searchEditing = false + + var isLandscape: Bool { + verticalSizeClass == .compact + } + public var body: some View { VStack(spacing: 0) { modalHeader() @@ -10,32 +18,31 @@ public struct ModalSheet: View { VStack(spacing: 0) { contentHeader() content() + } .frame(maxWidth: .infinity) .background(Color.background1) .cornerRadius(30, corners: [.topLeft, .topRight]) } - .padding(.bottom, 40) .edgesIgnoringSafeArea(.bottom) + .background( + VStack(spacing: 0) { + Color.accent + .frame(height: 90) + .cornerRadius(8, corners: [[.topLeft, .topRight]]) + Color.background1 + } + ) + .toastView(toast: $viewModel.toast) + .if(isLandscape) { + $0.padding(.horizontal, 80) + } .onAppear { Task { await viewModel.fetchWallets() await viewModel.createURI() } } - .background( - ZStack { - Color.thickOverlay.colorScheme(.light) - - VStack(spacing: 0) { - Color.accent - .frame(height: 90) - .cornerRadius(8, corners: [[.topLeft, .topRight]]) - Color.background1 - } - } - ) - .toastView(toast: $viewModel.toast) } private func modalHeader() -> some View { @@ -81,14 +88,33 @@ public struct ModalSheet: View { .overlay( VStack { if viewModel.destination.hasSearch { - TextField("Search", text: $viewModel.searchTerm) - .transform { - #if os(iOS) - $0.textFieldStyle(.roundedBorder) - .autocapitalization(.none) + + HStack { + Image(systemName: "magnifyingglass") + TextField("Search", text: $viewModel.searchTerm, onEditingChanged: { editing in + self.searchEditing = editing + }) + .transform { view in + #if os(macOS) + view + #else + view.autocapitalization(.none) #endif } - .padding(.horizontal, 50) + } + .padding(.vertical, 4) + .padding(.horizontal, 10) + .background(Color.background3) + .foregroundColor(searchEditing ? .foreground1 : .foreground3) + .cornerRadius(28) + .overlay( + RoundedRectangle(cornerRadius: 28) + .stroke(searchEditing ? Color.accent : Color.thinOverlay, lineWidth: 1) + ) + .onDisappear { + searchEditing = false + } + .padding(.horizontal, 50) } else { Text(viewModel.destination.contentTitle) .font(.system(size: 20).weight(.semibold)) @@ -135,14 +161,18 @@ public struct ModalSheet: View { navigateTo: viewModel.navigateTo(_:), navigateToExternalLink: viewModel.navigateToExternalLink(_:) ) + .padding(.bottom, 20) case .qr: qrCode() + .padding(.bottom, 20) case .getWallet: GetAWalletView( wallets: Array(viewModel.wallets.prefix(6)), onWalletTap: viewModel.onGetWalletTap(_:), navigateToExternalLink: viewModel.navigateToExternalLink(_:) ) + .frame(minHeight: isLandscape ? 200 : 550) + .padding(.bottom, 20) } } } diff --git a/Sources/WalletConnectModal/Modal/ModalViewModel.swift b/Sources/WalletConnectModal/Modal/ModalViewModel.swift index 6c1e4a5fb..fd59956f4 100644 --- a/Sources/WalletConnectModal/Modal/ModalViewModel.swift +++ b/Sources/WalletConnectModal/Modal/ModalViewModel.swift @@ -55,9 +55,11 @@ final class ModalViewModel: ObservableObject { } var filteredWallets: [Listing] { - if searchTerm.isEmpty { return wallets } + if searchTerm.isEmpty { return sortByRecent(wallets) } - return wallets.filter { $0.name.lowercased().contains(searchTerm.lowercased()) } + return sortByRecent( + wallets.filter { $0.name.lowercased().contains(searchTerm.lowercased()) } + ) } private var disposeBag = Set() @@ -77,7 +79,7 @@ final class ModalViewModel: ObservableObject { .sink { sessions in print(sessions) isShown.wrappedValue = false - self.toast = Toast(style: .success, message: "Session estabilished", duration: 15) + self.toast = Toast(style: .success, message: "Session estabilished", duration: 5) } .store(in: &disposeBag) @@ -120,6 +122,8 @@ final class ModalViewModel: ObservableObject { } func onListingTap(_ listing: Listing) { + setLastTimeUsed(listing.id) + navigateToDeepLink( universalLink: listing.mobile.universal ?? "", nativeLink: listing.mobile.native ?? "" @@ -146,7 +150,6 @@ final class ModalViewModel: ObservableObject { func onCopyButton() { - guard let uri else { toast = Toast(style: .error, message: "No uri found") return @@ -190,6 +193,8 @@ final class ModalViewModel: ObservableObject { return lhs < rhs } + + loadRecentWallets() } } catch { toast = Toast(style: .error, message: error.localizedDescription) @@ -197,6 +202,63 @@ final class ModalViewModel: ObservableObject { } } +// MARK: - Recent Wallets + +private extension ModalViewModel { + + func sortByRecent(_ input: [Listing]) -> [Listing] { + input.sorted { lhs, rhs in + guard let lhsLastTimeUsed = lhs.lastTimeUsed else { + return false + } + + guard let rhsLastTimeUsed = rhs.lastTimeUsed else { + return true + } + + return lhsLastTimeUsed > rhsLastTimeUsed + } + } + + func loadRecentWallets() { + RecentWalletsStorage().recentWallets.forEach { wallet in + + guard let lastTimeUsed = wallet.lastTimeUsed else { + return + } + + // Consider Recent only for 3 days + if abs(lastTimeUsed.timeIntervalSinceNow) > (24 * 60 * 60 * 3) { + return + } + + setLastTimeUsed(wallet.id, date: lastTimeUsed) + } + } + + func saveRecentWallets() { + RecentWalletsStorage().recentWallets = Array(wallets.filter { + $0.lastTimeUsed != nil + }.prefix(5)) + } + + func setLastTimeUsed(_ walletId: String, date: Date = Date()) { + guard let index = wallets.firstIndex(where: { + $0.id == walletId + }) else { + return + } + + var copy = wallets[index] + copy.lastTimeUsed = date + wallets[index] = copy + + saveRecentWallets() + } +} + +// MARK: - Deeplinking + private extension ModalViewModel { enum DeeplinkErrors: LocalizedError { case noWalletLinkFound diff --git a/Sources/WalletConnectModal/Modal/RecentWalletStorage.swift b/Sources/WalletConnectModal/Modal/RecentWalletStorage.swift new file mode 100644 index 000000000..04487edce --- /dev/null +++ b/Sources/WalletConnectModal/Modal/RecentWalletStorage.swift @@ -0,0 +1,31 @@ +import Foundation + +final class RecentWalletsStorage { + private let defaults: UserDefaults + + init(defaults: UserDefaults = .standard) { + self.defaults = defaults + } + + var recentWallets: [Listing] { + get { + guard + let data = defaults.data(forKey: "recentWallets"), + let wallets = try? JSONDecoder().decode([Listing].self, from: data) + else { + return [] + } + + return wallets + } + set { + guard + let walletsData = try? JSONEncoder().encode(newValue) + else { + return + } + + defaults.set(walletsData, forKey: "recentWallets") + } + } +} diff --git a/Sources/WalletConnectModal/Modal/Screens/GetAWalletView.swift b/Sources/WalletConnectModal/Modal/Screens/GetAWalletView.swift index 9f71c7b55..084e18c55 100644 --- a/Sources/WalletConnectModal/Modal/Screens/GetAWalletView.swift +++ b/Sources/WalletConnectModal/Modal/Screens/GetAWalletView.swift @@ -1,20 +1,17 @@ import SwiftUI struct GetAWalletView: View { - let wallets: [Listing] let onWalletTap: (Listing) -> Void let navigateToExternalLink: (URL) -> Void var body: some View { - VStack { - + ScrollView { List { - ForEach(wallets) { wallet in + ForEach(wallets, id: \.id) { wallet in Button { onWalletTap(wallet) } label: { - HStack { WalletImage(wallet: wallet) .frame(width: 40, height: 40) @@ -34,8 +31,8 @@ struct GetAWalletView: View { .frame(minHeight: 400) .listStyle(.plain) + VStack(alignment: .center, spacing: 8) { - Text("Not what you’re looking for?") .font( .system(size: 16) @@ -44,7 +41,7 @@ struct GetAWalletView: View { .multilineTextAlignment(.center) .foregroundColor(.foreground1) - Text("With hundreds of wallets out there, 
there’s something for everyone ") + Text("With hundreds of wallets out there, there’s something for everyone ") .font( .system(size: 14) .weight(.medium) @@ -70,10 +67,10 @@ struct GetAWalletView: View { } } +#if DEBUG + struct GetAWalletView_Previews: PreviewProvider { - static var previews: some View { - GetAWalletView( wallets: Listing.stubList, onWalletTap: { _ in }, @@ -82,3 +79,5 @@ struct GetAWalletView_Previews: PreviewProvider { .environment(\.projectId, Secrets.load().projectID) } } + +#endif diff --git a/Sources/WalletConnectModal/Modal/Screens/WalletList.swift b/Sources/WalletConnectModal/Modal/Screens/WalletList.swift index e601a5de7..94b00c7fa 100644 --- a/Sources/WalletConnectModal/Modal/Screens/WalletList.swift +++ b/Sources/WalletConnectModal/Modal/Screens/WalletList.swift @@ -13,18 +13,18 @@ struct WalletList: View { @State var availableSize: CGSize = .zero var body: some View { - content() - .readSize { size in - if availableSize == size { - return + ZStack { + content() + .animation(.default) + .readSize { size in + if availableSize == size { + return + } + + numberOfColumns = Int(round(size.width / 100)) + availableSize = size } - - numberOfColumns = Int(round(size.width / 100)) - availableSize = size - - return - } - .id(numberOfColumns) + } } @ViewBuilder @@ -32,8 +32,10 @@ struct WalletList: View { switch destination { case .welcome: initialList() + .padding(.bottom, 20) case .viewAll: viewAll() + .frame(minHeight: 250) case let .walletDetail(wallet): walletDetail(wallet) default: @@ -47,15 +49,15 @@ struct WalletList: View { VStack { HStack { - ForEach(0.. numberOfColumns * 2 { viewAllItem() .transform { @@ -80,21 +82,21 @@ struct WalletList: View { @ViewBuilder private func viewAll() -> some View { ZStack { - Spacer().frame(height: 450) + Spacer().frame(maxWidth: .infinity, maxHeight: 150) ScrollView(.vertical) { VStack(alignment: .leading) { ForEach(Array(stride(from: 0, to: wallets.count, by: numberOfColumns)), id: \.self) { row in HStack { ForEach(row..<(row + numberOfColumns), id: \.self) { index in - if wallets.indices.contains(index) { - gridItem(for: index) + if let wallet = wallets[safe: index] { + gridItem(for: wallet) } } } } } - .padding(.top) + .padding(.vertical) } LinearGradient( @@ -116,20 +118,22 @@ struct WalletList: View { func viewAllItem() -> some View { VStack { VStack(spacing: 3) { - let startingIndex = (2 * numberOfColumns - 1) + let viewAllWalletsFirstRow = wallets.dropFirst(2 * numberOfColumns - 1).prefix(2) HStack(spacing: 3) { - ForEach(startingIndex..<(startingIndex + 2)) { index in - WalletImage(wallet: wallets[safe: index]) + ForEach(viewAllWalletsFirstRow) { wallet in + WalletImage(wallet: wallet) .cornerRadius(8) .aspectRatio(1, contentMode: .fit) } } .padding(.horizontal, 5) + let viewAllWalletsSecondRow = wallets.dropFirst(2 * numberOfColumns + 1).prefix(2) + HStack(spacing: 3) { - ForEach((startingIndex + 2)..<(startingIndex + 4)) { index in - WalletImage(wallet: wallets[safe: index]) + ForEach(viewAllWalletsSecondRow) { wallet in + WalletImage(wallet: wallet) .cornerRadius(8) .aspectRatio(1, contentMode: .fit) } @@ -157,49 +161,44 @@ struct WalletList: View { } @ViewBuilder - func gridItem(for index: Int) -> some View { - if let wallet = wallets[safe: index] { - VStack { - WalletImage(wallet: wallet) - .frame(width: 60, height: 60) - .cornerRadius(16) - .overlay( - RoundedRectangle(cornerRadius: 16) - .stroke(.gray.opacity(0.4), lineWidth: 1) - ) - - Text(wallet.name) - .font(.system(size: 12)) - .foregroundColor(.foreground1) - .padding(.horizontal, 12) - .multilineTextAlignment(.center) - .minimumScaleFactor(0.4) - - Text("RECENT") - .opacity(0) - .font(.system(size: 10)) - .foregroundColor(.foreground3) - .padding(.horizontal, 12) - } - .frame(maxWidth: 80, maxHeight: 96) - .transform { - #if os(iOS) - $0.onTapGesture { - withAnimation { - navigateTo(.walletDetail(wallet)) - } + func gridItem(for wallet: Listing) -> some View { + VStack { + WalletImage(wallet: wallet) + .frame(width: 60, height: 60) + .cornerRadius(16) + .overlay( + RoundedRectangle(cornerRadius: 16) + .stroke(.gray.opacity(0.4), lineWidth: 1) + ) + + Text(String(wallet.name.split(separator: " ").first!)) + .font(.system(size: 12)) + .foregroundColor(.foreground1) + .multilineTextAlignment(.center) + + Text("RECENT") + .opacity(wallet.lastTimeUsed != nil ? 1 : 0) + .font(.system(size: 10)) + .foregroundColor(.foreground3) + .padding(.horizontal, 12) + } + .frame(maxWidth: 80, maxHeight: 96) + .transform { + #if os(iOS) + $0.onTapGesture { + withAnimation { + navigateTo(.walletDetail(wallet)) } - #endif - } - } else { - EmptyView() + } + #endif } } private func walletDetail(_ wallet: Listing) -> some View { VStack(spacing: 8) { WalletImage(wallet: wallet, size: .large) - .frame(maxWidth: 96, maxHeight: 96) + .frame(width: 96, height: 96) + .minimumScaleFactor(0.4) Text("Continue in \(wallet.name)...") .font(.system(size: 16, weight: .medium)) @@ -218,11 +217,10 @@ struct WalletList: View { } } .buttonStyle(W3MButtonStyle()) - .padding() + .padding(.vertical) .opacity(retryButtonShown ? 1 : 0) .animation(.easeIn) } - .padding() .onAppear { DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { onListingTap(wallet) diff --git a/Sources/WalletConnectModal/Modal/Screens/WhatIsWalletView.swift b/Sources/WalletConnectModal/Modal/Screens/WhatIsWalletView.swift index 508530924..1a2e1fec5 100644 --- a/Sources/WalletConnectModal/Modal/Screens/WhatIsWalletView.swift +++ b/Sources/WalletConnectModal/Modal/Screens/WhatIsWalletView.swift @@ -1,29 +1,44 @@ import SwiftUI struct WhatIsWalletView: View { - var navigateTo: (Destination) -> Void var navigateToExternalLink: (URL) -> Void - + + @Environment(\.verticalSizeClass) var verticalSizeClass + var body: some View { - - VStack(spacing: 10) { - HelpSection( - title: "A home for your digital assets", - description: "A wallet lets you store, send and receive digital assets like cryptocurrencies and NFTs.", - assets: [.DeFi, .NFT, .ETH] - ) - HelpSection( - title: "One login for all of web3", - description: "Log in to any app by connecting your wallet. Say goodbye to countless passwords!", - assets: [.Login, .Profile, .Lock] - ) - HelpSection( - title: "Your gateway to a new web", - description: "With your wallet, you can explore and interact with DeFi, NFTs, DAOs, and much more.", - assets: [.Browser, .Noun, .DAO] - ) - + content() + .onAppear { + UIPageControl.appearance().currentPageIndicatorTintColor = AssetColor.foreground1.uiColor + UIPageControl.appearance().pageIndicatorTintColor = AssetColor.foreground1.uiColor.withAlphaComponent(0.2) + } + } + + func content() -> some View { + VStack(spacing: 0) { + if verticalSizeClass == .compact { + TabView { + ForEach(sections(), id: \.title) { section in + section + .padding(.bottom, 40) + } + } + .transform { + #if os(iOS) + $0.tabViewStyle(.page(indexDisplayMode: .always)) + #endif + } + .frame(height: 150) + + } else { + VStack(spacing: 10) { + ForEach(sections(), id: \.title) { section in + section + } + } + .padding(.bottom) + } + HStack { Button(action: { navigateTo(.getWallet) @@ -46,14 +61,33 @@ struct WhatIsWalletView: View { } .padding(.horizontal, 24) } + + func sections() -> [HelpSection] { + [ + HelpSection( + title: "A home for your digital assets", + description: "A wallet lets you store, send and receive digital assets like cryptocurrencies and NFTs.", + assets: [.DeFi, .NFT, .ETH] + ), + HelpSection( + title: "One login for all of web3", + description: "Log in to any app by connecting your wallet. Say goodbye to countless passwords!", + assets: [.Login, .Profile, .Lock] + ), + HelpSection( + title: "Your gateway to a new web", + description: "With your wallet, you can explore and interact with DeFi, NFTs, DAOs, and much more.", + assets: [.Browser, .Noun, .DAO] + ) + ] + } } struct HelpSection: View { - let title: String let description: String let assets: [Asset] - + var body: some View { VStack { HStack { @@ -61,7 +95,7 @@ struct HelpSection: View { Image(asset) } } - + Text(title) .font(.system(size: 16)) .foregroundColor(.foreground1) @@ -79,9 +113,7 @@ struct HelpSection: View { } struct WhatIsWalletView_Previews: PreviewProvider { - static var previews: some View { - - WhatIsWalletView(navigateTo: { _ in}, navigateToExternalLink: { _ in }) + WhatIsWalletView(navigateTo: { _ in }, navigateToExternalLink: { _ in }) } } diff --git a/Sources/WalletConnectModal/Networking/Explorer/ListingsResponse.swift b/Sources/WalletConnectModal/Networking/Explorer/ListingsResponse.swift index 8c08458a5..bc7c91619 100644 --- a/Sources/WalletConnectModal/Networking/Explorer/ListingsResponse.swift +++ b/Sources/WalletConnectModal/Networking/Explorer/ListingsResponse.swift @@ -12,6 +12,7 @@ struct Listing: Codable, Hashable, Identifiable { let imageId: String let app: App let mobile: Mobile + var lastTimeUsed: Date? private enum CodingKeys: String, CodingKey { case id @@ -21,6 +22,7 @@ struct Listing: Codable, Hashable, Identifiable { case imageId = "image_id" case app case mobile + case lastTimeUsed } struct App: Codable, Hashable { diff --git a/Sources/WalletConnectModal/UI/Common/Toast.swift b/Sources/WalletConnectModal/UI/Common/Toast.swift index e36475df7..f8e276a25 100644 --- a/Sources/WalletConnectModal/UI/Common/Toast.swift +++ b/Sources/WalletConnectModal/UI/Common/Toast.swift @@ -1,10 +1,10 @@ import SwiftUI struct Toast: Equatable { - var style: ToastStyle - var message: String - var duration: Double = 3 - var width: Double = .infinity + let style: ToastStyle + let message: String + var duration: Double = 3 + var width: Double = .infinity } enum ToastStyle { @@ -73,7 +73,8 @@ struct ToastModifier: ViewModifier { ZStack { mainToastView() .offset(y: -64) - }.animation(.spring(), value: toast) + } + .animation(.spring(), value: toast) ) .onChangeBackported(of: toast) { _ in showToast() @@ -90,7 +91,9 @@ struct ToastModifier: ViewModifier { ) { dismissToast() } + Spacer() + .allowsHitTesting(false) } } } diff --git a/Sources/WalletConnectRelay/PackageConfig.json b/Sources/WalletConnectRelay/PackageConfig.json index 94c279119..e0c9c2edf 100644 --- a/Sources/WalletConnectRelay/PackageConfig.json +++ b/Sources/WalletConnectRelay/PackageConfig.json @@ -1 +1 @@ -{"version": "1.6.13"} +{"version": "1.6.14"} diff --git a/Sources/WalletConnectSign/Engine/Common/ApproveEngine.swift b/Sources/WalletConnectSign/Engine/Common/ApproveEngine.swift index fe160fd50..f8a87ddce 100644 --- a/Sources/WalletConnectSign/Engine/Common/ApproveEngine.swift +++ b/Sources/WalletConnectSign/Engine/Common/ApproveEngine.swift @@ -297,13 +297,14 @@ private extension ApproveEngine { let assertionId = payload.decryptedPayload.sha256().toHexString() do { let origin = try await verifyClient.verifyOrigin(assertionId: assertionId) - let verifyContext = await verifyClient.createVerifyContext( + let verifyContext = verifyClient.createVerifyContext( origin: origin, domain: payload.request.proposer.metadata.url ) onSessionProposal?(proposal.publicRepresentation(pairingTopic: payload.topic), verifyContext) } catch { - onSessionProposal?(proposal.publicRepresentation(pairingTopic: payload.topic), nil) + let verifyContext = verifyClient.createVerifyContext(origin: nil, domain: payload.request.proposer.metadata.url) + onSessionProposal?(proposal.publicRepresentation(pairingTopic: payload.topic), verifyContext) return } } diff --git a/Sources/WalletConnectSign/Engine/Common/SessionEngine.swift b/Sources/WalletConnectSign/Engine/Common/SessionEngine.swift index 50f460642..d8f265dab 100644 --- a/Sources/WalletConnectSign/Engine/Common/SessionEngine.swift +++ b/Sources/WalletConnectSign/Engine/Common/SessionEngine.swift @@ -242,13 +242,11 @@ private extension SessionEngine { let assertionId = payload.decryptedPayload.sha256().toHexString() do { let origin = try await verifyClient.verifyOrigin(assertionId: assertionId) - let verifyContext = await verifyClient.createVerifyContext( - origin: origin, - domain: session.peerParticipant.metadata.url - ) + let verifyContext = verifyClient.createVerifyContext(origin: origin, domain: session.peerParticipant.metadata.url) onSessionRequest?(request, verifyContext) } catch { - onSessionRequest?(request, nil) + let verifyContext = verifyClient.createVerifyContext(origin: nil, domain: session.peerParticipant.metadata.url) + onSessionRequest?(request, verifyContext) return } } diff --git a/Tests/WalletConnectModalTests/ModalViewModelTests.swift b/Tests/WalletConnectModalTests/ModalViewModelTests.swift index 73922b94e..afe61b693 100644 --- a/Tests/WalletConnectModalTests/ModalViewModelTests.swift +++ b/Tests/WalletConnectModalTests/ModalViewModelTests.swift @@ -49,10 +49,8 @@ final class ModalViewModelTests: XCTestCase { XCTAssertEqual(sut.uri, "wc:foo@2?symKey=bar&relay-protocol=irn") XCTAssertEqual(sut.wallets.count, 2) - XCTAssertEqual(sut.wallets, [ - Listing(id: "1", name: "Sample App", homepage: "https://example.com", order: 1, imageId: "1", app: Listing.App(ios: "https://example.com/download-ios", mac: "https://example.com/download-mac", safari: "https://example.com/download-safari"), mobile: Listing.Mobile(native: nil, universal: "https://example.com/universal")), - Listing(id: "2", name: "Awesome App", homepage: "https://example.com/awesome", order: 2, imageId: "2", app: Listing.App(ios: "https://example.com/download-ios", mac: "https://example.com/download-mac", safari: "https://example.com/download-safari"), mobile: Listing.Mobile(native: "awesomeapp://deeplink", universal: "https://awesome.com/awesome/universal")), - ]) + XCTAssertEqual(sut.wallets.map(\.id), ["1", "2"]) + XCTAssertEqual(sut.wallets.map(\.name), ["Sample App", "Awesome App"]) expectation = XCTestExpectation(description: "Wait for openUrl to be called") diff --git a/fastlane/Fastfile b/fastlane/Fastfile index b7e71fc34..2c35fdf42 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -108,10 +108,15 @@ platform :ios do upload_to_testflight( apple_id: ENV["APPLE_ID"], app_identifier: ENV["APP_IDENTIFIER"], - skip_waiting_for_build_processing: true, - distribute_external: true, changelog: "#{ENV["SCHEME"]} app weekly build 🚀", - notify_external_testers: false, + distribute_external: true, + skip_submission: true, + notify_external_testers: true, + skip_waiting_for_build_processing: false, + groups: [ + "WalletConnect", + "WalletConnect Users" + ] ) clean_build_artifacts() end