diff --git a/Frameworks/Bindings.txt b/Frameworks/Bindings.txt index 38f1055fcd434f0facef06268d75084a2f223620..e77b06d527dadbc6d73073897cc37beb65f704bd 100644 --- a/Frameworks/Bindings.txt +++ b/Frameworks/Bindings.txt @@ -1,4 +1,4 @@ -https://git.xx.network/elixxir/client/-/commit/d6f371bde264c048c9e2ceab5cbad0b973eefe81 +https://git.xx.network/elixxir/client/-/commit/2deedc730bbe8ff3a0888c666cdb096bdda56663 go version go1.17.13 darwin/arm64 Xcode 14.0 Build version 14A309 gomobile bind target: ios,iossimulator,macos diff --git a/Frameworks/Bindings.xcframework/Info.plist b/Frameworks/Bindings.xcframework/Info.plist index 1e6b67e7e5ab26303902b1288f432c61b61a6f28..43fe32dad94767ae305b61db56f5604f8612617e 100644 --- a/Frameworks/Bindings.xcframework/Info.plist +++ b/Frameworks/Bindings.xcframework/Info.plist @@ -6,15 +6,16 @@ <array> <dict> <key>LibraryIdentifier</key> - <string>ios-arm64</string> + <string>macos-arm64_x86_64</string> <key>LibraryPath</key> <string>Bindings.framework</string> <key>SupportedArchitectures</key> <array> <string>arm64</string> + <string>x86_64</string> </array> <key>SupportedPlatform</key> - <string>ios</string> + <string>macos</string> </dict> <dict> <key>LibraryIdentifier</key> @@ -33,16 +34,15 @@ </dict> <dict> <key>LibraryIdentifier</key> - <string>macos-arm64_x86_64</string> + <string>ios-arm64</string> <key>LibraryPath</key> <string>Bindings.framework</string> <key>SupportedArchitectures</key> <array> <string>arm64</string> - <string>x86_64</string> </array> <key>SupportedPlatform</key> - <string>macos</string> + <string>ios</string> </dict> </array> <key>CFBundlePackageType</key> diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings index 1d7e6e806517a62b5137bcd181a4885e089f66c7..028698e78d12ebe96e4ffd2d7e8e5ed848493dc9 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h index 389f151c7e4a79dad00bdf7799c1c6cb88fcafec..8a469e985c895f732191ca1be50728da7528d8e3 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h @@ -1239,11 +1239,6 @@ Example JSON [group.Membership] return: * GetName returns the name set by the user for the group. */ - (NSData* _Nullable)getName; -/** - * GetTrackedID returns the tracked ID of the Group object. This is used by the -backend tracker. - */ -- (long)getTrackedID; /** * Serialize serializes the Group. */ @@ -1291,10 +1286,10 @@ If an error is returned, handle it properly first; you may then retry later with the same trackedGroupId. Parameters: - - trackedGroupId - the ID to retrieve the Group object within the backend's - tracking system. This is received by GroupRequest.Callback. + - serializedGroupData - the result of calling Group.Serialize() on + any Group object returned over the bindings */ -- (BOOL)joinGroup:(long)trackedGroupId error:(NSError* _Nullable* _Nullable)error; +- (BOOL)joinGroup:(NSData* _Nullable)serializedGroupData error:(NSError* _Nullable* _Nullable)error; /** * LeaveGroup deletes a group so a user no longer has access. @@ -1865,6 +1860,12 @@ Returns */ FOUNDATION_EXPORT NSString* _Nonnull BindingsCreateUserFriendlyErrorMessage(NSString* _Nullable errStr); +/** + * DeserializeGroup converts the results of Group.Serialize() into a Group +so that its methods can be called. + */ +FOUNDATION_EXPORT BindingsGroup* _Nullable BindingsDeserializeGroup(NSData* _Nullable serializedGroupData, NSError* _Nullable* _Nullable error); + /** * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. The NDF is processed into a protobuf containing a signature that is verified @@ -2564,7 +2565,7 @@ The decryptedMessage field will be a JSON marshalled GroupChatMessage. * GroupRequest is a bindings-layer interface that handles a group reception. Parameters: - - trackedGroupId - a bindings layer Group object. + - g - a bindings layer Group object. */ @interface BindingsGroupRequest : NSObject <goSeqRefInterface, BindingsGroupRequest> { } diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings index 557c80c4a0e93a5be2e13626c0ea8d4d8c970b94..42059901ccb6235d86e772871181ef017f1f7121 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h index 389f151c7e4a79dad00bdf7799c1c6cb88fcafec..8a469e985c895f732191ca1be50728da7528d8e3 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h @@ -1239,11 +1239,6 @@ Example JSON [group.Membership] return: * GetName returns the name set by the user for the group. */ - (NSData* _Nullable)getName; -/** - * GetTrackedID returns the tracked ID of the Group object. This is used by the -backend tracker. - */ -- (long)getTrackedID; /** * Serialize serializes the Group. */ @@ -1291,10 +1286,10 @@ If an error is returned, handle it properly first; you may then retry later with the same trackedGroupId. Parameters: - - trackedGroupId - the ID to retrieve the Group object within the backend's - tracking system. This is received by GroupRequest.Callback. + - serializedGroupData - the result of calling Group.Serialize() on + any Group object returned over the bindings */ -- (BOOL)joinGroup:(long)trackedGroupId error:(NSError* _Nullable* _Nullable)error; +- (BOOL)joinGroup:(NSData* _Nullable)serializedGroupData error:(NSError* _Nullable* _Nullable)error; /** * LeaveGroup deletes a group so a user no longer has access. @@ -1865,6 +1860,12 @@ Returns */ FOUNDATION_EXPORT NSString* _Nonnull BindingsCreateUserFriendlyErrorMessage(NSString* _Nullable errStr); +/** + * DeserializeGroup converts the results of Group.Serialize() into a Group +so that its methods can be called. + */ +FOUNDATION_EXPORT BindingsGroup* _Nullable BindingsDeserializeGroup(NSData* _Nullable serializedGroupData, NSError* _Nullable* _Nullable error); + /** * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. The NDF is processed into a protobuf containing a signature that is verified @@ -2564,7 +2565,7 @@ The decryptedMessage field will be a JSON marshalled GroupChatMessage. * GroupRequest is a bindings-layer interface that handles a group reception. Parameters: - - trackedGroupId - a bindings layer Group object. + - g - a bindings layer Group object. */ @interface BindingsGroupRequest : NSObject <goSeqRefInterface, BindingsGroupRequest> { } diff --git a/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Bindings b/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Bindings index ff9e3a6be9272589f98bab355e0ed41892d04784..e4308e494b7c1c9233d1e4b05c6c458b2c055b14 100644 Binary files a/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Bindings and b/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Bindings differ diff --git a/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Headers/Bindings.objc.h index 389f151c7e4a79dad00bdf7799c1c6cb88fcafec..8a469e985c895f732191ca1be50728da7528d8e3 100644 --- a/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/macos-arm64_x86_64/Bindings.framework/Versions/A/Headers/Bindings.objc.h @@ -1239,11 +1239,6 @@ Example JSON [group.Membership] return: * GetName returns the name set by the user for the group. */ - (NSData* _Nullable)getName; -/** - * GetTrackedID returns the tracked ID of the Group object. This is used by the -backend tracker. - */ -- (long)getTrackedID; /** * Serialize serializes the Group. */ @@ -1291,10 +1286,10 @@ If an error is returned, handle it properly first; you may then retry later with the same trackedGroupId. Parameters: - - trackedGroupId - the ID to retrieve the Group object within the backend's - tracking system. This is received by GroupRequest.Callback. + - serializedGroupData - the result of calling Group.Serialize() on + any Group object returned over the bindings */ -- (BOOL)joinGroup:(long)trackedGroupId error:(NSError* _Nullable* _Nullable)error; +- (BOOL)joinGroup:(NSData* _Nullable)serializedGroupData error:(NSError* _Nullable* _Nullable)error; /** * LeaveGroup deletes a group so a user no longer has access. @@ -1865,6 +1860,12 @@ Returns */ FOUNDATION_EXPORT NSString* _Nonnull BindingsCreateUserFriendlyErrorMessage(NSString* _Nullable errStr); +/** + * DeserializeGroup converts the results of Group.Serialize() into a Group +so that its methods can be called. + */ +FOUNDATION_EXPORT BindingsGroup* _Nullable BindingsDeserializeGroup(NSData* _Nullable serializedGroupData, NSError* _Nullable* _Nullable error); + /** * DownloadAndVerifySignedNdfWithUrl retrieves the NDF from a specified URL. The NDF is processed into a protobuf containing a signature that is verified @@ -2564,7 +2565,7 @@ The decryptedMessage field will be a JSON marshalled GroupChatMessage. * GroupRequest is a bindings-layer interface that handles a group reception. Parameters: - - trackedGroupId - a bindings layer Group object. + - g - a bindings layer Group object. */ @interface BindingsGroupRequest : NSObject <goSeqRefInterface, BindingsGroupRequest> { } diff --git a/Sources/XXClient/Functions/DeserializeGroup.swift b/Sources/XXClient/Functions/DeserializeGroup.swift new file mode 100644 index 0000000000000000000000000000000000000000..f117051a68fe9fcfdb85f90e3c64d753ccc379e6 --- /dev/null +++ b/Sources/XXClient/Functions/DeserializeGroup.swift @@ -0,0 +1,32 @@ +import Bindings +import XCTestDynamicOverlay + +public struct DeserializeGroup { + public var run: (Data) throws -> Group + + public func callAsFunction(_ serializedGroupData: Data) throws -> Group { + try run(serializedGroupData) + } +} + +extension DeserializeGroup { + public static func live() -> DeserializeGroup { + DeserializeGroup { serializedGroupData in + var error: NSError? + let bindingsGroup = BindingsDeserializeGroup(serializedGroupData, &error) + if let error = error { + throw error + } + guard let bindingsGroup = bindingsGroup else { + fatalError("BindingsDeserializeGroup returned `nil` without providing error") + } + return .live(bindingsGroup) + } + } +} + +extension DeserializeGroup { + public static let unimplemented = DeserializeGroup( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/XXClient/Group/Functions/GroupGetTrackedId.swift b/Sources/XXClient/Group/Functions/GroupGetTrackedId.swift deleted file mode 100644 index f70d682b8f00bda85c5cdfee599ccce6ecc4b2a8..0000000000000000000000000000000000000000 --- a/Sources/XXClient/Group/Functions/GroupGetTrackedId.swift +++ /dev/null @@ -1,22 +0,0 @@ -import Bindings -import XCTestDynamicOverlay - -public struct GroupGetTrackedId { - public var run: () -> Int - - public func callAsFunction() -> Int { - run() - } -} - -extension GroupGetTrackedId { - public static func live(_ bindingsGroup: BindingsGroup) -> GroupGetTrackedId { - GroupGetTrackedId(run: bindingsGroup.getTrackedID) - } -} - -extension GroupGetTrackedId { - public static let unimplemented = GroupGetTrackedId( - run: XCTUnimplemented("\(Self.self)", placeholder: 0) - ) -} diff --git a/Sources/XXClient/Group/Group.swift b/Sources/XXClient/Group/Group.swift index 25723dbab131acc9a361ad47cbb944a1a131e12d..5542ee09b57532015ab2f5141501a019dc1bbb8e 100644 --- a/Sources/XXClient/Group/Group.swift +++ b/Sources/XXClient/Group/Group.swift @@ -7,7 +7,6 @@ public struct Group { public var getInitMessage: GroupGetInitMessage public var getMembership: GroupGetMembership public var getName: GroupGetName - public var getTrackedID: GroupGetTrackedId public var serialize: GroupSerialize } @@ -20,7 +19,6 @@ extension Group { getInitMessage: .live(bindingsGroup), getMembership: .live(bindingsGroup), getName: .live(bindingsGroup), - getTrackedID: .live(bindingsGroup), serialize: .live(bindingsGroup) ) } @@ -34,7 +32,6 @@ extension Group { getInitMessage: .unimplemented, getMembership: .unimplemented, getName: .unimplemented, - getTrackedID: .unimplemented, serialize: .unimplemented ) } diff --git a/Sources/XXClient/GroupChat/Functions/GroupChatJoinGroup.swift b/Sources/XXClient/GroupChat/Functions/GroupChatJoinGroup.swift index a69160396532f608e4014fb89a9930da755b597f..bd2185c700402f98db69ab8994e94f44a49ab566 100644 --- a/Sources/XXClient/GroupChat/Functions/GroupChatJoinGroup.swift +++ b/Sources/XXClient/GroupChat/Functions/GroupChatJoinGroup.swift @@ -2,10 +2,10 @@ import Bindings import XCTestDynamicOverlay public struct GroupChatJoinGroup { - public var run: (Int) throws -> Void + public var run: (Data) throws -> Void - public func callAsFunction(trackedGroupId: Int) throws { - try run(trackedGroupId) + public func callAsFunction(serializedGroupData: Data) throws { + try run(serializedGroupData) } }