Skip to content

Commit

Permalink
Merge branch 'user-defaults-group-migration' of github.com:WalletConn…
Browse files Browse the repository at this point in the history
…ect/WalletConnectSwiftV2 into keychain-group-migration

# Conflicts:
#	Sources/Auth/AuthClientFactory.swift
#	Sources/WalletConnectNetworking/NetworkingClientFactory.swift
#	Sources/WalletConnectPairing/PairingClientFactory.swift
#	Sources/WalletConnectPush/PushClientFactory.swift
#	Sources/WalletConnectRelay/RelayClientFactory.swift
#	Sources/WalletConnectSign/Sign/SignClientFactory.swift
  • Loading branch information
llbartekll committed Nov 30, 2023
2 parents 7bf3088 + ab1d5f0 commit 3885400
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
4 changes: 3 additions & 1 deletion Sources/Auth/AuthClientFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public struct AuthClientFactory {
groupIdentifier: String
) -> AuthClient {
let logger = ConsoleLogger(loggingLevel: .off)
let keyValueStorage = UserDefaults(suiteName: groupIdentifier) ?? UserDefaults.standard
guard let keyValueStorage = UserDefaults(suiteName: groupIdentifier) else {
fatalError("Could not instantiate UserDefaults for a group identifier \(groupIdentifier)")
}
let keychainStorage = KeychainStorage(serviceIdentifier: "com.walletconnect.sdk", accessGroup: groupIdentifier)
let iatProvider = DefaultIATProvider()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ public struct NetworkingClientFactory {
groupIdentifier: String
) -> NetworkingInteractor {
let logger = ConsoleLogger(prefix: "🕸️", loggingLevel: .off)
let keyValueStorage = UserDefaults(suiteName: groupIdentifier) ?? UserDefaults.standard

guard let keyValueStorage = UserDefaults(suiteName: groupIdentifier) else {
fatalError("Could not instantiate UserDefaults for a group identifier \(groupIdentifier)")
}

let keychainStorage = KeychainStorage(serviceIdentifier: "com.walletconnect.sdk", accessGroup: groupIdentifier)
return NetworkingClientFactory.create(relayClient: relayClient, logger: logger, keychainStorage: keychainStorage, keyValueStorage: keyValueStorage)
}
Expand Down
6 changes: 5 additions & 1 deletion Sources/WalletConnectPairing/PairingClientFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ public struct PairingClientFactory {
groupIdentifier: String
) -> PairingClient {
let logger = ConsoleLogger(loggingLevel: .off)
let keyValueStorage = UserDefaults(suiteName: groupIdentifier) ?? UserDefaults.standard

guard let keyValueStorage = UserDefaults(suiteName: groupIdentifier) else {
fatalError("Could not instantiate UserDefaults for a group identifier \(groupIdentifier)")
}
let keychainStorage = KeychainStorage(serviceIdentifier: "com.walletconnect.sdk", accessGroup: groupIdentifier)

return PairingClientFactory.create(logger: logger, keyValueStorage: keyValueStorage, keychainStorage: keychainStorage, networkingClient: networkingClient)
}

Expand Down
7 changes: 5 additions & 2 deletions Sources/WalletConnectPush/PushClientFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ public struct PushClientFactory {
environment: APNSEnvironment
) -> PushClient {

let keychainStorage = KeychainStorage(serviceIdentifier: "com.walletconnect.sdk", accessGroup: groupIdentifier)
let keyValueStorage = UserDefaults(suiteName: groupIdentifier) ?? UserDefaults.standard

guard let keyValueStorage = UserDefaults(suiteName: groupIdentifier) else {
fatalError("Could not instantiate UserDefaults for a group identifier \(groupIdentifier)")
}
let keychainStorage = KeychainStorage(serviceIdentifier: "com.walletconnect.sdk", accessGroup: groupIdentifier)

return PushClientFactory.create(
projectId: projectId,
pushHost: pushHost,
Expand Down
4 changes: 3 additions & 1 deletion Sources/WalletConnectRelay/RelayClientFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ public struct RelayClientFactory {
socketConnectionType: SocketConnectionType
) -> RelayClient {

let keyValueStorage = UserDefaults(suiteName: groupIdentifier) ?? UserDefaults.standard

guard let keyValueStorage = UserDefaults(suiteName: groupIdentifier) else {
fatalError("Could not instantiate UserDefaults for a group identifier \(groupIdentifier)")
}
let keychainStorage = KeychainStorage(serviceIdentifier: "com.walletconnect.sdk", accessGroup: groupIdentifier)

let logger = ConsoleLogger(prefix: "🚄" ,loggingLevel: .off)
Expand Down
6 changes: 5 additions & 1 deletion Sources/WalletConnectSign/Sign/SignClientFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ public struct SignClientFactory {
groupIdentifier: String
) -> SignClient {
let logger = ConsoleLogger(loggingLevel: .debug)
let keyValueStorage = UserDefaults(suiteName: groupIdentifier) ?? UserDefaults.standard

guard let keyValueStorage = UserDefaults(suiteName: groupIdentifier) else {
fatalError("Could not instantiate UserDefaults for a group identifier \(groupIdentifier)")
}
let keychainStorage = KeychainStorage(serviceIdentifier: "com.walletconnect.sdk", accessGroup: groupIdentifier)

return SignClientFactory.create(metadata: metadata, logger: logger, keyValueStorage: keyValueStorage, keychainStorage: keychainStorage, pairingClient: pairingClient, networkingClient: networkingClient)
}

Expand Down

0 comments on commit 3885400

Please sign in to comment.