Skip to content

Commit

Permalink
remove more v3 verbage from the code
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Nov 7, 2024
1 parent 6c63e3a commit 1862832
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
24 changes: 9 additions & 15 deletions Sources/XMTPiOS/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@ public typealias PreEventCallback = () async throws -> Void

public enum ClientError: Error, CustomStringConvertible, LocalizedError {
case creationError(String)
case noV3Client(String)
case noV2Client(String)
case missingInboxId

public var description: String {
switch self {
case .creationError(let err):
return "ClientError.creationError: \(err)"
case .noV3Client(let err):
return "ClientError.noV3Client: \(err)"
case .noV2Client(let err):
return "ClientError.noV2Client: \(err)"
case .missingInboxId:
return "ClientError.missingInboxId"
}
Expand Down Expand Up @@ -117,7 +111,7 @@ public final class Client {
signingKey: SigningKey?,
inboxId: String
) async throws -> Client {
let (libxmtpClient, dbPath) = try await initV3Client(
let (libxmtpClient, dbPath) = try await initFFiClient(
accountAddress: accountAddress,
options: options,
signingKey: signingKey,
Expand All @@ -126,7 +120,7 @@ public final class Client {

let client = try Client(
address: accountAddress,
v3Client: libxmtpClient,
ffiClient: libxmtpClient,
dbPath: dbPath,
installationID: libxmtpClient.installationId().toHex,
inboxID: libxmtpClient.inboxId(),
Expand Down Expand Up @@ -171,7 +165,7 @@ public final class Client {
)
}

static func initV3Client(
static func initFFiClient(
accountAddress: String,
options: ClientOptions,
signingKey: SigningKey?,
Expand Down Expand Up @@ -203,7 +197,7 @@ public final class Client {
let alias = "xmtp-\(options.api.env.rawValue)-\(inboxId).db3"
let dbURL = directoryURL.appendingPathComponent(alias).path

let v3Client = try await LibXMTP.createClient(
let ffiClient = try await LibXMTP.createClient(
logger: XMTPLogger(),
host: options.api.env.url,
isSecure: options.api.env.isSecure == true,
Expand All @@ -217,7 +211,7 @@ public final class Client {
)

try await options.preAuthenticateToInboxCallback?()
if let signatureRequest = v3Client.signatureRequest() {
if let signatureRequest = ffiClient.signatureRequest() {
if let signingKey = signingKey {
do {
if signingKey.type == WalletType.SCW {
Expand All @@ -242,7 +236,7 @@ public final class Client {
try await signatureRequest.addEcdsaSignature(
signatureBytes: signedData.rawData)
}
try await v3Client.registerIdentity(
try await ffiClient.registerIdentity(
signatureRequest: signatureRequest)
} catch {
throw ClientError.creationError(
Expand All @@ -258,7 +252,7 @@ public final class Client {

print("LibXMTP \(getVersionInfo())")

return (v3Client, dbURL)
return (ffiClient, dbURL)
}

public static func getOrCreateInboxId(
Expand All @@ -280,11 +274,11 @@ public final class Client {
}

init(
address: String, v3Client: LibXMTP.FfiXmtpClient, dbPath: String,
address: String, ffiClient: LibXMTP.FfiXmtpClient, dbPath: String,
installationID: String, inboxID: String, environment: XMTPEnvironment
) throws {
self.address = address
self.ffiClient = v3Client
self.ffiClient = ffiClient
self.dbPath = dbPath
self.installationID = installationID
self.inboxID = inboxID
Expand Down
2 changes: 1 addition & 1 deletion Sources/XMTPiOS/Libxmtp/Message.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public struct Message: Identifiable {
do {
return try decode()
} catch {
print("MESSAGE_V3: discarding message that failed to decode", error)
print("MESSAGE: discarding message that failed to decode", error)
return nil
}
}
Expand Down

0 comments on commit 1862832

Please sign in to comment.