Add polls' room summaries (#1770)

* Update sdk to 1.1.18 & add poll summary

* Fix localisation
This commit is contained in:
Alfonso Grillo 2023-09-21 09:47:14 +02:00 committed by GitHub
parent 9d91cd4fc0
commit 7048a0e4ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 14 deletions

View File

@ -5738,7 +5738,7 @@
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
requirement = {
kind = exactVersion;
version = 1.1.17;
version = 1.1.18;
};
};
821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = {

View File

@ -129,8 +129,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
"state" : {
"revision" : "5f7b353fc306e21237f71b9e242f7fc086ad00c8",
"version" : "1.1.17"
"revision" : "f00c834ec4f80c9eea43282b79b368c93ad6bd82",
"version" : "1.1.18"
}
},
{

View File

@ -8,6 +8,7 @@
"a11y_show_password" = "Show password";
"a11y_user_menu" = "User menu";
"action_accept" = "Accept";
"action_add_to_timeline" = "Add to timeline";
"action_back" = "Back";
"action_cancel" = "Cancel";
"action_choose_photo" = "Choose photo";
@ -144,6 +145,7 @@
"common_verification_complete" = "Verification complete";
"common_video" = "Video";
"common_waiting" = "Waiting…";
"common_poll_summary" = "Poll: %1$@";
"crash_detection_dialog_content" = "%1$@ crashed the last time it was used. Would you like to share a crash report with us?";
"dialog_title_confirmation" = "Confirmation";
"dialog_title_warning" = "Warning";
@ -331,7 +333,7 @@
"screen_report_content_block_user_hint" = "Check if you want to hide all current and future messages from this user";
"screen_room_attachment_source_camera" = "Camera";
"screen_room_attachment_source_camera_photo" = "Take photo";
"screen_room_attachment_source_camera_video" = "Record a video";
"screen_room_attachment_source_camera_video" = "Record video";
"screen_room_attachment_source_files" = "Attachment";
"screen_room_attachment_source_gallery" = "Photo & Video Library";
"screen_room_attachment_source_location" = "Location";

View File

@ -28,6 +28,8 @@ public enum L10n {
public static var a11yUserMenu: String { return L10n.tr("Localizable", "a11y_user_menu") }
/// Accept
public static var actionAccept: String { return L10n.tr("Localizable", "action_accept") }
/// Add to timeline
public static var actionAddToTimeline: String { return L10n.tr("Localizable", "action_add_to_timeline") }
/// Back
public static var actionBack: String { return L10n.tr("Localizable", "action_back") }
/// Cancel
@ -230,6 +232,10 @@ public enum L10n {
public static var commonPeople: String { return L10n.tr("Localizable", "common_people") }
/// Permalink
public static var commonPermalink: String { return L10n.tr("Localizable", "common_permalink") }
/// Poll: %1$@
public static func commonPollSummary(_ p1: Any) -> String {
return L10n.tr("Localizable", "common_poll_summary", String(describing: p1))
}
/// Total votes: %1$@
public static func commonPollTotalVotes(_ p1: Any) -> String {
return L10n.tr("Localizable", "common_poll_total_votes", String(describing: p1))
@ -830,7 +836,7 @@ public enum L10n {
public static var screenRoomAttachmentSourceCamera: String { return L10n.tr("Localizable", "screen_room_attachment_source_camera") }
/// Take photo
public static var screenRoomAttachmentSourceCameraPhoto: String { return L10n.tr("Localizable", "screen_room_attachment_source_camera_photo") }
/// Record a video
/// Record video
public static var screenRoomAttachmentSourceCameraVideo: String { return L10n.tr("Localizable", "screen_room_attachment_source_camera_video") }
/// Attachment
public static var screenRoomAttachmentSourceFiles: String { return L10n.tr("Localizable", "screen_room_attachment_source_files") }

View File

@ -1370,11 +1370,11 @@ class RoomProxyMock: RoomProxyProtocol {
return setNameCallsCount > 0
}
var setNameReceivedName: String?
var setNameReceivedInvocations: [String?] = []
var setNameReceivedInvocations: [String] = []
var setNameReturnValue: Result<Void, RoomProxyError>!
var setNameClosure: ((String?) async -> Result<Void, RoomProxyError>)?
var setNameClosure: ((String) async -> Result<Void, RoomProxyError>)?
func setName(_ name: String?) async -> Result<Void, RoomProxyError> {
func setName(_ name: String) async -> Result<Void, RoomProxyError> {
setNameCallsCount += 1
setNameReceivedName = name
setNameReceivedInvocations.append(name)

View File

@ -633,7 +633,7 @@ class RoomProxy: RoomProxyProtocol {
}
}
func setName(_ name: String?) async -> Result<Void, RoomProxyError> {
func setName(_ name: String) async -> Result<Void, RoomProxyError> {
await Task.dispatch(on: .global()) {
do {
return try .success(self.room.setName(name: name))

View File

@ -159,7 +159,7 @@ protocol RoomProxyProtocol {
func invite(userID: String) async -> Result<Void, RoomProxyError>
func setName(_ name: String?) async -> Result<Void, RoomProxyError>
func setName(_ name: String) async -> Result<Void, RoomProxyError>
func setTopic(_ topic: String) async -> Result<Void, RoomProxyError>

View File

@ -68,9 +68,8 @@ struct RoomEventStringBuilder {
member: sender.id,
memberIsYou: isOutgoing)
.map(AttributedString.init)
case .poll:
// The Rust SDK doesn't support poll events as room summaries yet
return nil
case .poll(let question, _, _, _, _, _):
return prefix(L10n.commonPollSummary(question), with: senderDisplayName)
}
}

View File

@ -45,7 +45,7 @@ packages:
# Element/Matrix dependencies
MatrixRustSDK:
url: https://github.com/matrix-org/matrix-rust-components-swift
exactVersion: 1.1.17
exactVersion: 1.1.18
# path: ../matrix-rust-sdk
DesignKit:
path: DesignKit