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

[Cocoapods] Sync API support #909

Merged
merged 2 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion Sources/Chat/Storage/ChatStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ final class ChatStorage {
}

func getReceivedInvites(account: Account) -> [ReceivedInvite] {
return receivedInviteStore.getAll(for: account.absoluteString) ?? []
return receivedInviteStore.getAll(for: account.absoluteString)
}

func syncRejectedReceivedInviteStatus(id: Int64, account: Account) async throws {
Expand Down
19 changes: 0 additions & 19 deletions Sources/WalletConnectKMS/Keychain/GenericPasswordConvertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,3 @@ public protocol GenericPasswordConvertible {
init<D>(rawRepresentation data: D) throws where D: ContiguousBytes
var rawRepresentation: Data { get }
}

extension String: GenericPasswordConvertible {

enum Errors: Error {
case notUTF8
}

public init<D>(rawRepresentation data: D) throws where D: ContiguousBytes {
let buffer = data.withUnsafeBytes { Data($0) }
guard let string = String(data: buffer, encoding: .utf8) else {
throw Errors.notUTF8
}
self = string
}

public var rawRepresentation: Data {
return data(using: .utf8) ?? Data()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Foundation

extension String: GenericPasswordConvertible {

public init<D>(rawRepresentation data: D) throws where D: ContiguousBytes {
let buffer = data.withUnsafeBytes { Data($0) }
guard let string = String(data: buffer, encoding: .utf8) else {
throw Errors.notUTF8
}
self = string
}

public var rawRepresentation: Data {
return data(using: .utf8) ?? Data()
}
}

fileprivate enum Errors: Error {
case notUTF8
}
8 changes: 4 additions & 4 deletions Sources/WalletConnectUtils/Extensions/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import Foundation

public extension String {

enum Errors: Error {
case notAnURL
}

func toHexEncodedString(uppercase: Bool = true, prefix: String = "", separator: String = "") -> String {
return unicodeScalars.map { prefix + .init($0.value, radix: 16, uppercase: uppercase) } .joined(separator: separator)
}
Expand All @@ -20,3 +16,7 @@ public extension String {
return url
}
}

fileprivate enum Errors: Error {
case notAnURL
}