mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-14 16:55:27 +00:00
29990765e7
* mobile: webrtc calls state machine * android: call api types * android: call api methods * ios: connect calls via chat UI (WIP) * ios: webrtc call connects via UI * core: update call duration/status when x.call.end is received * improve call UX/UI * audio calls * different overlay for audio calls * toggle video/audio in the call
44 lines
1.6 KiB
Swift
44 lines
1.6 KiB
Swift
//
|
|
// ChatItemView.swift
|
|
// SimpleX
|
|
//
|
|
// Created by Evgeny Poberezkin on 30/01/2022.
|
|
// Copyright © 2022 SimpleX Chat. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ChatItemView: View {
|
|
var chatItem: ChatItem
|
|
var showMember = false
|
|
var maxWidth: CGFloat = .infinity
|
|
|
|
var body: some View {
|
|
if chatItem.isMsgContent() {
|
|
if (chatItem.quotedItem == nil && chatItem.file == nil && isShortEmoji(chatItem.content.text)) {
|
|
EmojiItemView(chatItem: chatItem)
|
|
} else {
|
|
FramedItemView(chatItem: chatItem, showMember: showMember, maxWidth: maxWidth)
|
|
}
|
|
} else if chatItem.isDeletedContent() {
|
|
DeletedItemView(chatItem: chatItem, showMember: showMember)
|
|
} else if chatItem.isCall() {
|
|
FramedItemView(chatItem: chatItem, showMember: showMember, maxWidth: maxWidth)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct ChatItemView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
Group{
|
|
ChatItemView(chatItem: ChatItem.getSample(1, .directSnd, .now, "hello"))
|
|
ChatItemView(chatItem: ChatItem.getSample(2, .directRcv, .now, "hello there too"))
|
|
ChatItemView(chatItem: ChatItem.getSample(1, .directSnd, .now, "🙂"))
|
|
ChatItemView(chatItem: ChatItem.getSample(2, .directRcv, .now, "🙂🙂🙂🙂🙂"))
|
|
ChatItemView(chatItem: ChatItem.getSample(2, .directRcv, .now, "🙂🙂🙂🙂🙂🙂"))
|
|
ChatItemView(chatItem: ChatItem.getDeletedContentSample())
|
|
}
|
|
.previewLayout(.fixed(width: 360, height: 70))
|
|
}
|
|
}
|