mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
placeholder adjustments
This commit is contained in:
@@ -62,6 +62,8 @@ struct ChatItemView: View {
|
||||
CIVoiceView(chat: chat, chatItem: ci, recordingFile: ci.file, duration: duration, allowMenu: $allowMenu)
|
||||
} else if ci.content.msgContent == nil {
|
||||
ChatItemContentView(chat: chat, chatItem: chatItem, msgContentView: { Text(ci.text) }) // msgContent is unreachable branch in this case
|
||||
} else if ci.isPlaceholder {
|
||||
EmptyView()
|
||||
} else {
|
||||
framedItemView()
|
||||
}
|
||||
|
||||
@@ -1309,7 +1309,7 @@ struct ChatView: View {
|
||||
|
||||
@ViewBuilder
|
||||
private func menu(_ ci: ChatItem, _ range: ClosedRange<Int>?, live: Bool) -> some View {
|
||||
if let mc = ci.content.msgContent, ci.meta.itemDeleted == nil || revealed {
|
||||
if let mc = ci.content.msgContent, ci.meta.itemDeleted == nil || revealed, !ci.isPlaceholder {
|
||||
if chat.chatInfo.featureEnabled(.reactions) && ci.allowAddReaction,
|
||||
availableReactions.count > 0 {
|
||||
reactionsGroup
|
||||
|
||||
@@ -85,7 +85,6 @@ struct ReverseList<Content: View>: UIViewControllerRepresentable {
|
||||
) { (tableView, indexPath, item) -> UITableViewCell? in
|
||||
if self.representer.scrollState == .atDestination {
|
||||
if indexPath.item > self.itemCount - preloadItem, let item = self.getItemAtPath(indexPath: IndexPath(row: self.itemCount - 1, section: 0)) {
|
||||
logger.error("[scrolling] requesting page \(item.text)")
|
||||
self.representer.loadPage(.before(chatItemId: item.id, count: loadItemsPerPage))
|
||||
} else if let item = self.getFirstItemBeforePlacholder(indexPath) {
|
||||
// TODO: Cleanup, this should never be possible
|
||||
|
||||
@@ -119,7 +119,7 @@ struct SelectedItemsBottomToolbar: View {
|
||||
dee = dee && ci.meta.deletable && !ci.localNote
|
||||
onlyOwnGroupItems = onlyOwnGroupItems && ci.chatDir == .groupSnd
|
||||
me = me && ci.content.msgContent != nil && ci.memberToModerate(chatInfo) != nil
|
||||
fe = fe && ci.content.msgContent != nil && ci.meta.itemDeleted == nil && !ci.isLiveDummy
|
||||
fe = fe && ci.content.msgContent != nil && ci.meta.itemDeleted == nil && !ci.isLiveDummy && !ci.isPlaceholder
|
||||
sel.insert(ci.id) // we are collecting new selected items here to account for any changes in chat items list
|
||||
return (de, dee, me, onlyOwnGroupItems, fe, sel)
|
||||
} else {
|
||||
|
||||
@@ -2468,7 +2468,7 @@ public struct ChatItem: Identifiable, Decodable, Hashable {
|
||||
}
|
||||
|
||||
public var allowAddReaction: Bool {
|
||||
meta.itemDeleted == nil && !isLiveDummy && reactions.filter({ $0.userReacted }).count < 3
|
||||
meta.itemDeleted == nil && !isLiveDummy && !isPlaceholder && reactions.filter({ $0.userReacted }).count < 3
|
||||
}
|
||||
|
||||
public func autoReceiveFile() -> CIFile? {
|
||||
@@ -2677,7 +2677,7 @@ public struct ChatItem: Identifiable, Decodable, Hashable {
|
||||
updatedAt: .now,
|
||||
itemDeleted: nil,
|
||||
itemEdited: false,
|
||||
itemLive: true,
|
||||
itemLive: false,
|
||||
deletable: false,
|
||||
editable: false
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user