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

[SDK] Inject WebSocket factory #281

Merged
merged 9 commits into from
Jun 27, 2022
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
47 changes: 36 additions & 11 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ on:
branches: [ main, develop ]

jobs:
build:
build:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v2

- name: Setup Xcode Version
uses: maxim-lobanov/setup-xcode@v1
Expand All @@ -21,24 +20,50 @@ jobs:

- uses: actions/cache@v2
with:
path: .build
path: |
.build
SourcePackages
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-

# Package builds
- name: Build Package
run: swift build -v
- name: Run tests
run: swift test -v
run: "xcodebuild \
-project Example/ExampleApp.xcodeproj \
-scheme WalletConnect \
-clonedSourcePackagesDirPath SourcePackages \
-sdk iphonesimulator"

# Example app builds
# Integration tests
- name: Run integration tests
run: "xcodebuild \
-project Example/ExampleApp.xcodeproj \
-scheme IntegrationTests \
-clonedSourcePackagesDirPath SourcePackages \
-destination 'platform=iOS Simulator,name=iPhone 13' test"

# Wallet build
- name: Build Example Wallet
run: xcodebuild -project Example/ExampleApp.xcodeproj -scheme Wallet -sdk iphonesimulator
run: "xcodebuild \
-project Example/ExampleApp.xcodeproj \
-scheme Wallet \
-clonedSourcePackagesDirPath SourcePackages \
-sdk iphonesimulator"

# DApp build
- name: Build Example Dapp
run: xcodebuild -project Example/ExampleApp.xcodeproj -scheme DApp -sdk iphonesimulator
run: "xcodebuild \
-project Example/ExampleApp.xcodeproj \
-scheme DApp \
-clonedSourcePackagesDirPath SourcePackages \
-sdk iphonesimulator"

# UI tests
- name: UI Tests
run: xcodebuild -project Example/ExampleApp.xcodeproj -scheme UITests -destination 'platform=iOS Simulator,name=iPhone 13' test
run: "xcodebuild \
-project Example/ExampleApp.xcodeproj \
-scheme UITests \
-clonedSourcePackagesDirPath SourcePackages \
-destination 'platform=iOS Simulator,name=iPhone 13' test"
continue-on-error: true
30 changes: 10 additions & 20 deletions .swiftpm/xcode/xcshareddata/xcschemes/WalletConnect.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -192,26 +192,6 @@
</BuildableReference>
</CodeCoverageTargets>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WalletConnectTests"
BuildableName = "WalletConnectTests"
BlueprintName = "WalletConnectTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "IntegrationTests"
BuildableName = "IntegrationTests"
BlueprintName = "IntegrationTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
Expand Down Expand Up @@ -272,6 +252,16 @@
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ChatTests"
BuildableName = "ChatTests"
BlueprintName = "ChatTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
13 changes: 12 additions & 1 deletion Example/DApp/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import UIKit
import WalletConnectSign
import WalletConnectRelay
import Combine
import Starscream

extension WebSocket: WebSocketConnecting { }

struct SocketFactory: WebSocketFactory {
func create(with url: URL) -> WebSocketConnecting {
return WebSocket(url: url)
}
}

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

Expand All @@ -18,7 +28,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
description: "a description",
url: "wallet.connect",
icons: ["https://avatars.githubusercontent.com/u/37784886"])
Sign.configure(Sign.Config(metadata: metadata, projectId: "8ba9ee138960775e5231b70cc5ef1c3a"))

Sign.configure(metadata: metadata, projectId: "8ba9ee138960775e5231b70cc5ef1c3a", socketFactory: SocketFactory())
flypaper0 marked this conversation as resolved.
Show resolved Hide resolved

if CommandLine.arguments.contains("-cleanInstall") {
try? Sign.instance.cleanup()
Expand Down
35 changes: 0 additions & 35 deletions Example/DappTests/DappTests.swift

This file was deleted.

Loading