Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
llbartekll committed May 29, 2023
1 parent 9e9cc13 commit 34389da
Show file tree
Hide file tree
Showing 173 changed files with 562 additions and 645 deletions.
21 changes: 10 additions & 11 deletions Example/DApp/Auth/AuthView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,38 @@ import SwiftUI
struct AuthView: View {

@ObservedObject var viewModel: AuthViewModel

var body: some View {
VStack(spacing: 16.0) {

Spacer()

Image(uiImage: viewModel.qrImage ?? UIImage())
.interpolation(.none)
.resizable()
.frame(width: 300, height: 300)

signingLabel()
.frame(maxWidth: .infinity)

Spacer()

Button("Connect Wallet", action: { })
.buttonStyle(CircleButtonStyle())

Button("Copy URI", action: { viewModel.copyDidPressed() })
.buttonStyle(CircleButtonStyle())

Button("Deeplink", action: { viewModel.deeplinkPressed() })
.buttonStyle(CircleButtonStyle())



}
.padding(16.0)
.onAppear { Task(priority: .userInitiated) {
try await viewModel.setupInitialState()
}}
}

@ViewBuilder
private func signingLabel() -> some View {
switch viewModel.state {
Expand Down
3 changes: 1 addition & 2 deletions Example/DApp/Sign/Accounts/AccountsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ final class AccountsViewController: UIViewController, UITableViewDataSource, UIT
super.viewDidLoad()
navigationItem.title = "Accounts"


navigationItem.rightBarButtonItem = UIBarButtonItem(
title: "Disconnect",
style: .plain,
Expand All @@ -58,7 +57,7 @@ final class AccountsViewController: UIViewController, UITableViewDataSource, UIT
func proposePushSubscription() {
let account = session.namespaces.values.first!.accounts.first!

Task(priority: .high){ try! await Push.dapp.propose(account: account, topic: session.pairingTopic)}
Task(priority: .high) { try! await Push.dapp.propose(account: account, topic: session.pairingTopic)}
Push.dapp.proposalResponsePublisher.sink { result in
switch result {
case .success(let subscription):
Expand Down
2 changes: 1 addition & 1 deletion Example/DApp/Sign/Connect/ConnectView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class ConnectView: UIView {
return button
}()

let invisibleUriLabel: UILabel = {
let invisibleUriLabel: UILabel = {
let label = UILabel(frame: CGRect(origin: .zero, size: .init(width: 1, height: 1)))
label.numberOfLines = 0
label.textColor = .clear
Expand Down
2 changes: 1 addition & 1 deletion Example/DApp/Sign/Connect/ConnectViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ConnectViewController: UIViewController, UITableViewDataSource, UITableVie
self.connectView.copyButton.isHidden = false
}
}

connectView.invisibleUriLabel.text = uri.absoluteString
connectView.copyButton.addTarget(self, action: #selector(copyURI), for: .touchUpInside)
connectView.connectWalletButton.addTarget(self, action: #selector(connectWithExampleWallet), for: .touchUpInside)
Expand Down
2 changes: 1 addition & 1 deletion Example/EchoUITests/Engine/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ enum App {
var instance: XCUIApplication {
return XCUIApplication(bundleIdentifier: bundleID)
}

private var bundleID: String {
switch self {
case .dapp:
Expand Down
2 changes: 1 addition & 1 deletion Example/EchoUITests/Engine/DAppEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct DAppEngine {
var accountRow: XCUIElement {
instance.tables.cells.containing("0x").firstMatch
}

var methodRow: XCUIElement {
instance.tables.cells.firstMatch
}
Expand Down
4 changes: 2 additions & 2 deletions Example/EchoUITests/Engine/WalletEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ struct WalletEngine {
}

// Onboarding

var getStartedButton: XCUIElement {
instance.buttons["Get Started"]
}

// MainScreen

var pasteURIButton: XCUIElement {
Expand Down
4 changes: 2 additions & 2 deletions Example/EchoUITests/Extensions/XCTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ extension XCTestCase {
if alerts.buttons["Allow"].exists {
alerts.buttons["Allow"].tap()
}

return true
}
app.swipeUp()

self.removeUIInterruptionMonitor(pnPermission)
}
}
6 changes: 3 additions & 3 deletions Example/EchoUITests/Extensions/XCUIElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import XCTest
extension XCUIElement {

static let waitTimeout: TimeInterval = 15

@discardableResult
func wait(
until expression: @escaping (XCUIElement) -> Bool,
Expand Down Expand Up @@ -35,7 +35,7 @@ extension XCUIElement {

return self
}

@discardableResult
func wait<Value: Equatable>(
until keyPath: KeyPath<XCUIElement, Value>,
Expand All @@ -53,7 +53,7 @@ extension XCUIElement {
line: line
)
}

@discardableResult
func wait(
until keyPath: KeyPath<XCUIElement, Bool>,
Expand Down
2 changes: 1 addition & 1 deletion Example/EchoUITests/Extensions/XCUIElementQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import XCTest

extension XCUIElementQuery {

func containing(_ text: String) -> XCUIElementQuery {
let predicate = NSPredicate(format: "label CONTAINS[c] %@", text)
let elementQuery = self.containing(predicate)
Expand Down
26 changes: 13 additions & 13 deletions Example/EchoUITests/Tests/PushNotificationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,48 @@ class PushNotificationTests: XCTestCase {
engine.routing.launch(app: .wallet, clean: true)
engine.routing.launch(app: .dapp, clean: true)
}

func testPushNotification() {

// Initiate connection & copy URI from dApp
engine.routing.activate(app: .dapp)
engine.dapp.connectButton.wait(until: \.exists).tap()
engine.dapp.newPairingButton.wait(until: \.exists).tap()

// Relies on existence of invisible label with uri in Dapp
let uri = engine.dapp.instance.staticTexts.containing("wc:").firstMatch.label

engine.dapp.copyURIButton.wait(until: \.exists).tap()

// Paste URI into Wallet & and allow connect
engine.routing.activate(app: .wallet)

allowPushNotificationsIfNeeded(app: engine.wallet.instance)

engine.wallet.getStartedButton.wait(until: \.exists).tap()
engine.wallet.pasteURIButton.wait(until: \.exists).tap()

engine.wallet.alertUriTextField.wait(until: \.exists).tap()
engine.wallet.alertUriTextField.typeText(uri)
engine.wallet.alertConnectButton.wait(until: \.exists).tap()

// Allow session
engine.wallet.allowButton.wait(until: \.exists, timeout: 15, message: "No session dialog appeared").tap()

// Trigger PN
engine.routing.activate(app: .dapp)
engine.dapp.accountRow.wait(until: \.exists, timeout: 15).tap()
engine.dapp.methodRow.wait(until: \.exists).tap()

// Launch springboard
engine.routing.activate(app: .springboard)

// Assert notification
let notification = engine.routing.springboard.otherElements.descendants(matching: .any)["NotificationShortLookView"]
notification
.wait(until: \.exists, timeout: 15)
.tap()

engine.wallet.instance.wait(until: \.exists)
}
}
2 changes: 1 addition & 1 deletion Example/IntegrationTests/Chat/ChatTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class ChatTests: XCTestCase {
let clientId = try! networkingInteractor.getClientId()
logger.debug("My client id is: \(clientId)")

return ChatClientFactory.create(keyserverURL: keyserverURL, relayClient: relayClient, networkingInteractor: networkingInteractor, keychain: keychain, logger: logger, keyValueStorage: keyValueStorage)
return ChatClientFactory.create(keyserverURL: keyserverURL, relayClient: relayClient, networkingInteractor: networkingInteractor, keychain: keychain, logger: logger, keyValueStorage: keyValueStorage)
}

func testInvite() async throws {
Expand Down
2 changes: 1 addition & 1 deletion Example/IntegrationTests/Chat/RegistryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class RegistryTests: XCTestCase {
let keychain = KeychainStorageMock()
let ksm = KeyManagementService(keychain: keychain)
storage = IdentityStorage(keychain: keychain)
sut = IdentityService (
sut = IdentityService(
keyserverURL: keyserverURL,
kms: ksm,
storage: storage,
Expand Down
2 changes: 1 addition & 1 deletion Example/IntegrationTests/Pairing/PairingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class PairingTests: XCTestCase {

let clientId = try! networkingClient.getClientId()
networkingLogger.debug("My client id is: \(clientId)")

return (pairingClient, networkingClient, keychain, keyValueStorage)
}

Expand Down
6 changes: 2 additions & 4 deletions Example/IntegrationTests/Push/PushTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ final class PushTests: XCTestCase {

let clientId = try! networkingClient.getClientId()
networkingLogger.debug("My client id is: \(clientId)")

return (pairingClient, networkingClient, keychain, keyValueStorage)
}

Expand Down Expand Up @@ -149,7 +149,6 @@ final class PushTests: XCTestCase {
wait(for: [expectation], timeout: InputConfig.defaultTimeout)
}


func testDeletePushSubscription() async {
let expectation = expectation(description: "expects to delete push subscription")
let uri = try! await dappPairingClient.create()
Expand Down Expand Up @@ -192,7 +191,7 @@ final class PushTests: XCTestCase {
walletPushClient.updateSubscriptionPublisher
.sink { [unowned self] result in
guard case .success(let subscription) = result else { XCTFail(); return }
let updatedScope = Set(subscription.scope.filter{ $0.value.enabled == true }.keys)
let updatedScope = Set(subscription.scope.filter { $0.value.enabled == true }.keys)
XCTAssertEqual(updatedScope, updateScope)
Task { try! await walletPushClient.deleteSubscription(topic: subscription.topic) }
expectation.fulfill()
Expand All @@ -203,7 +202,6 @@ final class PushTests: XCTestCase {

}


private extension PushTests {
func sign(_ message: String) -> SigningResult {
let privateKey = Data(hex: "305c6cde3846927892cd32762f6120539f3ec74c9e3a16b9b798b1e85351ae2a")
Expand Down
Loading

0 comments on commit 34389da

Please sign in to comment.