Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin Tweaks #3242

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ struct PinnedItemsBannerView: View {

private var content: some View {
VStack(alignment: .leading, spacing: 0) {
Text(state.bannerIndicatorDescription)
.font(.compound.bodySM)
.foregroundColor(.compound.textActionAccent)
.lineLimit(1)
// Only the display the indicator description for more than 1 pinned item
if state.count > 1 {
Text(state.bannerIndicatorDescription)
.font(.compound.bodySM)
.foregroundColor(.compound.textActionAccent)
.lineLimit(1)
}
Text(state.displayedMessage)
.font(.compound.bodyMD)
.foregroundColor(.compound.textPrimary)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,12 @@ class TimelineTableViewController: UIViewController {
guard let dataSource else { return }

var snapshot = NSDiffableDataSourceSnapshot<TimelineSection, String>()
snapshot.appendSections([.typingIndicator])
snapshot.appendItems([TimelineTypingIndicatorCell.reuseIdentifier])

// We don't want to display the typing notification in this timeline
if !coordinator.context.viewState.isPinnedEventsTimeline {
snapshot.appendSections([.typingIndicator])
snapshot.appendItems([TimelineTypingIndicatorCell.reuseIdentifier])
}
snapshot.appendSections([.main])
snapshot.appendItems(timelineItemsIDs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ enum TimelineItemMenuAction: Identifiable, Hashable {

var canAppearInPinnedEventsTimeline: Bool {
switch self {
case .viewInRoomTimeline, .pin, .unpin, .forward, .redact:
case .viewInRoomTimeline, .pin, .unpin, .forward:
return true
default:
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ struct TimelineItemMenuActionProvider {
if item.isForwardable {
actions.append(.forward(itemID: item.id))
}

if canCurrentUserPin, let eventID = item.id.eventID {
actions.append(pinnedEventIDs.contains(eventID) ? .unpin : .pin)
}

if item.isEditable {
actions.append(.edit)
}

if canCurrentUserPin, let eventID = item.id.eventID {
actions.append(pinnedEventIDs.contains(eventID) ? .unpin : .pin)
}

if item.isCopyable {
actions.append(.copy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
context.send(viewAction: .displayTimelineItemMenu(itemID: timelineItem.id))
}

if !timelineItem.properties.reactions.isEmpty {
// Do not display reactions in the pinned events timeline
if !context.viewState.isPinnedEventsTimeline,
!timelineItem.properties.reactions.isEmpty {
TimelineReactionsView(context: context,
itemID: timelineItem.id,
reactions: timelineItem.properties.reactions,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading