Skip to content

Commit a31fcfe

Browse files
committed
Bump to version 26.02.03 (matrix-rust-sdk/main 40c6c330b05aa6aaea4c1507807d9e0c5f78da3d)
1 parent 440bba3 commit a31fcfe

File tree

3 files changed

+174
-6
lines changed

3 files changed

+174
-6
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// swift-tools-version:5.9
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33
import PackageDescription
4-
let checksum = "fd146561bb247111cbd0df8c85bfdc05dc786df3828becea4b1536e9792360ed"
5-
let version = "26.01.30"
4+
let checksum = "6ec0de64811a16427af77ba0bdf91c9cee24caea3e82ebd55056978f2442bfb7"
5+
let version = "26.02.03"
66
let url = "https://github.com/element-hq/matrix-rust-components-swift/releases/download/\(version)/MatrixSDKFFI.xcframework.zip"
77
let package = Package(
88
name: "MatrixRustSDK",

Sources/MatrixRustSDK/matrix_sdk_common.swift

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,108 @@ fileprivate struct FfiConverterString: FfiConverter {
457457
}
458458
}
459459

460+
// Note that we don't yet support `indirect` for enums.
461+
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
462+
/**
463+
* Reason why a background task failed.
464+
*/
465+
466+
public enum BackgroundTaskFailureReason: Equatable, Hashable {
467+
468+
/**
469+
* The task panicked.
470+
*/
471+
case panic(
472+
/**
473+
* The panic message, if it could be extracted.
474+
*/message: String?,
475+
/**
476+
* Backtrace captured after the panic (if available).
477+
*/panicBacktrace: String?
478+
)
479+
/**
480+
* The task returned an error.
481+
*/
482+
case error(
483+
/**
484+
* String representation of the error.
485+
*/error: String
486+
)
487+
/**
488+
* The task ended unexpectedly (for tasks expected to run forever).
489+
*/
490+
case earlyTermination
491+
492+
493+
494+
495+
496+
}
497+
498+
#if compiler(>=6)
499+
extension BackgroundTaskFailureReason: Sendable {}
500+
#endif
501+
502+
#if swift(>=5.8)
503+
@_documentation(visibility: private)
504+
#endif
505+
public struct FfiConverterTypeBackgroundTaskFailureReason: FfiConverterRustBuffer {
506+
typealias SwiftType = BackgroundTaskFailureReason
507+
508+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BackgroundTaskFailureReason {
509+
let variant: Int32 = try readInt(&buf)
510+
switch variant {
511+
512+
case 1: return .panic(message: try FfiConverterOptionString.read(from: &buf), panicBacktrace: try FfiConverterOptionString.read(from: &buf)
513+
)
514+
515+
case 2: return .error(error: try FfiConverterString.read(from: &buf)
516+
)
517+
518+
case 3: return .earlyTermination
519+
520+
default: throw UniffiInternalError.unexpectedEnumCase
521+
}
522+
}
523+
524+
public static func write(_ value: BackgroundTaskFailureReason, into buf: inout [UInt8]) {
525+
switch value {
526+
527+
528+
case let .panic(message,panicBacktrace):
529+
writeInt(&buf, Int32(1))
530+
FfiConverterOptionString.write(message, into: &buf)
531+
FfiConverterOptionString.write(panicBacktrace, into: &buf)
532+
533+
534+
case let .error(error):
535+
writeInt(&buf, Int32(2))
536+
FfiConverterString.write(error, into: &buf)
537+
538+
539+
case .earlyTermination:
540+
writeInt(&buf, Int32(3))
541+
542+
}
543+
}
544+
}
545+
546+
547+
#if swift(>=5.8)
548+
@_documentation(visibility: private)
549+
#endif
550+
public func FfiConverterTypeBackgroundTaskFailureReason_lift(_ buf: RustBuffer) throws -> BackgroundTaskFailureReason {
551+
return try FfiConverterTypeBackgroundTaskFailureReason.lift(buf)
552+
}
553+
554+
#if swift(>=5.8)
555+
@_documentation(visibility: private)
556+
#endif
557+
public func FfiConverterTypeBackgroundTaskFailureReason_lower(_ value: BackgroundTaskFailureReason) -> RustBuffer {
558+
return FfiConverterTypeBackgroundTaskFailureReason.lower(value)
559+
}
560+
561+
460562
// Note that we don't yet support `indirect` for enums.
461563
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
462564
/**
@@ -574,6 +676,30 @@ public func FfiConverterTypeShieldStateCode_lower(_ value: ShieldStateCode) -> R
574676
}
575677

576678

679+
#if swift(>=5.8)
680+
@_documentation(visibility: private)
681+
#endif
682+
fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer {
683+
typealias SwiftType = String?
684+
685+
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
686+
guard let value = value else {
687+
writeInt(&buf, Int8(0))
688+
return
689+
}
690+
writeInt(&buf, Int8(1))
691+
FfiConverterString.write(value, into: &buf)
692+
}
693+
694+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
695+
switch try readInt(&buf) as Int8 {
696+
case 0: return nil
697+
case 1: return try FfiConverterString.read(from: &buf)
698+
default: throw UniffiInternalError.unexpectedOptionalTag
699+
}
700+
}
701+
}
702+
577703
private enum InitializationResult {
578704
case ok
579705
case contractVersionMismatch

Sources/MatrixRustSDK/matrix_sdk_ffi.swift

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ public protocol ClientProtocol: AnyObject, Sendable {
12941294
func setPusher(identifiers: PusherIdentifiers, kind: PusherKind, appDisplayName: String, deviceDisplayName: String, profileTag: String?, lang: String) async throws
12951295

12961296
/**
1297-
* Sets the [UnableToDecryptDelegate] which will inform about UTDs.
1297+
* Sets the [`UnableToDecryptDelegate`] which will inform about UTDs.
12981298
* Returns an error if the delegate was already set.
12991299
*/
13001300
func setUtdDelegate(utdDelegate: UnableToDecryptDelegate) async throws
@@ -2973,7 +2973,7 @@ open func setPusher(identifiers: PusherIdentifiers, kind: PusherKind, appDisplay
29732973
}
29742974

29752975
/**
2976-
* Sets the [UnableToDecryptDelegate] which will inform about UTDs.
2976+
* Sets the [`UnableToDecryptDelegate`] which will inform about UTDs.
29772977
* Returns an error if the delegate was already set.
29782978
*/
29792979
open func setUtdDelegate(utdDelegate: UnableToDecryptDelegate)async throws {
@@ -38821,8 +38821,20 @@ public func FfiConverterCallbackInterfaceCallDeclineListener_lower(_ v: CallDecl
3882138821

3882238822
public protocol ClientDelegate: AnyObject, Sendable {
3882338823

38824+
/**
38825+
* A callback invoked whenever the SDK runs into an unknown token error.
38826+
*/
3882438827
func didReceiveAuthError(isSoftLogout: Bool)
3882538828

38829+
/**
38830+
* A callback invoked when a background task registered with the client's
38831+
* task monitor encounters an error.
38832+
*
38833+
* Can default to an empty implementation, if the embedder doesn't care
38834+
* about handling background jobs errors.
38835+
*/
38836+
func onBackgroundTaskErrorReport(taskName: String, error: BackgroundTaskFailureReason)
38837+
3882638838
}
3882738839

3882838840

@@ -38866,6 +38878,32 @@ fileprivate struct UniffiCallbackInterfaceClientDelegate {
3886638878
}
3886738879

3886838880

38881+
let writeReturn = { () }
38882+
uniffiTraitInterfaceCall(
38883+
callStatus: uniffiCallStatus,
38884+
makeCall: makeCall,
38885+
writeReturn: writeReturn
38886+
)
38887+
},
38888+
onBackgroundTaskErrorReport: { (
38889+
uniffiHandle: UInt64,
38890+
taskName: RustBuffer,
38891+
error: RustBuffer,
38892+
uniffiOutReturn: UnsafeMutableRawPointer,
38893+
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
38894+
) in
38895+
let makeCall = {
38896+
() throws -> () in
38897+
guard let uniffiObj = try? FfiConverterCallbackInterfaceClientDelegate.handleMap.get(handle: uniffiHandle) else {
38898+
throw UniffiInternalError.unexpectedStaleHandle
38899+
}
38900+
return uniffiObj.onBackgroundTaskErrorReport(
38901+
taskName: try FfiConverterString.lift(taskName),
38902+
error: try FfiConverterTypeBackgroundTaskFailureReason_lift(error)
38903+
)
38904+
}
38905+
38906+
3886938907
let writeReturn = { () }
3887038908
uniffiTraitInterfaceCall(
3887138909
callStatus: uniffiCallStatus,
@@ -47837,7 +47875,7 @@ private let initializationResult: InitializationResult = {
4783747875
if (uniffi_matrix_sdk_ffi_checksum_method_client_set_pusher() != 51438) {
4783847876
return InitializationResult.apiChecksumMismatch
4783947877
}
47840-
if (uniffi_matrix_sdk_ffi_checksum_method_client_set_utd_delegate() != 38853) {
47878+
if (uniffi_matrix_sdk_ffi_checksum_method_client_set_utd_delegate() != 53527) {
4784147879
return InitializationResult.apiChecksumMismatch
4784247880
}
4784347881
if (uniffi_matrix_sdk_ffi_checksum_method_client_sliding_sync_version() != 55440) {
@@ -48992,7 +49030,10 @@ private let initializationResult: InitializationResult = {
4899249030
if (uniffi_matrix_sdk_ffi_checksum_method_accountdatalistener_on_change() != 13017) {
4899349031
return InitializationResult.apiChecksumMismatch
4899449032
}
48995-
if (uniffi_matrix_sdk_ffi_checksum_method_clientdelegate_did_receive_auth_error() != 38563) {
49033+
if (uniffi_matrix_sdk_ffi_checksum_method_clientdelegate_did_receive_auth_error() != 55975) {
49034+
return InitializationResult.apiChecksumMismatch
49035+
}
49036+
if (uniffi_matrix_sdk_ffi_checksum_method_clientdelegate_on_background_task_error_report() != 53131) {
4899649037
return InitializationResult.apiChecksumMismatch
4899749038
}
4899849039
if (uniffi_matrix_sdk_ffi_checksum_method_clientsessiondelegate_retrieve_session_from_keychain() != 43233) {
@@ -49184,6 +49225,7 @@ private let initializationResult: InitializationResult = {
4918449225
uniffiCallbackInitVerificationStateListener()
4918549226
uniffiCallbackInitWidgetCapabilitiesProvider()
4918649227
uniffiEnsureMatrixSdkBaseInitialized()
49228+
uniffiEnsureMatrixSdkCommonInitialized()
4918749229
uniffiEnsureMatrixSdkCryptoInitialized()
4918849230
uniffiEnsureMatrixSdkInitialized()
4918949231
uniffiEnsureMatrixSdkUiInitialized()

0 commit comments

Comments
 (0)