mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-25 18:32:17 +00:00
* light github image for dark mode * show message received status, remove chevrons in chat list * show unread message status * add message send error mark * refactor alerts to use AlertManager * show alert message on tapping undelivered message, simplify text-only alerts
48 lines
1.3 KiB
Swift
48 lines
1.3 KiB
Swift
//
|
|
// CIMetaView.swift
|
|
// SimpleX
|
|
//
|
|
// Created by Evgeny Poberezkin on 11/02/2022.
|
|
// Copyright © 2022 SimpleX Chat. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct CIMetaView: View {
|
|
var chatItem: ChatItem
|
|
|
|
var body: some View {
|
|
HStack(alignment: .center, spacing: 4) {
|
|
switch chatItem.meta.itemStatus {
|
|
case .sndSent:
|
|
statusImage("checkmark", .secondary)
|
|
case .sndErrorAuth:
|
|
statusImage("multiply", .red)
|
|
case .sndError:
|
|
statusImage("exclamationmark.triangle.fill", .yellow)
|
|
case .rcvNew:
|
|
statusImage("circlebadge.fill", Color.accentColor)
|
|
default: EmptyView()
|
|
}
|
|
|
|
Text(chatItem.timestampText)
|
|
.font(.caption)
|
|
.foregroundColor(.secondary)
|
|
}
|
|
}
|
|
|
|
private func statusImage(_ systemName: String, _ color: Color) -> some View {
|
|
Image(systemName: systemName)
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
.foregroundColor(color)
|
|
.frame(maxHeight: 8)
|
|
}
|
|
}
|
|
|
|
struct CIMetaView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
CIMetaView(chatItem: ChatItem.getSample(2, .directSnd, .now, "https://simplex.chat", .sndSent))
|
|
}
|
|
}
|