Add support for aliases to RoomProxy and bump the SDK. (#486)

This commit is contained in:
Doug
2023-01-24 17:01:00 +00:00
committed by GitHub
parent b8e2d6f823
commit 3a74f13097
8 changed files with 21 additions and 11 deletions
+1 -1
View File
@@ -3962,7 +3962,7 @@
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift"; repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
requirement = { requirement = {
kind = exactVersion; kind = exactVersion;
version = "1.0.32-alpha"; version = "1.0.33-alpha";
}; };
}; };
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = { 96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
@@ -86,8 +86,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-rust-components-swift", "location" : "https://github.com/matrix-org/matrix-rust-components-swift",
"state" : { "state" : {
"revision" : "a119a8f16bbe3adc34cfdf2e092886d44e01705a", "revision" : "2d702d0d52805e4f81924507b39ad81c8a74a63f",
"version" : "1.0.32-alpha" "version" : "1.0.33-alpha"
} }
}, },
{ {
@@ -29,6 +29,8 @@ struct MockRoomProxy: RoomProxyProtocol {
var isPublic = Bool.random() var isPublic = Bool.random()
var isEncrypted = Bool.random() var isEncrypted = Bool.random()
var isTombstoned = Bool.random() var isTombstoned = Bool.random()
var canonicalAlias: String?
var alternativeAliases: [String] = []
var hasUnreadNotifications = Bool.random() var hasUnreadNotifications = Bool.random()
var members: [RoomMemberProxy]? var members: [RoomMemberProxy]?
@@ -83,6 +83,14 @@ class RoomProxy: RoomProxyProtocol {
room.isTombstoned() room.isTombstoned()
} }
var canonicalAlias: String? {
room.canonicalAlias()
}
var alternativeAliases: [String] {
room.alternativeAliases()
}
var hasUnreadNotifications: Bool { var hasUnreadNotifications: Bool {
slidingSyncRoom.hasUnreadNotifications() slidingSyncRoom.hasUnreadNotifications()
} }
@@ -40,6 +40,8 @@ protocol RoomProxyProtocol {
var isSpace: Bool { get } var isSpace: Bool { get }
var isEncrypted: Bool { get } var isEncrypted: Bool { get }
var isTombstoned: Bool { get } var isTombstoned: Bool { get }
var canonicalAlias: String? { get }
var alternativeAliases: [String] { get }
var hasUnreadNotifications: Bool { get } var hasUnreadNotifications: Bool { get }
var name: String? { get } var name: String? { get }
@@ -261,14 +261,11 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
} }
case .virtual(let virtualItem): case .virtual(let virtualItem):
switch virtualItem { switch virtualItem {
case .dayDivider(let year, let month, let day): case .dayDivider(let timestamp):
// These components will be replaced by a timestamp in upcoming releases // These components will be replaced by a timestamp in upcoming releases
let dateComponents = DateComponents(calendar: .current, year: Int(year), month: Int(month), day: Int(day)) let date = Date(timeIntervalSince1970: TimeInterval(timestamp / 1000))
if let dateString = dateComponents.date?.formatted(date: .complete, time: .omitted) { let dateString = date.formatted(date: .complete, time: .omitted)
newTimelineItems.append(SeparatorRoomTimelineItem(text: dateString)) newTimelineItems.append(SeparatorRoomTimelineItem(text: dateString))
} else {
MXLog.error("Failed formatting separator date")
}
case .readMarker: case .readMarker:
// Don't show the read marker if it's the last item in the timeline // Don't show the read marker if it's the last item in the timeline
if index != timelineProvider.itemsPublisher.value.indices.last { if index != timelineProvider.itemsPublisher.value.indices.last {
+1
View File
@@ -0,0 +1 @@
Add support for aliases to RoomProxy and bump the SDK version.
+1 -1
View File
@@ -40,7 +40,7 @@ include:
packages: packages:
MatrixRustSDK: MatrixRustSDK:
url: https://github.com/matrix-org/matrix-rust-components-swift url: https://github.com/matrix-org/matrix-rust-components-swift
exactVersion: 1.0.32-alpha exactVersion: 1.0.33-alpha
# path: ../matrix-rust-sdk # path: ../matrix-rust-sdk
DesignKit: DesignKit:
path: DesignKit path: DesignKit