diff --git a/apps/ios/Shared/Views/Chat/ChatView.swift b/apps/ios/Shared/Views/Chat/ChatView.swift index 5700a8c732..763e5d42f6 100644 --- a/apps/ios/Shared/Views/Chat/ChatView.swift +++ b/apps/ios/Shared/Views/Chat/ChatView.swift @@ -731,7 +731,7 @@ struct ChatView: View { case let .grouped(items, _, _, _, _, _, _, _): items.boxedValue.last!.item } return Group { - if case .chatBanner = ci.content { + if ci.isChatBanner { ChatBannerView(chat: chat) .padding(.bottom, 90) .padding(.top, 8) @@ -1494,8 +1494,14 @@ struct ChatView: View { } var body: some View { - let last = isLastItem ? im.reversedChatItems.last : nil let listItem = merged.newest() + let last = ( + (listItem.nextItem?.isChatBanner ?? false) + ? listItem.item + : isLastItem + ? im.reversedChatItems.last + : nil + ) let item = listItem.item let range: ClosedRange? = if case let .grouped(_, _, _, rangeInReversed, _, _, _, _) = merged { rangeInReversed.boxedValue diff --git a/apps/ios/SimpleXChat/ChatTypes.swift b/apps/ios/SimpleXChat/ChatTypes.swift index 5107ddf45d..8f2f9670a0 100644 --- a/apps/ios/SimpleXChat/ChatTypes.swift +++ b/apps/ios/SimpleXChat/ChatTypes.swift @@ -3021,6 +3021,13 @@ public struct ChatItem: Identifiable, Decodable, Hashable { (content.msgContent != nil && !meta.isLive) || meta.itemDeleted != nil || isDeletedContent || mergeCategory != nil || showLocalDelete } + public var isChatBanner: Bool { + switch content { + case .chatBanner: true + default: false + } + } + public static func getSample (_ id: Int64, _ dir: CIDirection, _ ts: Date, _ text: String, _ status: CIStatus = .sndNew, quotedItem: CIQuote? = nil, file: CIFile? = nil, itemDeleted: CIDeleted? = nil, itemEdited: Bool = false, itemLive: Bool = false, deletable: Bool = true, editable: Bool = true) -> ChatItem { ChatItem( chatDir: dir,