Skip to content

Commit

Permalink
Fixes #660 - Expose message actions to voice over rotor
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Nov 10, 2023
1 parent a4bc7b8 commit 215e724
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 29 deletions.
48 changes: 28 additions & 20 deletions ElementX.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions ElementX/Resources/Localizations/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"common_link_copied_to_clipboard" = "Link copied to clipboard";
"common_loading" = "Loading…";
"common_message" = "Message";
"common_message_actions" = "Message actions";
"common_message_layout" = "Message layout";
"common_message_removed" = "Message removed";
"common_modern" = "Modern";
Expand Down Expand Up @@ -542,7 +543,6 @@
"screen_signed_out_subtitle" = "You might have been signed out for one of the reasons listed below. Please sign in again to continue using %@.";
"screen_signed_out_title" = "You’re signed out";
"screen_signout_confirmation_dialog_content" = "Are you sure you want to sign out?";
"screen_signout_confirmation_dialog_title" = "Sign out";
"screen_signout_in_progress_dialog_content" = "Signing out…";
"screen_signout_key_backup_disabled_subtitle" = "You are about to sign out of your last session. If you sign out now, you will lose access to your encrypted messages.";
"screen_signout_key_backup_disabled_title" = "You have turned off backup";
Expand All @@ -560,7 +560,7 @@
"screen_waitlist_title" = "You’re almost there.";
"screen_waitlist_title_success" = "You're in.";
"screen_welcome_bullet_1" = "Calls, polls, search and more will be added later this year.";
"screen_welcome_bullet_2" = "Message history for encrypted rooms won’t be available in this update.";
"screen_welcome_bullet_2" = "Message history for encrypted rooms isn’t available yet.";
"screen_welcome_bullet_3" = "We’d love to hear from you, let us know what you think via the settings page.";
"screen_welcome_button" = "Let's go!";
"screen_welcome_subtitle" = "Here’s what you need to know:";
Expand Down Expand Up @@ -650,5 +650,6 @@
"screen_room_error_failed_processing_media" = "Failed processing media to upload, please try again.";
"screen_room_notification_settings_mode_mentions_and_keywords" = "Mentions and Keywords only";
"screen_signout_confirmation_dialog_submit" = "Sign out";
"screen_signout_confirmation_dialog_title" = "Sign out";
"screen_signout_preference_item" = "Sign out";
"screen_waitlist_message_success" = "Welcome to %1$@!";
4 changes: 3 additions & 1 deletion ElementX/Sources/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ public enum L10n {
}
/// Message
public static var commonMessage: String { return L10n.tr("Localizable", "common_message") }
/// Message actions
public static var commonMessageActions: String { return L10n.tr("Localizable", "common_message_actions") }
/// Message layout
public static var commonMessageLayout: String { return L10n.tr("Localizable", "common_message_layout") }
/// Message removed
Expand Down Expand Up @@ -1342,7 +1344,7 @@ public enum L10n {
public static var screenWaitlistTitleSuccess: String { return L10n.tr("Localizable", "screen_waitlist_title_success") }
/// Calls, polls, search and more will be added later this year.
public static var screenWelcomeBullet1: String { return L10n.tr("Localizable", "screen_welcome_bullet_1") }
/// Message history for encrypted rooms won’t be available in this update.
/// Message history for encrypted rooms isn’t available yet.
public static var screenWelcomeBullet2: String { return L10n.tr("Localizable", "screen_welcome_bullet_2") }
/// We’d love to hear from you, let us know what you think via the settings page.
public static var screenWelcomeBullet3: String { return L10n.tr("Localizable", "screen_welcome_bullet_3") }
Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Mocks/Generated/GeneratedMocks.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated using Sourcery 2.1.1 — https://github.com/krzysztofzablocki/Sourcery
// Generated using Sourcery 2.1.2 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT

// swiftlint:disable all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

import SwiftUI

private struct TimelineAccessibilityModifier: ViewModifier {
private struct TimelineItemAccessibilityModifier: ViewModifier {
let timelineItem: RoomTimelineItemProtocol
let action: () -> Void

@ViewBuilder
func body(content: Content) -> some View {
Expand All @@ -33,6 +34,11 @@ private struct TimelineAccessibilityModifier: ViewModifier {
}
}
.accessibilityElement(children: .combine)
.accessibilityActions {
Button(L10n.commonMessageActions) {
action()
}
}
default:
content
.accessibilityElement(children: .combine)
Expand All @@ -41,7 +47,7 @@ private struct TimelineAccessibilityModifier: ViewModifier {
}

extension View {
func timelineAccessibility(_ timelineItem: RoomTimelineItemProtocol) -> some View {
modifier(TimelineAccessibilityModifier(timelineItem: timelineItem))
func timelineItemAccessibility(_ timelineItem: RoomTimelineItemProtocol, action: @escaping () -> Void) -> some View {
modifier(TimelineItemAccessibilityModifier(timelineItem: timelineItem, action: action))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
// Figma overlaps reactions by 3
VStack(alignment: alignment, spacing: -3) {
messageBubble
.timelineAccessibility(timelineItem)
.timelineItemAccessibility(timelineItem) {
context.send(viewAction: .timelineItemMenu(itemID: timelineItem.id))
}

if !timelineItem.properties.reactions.isEmpty {
TimelineReactionsView(context: context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ struct TimelineItemPlainStylerView<Content: View>: View {

content()
.layoutPriority(1)
.timelineAccessibility(timelineItem)
.timelineItemAccessibility(timelineItem) {
context.send(viewAction: .timelineItemMenu(itemID: timelineItem.id))
}
}
.onTapGesture(count: 2) {
context.send(viewAction: .displayEmojiPicker(itemID: timelineItem.id))
Expand Down
1 change: 1 addition & 0 deletions changelog.d/660.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Expose message actions to voice over rotor

0 comments on commit 215e724

Please sign in to comment.