* ios: verify connection security code * verification in member sheet (still crashes) * use navigation view for members list * ios: show verified status in the lists * update verification status in the list of members * verified shield layout * update icon, make add member navigation to right * refactor chatPreviewTitle
62 lines
1.9 KiB
Swift
62 lines
1.9 KiB
Swift
//
|
|
// ChatInfoToolbar.swift
|
|
// SimpleX
|
|
//
|
|
// Created by Evgeny Poberezkin on 11/02/2022.
|
|
// Copyright © 2022 SimpleX Chat. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
import SimpleXChat
|
|
|
|
let chatImageColorLight = Color(red: 0.9, green: 0.9, blue: 0.9)
|
|
let chatImageColorDark = Color(red: 0.2, green: 0.2, blue: 0.2)
|
|
struct ChatInfoToolbar: View {
|
|
@Environment(\.colorScheme) var colorScheme
|
|
@ObservedObject var chat: Chat
|
|
var imageSize: CGFloat = 32
|
|
|
|
var body: some View {
|
|
let cInfo = chat.chatInfo
|
|
return HStack {
|
|
if (cInfo.incognito) {
|
|
Image(systemName: "theatermasks").frame(maxWidth: 24, maxHeight: 24, alignment: .center).foregroundColor(.indigo)
|
|
Spacer().frame(width: 16)
|
|
}
|
|
ChatInfoImage(
|
|
chat: chat,
|
|
color: colorScheme == .dark
|
|
? chatImageColorDark
|
|
: chatImageColorLight
|
|
)
|
|
.frame(width: imageSize, height: imageSize)
|
|
.padding(.trailing, 4)
|
|
VStack {
|
|
let t = Text(cInfo.displayName).font(.headline)
|
|
(cInfo.contact?.verified == true ? contactVerifiedShield + t : t)
|
|
.lineLimit(1)
|
|
if cInfo.fullName != "" && cInfo.displayName != cInfo.fullName {
|
|
Text(cInfo.fullName).font(.subheadline)
|
|
.lineLimit(1)
|
|
}
|
|
}
|
|
}
|
|
.foregroundColor(.primary)
|
|
.frame(width: 220)
|
|
}
|
|
|
|
private var contactVerifiedShield: Text {
|
|
(Text(Image(systemName: "checkmark.shield")) + Text(" "))
|
|
.font(.caption)
|
|
.foregroundColor(.secondary)
|
|
.baselineOffset(1)
|
|
.kerning(-2)
|
|
}
|
|
}
|
|
|
|
struct ChatInfoToolbar_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
ChatInfoToolbar(chat: Chat(chatInfo: ChatInfo.sampleData.direct, chatItems: []))
|
|
}
|
|
}
|