mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Improvements to state items (#478)
- Remove context menu (and fix long press when there are no items). - Add membership change tests. - Fix new/old name incorrect ordering. - Fix message grouping when it comes before/after a state item from the same user. - Only show reactions picker for items that can be reacted to.
This commit is contained in:
@@ -17,8 +17,11 @@
|
||||
import SwiftUI
|
||||
|
||||
struct TimelineItemContextMenuActions {
|
||||
static var empty: TimelineItemContextMenuActions { .init(actions: [], debugActions: []) }
|
||||
|
||||
let actions: [TimelineItemContextMenuAction]
|
||||
let debugActions: [TimelineItemContextMenuAction]
|
||||
var isEmpty: Bool { actions.isEmpty && debugActions.isEmpty }
|
||||
}
|
||||
|
||||
enum TimelineItemContextMenuAction: Identifiable, Hashable {
|
||||
@@ -48,13 +51,17 @@ public struct TimelineItemContextMenu: View {
|
||||
let contextMenuActions: TimelineItemContextMenuActions
|
||||
let callback: (TimelineItemContextMenuAction) -> Void
|
||||
|
||||
@ViewBuilder
|
||||
public var body: some View {
|
||||
viewsForActions(contextMenuActions.actions)
|
||||
Menu {
|
||||
viewsForActions(contextMenuActions.debugActions)
|
||||
} label: {
|
||||
Label("Developer", systemImage: "hammer")
|
||||
if contextMenuActions.isEmpty {
|
||||
// When there are no actions make sure then menu isn't shown.
|
||||
EmptyView()
|
||||
} else {
|
||||
viewsForActions(contextMenuActions.actions)
|
||||
Menu {
|
||||
viewsForActions(contextMenuActions.debugActions)
|
||||
} label: {
|
||||
Label("Developer", systemImage: "hammer")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ class TimelineTableViewController: UIViewController {
|
||||
return .systemAction
|
||||
})
|
||||
.onTapGesture(count: 2) {
|
||||
coordinator.send(viewAction: .displayEmojiPicker(itemId: timelineItem.id))
|
||||
coordinator.send(viewAction: .itemDoubleTapped(id: timelineItem.id))
|
||||
}
|
||||
.onTapGesture {
|
||||
coordinator.send(viewAction: .itemTapped(id: timelineItem.id))
|
||||
|
||||
Reference in New Issue
Block a user