mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Removed Edit/Reply Dimming (#606)
* #542 removed reply/edit dimming * removed unneeded didSet
This commit is contained in:
@@ -53,13 +53,7 @@ class TimelineTableViewController: UIViewController {
|
|||||||
|
|
||||||
/// The mode of the message composer. This is used to render selected
|
/// The mode of the message composer. This is used to render selected
|
||||||
/// items in the timeline when replying, editing etc.
|
/// items in the timeline when replying, editing etc.
|
||||||
var composerMode: RoomScreenComposerMode = .default {
|
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether or not the timeline has more messages to back paginate.
|
/// Whether or not the timeline has more messages to back paginate.
|
||||||
var canBackPaginate = true
|
var canBackPaginate = true
|
||||||
@@ -196,14 +190,12 @@ class TimelineTableViewController: UIViewController {
|
|||||||
|
|
||||||
// A local reference to avoid capturing self in the cell configuration.
|
// A local reference to avoid capturing self in the cell configuration.
|
||||||
let coordinator = self.coordinator
|
let coordinator = self.coordinator
|
||||||
let opacity = self.opacity(for: timelineItem)
|
|
||||||
|
|
||||||
cell.item = timelineItem
|
cell.item = timelineItem
|
||||||
cell.contentConfiguration = UIHostingConfiguration {
|
cell.contentConfiguration = UIHostingConfiguration {
|
||||||
timelineItem
|
timelineItem
|
||||||
.id(timelineItem.id)
|
.id(timelineItem.id)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.opacity(opacity)
|
|
||||||
.environmentObject(coordinator.context) // Attempted fix at a crash in TimelineItemContextMenu
|
.environmentObject(coordinator.context) // Attempted fix at a crash in TimelineItemContextMenu
|
||||||
.onAppear {
|
.onAppear {
|
||||||
coordinator.send(viewAction: .itemAppeared(id: timelineItem.id))
|
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
|
/// Returns a description of the current layout in order to update the
|
||||||
/// scroll position after adding/updating items to the timeline.
|
/// scroll position after adding/updating items to the timeline.
|
||||||
private func layout() -> LayoutDescriptor {
|
private func layout() -> LayoutDescriptor {
|
||||||
@@ -351,12 +331,6 @@ class TimelineTableViewController: UIViewController {
|
|||||||
|
|
||||||
coordinator.send(viewAction: .paginateBackwards)
|
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
|
// MARK: - UITableViewDelegate
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Removed reply/edit dimming for all non highlighted messages to increase readability.
|
||||||
Reference in New Issue
Block a user