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

Remove cocoapod dependencies #425

Merged
merged 18 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 .github/workflows/deploy_to_cocoapods.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build:
runs-on: macos-12
runs-on: macos-13

steps:
- uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: macos-12
runs-on: macos-13
steps:
- uses: actions/checkout@v3

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ on:
jobs:
build:
name: Run swiftlint
runs-on: macos-12
runs-on: macos-13
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
xcode-version: '14'
- uses: actions/checkout@v3
- run: swiftlint Sources/ XMTPiOSExample/XMTPiOSExample
- run: pod lib lint --allow-warnings
124 changes: 26 additions & 98 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,57 +1,39 @@
{
"pins" : [
{
"identity" : "bigint",
"kind" : "remoteSourceControl",
"location" : "https://github.com/attaswift/BigInt",
"state" : {
"revision" : "793a7fac0bfc318e85994bf6900652e827aef33e",
"version" : "5.4.1"
}
},
{
"identity" : "connect-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/bufbuild/connect-swift",
"state" : {
"revision" : "1701d3d1b2c4c63fcccfd7094f86a88672fa5acb",
"version" : "0.12.0"
}
},
{
"identity" : "generic-json-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/iwill/generic-json-swift",
"state" : {
"revision" : "0a06575f4038b504e78ac330913d920f1630f510",
"version" : "2.0.2"
"revision" : "a8c984a1077f78e94e0884c5c11683a7f684f92c",
"version" : "1.0.0"
}
},
{
"identity" : "gzipswift",
"identity" : "cryptoswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/1024jp/GzipSwift",
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
"state" : {
"revision" : "7a7f17761c76a932662ab77028a4329f67d645a4",
"version" : "5.2.0"
"revision" : "678d442c6f7828def400a70ae15968aef67ef52d",
"version" : "1.8.3"
}
},
{
"identity" : "libxmtp-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/xmtp/libxmtp-swift.git",
"state" : {
"revision" : "abd4f896f539e5bb090c85022177d775ad08dcb1",
"version" : "0.5.8-beta4"
"revision" : "f495d4feaab40a0a6a48c1d5a99585de8107f5d2",
"version" : "3.0.1"
}
},
{
"identity" : "secp256k1.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/GigaBitcoin/secp256k1.swift.git",
"location" : "https://github.com/Boilertalk/secp256k1.swift.git",
"state" : {
"revision" : "48fb20fce4ca3aad89180448a127d5bc16f0e44c",
"version" : "0.10.0"
"revision" : "cd187c632fb812fd93711a9f7e644adb7e5f97f0",
"version" : "0.1.7"
}
},
{
Expand All @@ -68,125 +50,71 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "3d2dc41a01f9e49d84f0a3925fb858bed64f702d",
"version" : "1.1.2"
"revision" : "671108c96644956dddcd89dd59c203dcdb36cec7",
"version" : "1.1.4"
}
},
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-plugin.git",
"state" : {
"revision" : "26ac5758409154cc448d7ab82389c520fa8a8247",
"version" : "1.3.0"
"revision" : "85e4bb4e1cd62cec64a4b8e769dcefdf0c5b9d64",
"version" : "1.4.3"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-symbolkit",
"location" : "https://github.com/swiftlang/swift-docc-symbolkit",
"state" : {
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
},
{
"identity" : "swift-http-types",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-types",
"state" : {
"revision" : "1ddbea1ee34354a6a2532c60f98501c35ae8edfa",
"version" : "1.2.0"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
"version" : "1.6.1"
}
},
{
"identity" : "swift-nio",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "fc79798d5a150d61361a27ce0c51169b889e23de",
"version" : "2.68.0"
}
},
{
"identity" : "swift-nio-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-extras.git",
"state" : {
"revision" : "05c36b57453d23ea63785d58a7dbc7b70ba1745e",
"version" : "1.23.0"
"revision" : "914081701062b11e3bb9e21accc379822621995e",
"version" : "2.76.1"
}
},
{
"identity" : "swift-nio-http2",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-http2.git",
"state" : {
"revision" : "a0224f3d20438635dd59c9fcc593520d80d131d0",
"version" : "1.33.0"
"revision" : "eaa71bb6ae082eee5a07407b1ad0cbd8f48f9dca",
"version" : "1.34.1"
}
},
{
"identity" : "swift-nio-ssl",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-ssl.git",
"state" : {
"revision" : "2b09805797f21c380f7dc9bedaab3157c5508efb",
"version" : "2.27.0"
}
},
{
"identity" : "swift-nio-transport-services",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-transport-services.git",
"state" : {
"revision" : "38ac8221dd20674682148d6451367f89c2652980",
"version" : "1.21.0"
"revision" : "c7e95421334b1068490b5d41314a50e70bab23d1",
"version" : "2.29.0"
}
},
{
"identity" : "swift-protobuf",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "d57a5aecf24a25b32ec4a74be2f5d0a995a47c4b",
"version" : "1.27.0"
"revision" : "ebc7251dd5b37f627c93698e4374084d98409633",
"version" : "1.28.2"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"state" : {
"revision" : "6a9e38e7bd22a3b8ba80bddf395623cf68f57807",
"version" : "1.3.1"
}
},
{
"identity" : "web3.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/argentlabs/web3.swift",
"state" : {
"revision" : "1e75f98a5738c470b23bbfffa9314e9f788df76b",
"version" : "1.6.1"
}
},
{
"identity" : "websocket-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/websocket-kit.git",
"state" : {
"revision" : "4232d34efa49f633ba61afde365d3896fc7f8740",
"version" : "2.15.0"
"revision" : "c8a44d836fe7913603e246acab7c528c2e780168",
"version" : "1.4.0"
}
}
],
Expand Down
21 changes: 7 additions & 14 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ let package = Package(
name: "XMTPiOS",
platforms: [.iOS(.v14), .macOS(.v11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "XMTPiOS",
targets: ["XMTPiOS"]
Expand All @@ -18,26 +17,20 @@ let package = Package(
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/GigaBitcoin/secp256k1.swift.git", exact: "0.10.0"),
.package(url: "https://github.com/argentlabs/web3.swift", from: "1.1.0"),
.package(url: "https://github.com/1024jp/GzipSwift", from: "5.2.0"),
.package(url: "https://github.com/bufbuild/connect-swift", exact: "0.12.0"),
.package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.0.0"),
.package(url: "https://github.com/tesseract-one/CSecp256k1.swift.git", from: "0.2.0"),
.package(url: "https://github.com/bufbuild/connect-swift", exact: "1.0.0"),
.package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.4.3"),
.package(url: "https://github.com/xmtp/libxmtp-swift.git", exact: "3.0.3"),
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", exact: "1.8.3")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "XMTPiOS",
dependencies: [
.product(name: "secp256k1", package: "secp256k1.swift"),
"web3.swift",
.product(name: "Gzip", package: "GzipSwift"),
.product(name: "CSecp256k1", package: "CSecp256k1.swift"),
.product(name: "Connect", package: "connect-swift"),
.product(name: "LibXMTP", package: "libxmtp-swift")
.product(name: "LibXMTP", package: "libxmtp-swift"),
.product(name: "CryptoSwift", package: "CryptoSwift")
]
),
.target(
Expand Down
1 change: 0 additions & 1 deletion Sources/XMTPTestHelpers/TestHelpers.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#if canImport(XCTest)
import Combine
import CryptoKit
import XCTest
@testable import XMTPiOS
import LibXMTP
Expand Down
1 change: 0 additions & 1 deletion Sources/XMTPiOS/Client.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Foundation
import LibXMTP
import web3

public typealias PreEventCallback = () async throws -> Void

Expand Down
19 changes: 16 additions & 3 deletions Sources/XMTPiOS/Codecs/ContentCodec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ extension EncodedContent {
copy.compression = .gzip
}

copy.content = try compression.compress(content: content)
if let compressedContent = compression.compress(content: content) {
copy.content = compressedContent
} else {
throw CodecError.invalidContent
}

return copy
}
Expand All @@ -54,15 +58,24 @@ extension EncodedContent {

switch compression {
case .gzip:
copy.content = try EncodedContentCompression.gzip.decompress(content: content)
if let decompressedContent = EncodedContentCompression.gzip.decompress(content: content) {
copy.content = decompressedContent
} else {
throw CodecError.invalidContent
}
case .deflate:
copy.content = try EncodedContentCompression.deflate.decompress(content: content)
if let decompressedContent = EncodedContentCompression.deflate.decompress(content: content) {
copy.content = decompressedContent
} else {
throw CodecError.invalidContent
}
default:
return copy
}

return copy
}

}

public protocol ContentCodec: Hashable, Equatable {
Expand Down
15 changes: 2 additions & 13 deletions Sources/XMTPiOS/Codecs/RemoteAttachmentCodec.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
//
// RemoteAttachmentCodec.swift
//
//
// Created by Pat Nakajima on 2/19/23.
//

import CryptoKit
import CryptoSwift
import Foundation
import web3

public let ContentTypeRemoteAttachment = ContentTypeID(authorityID: "xmtp.org", typeID: "remoteStaticAttachment", versionMajor: 1, versionMinor: 0)

Expand Down Expand Up @@ -217,11 +210,7 @@ public struct RemoteAttachmentCodec: ContentCodec {
throw RemoteAttachmentError.invalidParameters("missing \(name) parameter")
}

guard let parameterData = parameterHex.web3.hexData else {
throw RemoteAttachmentError.invalidParameters("invalid \(name) value")
}

return Data(parameterData)
return Data(parameterHex.hexToData)
}

public func shouldPush(content: RemoteAttachment) throws -> Bool {
Expand Down
4 changes: 0 additions & 4 deletions Sources/XMTPiOS/Crypto.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//
// Crypto.swift
//

import CryptoKit
import Foundation

Expand Down
Loading
Loading