Skip to content

Commit 691d8b0

Browse files
committed
Bump to v1.1.38 (matrix-rust-sdk/main 9bf48ef041677282c4341561ba2ec1f095b78e3f)
1 parent 4d0d750 commit 691d8b0

File tree

4 files changed

+660
-17
lines changed

4 files changed

+660
-17
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import PackageDescription
55

6-
let checksum = "b92907893d3e9f7f90740d5a5633ae956e6c0a1f10f218f049b7f00aa99bd0e4"
7-
let version = "v1.1.37"
6+
let checksum = "5102270eafbac7cc12bf8b568992aabe729284528315455259e44a523d57418b"
7+
let version = "v1.1.38"
88
let url = "https://github.com/matrix-org/matrix-rust-components-swift/releases/download/\(version)/MatrixSDKFFI.xcframework.zip"
99

1010
let package = Package(

Sources/MatrixRustSDK/matrix_sdk.swift

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,19 @@ private func uniffiCheckCallStatus(
297297
// Public interface members begin here.
298298

299299

300+
fileprivate struct FfiConverterInt64: FfiConverterPrimitive {
301+
typealias FfiType = Int64
302+
typealias SwiftType = Int64
303+
304+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Int64 {
305+
return try lift(readInt(&buf))
306+
}
307+
308+
public static func write(_ value: Int64, into buf: inout [UInt8]) {
309+
writeInt(&buf, lower(value))
310+
}
311+
}
312+
300313
fileprivate struct FfiConverterString: FfiConverter {
301314
typealias SwiftType = String
302315
typealias FfiType = RustBuffer
@@ -335,6 +348,201 @@ fileprivate struct FfiConverterString: FfiConverter {
335348
}
336349
}
337350

351+
352+
/**
353+
* A set of common power levels required for various operations within a room,
354+
* that can be applied as a single operation. When updating these
355+
* settings, any levels that are `None` will remain unchanged.
356+
*/
357+
public struct RoomPowerLevelChanges {
358+
/**
359+
* The level required to ban a user.
360+
*/
361+
public var ban: Int64?
362+
/**
363+
* The level required to invite a user.
364+
*/
365+
public var invite: Int64?
366+
/**
367+
* The level required to kick a user.
368+
*/
369+
public var kick: Int64?
370+
/**
371+
* The level required to redact an event.
372+
*/
373+
public var redact: Int64?
374+
/**
375+
* The default level required to send message events.
376+
*/
377+
public var eventsDefault: Int64?
378+
/**
379+
* The default level required to send state events.
380+
*/
381+
public var stateDefault: Int64?
382+
/**
383+
* The default power level for every user in the room.
384+
*/
385+
public var usersDefault: Int64?
386+
/**
387+
* The level required to change the room's name.
388+
*/
389+
public var roomName: Int64?
390+
/**
391+
* The level required to change the room's avatar.
392+
*/
393+
public var roomAvatar: Int64?
394+
/**
395+
* The level required to change the room's topic.
396+
*/
397+
public var roomTopic: Int64?
398+
399+
// Default memberwise initializers are never public by default, so we
400+
// declare one manually.
401+
public init(
402+
/**
403+
* The level required to ban a user.
404+
*/
405+
ban: Int64? = nil,
406+
/**
407+
* The level required to invite a user.
408+
*/
409+
invite: Int64? = nil,
410+
/**
411+
* The level required to kick a user.
412+
*/
413+
kick: Int64? = nil,
414+
/**
415+
* The level required to redact an event.
416+
*/
417+
redact: Int64? = nil,
418+
/**
419+
* The default level required to send message events.
420+
*/
421+
eventsDefault: Int64? = nil,
422+
/**
423+
* The default level required to send state events.
424+
*/
425+
stateDefault: Int64? = nil,
426+
/**
427+
* The default power level for every user in the room.
428+
*/
429+
usersDefault: Int64? = nil,
430+
/**
431+
* The level required to change the room's name.
432+
*/
433+
roomName: Int64? = nil,
434+
/**
435+
* The level required to change the room's avatar.
436+
*/
437+
roomAvatar: Int64? = nil,
438+
/**
439+
* The level required to change the room's topic.
440+
*/
441+
roomTopic: Int64? = nil) {
442+
self.ban = ban
443+
self.invite = invite
444+
self.kick = kick
445+
self.redact = redact
446+
self.eventsDefault = eventsDefault
447+
self.stateDefault = stateDefault
448+
self.usersDefault = usersDefault
449+
self.roomName = roomName
450+
self.roomAvatar = roomAvatar
451+
self.roomTopic = roomTopic
452+
}
453+
}
454+
455+
456+
extension RoomPowerLevelChanges: Equatable, Hashable {
457+
public static func ==(lhs: RoomPowerLevelChanges, rhs: RoomPowerLevelChanges) -> Bool {
458+
if lhs.ban != rhs.ban {
459+
return false
460+
}
461+
if lhs.invite != rhs.invite {
462+
return false
463+
}
464+
if lhs.kick != rhs.kick {
465+
return false
466+
}
467+
if lhs.redact != rhs.redact {
468+
return false
469+
}
470+
if lhs.eventsDefault != rhs.eventsDefault {
471+
return false
472+
}
473+
if lhs.stateDefault != rhs.stateDefault {
474+
return false
475+
}
476+
if lhs.usersDefault != rhs.usersDefault {
477+
return false
478+
}
479+
if lhs.roomName != rhs.roomName {
480+
return false
481+
}
482+
if lhs.roomAvatar != rhs.roomAvatar {
483+
return false
484+
}
485+
if lhs.roomTopic != rhs.roomTopic {
486+
return false
487+
}
488+
return true
489+
}
490+
491+
public func hash(into hasher: inout Hasher) {
492+
hasher.combine(ban)
493+
hasher.combine(invite)
494+
hasher.combine(kick)
495+
hasher.combine(redact)
496+
hasher.combine(eventsDefault)
497+
hasher.combine(stateDefault)
498+
hasher.combine(usersDefault)
499+
hasher.combine(roomName)
500+
hasher.combine(roomAvatar)
501+
hasher.combine(roomTopic)
502+
}
503+
}
504+
505+
506+
public struct FfiConverterTypeRoomPowerLevelChanges: FfiConverterRustBuffer {
507+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomPowerLevelChanges {
508+
return
509+
try RoomPowerLevelChanges(
510+
ban: FfiConverterOptionInt64.read(from: &buf),
511+
invite: FfiConverterOptionInt64.read(from: &buf),
512+
kick: FfiConverterOptionInt64.read(from: &buf),
513+
redact: FfiConverterOptionInt64.read(from: &buf),
514+
eventsDefault: FfiConverterOptionInt64.read(from: &buf),
515+
stateDefault: FfiConverterOptionInt64.read(from: &buf),
516+
usersDefault: FfiConverterOptionInt64.read(from: &buf),
517+
roomName: FfiConverterOptionInt64.read(from: &buf),
518+
roomAvatar: FfiConverterOptionInt64.read(from: &buf),
519+
roomTopic: FfiConverterOptionInt64.read(from: &buf)
520+
)
521+
}
522+
523+
public static func write(_ value: RoomPowerLevelChanges, into buf: inout [UInt8]) {
524+
FfiConverterOptionInt64.write(value.ban, into: &buf)
525+
FfiConverterOptionInt64.write(value.invite, into: &buf)
526+
FfiConverterOptionInt64.write(value.kick, into: &buf)
527+
FfiConverterOptionInt64.write(value.redact, into: &buf)
528+
FfiConverterOptionInt64.write(value.eventsDefault, into: &buf)
529+
FfiConverterOptionInt64.write(value.stateDefault, into: &buf)
530+
FfiConverterOptionInt64.write(value.usersDefault, into: &buf)
531+
FfiConverterOptionInt64.write(value.roomName, into: &buf)
532+
FfiConverterOptionInt64.write(value.roomAvatar, into: &buf)
533+
FfiConverterOptionInt64.write(value.roomTopic, into: &buf)
534+
}
535+
}
536+
537+
538+
public func FfiConverterTypeRoomPowerLevelChanges_lift(_ buf: RustBuffer) throws -> RoomPowerLevelChanges {
539+
return try FfiConverterTypeRoomPowerLevelChanges.lift(buf)
540+
}
541+
542+
public func FfiConverterTypeRoomPowerLevelChanges_lower(_ value: RoomPowerLevelChanges) -> RustBuffer {
543+
return FfiConverterTypeRoomPowerLevelChanges.lower(value)
544+
}
545+
338546
// Note that we don't yet support `indirect` for enums.
339547
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
340548
/**
@@ -406,6 +614,27 @@ extension RoomMemberRole: Equatable, Hashable {}
406614

407615

408616

617+
fileprivate struct FfiConverterOptionInt64: FfiConverterRustBuffer {
618+
typealias SwiftType = Int64?
619+
620+
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
621+
guard let value = value else {
622+
writeInt(&buf, Int8(0))
623+
return
624+
}
625+
writeInt(&buf, Int8(1))
626+
FfiConverterInt64.write(value, into: &buf)
627+
}
628+
629+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
630+
switch try readInt(&buf) as Int8 {
631+
case 0: return nil
632+
case 1: return try FfiConverterInt64.read(from: &buf)
633+
default: throw UniffiInternalError.unexpectedOptionalTag
634+
}
635+
}
636+
}
637+
409638
private enum InitializationResult {
410639
case ok
411640
case contractVersionMismatch

Sources/MatrixRustSDK/matrix_sdk_base.swift

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,24 @@ public struct RoomNotableTags {
365365
* Whether or not the room is marked as favorite.
366366
*/
367367
public var isFavorite: Bool
368+
/**
369+
* Whether or not the room is marked as low priority.
370+
*/
371+
public var isLowPriority: Bool
368372

369373
// Default memberwise initializers are never public by default, so we
370374
// declare one manually.
371375
public init(
372376
/**
373377
* Whether or not the room is marked as favorite.
374378
*/
375-
isFavorite: Bool) {
379+
isFavorite: Bool,
380+
/**
381+
* Whether or not the room is marked as low priority.
382+
*/
383+
isLowPriority: Bool) {
376384
self.isFavorite = isFavorite
385+
self.isLowPriority = isLowPriority
377386
}
378387
}
379388

@@ -383,11 +392,15 @@ extension RoomNotableTags: Equatable, Hashable {
383392
if lhs.isFavorite != rhs.isFavorite {
384393
return false
385394
}
395+
if lhs.isLowPriority != rhs.isLowPriority {
396+
return false
397+
}
386398
return true
387399
}
388400

389401
public func hash(into hasher: inout Hasher) {
390402
hasher.combine(isFavorite)
403+
hasher.combine(isLowPriority)
391404
}
392405
}
393406

@@ -396,12 +409,14 @@ public struct FfiConverterTypeRoomNotableTags: FfiConverterRustBuffer {
396409
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomNotableTags {
397410
return
398411
try RoomNotableTags(
399-
isFavorite: FfiConverterBool.read(from: &buf)
412+
isFavorite: FfiConverterBool.read(from: &buf),
413+
isLowPriority: FfiConverterBool.read(from: &buf)
400414
)
401415
}
402416

403417
public static func write(_ value: RoomNotableTags, into buf: inout [UInt8]) {
404418
FfiConverterBool.write(value.isFavorite, into: &buf)
419+
FfiConverterBool.write(value.isLowPriority, into: &buf)
405420
}
406421
}
407422

0 commit comments

Comments
 (0)