-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1862b95
commit db3b57f
Showing
10 changed files
with
294 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import UIKit | ||
|
||
struct UIApplicationWrapper { | ||
let openURL: (URL) async -> Void | ||
let canOpenURL: (URL) -> Bool | ||
} | ||
|
||
extension UIApplicationWrapper { | ||
static let live = Self( | ||
openURL: { @MainActor url in | ||
await UIApplication.shared.open(url) | ||
}, | ||
canOpenURL: { url in | ||
UIApplication.shared.canOpenURL(url) | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
struct FuncTest<T> { | ||
private(set) var values: [T] = [] | ||
var wasCalled: Bool { !values.isEmpty } | ||
var wasNotCalled: Bool { !wasCalled } | ||
var callsCount: Int { values.count } | ||
var wasCalledOnce: Bool { values.count == 1 } | ||
var currentValue: T? { values.last } | ||
mutating func call(_ value: T) { values.append(value) } | ||
init() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import Combine | ||
import Foundation | ||
import WalletConnectSign | ||
import WalletConnectUtils | ||
@testable import Web3Modal | ||
@testable import WalletConnectSign | ||
|
||
final class ModalSheetInteractorMock: ModalSheetInteractor { | ||
|
||
static let listingsStub: [Listing] = [ | ||
Listing(id: UUID().uuidString, name: "Sample App", homepage: "https://example.com", order: 1, imageId: UUID().uuidString, 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: "sampleapp://deeplink", universal: "https://example.com/universal")), | ||
Listing(id: UUID().uuidString, name: "Awesome App", homepage: "https://example.com/awesome", order: 2, imageId: UUID().uuidString, 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://example.com/awesome/universal")), | ||
Listing(id: UUID().uuidString, name: "Cool App", homepage: "https://example.com/cool", order: 3, imageId: UUID().uuidString, 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: "coolapp://deeplink", universal: "https://example.com/cool/universal")) | ||
] | ||
|
||
var listings: [Listing] | ||
|
||
init(listings: [Listing] = ModalSheetInteractorMock.listingsStub) { | ||
self.listings = listings | ||
} | ||
|
||
func getListings() async throws -> [Web3Modal.Listing] { | ||
listings | ||
} | ||
|
||
func connect() async throws -> WalletConnectURI { | ||
.init(topic: "foo", symKey: "bar", relay: .init(protocol: "irn", data: nil)) | ||
} | ||
|
||
var sessionSettlePublisher: AnyPublisher<Session, Never> { | ||
Result.Publisher(Session(topic: "", pairingTopic: "", peer: .stub(), namespaces: [:], expiryDate: Date())) | ||
.eraseToAnyPublisher() | ||
} | ||
} |
Oops, something went wrong.