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

1.8.5 #1148

Merged
merged 34 commits into from
Oct 2, 2023
Merged

1.8.5 #1148

Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6fdb97c
Authenticator fix
alexander-lsvk Sep 20, 2023
679d858
Update verify UI
alexander-lsvk Sep 22, 2023
78b570f
Concurrent queue
flypaper0 Sep 25, 2023
ffe2ea4
Initialize WalletConnectURI from deeplinks
alexander-lsvk Sep 26, 2023
3e0e73d
Merge pull request #1137 from WalletConnect/feature/sockets-global-th…
flypaper0 Sep 26, 2023
eb2aec8
savepoint
llbartekll Sep 26, 2023
6924deb
update subscriptions watcher
llbartekll Sep 26, 2023
96b1f4c
Update NotificationsView.swift
flypaper0 Sep 25, 2023
42c6295
Subscriber continuation
flypaper0 Sep 26, 2023
05cb5a2
Messages publisher debounce
flypaper0 Sep 26, 2023
5b349b0
Cancellable fix
flypaper0 Sep 27, 2023
606cf48
update Subscription Watcher
llbartekll Sep 27, 2023
47306da
Notify tests updated
flypaper0 Sep 27, 2023
3897072
Merge pull request #1141 from WalletConnect/feature/notify-view-redesign
flypaper0 Sep 27, 2023
5bef8c5
Add tests
llbartekll Sep 27, 2023
f5a6672
clean up
llbartekll Sep 27, 2023
2089503
fix var accesibility
llbartekll Sep 27, 2023
a557e39
savepoint
llbartekll Sep 27, 2023
427664f
increase timeout in tests
llbartekll Sep 27, 2023
42fdc07
fix tests
llbartekll Sep 27, 2023
e53cdf3
Merge pull request #1133 from WalletConnect/update-verify-ui
alexander-lsvk Sep 28, 2023
f7e53f7
Merge pull request #1138 from WalletConnect/deeplink-handler
alexander-lsvk Sep 28, 2023
4a294d3
Update KeychainError.swift
flypaper0 Sep 29, 2023
e93802b
Decrypt request message
alexander-lsvk Sep 29, 2023
44c6af6
Update
alexander-lsvk Sep 29, 2023
d959e18
update subscriptions watcher
llbartekll Sep 29, 2023
b520ae2
Merge branch 'develop' of github.com:WalletConnect/WalletConnectSwift…
llbartekll Sep 29, 2023
62f5701
Merge pull request #1142 from WalletConnect/subscriptions-watcher
llbartekll Sep 29, 2023
73850f8
Push client mixpanel
flypaper0 Sep 29, 2023
8370c13
Merge pull request #1147 from WalletConnect/request-message-decryption
alexander-lsvk Sep 29, 2023
413cbe0
Merge pull request #1146 from WalletConnect/feature/keychain-error-de…
flypaper0 Sep 29, 2023
0266213
Set User Agent
flypaper0 Sep 29, 2023
8a8c6da
Update authenticator url
alexander-lsvk Oct 2, 2023
2e1b67d
Merge pull request #1124 from WalletConnect/authenticator-fix
alexander-lsvk Oct 2, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift.git",
"state": {
"branch": null,
"revision": "32f641cf24fc7abc1c591a2025e9f2f572648b0f",
"version": "1.7.2"
"revision": "db51c407d3be4a051484a141bf0bff36c43d3b1e",
"version": "1.8.0"
}
},
{
Expand Down Expand Up @@ -69,8 +69,8 @@
"repositoryURL": "https://github.com/getsentry/sentry-cocoa.git",
"state": {
"branch": null,
"revision": "04bee4ad86d74d4cb4d7101ff826d6e355301ba9",
"version": "8.9.4"
"revision": "14aa6e47b03b820fd2b338728637570b9e969994",
"version": "8.12.0"
}
},
{
Expand Down
11 changes: 6 additions & 5 deletions Example/IntegrationTests/Push/NotifyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,6 @@ final class NotifyTests: XCTestCase {
let updateScope: Set<String> = ["alerts"]
expectation.assertForOverFulfill = false

try! await walletNotifyClientA.register(account: account, domain: gmDappDomain, onSign: sign)
try! await walletNotifyClientA.subscribe(appDomain: gmDappDomain, account: account)

var didUpdate = false
walletNotifyClientA.subscriptionsPublisher
.sink { [unowned self] subscriptions in
Expand All @@ -181,15 +178,16 @@ final class NotifyTests: XCTestCase {
}
}.store(in: &publishers)

try! await walletNotifyClientA.register(account: account, domain: gmDappDomain, onSign: sign)
try! await walletNotifyClientA.subscribe(appDomain: gmDappDomain, account: account)

wait(for: [expectation], timeout: InputConfig.defaultTimeout)
}

func testNotifyServerSubscribeAndNotifies() async throws {
let subscribeExpectation = expectation(description: "creates notify subscription")
let messageExpectation = expectation(description: "receives a notify message")
let notifyMessage = NotifyMessage.stub()
try! await walletNotifyClientA.register(account: account, domain: gmDappDomain, onSign: sign)
try! await walletNotifyClientA.subscribe(appDomain: gmDappDomain, account: account)

var didNotify = false
walletNotifyClientA.subscriptionsPublisher
Expand All @@ -215,6 +213,9 @@ final class NotifyTests: XCTestCase {
}
}.store(in: &publishers)

try! await walletNotifyClientA.register(account: account, domain: gmDappDomain, onSign: sign)
try! await walletNotifyClientA.subscribe(appDomain: gmDappDomain, account: account)

wait(for: [subscribeExpectation, messageExpectation], timeout: InputConfig.defaultTimeout)
}

Expand Down
5 changes: 4 additions & 1 deletion Example/Shared/DefaultSocketFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ extension WebSocket: WebSocketConnecting { }

struct DefaultSocketFactory: WebSocketFactory {
func create(with url: URL) -> WebSocketConnecting {
return WebSocket(url: url)
let socket = WebSocket(url: url)
let queue = DispatchQueue(label: "com.walletconnect.sdk.sockets", attributes: .concurrent)
socket.callbackQueue = queue
return socket
}
}
3 changes: 1 addition & 2 deletions Example/WalletApp/ApplicationLayer/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import WalletConnectChat

final class Application {
var uri: String?
var uri: WalletConnectURI?
var requestSent = false

lazy var pushRegisterer = PushRegisterer()
Expand All @@ -11,4 +11,3 @@ final class Application {
lazy var messageSigner = MessageSignerFactory(signerFactory: DefaultSignerFactory()).create()
lazy var configurationService = ConfigurationService()
}

14 changes: 8 additions & 6 deletions Example/WalletApp/ApplicationLayer/ConfigurationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,22 @@ final class ConfigurationService {

Notify.instance.setLogging(level: .debug)

if let clientId = try? Networking.interactor.getClientId() {
LoggingService.instance.setUpUser(account: importAccount.account.absoluteString, clientId: clientId)
ProfilingService.instance.setUpProfiling(account: importAccount.account.absoluteString, clientId: clientId)
}
LoggingService.instance.startLogging()

Task {
do {
try await Notify.instance.register(account: importAccount.account, domain: "com.walletconnect", onSign: importAccount.onSign)
} catch {
DispatchQueue.main.async {
let logMessage = LogMessage(message: "Push Server registration failed with: \(error.localizedDescription)")
ProfilingService.instance.send(logMessage: logMessage)
UIApplication.currentWindow.rootViewController?.showAlert(title: "Register error", error: error)
}
}
}

if let clientId = try? Networking.interactor.getClientId() {
LoggingService.instance.setUpUser(account: importAccount.account.absoluteString, clientId: clientId)
ProfilingService.instance.setUpProfiling(account: importAccount.account.absoluteString, clientId: clientId)
}
LoggingService.instance.startLogging()
}
}
1 change: 1 addition & 0 deletions Example/WalletApp/ApplicationLayer/ProfilingService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ final class ProfilingService {

handleLogs(from: Networking.instance.logsPublisher)
handleLogs(from: Notify.instance.logsPublisher)
handleLogs(from: Push.instance.logsPublisher)
}

private func handleLogs(from publisher: AnyPublisher<Log, Never>) {
Expand Down
8 changes: 4 additions & 4 deletions Example/WalletApp/ApplicationLayer/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
window = UIWindow(windowScene: windowScene)
window?.makeKeyAndVisible()

app.uri = connectionOptions.urlContexts.first?.url.absoluteString.replacingOccurrences(of: "walletapp://wc?uri=", with: "")
app.uri = WalletConnectURI(connectionOptions: connectionOptions)
app.requestSent = (connectionOptions.urlContexts.first?.url.absoluteString.replacingOccurrences(of: "walletapp://wc?", with: "") == "requestSent")

configurators.configure()
Expand All @@ -37,11 +37,11 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let context = URLContexts.first else { return }

let queryParams = context.url.queryParameters
let uri = WalletConnectURI(urlContext: context)

if let uri = queryParams["uri"] as? String {
if let uri {
Task {
try await Pair.instance.pair(uri: WalletConnectURI(string: uri)!)
try await Pair.instance.pair(uri: uri)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,31 @@ struct AuthRequestView: View {
.foregroundColor(.grey8)
.font(.system(size: 22, weight: .medium, design: .rounded))

Text(presenter.request.payload.domain)
.foregroundColor(.grey50)
.font(.system(size: 13, weight: .semibold, design: .rounded))
.multilineTextAlignment(.center)
.lineSpacing(4)
if case .valid = presenter.validationStatus {
HStack {
Image(systemName: "checkmark.seal.fill")
.font(.system(size: 14, weight: .semibold, design: .rounded))
.foregroundColor(.blue)

Text(presenter.request.payload.domain)
.foregroundColor(.grey8)
.font(.system(size: 13, weight: .semibold, design: .rounded))
.lineSpacing(4)
}
.padding(.top, 8)
} else {
Text(presenter.request.payload.domain)
.foregroundColor(.grey8)
.font(.system(size: 13, weight: .semibold, design: .rounded))
.multilineTextAlignment(.center)
.lineSpacing(4)
.padding(.top, 8)
}

switch presenter.validationStatus {
case .unknown:
verifyBadgeView(imageName: "exclamationmark.circle.fill", title: "Cannot verify", color: .orange)

case .valid:
verifyBadgeView(imageName: "checkmark.seal.fill", title: "Verified domain", color: .blue)

case .invalid:
verifyBadgeView(imageName: "exclamationmark.triangle.fill", title: "Invalid domain", color: .red)

Expand Down Expand Up @@ -68,52 +79,21 @@ struct AuthRequestView: View {
}
}

HStack(spacing: 20) {
Button {
Task(priority: .userInitiated) { try await
presenter.onReject()
}
} label: {
Text("Decline")
.frame(maxWidth: .infinity)
.foregroundColor(.white)
.font(.system(size: 20, weight: .semibold, design: .rounded))
.padding(.vertical, 11)
.background(
LinearGradient(
gradient: Gradient(colors: [
.foregroundNegative,
.lightForegroundNegative
]),
startPoint: .top, endPoint: .bottom)
)
.cornerRadius(20)
if case .scam = presenter.validationStatus {
VStack(spacing: 20) {
declineButton()
allowButton()
}
.shadow(color: .white.opacity(0.25), radius: 8, y: 2)

Button {
Task(priority: .userInitiated) { try await
presenter.onApprove()
}
} label: {
Text("Allow")
.frame(maxWidth: .infinity)
.foregroundColor(.white)
.font(.system(size: 20, weight: .semibold, design: .rounded))
.padding(.vertical, 11)
.background(
LinearGradient(
gradient: Gradient(colors: [
.foregroundPositive,
.lightForegroundPositive
]),
startPoint: .top, endPoint: .bottom)
)
.cornerRadius(20)
.padding(.top, 25)
} else {
HStack {
declineButton()
allowButton()
}
.shadow(color: .white.opacity(0.25), radius: 8, y: 2)
.padding(.top, 25)
}
.padding(.top, 25)


}
.padding(20)
.background(.ultraThinMaterial)
Expand Down Expand Up @@ -147,13 +127,12 @@ struct AuthRequestView: View {
}
.padding(.horizontal, 18)
.padding(.vertical, 10)
.frame(height: 250)
.frame(height: 150)
}
.background(Color.whiteBackground)
.cornerRadius(20, corners: .allCorners)
.padding(.horizontal, 5)
.padding(.bottom, 5)

}
.background(.thinMaterial)
.cornerRadius(25, corners: .allCorners)
Expand Down Expand Up @@ -199,6 +178,61 @@ struct AuthRequestView: View {
.background(color.opacity(0.15))
.cornerRadius(20)
}

private func declineButton() -> some View {
Button {
Task(priority: .userInitiated) { try await
presenter.onReject()
}
} label: {
Text("Decline")
.frame(maxWidth: .infinity)
.foregroundColor(.white)
.font(.system(size: 20, weight: .semibold, design: .rounded))
.padding(.vertical, 11)
.background(
LinearGradient(
gradient: Gradient(colors: [
.foregroundNegative,
.lightForegroundNegative
]),
startPoint: .top, endPoint: .bottom)
)
.cornerRadius(20)
}
.shadow(color: .white.opacity(0.25), radius: 8, y: 2)
}

private func allowButton() -> some View {
Button {
Task(priority: .userInitiated) { try await
presenter.onApprove()
}
} label: {
Text(presenter.validationStatus == .scam ? "Proceed anyway" : "Allow")
.frame(maxWidth: .infinity)
.foregroundColor(presenter.validationStatus == .scam ? .grey50 : .white)
.font(.system(size: 20, weight: .semibold, design: .rounded))
.padding(.vertical, 11)
.background(
Group {
if presenter.validationStatus == .scam {
Color.clear
} else {
LinearGradient(
gradient: Gradient(colors: [
.foregroundPositive,
.lightForegroundPositive
]),
startPoint: .top, endPoint: .bottom
)
}
}
)
.cornerRadius(20)
}
.shadow(color: .white.opacity(0.25), radius: 8, y: 2)
}
}

#if DEBUG
Expand Down
Loading
Loading