* ios: marked deleted chat items; full deletion preference * text_, menu, backend * android types * more android types * fix * refactor ios * restore previews * box * refactor menu * revert unnecessary content.text changes * Update apps/ios/Shared/Views/Chat/ChatItem/CIVoiceView.swift Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> * revert layered framed items * clever framed view * improve look * restore previews * restore previews * refactor * refactoring, almost looks good * look * add previews * more previews * remove preview of legacy item * ChatItemDeleted * flip if * remove text_ * refactor * abstract pref property * move marked deleted * revert pref change * undo menu * fix - change to constants * undo pref logic Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
55 lines
1.6 KiB
Swift
55 lines
1.6 KiB
Swift
//
|
|
// ContextItemView.swift
|
|
// SimpleX
|
|
//
|
|
// Created by JRoberts on 13/03/2022.
|
|
// Copyright © 2022 SimpleX Chat. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
import SimpleXChat
|
|
|
|
struct ContextItemView: View {
|
|
@Environment(\.colorScheme) var colorScheme
|
|
let contextItem: ChatItem
|
|
let contextIcon: String
|
|
let cancelContextItem: () -> Void
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Image(systemName: contextIcon)
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
.frame(width: 16, height: 16)
|
|
.foregroundColor(.secondary)
|
|
MsgContentView(
|
|
text: contextItem.text,
|
|
formattedText: contextItem.formattedText,
|
|
sender: contextItem.memberDisplayName
|
|
)
|
|
.multilineTextAlignment(isRightToLeft(contextItem.text) ? .trailing : .leading)
|
|
.lineLimit(3)
|
|
Spacer()
|
|
Button {
|
|
withAnimation {
|
|
cancelContextItem()
|
|
}
|
|
} label: {
|
|
Image(systemName: "multiply")
|
|
}
|
|
}
|
|
.padding(12)
|
|
.frame(minHeight: 50)
|
|
.frame(maxWidth: .infinity)
|
|
.background(chatItemFrameColor(contextItem, colorScheme))
|
|
.padding(.top, 8)
|
|
}
|
|
}
|
|
|
|
struct ContextItemView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
let contextItem: ChatItem = ChatItem.getSample(1, .directSnd, .now, "hello")
|
|
return ContextItemView(contextItem: contextItem, contextIcon: "pencil.circle", cancelContextItem: {})
|
|
}
|
|
}
|