Skip to content

Commit

Permalink
Merge pull request #51 from xmtp/cv/libxmtp-4a572e8
Browse files Browse the repository at this point in the history
Custom permissions on group create
  • Loading branch information
cameronvoell authored Jul 23, 2024
2 parents b9012ce + a4e1139 commit 1b49003
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
4 changes: 2 additions & 2 deletions LibXMTP.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'LibXMTP'
s.version = '0.5.6-beta0'
s.version = '0.5.6-beta1'
s.summary = 'XMTP shared Rust code that powers cross-platform SDKs'

s.homepage = 'https://github.com/xmtp/libxmtp-swift'
Expand All @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.platform = :ios, '14.0', :macos, '11.0'
s.swift_version = '5.3'

s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-9698552/LibXMTPSwiftFFI.zip", :type => :zip }
s.source = { :http => "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-4a572e8/LibXMTPSwiftFFI.zip", :type => :zip }
s.vendored_frameworks = 'LibXMTPSwiftFFI.xcframework'
s.source_files = 'Sources/LibXMTP/**/*'
end
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ let package = Package(
),
.binaryTarget(
name: "LibXMTPSwiftFFI",
url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-9698552/LibXMTPSwiftFFI.zip",
checksum: "114b0d8d2787b4f24bc89f977bc08fc4395a7f6d6b7cc7d9dcd0318bd0891b8f"
url: "https://github.com/xmtp/libxmtp/releases/download/swift-bindings-4a572e8/LibXMTPSwiftFFI.zip",
checksum: "92be1828b74f8c8d3d9fcac65f2ec694b626fc5cf979b55c196ca4cab9d22c4b"
),
.testTarget(name: "LibXMTPTests", dependencies: ["LibXMTP"]),
]
Expand Down
4 changes: 2 additions & 2 deletions Sources/LibXMTP/libxmtp-version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: d1cd7939
Version: 4a572e8a
Branch: main
Date: 2024-07-19 21:33:48 +0000
Date: 2024-07-23 15:16:12 +0000
33 changes: 31 additions & 2 deletions Sources/LibXMTP/xmtpv3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2399,15 +2399,17 @@ public struct FfiCreateGroupOptions {
public var groupImageUrlSquare: String?
public var groupDescription: String?
public var groupPinnedFrameUrl: String?
public var customPermissionPolicySet: FfiPermissionPolicySet?

// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(permissions: FfiGroupPermissionsOptions?, groupName: String?, groupImageUrlSquare: String?, groupDescription: String?, groupPinnedFrameUrl: String?) {
public init(permissions: FfiGroupPermissionsOptions?, groupName: String?, groupImageUrlSquare: String?, groupDescription: String?, groupPinnedFrameUrl: String?, customPermissionPolicySet: FfiPermissionPolicySet?) {
self.permissions = permissions
self.groupName = groupName
self.groupImageUrlSquare = groupImageUrlSquare
self.groupDescription = groupDescription
self.groupPinnedFrameUrl = groupPinnedFrameUrl
self.customPermissionPolicySet = customPermissionPolicySet
}
}

Expand All @@ -2428,6 +2430,9 @@ extension FfiCreateGroupOptions: Equatable, Hashable {
if lhs.groupPinnedFrameUrl != rhs.groupPinnedFrameUrl {
return false
}
if lhs.customPermissionPolicySet != rhs.customPermissionPolicySet {
return false
}
return true
}

Expand All @@ -2437,6 +2442,7 @@ extension FfiCreateGroupOptions: Equatable, Hashable {
hasher.combine(groupImageUrlSquare)
hasher.combine(groupDescription)
hasher.combine(groupPinnedFrameUrl)
hasher.combine(customPermissionPolicySet)
}
}

Expand All @@ -2448,7 +2454,8 @@ public struct FfiConverterTypeFfiCreateGroupOptions: FfiConverterRustBuffer {
groupName: FfiConverterOptionString.read(from: &buf),
groupImageUrlSquare: FfiConverterOptionString.read(from: &buf),
groupDescription: FfiConverterOptionString.read(from: &buf),
groupPinnedFrameUrl: FfiConverterOptionString.read(from: &buf)
groupPinnedFrameUrl: FfiConverterOptionString.read(from: &buf),
customPermissionPolicySet: FfiConverterOptionTypeFfiPermissionPolicySet.read(from: &buf)
)
}

Expand All @@ -2458,6 +2465,7 @@ public struct FfiConverterTypeFfiCreateGroupOptions: FfiConverterRustBuffer {
FfiConverterOptionString.write(value.groupImageUrlSquare, into: &buf)
FfiConverterOptionString.write(value.groupDescription, into: &buf)
FfiConverterOptionString.write(value.groupPinnedFrameUrl, into: &buf)
FfiConverterOptionTypeFfiPermissionPolicySet.write(value.customPermissionPolicySet, into: &buf)
}
}

Expand Down Expand Up @@ -4409,6 +4417,27 @@ private struct FfiConverterOptionTypeFfiPagingInfo: FfiConverterRustBuffer {
}
}

private struct FfiConverterOptionTypeFfiPermissionPolicySet: FfiConverterRustBuffer {
typealias SwiftType = FfiPermissionPolicySet?

public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
guard let value = value else {
writeInt(&buf, Int8(0))
return
}
writeInt(&buf, Int8(1))
FfiConverterTypeFfiPermissionPolicySet.write(value, into: &buf)
}

public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
switch try readInt(&buf) as Int8 {
case 0: return nil
case 1: return try FfiConverterTypeFfiPermissionPolicySet.read(from: &buf)
default: throw UniffiInternalError.unexpectedOptionalTag
}
}
}

private struct FfiConverterOptionTypeFfiDeliveryStatus: FfiConverterRustBuffer {
typealias SwiftType = FfiDeliveryStatus?

Expand Down

0 comments on commit 1b49003

Please sign in to comment.