From e2f2604ec07d32f88f2ddca94db6d548e3d566ef Mon Sep 17 00:00:00 2001 From: Mauro <34335419+Velin92@users.noreply.github.com> Date: Tue, 21 Feb 2023 11:02:35 +0100 Subject: [PATCH] Removed Edit/Reply Dimming (#606) * #542 removed reply/edit dimming * removed unneeded didSet --- .../View/TimelineTableViewController.swift | 30 ++----------------- changelog.d/542.change | 1 + 2 files changed, 3 insertions(+), 28 deletions(-) create mode 100644 changelog.d/542.change diff --git a/ElementX/Sources/Screens/RoomScreen/View/TimelineTableViewController.swift b/ElementX/Sources/Screens/RoomScreen/View/TimelineTableViewController.swift index 9d1505607..c0124fe71 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/TimelineTableViewController.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/TimelineTableViewController.swift @@ -53,13 +53,7 @@ class TimelineTableViewController: UIViewController { /// The mode of the message composer. This is used to render selected /// items in the timeline when replying, editing etc. - var composerMode: RoomScreenComposerMode = .default { - didSet { - // Reload the visible items in order to update their opacity. - // Applying a snapshot won't work in this instance as the items don't change. - reloadVisibleItems() - } - } + var composerMode: RoomScreenComposerMode = .default /// Whether or not the timeline has more messages to back paginate. var canBackPaginate = true @@ -196,14 +190,12 @@ class TimelineTableViewController: UIViewController { // A local reference to avoid capturing self in the cell configuration. let coordinator = self.coordinator - let opacity = self.opacity(for: timelineItem) - + cell.item = timelineItem cell.contentConfiguration = UIHostingConfiguration { timelineItem .id(timelineItem.id) .frame(maxWidth: .infinity, alignment: .leading) - .opacity(opacity) .environmentObject(coordinator.context) // Attempted fix at a crash in TimelineItemContextMenu .onAppear { coordinator.send(viewAction: .itemAppeared(id: timelineItem.id)) @@ -254,18 +246,6 @@ class TimelineTableViewController: UIViewController { } } - /// Reloads all of the visible timeline items. - /// - /// This only needs to be called when some state internal to this table view changes that - /// will affect the appearance of those items. Any updates to the items themselves should - /// use ``applySnapshot()`` which handles everything in the diffable data source. - private func reloadVisibleItems() { - guard let visibleIndexPaths = tableView.indexPathsForVisibleRows, let dataSource else { return } - var snapshot = dataSource.snapshot() - snapshot.reloadItems(visibleIndexPaths.compactMap { dataSource.itemIdentifier(for: $0) }) - dataSource.apply(snapshot) - } - /// Returns a description of the current layout in order to update the /// scroll position after adding/updating items to the timeline. private func layout() -> LayoutDescriptor { @@ -351,12 +331,6 @@ class TimelineTableViewController: UIViewController { coordinator.send(viewAction: .paginateBackwards) } - - /// Returns the opacity that the supplied timeline item's cell should be. - private func opacity(for item: RoomTimelineViewProvider) -> CGFloat { - guard case let .reply(selectedItemID, _) = composerMode else { return 1.0 } - return selectedItemID == item.id ? 1.0 : 0.5 - } } // MARK: - UITableViewDelegate diff --git a/changelog.d/542.change b/changelog.d/542.change new file mode 100644 index 000000000..209e683af --- /dev/null +++ b/changelog.d/542.change @@ -0,0 +1 @@ +Removed reply/edit dimming for all non highlighted messages to increase readability. \ No newline at end of file