From 16b725829f3accbc9edee294f3e375f5f54564bb Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Mon, 17 Jul 2023 19:51:38 -0700 Subject: [PATCH 1/4] add app version --- Sources/XMTP/ApiClient.swift | 14 ++++++++------ Sources/XMTP/Client.swift | 8 ++++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Sources/XMTP/ApiClient.swift b/Sources/XMTP/ApiClient.swift index 07c7a69d..f89cc281 100644 --- a/Sources/XMTP/ApiClient.swift +++ b/Sources/XMTP/ApiClient.swift @@ -27,7 +27,7 @@ public enum ApiClientError: Error { protocol ApiClient { var environment: XMTPEnvironment { get } - init(environment: XMTPEnvironment, secure: Bool, rustClient: XMTPRust.RustClient) throws + init(environment: XMTPEnvironment, secure: Bool, rustClient: XMTPRust.RustClient, appVersion: String?) throws func setAuthToken(_ token: String) func batchQuery(request: BatchQueryRequest) async throws -> BatchQueryResponse func query(topic: String, pagination: Pagination?, cursor: Xmtp_MessageApi_V1_Cursor?) async throws -> QueryResponse @@ -67,10 +67,12 @@ class GRPCApiClient: ApiClient { var authToken = "" var rustClient: XMTPRust.RustClient + var appVersion: String - required init(environment: XMTPEnvironment, secure _: Bool = true, rustClient: XMTPRust.RustClient) throws { + required init(environment: XMTPEnvironment, secure _: Bool = true, rustClient: XMTPRust.RustClient, appVersion: String? = nil) throws { self.environment = environment self.rustClient = rustClient + self.appVersion = appVersion ?? "0.0.0" } static func envToUrl(env: XMTPEnvironment) -> String { @@ -88,7 +90,7 @@ class GRPCApiClient: ApiClient { func batchQuery(request: BatchQueryRequest) async throws -> BatchQueryResponse { do { let req = RustVec(try request.serializedData()) - let res: RustVec = try await rustClient.batch_query(req) + let res: RustVec = try await rustClient.batch_query(req, appVersion.intoRustString()) return try BatchQueryResponse(serializedData: Data(res)) } catch let error as RustString { throw ApiClientError.batchQueryError(error.toString()) @@ -98,7 +100,7 @@ class GRPCApiClient: ApiClient { func query(request: QueryRequest) async throws -> QueryResponse { do { let req = RustVec(try request.serializedData()) - let res: RustVec = try await rustClient.query(req) + let res: RustVec = try await rustClient.query(req, appVersion.intoRustString()) return try QueryResponse(serializedData: Data(res)) } catch let error as RustString { throw ApiClientError.queryError(error.toString()) @@ -136,7 +138,7 @@ class GRPCApiClient: ApiClient { let request = SubscribeRequest.with { $0.contentTopics = topics } let req = RustVec(try request.serializedData()) do { - let subscription = try await self.rustClient.subscribe(req) + let subscription = try await self.rustClient.subscribe(req, appVersion.intoRustString()) // Run a continuous for loop polling and sleeping for a bit each loop. while true { let buf = try subscription.get_envelopes_as_query_response() @@ -157,7 +159,7 @@ class GRPCApiClient: ApiClient { func publish(request: PublishRequest) async throws -> PublishResponse { do { let req = RustVec(try request.serializedData()) - let res: RustVec = try await rustClient.publish(authToken.intoRustString(), req) + let res: RustVec = try await rustClient.publish(authToken.intoRustString(), req, appVersion.intoRustString()) return try PublishResponse(serializedData: Data(res)) } catch let error as RustString { throw ApiClientError.publishError(error.toString()) diff --git a/Sources/XMTP/Client.swift b/Sources/XMTP/Client.swift index 6a51664c..51df4132 100644 --- a/Sources/XMTP/Client.swift +++ b/Sources/XMTP/Client.swift @@ -20,12 +20,16 @@ public struct ClientOptions { /// Specify which XMTP network to connect to. Defaults to ``.dev`` public var env: XMTPEnvironment = .dev - /// Specify whether the API client should use TLS security. In general this should only be false when using the `.local` environment. + /// Optional: Specify self-reported version e.g. XMTPInbox/v1.0.0. public var isSecure: Bool = true + + /// Specify whether the API client should use TLS security. In general this should only be false when using the `.local` environment. + public var appVersion: String? = nil - public init(env: XMTPEnvironment = .dev, isSecure: Bool = true) { + public init(env: XMTPEnvironment = .dev, isSecure: Bool = true, appVersion: String? = nil) { self.env = env self.isSecure = isSecure + self.appVersion = appVersion } } From 4ae160ce72c8eaaf01a7bc6899893298843291de Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Fri, 21 Jul 2023 16:55:10 -0700 Subject: [PATCH 2/4] update the sdk to point at the new rust code --- Package.swift | 2 +- Sources/XMTP/ApiClient.swift | 12 ++- XMTP.podspec | 4 +- XMTPiOSExample/Podfile.lock | 2 +- .../XMTPiOSExample.xcodeproj/project.pbxproj | 84 ++++++++++++++++++- .../xcshareddata/swiftpm/Package.resolved | 4 +- 6 files changed, 95 insertions(+), 13 deletions(-) diff --git a/Package.swift b/Package.swift index 7ae21f68..7c10ff07 100644 --- a/Package.swift +++ b/Package.swift @@ -26,7 +26,7 @@ let package = Package( .package(url: "https://github.com/1024jp/GzipSwift", from: "5.2.0"), .package(url: "https://github.com/bufbuild/connect-swift", from: "0.3.0"), .package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.0.0"), - .package(url: "https://github.com/xmtp/xmtp-rust-swift", from: "0.3.0-beta0"), + .package(url: "https://github.com/xmtp/xmtp-rust-swift", from: "0.3.1-beta0"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. diff --git a/Sources/XMTP/ApiClient.swift b/Sources/XMTP/ApiClient.swift index f89cc281..44c69b4c 100644 --- a/Sources/XMTP/ApiClient.swift +++ b/Sources/XMTP/ApiClient.swift @@ -89,8 +89,9 @@ class GRPCApiClient: ApiClient { func batchQuery(request: BatchQueryRequest) async throws -> BatchQueryResponse { do { + rustClient.set_app_version(appVersion.intoRustString()) let req = RustVec(try request.serializedData()) - let res: RustVec = try await rustClient.batch_query(req, appVersion.intoRustString()) + let res: RustVec = try await rustClient.batch_query(req) return try BatchQueryResponse(serializedData: Data(res)) } catch let error as RustString { throw ApiClientError.batchQueryError(error.toString()) @@ -99,8 +100,9 @@ class GRPCApiClient: ApiClient { func query(request: QueryRequest) async throws -> QueryResponse { do { + rustClient.set_app_version(appVersion.intoRustString()) let req = RustVec(try request.serializedData()) - let res: RustVec = try await rustClient.query(req, appVersion.intoRustString()) + let res: RustVec = try await rustClient.query(req) return try QueryResponse(serializedData: Data(res)) } catch let error as RustString { throw ApiClientError.queryError(error.toString()) @@ -135,10 +137,11 @@ class GRPCApiClient: ApiClient { func subscribe(topics: [String]) -> AsyncThrowingStream { return AsyncThrowingStream { continuation in Task { + rustClient.set_app_version(appVersion.intoRustString()) let request = SubscribeRequest.with { $0.contentTopics = topics } let req = RustVec(try request.serializedData()) do { - let subscription = try await self.rustClient.subscribe(req, appVersion.intoRustString()) + let subscription = try await self.rustClient.subscribe(req) // Run a continuous for loop polling and sleeping for a bit each loop. while true { let buf = try subscription.get_envelopes_as_query_response() @@ -158,8 +161,9 @@ class GRPCApiClient: ApiClient { func publish(request: PublishRequest) async throws -> PublishResponse { do { + rustClient.set_app_version(appVersion.intoRustString()) let req = RustVec(try request.serializedData()) - let res: RustVec = try await rustClient.publish(authToken.intoRustString(), req, appVersion.intoRustString()) + let res: RustVec = try await rustClient.publish(authToken.intoRustString(), req) return try PublishResponse(serializedData: Data(res)) } catch let error as RustString { throw ApiClientError.publishError(error.toString()) diff --git a/XMTP.podspec b/XMTP.podspec index eea046f5..124e0b83 100644 --- a/XMTP.podspec +++ b/XMTP.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |spec| # spec.name = "XMTP" - spec.version = "0.4.0-alpha0" + spec.version = "0.4.1-alpha0" spec.summary = "XMTP SDK Cocoapod" # This description is used to generate tags and improve search results. @@ -44,7 +44,7 @@ Pod::Spec.new do |spec| spec.dependency "web3.swift" spec.dependency "GzipSwift" spec.dependency "Connect-Swift" - spec.dependency 'XMTPRust', '= 0.3.0-beta0' + spec.dependency 'XMTPRust', '= 0.3.1-beta0' spec.xcconfig = {'VALID_ARCHS' => 'arm64' } end diff --git a/XMTPiOSExample/Podfile.lock b/XMTPiOSExample/Podfile.lock index 76b699fe..b0956012 100644 --- a/XMTPiOSExample/Podfile.lock +++ b/XMTPiOSExample/Podfile.lock @@ -1,3 +1,3 @@ PODFILE CHECKSUM: e82385142d41677b470dd3362d25b239b9c3621c -COCOAPODS: 1.12.0 +COCOAPODS: 1.12.1 diff --git a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.pbxproj b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.pbxproj index 07367f28..17cffdd7 100644 --- a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.pbxproj +++ b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.pbxproj @@ -7,7 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + 39CA3CF54A5170EE01D74602 /* Pods_NotificationService.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5615F34D8FC7214EE880CEE /* Pods_NotificationService.framework */; }; 6AEE396E29F330CD0027B657 /* secp256k1 in Frameworks */ = {isa = PBXBuildFile; productRef = 6AEE396D29F330CD0027B657 /* secp256k1 */; }; + 888112F913DABB634CF4CC10 /* Pods_XMTPiOSExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAAD8A94269C8987D6D62860 /* Pods_XMTPiOSExample.framework */; }; A60FC8BF293AD054001697E3 /* MessageComposerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A60FC8BE293AD054001697E3 /* MessageComposerView.swift */; }; A60FC8C1293AD171001697E3 /* ConversationDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A60FC8C0293AD171001697E3 /* ConversationDetailView.swift */; }; A60FC8C3293AD18A001697E3 /* PreviewClientProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = A60FC8C2293AD18A001697E3 /* PreviewClientProvider.swift */; }; @@ -61,6 +63,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 60B0DA9DAE62272EF03E8015 /* Pods-NotificationService.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.debug.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.debug.xcconfig"; sourceTree = ""; }; + 6289A84B01C98FAA4AF8C5EC /* Pods-NotificationService.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.release.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.release.xcconfig"; sourceTree = ""; }; + 9CEAF93B004EFF39D22744A5 /* Pods-XMTPiOSExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XMTPiOSExample.release.xcconfig"; path = "Target Support Files/Pods-XMTPiOSExample/Pods-XMTPiOSExample.release.xcconfig"; sourceTree = ""; }; + A5615F34D8FC7214EE880CEE /* Pods_NotificationService.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NotificationService.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A60FC8BE293AD054001697E3 /* MessageComposerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageComposerView.swift; sourceTree = ""; }; A60FC8C0293AD171001697E3 /* ConversationDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationDetailView.swift; sourceTree = ""; }; A60FC8C2293AD18A001697E3 /* PreviewClientProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewClientProvider.swift; sourceTree = ""; }; @@ -85,6 +91,8 @@ A6AE518B297B61C8006FDD0F /* NotificationService.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotificationService.entitlements; sourceTree = ""; }; A6AE518C297B6210006FDD0F /* NotificationService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = ""; }; A6D192CF293A7B97006B49F2 /* ConversationListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationListView.swift; sourceTree = ""; }; + AAAD8A94269C8987D6D62860 /* Pods_XMTPiOSExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_XMTPiOSExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B44173199E60C89BCA87D59C /* Pods-XMTPiOSExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XMTPiOSExample.debug.xcconfig"; path = "Target Support Files/Pods-XMTPiOSExample/Pods-XMTPiOSExample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -96,6 +104,7 @@ 6AEE396E29F330CD0027B657 /* secp256k1 in Frameworks */, A69F33C6292DC992005A5556 /* XMTP in Frameworks */, A65F070A297B5E8600C3C76E /* KeychainAccess in Frameworks */, + 888112F913DABB634CF4CC10 /* Pods_XMTPiOSExample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -105,12 +114,25 @@ files = ( A6AE5194297B62C8006FDD0F /* KeychainAccess in Frameworks */, A6AE5191297B625F006FDD0F /* XMTP in Frameworks */, + 39CA3CF54A5170EE01D74602 /* Pods_NotificationService.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 8161EE1C173B9E587116B58D /* Pods */ = { + isa = PBXGroup; + children = ( + 60B0DA9DAE62272EF03E8015 /* Pods-NotificationService.debug.xcconfig */, + 6289A84B01C98FAA4AF8C5EC /* Pods-NotificationService.release.xcconfig */, + B44173199E60C89BCA87D59C /* Pods-XMTPiOSExample.debug.xcconfig */, + 9CEAF93B004EFF39D22744A5 /* Pods-XMTPiOSExample.release.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; A6281986292DC825004B9117 = { isa = PBXGroup; children = ( @@ -119,6 +141,7 @@ A6AE5181297B61AE006FDD0F /* NotificationService */, A6281990292DC825004B9117 /* Products */, A69F33C4292DC992005A5556 /* Frameworks */, + 8161EE1C173B9E587116B58D /* Pods */, ); sourceTree = ""; }; @@ -168,6 +191,8 @@ A69F33C4292DC992005A5556 /* Frameworks */ = { isa = PBXGroup; children = ( + A5615F34D8FC7214EE880CEE /* Pods_NotificationService.framework */, + AAAD8A94269C8987D6D62860 /* Pods_XMTPiOSExample.framework */, ); name = Frameworks; sourceTree = ""; @@ -204,6 +229,7 @@ isa = PBXNativeTarget; buildConfigurationList = A628199E292DC826004B9117 /* Build configuration list for PBXNativeTarget "XMTPiOSExample" */; buildPhases = ( + 0CC0D1C814090A210E1D8CFF /* [CP] Check Pods Manifest.lock */, A628198B292DC825004B9117 /* Sources */, A628198C292DC825004B9117 /* Frameworks */, A628198D292DC825004B9117 /* Resources */, @@ -229,6 +255,7 @@ isa = PBXNativeTarget; buildConfigurationList = A6AE5188297B61AE006FDD0F /* Build configuration list for PBXNativeTarget "NotificationService" */; buildPhases = ( + 31157D7225665F6C1C46DF01 /* [CP] Check Pods Manifest.lock */, A6AE517C297B61AE006FDD0F /* Sources */, A6AE517D297B61AE006FDD0F /* Frameworks */, A6AE517E297B61AE006FDD0F /* Resources */, @@ -276,7 +303,7 @@ packageReferences = ( A65F0705297B5E7500C3C76E /* XCRemoteSwiftPackageReference "WalletConnectSwift" */, A65F0708297B5E8600C3C76E /* XCRemoteSwiftPackageReference "KeychainAccess" */, - 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift" */, + 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift.git" */, ); productRefGroup = A6281990292DC825004B9117 /* Products */; projectDirPath = ""; @@ -307,6 +334,53 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 0CC0D1C814090A210E1D8CFF /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-XMTPiOSExample-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 31157D7225665F6C1C46DF01 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-NotificationService-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ A628198B292DC825004B9117 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -462,6 +536,7 @@ }; A628199F292DC826004B9117 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B44173199E60C89BCA87D59C /* Pods-XMTPiOSExample.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -503,6 +578,7 @@ }; A62819A0292DC826004B9117 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 9CEAF93B004EFF39D22744A5 /* Pods-XMTPiOSExample.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -543,6 +619,7 @@ }; A6AE5189297B61AE006FDD0F /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 60B0DA9DAE62272EF03E8015 /* Pods-NotificationService.debug.xcconfig */; buildSettings = { CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements; CODE_SIGN_STYLE = Automatic; @@ -571,6 +648,7 @@ }; A6AE518A297B61AE006FDD0F /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 6289A84B01C98FAA4AF8C5EC /* Pods-NotificationService.release.xcconfig */; buildSettings = { CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements; CODE_SIGN_STYLE = Automatic; @@ -631,7 +709,7 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift" */ = { + 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift.git" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/GigaBitcoin/secp256k1.swift.git"; requirement = { @@ -660,7 +738,7 @@ /* Begin XCSwiftPackageProductDependency section */ 6AEE396D29F330CD0027B657 /* secp256k1 */ = { isa = XCSwiftPackageProductDependency; - package = 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift" */; + package = 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift.git" */; productName = secp256k1; }; A65F0706297B5E7600C3C76E /* WalletConnectSwift */ = { diff --git a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index e72c65df..6187659e 100644 --- a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -176,8 +176,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/xmtp/xmtp-rust-swift", "state" : { - "revision" : "41a1161cf06a86bab0aa886e450584a1191429b1", - "version" : "0.3.0-beta0" + "revision" : "4a76e5401fa780c40610e2f0d248f695261d08dd", + "version" : "0.3.1-beta0" } } ], From 1adab74cae1827890fd2682737fd01821010e1d5 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Fri, 21 Jul 2023 17:06:34 -0700 Subject: [PATCH 3/4] add it to the example app --- Sources/XMTPTestHelpers/TestHelpers.swift | 5 ++++- XMTPiOSExample/XMTPiOSExample/ContentView.swift | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/XMTPTestHelpers/TestHelpers.swift b/Sources/XMTPTestHelpers/TestHelpers.swift index 3f910677..d0f568af 100644 --- a/Sources/XMTPTestHelpers/TestHelpers.swift +++ b/Sources/XMTPTestHelpers/TestHelpers.swift @@ -87,6 +87,7 @@ public class FakeApiClient: ApiClient { public var environment: XMTPEnvironment public var authToken: String = "" + public var appVersion: String private var responses: [String: [XMTP.Envelope]] = [:] private var stream = FakeStreamHolder() public var published: [XMTP.Envelope] = [] @@ -119,6 +120,7 @@ public class FakeApiClient: ApiClient { public init() { environment = .local + appVersion = "test/0.0.0" } public func send(envelope: XMTP.Envelope) { @@ -135,8 +137,9 @@ public class FakeApiClient: ApiClient { // MARK: ApiClient conformance - public required init(environment: XMTP.XMTPEnvironment, secure _: Bool, rustClient _: XMTPRust.RustClient) throws { + public required init(environment: XMTP.XMTPEnvironment, secure _: Bool, rustClient _: XMTPRust.RustClient, appVersion: String?) throws { self.environment = environment + self.appVersion = appVersion ?? "0.0.0" } public func subscribe(topics: [String]) -> AsyncThrowingStream { diff --git a/XMTPiOSExample/XMTPiOSExample/ContentView.swift b/XMTPiOSExample/XMTPiOSExample/ContentView.swift index 00e6fea8..37818cdc 100644 --- a/XMTPiOSExample/XMTPiOSExample/ContentView.swift +++ b/XMTPiOSExample/XMTPiOSExample/ContentView.swift @@ -105,7 +105,7 @@ struct ContentView: View { Task { do { let wallet = try PrivateKey.generate() - let client = try await Client.create(account: wallet, options: .init(api: .init(env: .dev, isSecure: true))) + let client = try await Client.create(account: wallet, options: .init(api: .init(env: .dev, isSecure: true, appVersion: "XMTPTest/v1.0.0"))) let keysData = try client.privateKeyBundle.serializedData() Persistence().saveKeys(keysData) From 18f7781e83f6d0d7249413a159616d99bfdc0482 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Fri, 21 Jul 2023 17:08:29 -0700 Subject: [PATCH 4/4] remove file that shouldnt be committed --- .../XMTPiOSExample.xcodeproj/project.pbxproj | 84 +------------------ 1 file changed, 3 insertions(+), 81 deletions(-) diff --git a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.pbxproj b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.pbxproj index 17cffdd7..07367f28 100644 --- a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.pbxproj +++ b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.pbxproj @@ -7,9 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 39CA3CF54A5170EE01D74602 /* Pods_NotificationService.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5615F34D8FC7214EE880CEE /* Pods_NotificationService.framework */; }; 6AEE396E29F330CD0027B657 /* secp256k1 in Frameworks */ = {isa = PBXBuildFile; productRef = 6AEE396D29F330CD0027B657 /* secp256k1 */; }; - 888112F913DABB634CF4CC10 /* Pods_XMTPiOSExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAAD8A94269C8987D6D62860 /* Pods_XMTPiOSExample.framework */; }; A60FC8BF293AD054001697E3 /* MessageComposerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A60FC8BE293AD054001697E3 /* MessageComposerView.swift */; }; A60FC8C1293AD171001697E3 /* ConversationDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A60FC8C0293AD171001697E3 /* ConversationDetailView.swift */; }; A60FC8C3293AD18A001697E3 /* PreviewClientProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = A60FC8C2293AD18A001697E3 /* PreviewClientProvider.swift */; }; @@ -63,10 +61,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 60B0DA9DAE62272EF03E8015 /* Pods-NotificationService.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.debug.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.debug.xcconfig"; sourceTree = ""; }; - 6289A84B01C98FAA4AF8C5EC /* Pods-NotificationService.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.release.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.release.xcconfig"; sourceTree = ""; }; - 9CEAF93B004EFF39D22744A5 /* Pods-XMTPiOSExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XMTPiOSExample.release.xcconfig"; path = "Target Support Files/Pods-XMTPiOSExample/Pods-XMTPiOSExample.release.xcconfig"; sourceTree = ""; }; - A5615F34D8FC7214EE880CEE /* Pods_NotificationService.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NotificationService.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A60FC8BE293AD054001697E3 /* MessageComposerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageComposerView.swift; sourceTree = ""; }; A60FC8C0293AD171001697E3 /* ConversationDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationDetailView.swift; sourceTree = ""; }; A60FC8C2293AD18A001697E3 /* PreviewClientProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewClientProvider.swift; sourceTree = ""; }; @@ -91,8 +85,6 @@ A6AE518B297B61C8006FDD0F /* NotificationService.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotificationService.entitlements; sourceTree = ""; }; A6AE518C297B6210006FDD0F /* NotificationService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = ""; }; A6D192CF293A7B97006B49F2 /* ConversationListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationListView.swift; sourceTree = ""; }; - AAAD8A94269C8987D6D62860 /* Pods_XMTPiOSExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_XMTPiOSExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - B44173199E60C89BCA87D59C /* Pods-XMTPiOSExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XMTPiOSExample.debug.xcconfig"; path = "Target Support Files/Pods-XMTPiOSExample/Pods-XMTPiOSExample.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -104,7 +96,6 @@ 6AEE396E29F330CD0027B657 /* secp256k1 in Frameworks */, A69F33C6292DC992005A5556 /* XMTP in Frameworks */, A65F070A297B5E8600C3C76E /* KeychainAccess in Frameworks */, - 888112F913DABB634CF4CC10 /* Pods_XMTPiOSExample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -114,25 +105,12 @@ files = ( A6AE5194297B62C8006FDD0F /* KeychainAccess in Frameworks */, A6AE5191297B625F006FDD0F /* XMTP in Frameworks */, - 39CA3CF54A5170EE01D74602 /* Pods_NotificationService.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 8161EE1C173B9E587116B58D /* Pods */ = { - isa = PBXGroup; - children = ( - 60B0DA9DAE62272EF03E8015 /* Pods-NotificationService.debug.xcconfig */, - 6289A84B01C98FAA4AF8C5EC /* Pods-NotificationService.release.xcconfig */, - B44173199E60C89BCA87D59C /* Pods-XMTPiOSExample.debug.xcconfig */, - 9CEAF93B004EFF39D22744A5 /* Pods-XMTPiOSExample.release.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; A6281986292DC825004B9117 = { isa = PBXGroup; children = ( @@ -141,7 +119,6 @@ A6AE5181297B61AE006FDD0F /* NotificationService */, A6281990292DC825004B9117 /* Products */, A69F33C4292DC992005A5556 /* Frameworks */, - 8161EE1C173B9E587116B58D /* Pods */, ); sourceTree = ""; }; @@ -191,8 +168,6 @@ A69F33C4292DC992005A5556 /* Frameworks */ = { isa = PBXGroup; children = ( - A5615F34D8FC7214EE880CEE /* Pods_NotificationService.framework */, - AAAD8A94269C8987D6D62860 /* Pods_XMTPiOSExample.framework */, ); name = Frameworks; sourceTree = ""; @@ -229,7 +204,6 @@ isa = PBXNativeTarget; buildConfigurationList = A628199E292DC826004B9117 /* Build configuration list for PBXNativeTarget "XMTPiOSExample" */; buildPhases = ( - 0CC0D1C814090A210E1D8CFF /* [CP] Check Pods Manifest.lock */, A628198B292DC825004B9117 /* Sources */, A628198C292DC825004B9117 /* Frameworks */, A628198D292DC825004B9117 /* Resources */, @@ -255,7 +229,6 @@ isa = PBXNativeTarget; buildConfigurationList = A6AE5188297B61AE006FDD0F /* Build configuration list for PBXNativeTarget "NotificationService" */; buildPhases = ( - 31157D7225665F6C1C46DF01 /* [CP] Check Pods Manifest.lock */, A6AE517C297B61AE006FDD0F /* Sources */, A6AE517D297B61AE006FDD0F /* Frameworks */, A6AE517E297B61AE006FDD0F /* Resources */, @@ -303,7 +276,7 @@ packageReferences = ( A65F0705297B5E7500C3C76E /* XCRemoteSwiftPackageReference "WalletConnectSwift" */, A65F0708297B5E8600C3C76E /* XCRemoteSwiftPackageReference "KeychainAccess" */, - 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift.git" */, + 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift" */, ); productRefGroup = A6281990292DC825004B9117 /* Products */; projectDirPath = ""; @@ -334,53 +307,6 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 0CC0D1C814090A210E1D8CFF /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-XMTPiOSExample-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 31157D7225665F6C1C46DF01 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-NotificationService-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ A628198B292DC825004B9117 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -536,7 +462,6 @@ }; A628199F292DC826004B9117 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = B44173199E60C89BCA87D59C /* Pods-XMTPiOSExample.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -578,7 +503,6 @@ }; A62819A0292DC826004B9117 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9CEAF93B004EFF39D22744A5 /* Pods-XMTPiOSExample.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -619,7 +543,6 @@ }; A6AE5189297B61AE006FDD0F /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 60B0DA9DAE62272EF03E8015 /* Pods-NotificationService.debug.xcconfig */; buildSettings = { CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements; CODE_SIGN_STYLE = Automatic; @@ -648,7 +571,6 @@ }; A6AE518A297B61AE006FDD0F /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 6289A84B01C98FAA4AF8C5EC /* Pods-NotificationService.release.xcconfig */; buildSettings = { CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements; CODE_SIGN_STYLE = Automatic; @@ -709,7 +631,7 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift.git" */ = { + 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/GigaBitcoin/secp256k1.swift.git"; requirement = { @@ -738,7 +660,7 @@ /* Begin XCSwiftPackageProductDependency section */ 6AEE396D29F330CD0027B657 /* secp256k1 */ = { isa = XCSwiftPackageProductDependency; - package = 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift.git" */; + package = 6AEE396C29F330CD0027B657 /* XCRemoteSwiftPackageReference "secp256k1.swift" */; productName = secp256k1; }; A65F0706297B5E7600C3C76E /* WalletConnectSwift */ = {