mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-09-19 05:00:48 +00:00
Address PR feedback: catalog entries, GeoDM filtering, accessibility hint, media suppression
This commit is contained in:
parent
72c21fb183
commit
0779765c2d
@ -65,6 +65,8 @@ final class PeerListModel: ObservableObject {
|
||||
@Published private(set) var visibleGeohashPeerCount = 0
|
||||
@Published private(set) var renderID = ""
|
||||
|
||||
var activeChannel: ChannelID { conversations.activeChannel }
|
||||
|
||||
private let chatViewModel: ChatViewModel
|
||||
private let conversations: ConversationStore
|
||||
private let locationChannelsModel: LocationChannelsModel
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -33,14 +33,25 @@ struct ForwardMessageSheet: View {
|
||||
static let title = String(localized: "forward.title", defaultValue: "Forward to…", comment: "Title of the sheet for picking who to forward a message to")
|
||||
static let noRecipients = String(localized: "forward.no_recipients", defaultValue: "No one to forward to yet — no known peers or recent conversations.", comment: "Empty state shown in the forward-message sheet when there is nobody to pick")
|
||||
static let peersHeader = String(localized: "forward.peers_header", defaultValue: "people", comment: "Section header above known peers in the forward-message sheet")
|
||||
static let accessibilityHint = String(localized: "forward.accessibility.forward_hint", defaultValue: "forwards message to this conversation", comment: "Accessibility hint for selecting a target to forward a message to")
|
||||
}
|
||||
|
||||
private var meshTargets: [MeshPeerRow] {
|
||||
peerListModel.meshRows.filter { !$0.isMe && !$0.isBlocked }
|
||||
}
|
||||
|
||||
private var filteredRecentChatRows: [RecentChatRow] {
|
||||
peerListModel.recentChatRows.filter { row in
|
||||
if case .location = peerListModel.activeChannel {
|
||||
return true
|
||||
} else {
|
||||
return !row.peerID.isGeoDM
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var hasAnyTarget: Bool {
|
||||
!meshTargets.isEmpty || !peerListModel.recentChatRows.isEmpty
|
||||
!meshTargets.isEmpty || !filteredRecentChatRows.isEmpty
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
@ -103,7 +114,10 @@ struct ForwardMessageSheet: View {
|
||||
}
|
||||
}
|
||||
|
||||
RecentChatList(chats: peerListModel.recentChatRows) { peerID in
|
||||
RecentChatList(
|
||||
chats: filteredRecentChatRows,
|
||||
accessibilityHint: Strings.accessibilityHint
|
||||
) { peerID in
|
||||
forward(to: peerID)
|
||||
}
|
||||
}
|
||||
@ -127,6 +141,7 @@ struct ForwardMessageSheet: View {
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityHint(Strings.accessibilityHint)
|
||||
}
|
||||
|
||||
private func forward(to peerID: PeerID) {
|
||||
|
||||
@ -158,14 +158,16 @@ struct MessageListView: View {
|
||||
conversationUIModel.resendFailedPrivateMessage(message)
|
||||
}
|
||||
}
|
||||
Button(
|
||||
String(
|
||||
localized: "content.actions.forward",
|
||||
defaultValue: "Forward",
|
||||
comment: "Context menu action that opens a picker to forward this message to another conversation"
|
||||
)
|
||||
) {
|
||||
messageToForward = message
|
||||
if conversationUIModel.mediaAttachment(for: message) == nil {
|
||||
Button(
|
||||
String(
|
||||
localized: "content.actions.forward",
|
||||
defaultValue: "Forward",
|
||||
comment: "Context menu action that opens a picker to forward this message to another conversation"
|
||||
)
|
||||
) {
|
||||
messageToForward = message
|
||||
}
|
||||
}
|
||||
if showsUserActions {
|
||||
Button("content.actions.block", role: .destructive) {
|
||||
|
||||
@ -18,6 +18,7 @@ struct RecentChatList: View {
|
||||
@ThemedPalette private var palette
|
||||
|
||||
let chats: [RecentChatRow]
|
||||
var accessibilityHint: String? = nil
|
||||
let onTapChat: (PeerID) -> Void
|
||||
|
||||
private enum Strings {
|
||||
@ -72,7 +73,7 @@ struct RecentChatList: View {
|
||||
.accessibilityElement(children: .ignore)
|
||||
.accessibilityLabel(accessibilityDescription(for: chat))
|
||||
.accessibilityAddTraits(.isButton)
|
||||
.accessibilityHint(Strings.openChatHint)
|
||||
.accessibilityHint(accessibilityHint ?? Strings.openChatHint)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user