Files
simplex-chat/apps/ios/Shared/Views/ChatList/ContactRequestView.swift
T
Evgeny @ SimpleX Chat cfb9b7c656 ios: snapshot tests render all app previews (#7912)
* ios: snapshot tests render all previews at fixed dates

* ios: previews of your servers and terminal render without errors

* ios: snapshots fill the screen height for lists, skip device migration

* ios: snapshots show the sample user, secondary chat preview has items

* ios: snapshots skip previews of live prices, profiles and console

* ci: references of all iOS previews

* ci: snapshot docs state window height, exclusions and timing

* ios: snapshots skip previews with a blinking caret or a spinner

* ios: snapshots end editing and stop animations, restoring 8 previews

* ci: references of the restored cursor and spinner previews

* ios: chat item previews clip items to bubbles as the chat view does

* ci: references of chat item previews with bubbles
2026-10-28 05:18:10 +00:00

64 lines
2.2 KiB
Swift

//
// ContactRequestView.swift
// SimpleX
//
// Created by Evgeny Poberezkin on 02/02/2022.
// Copyright © 2022 SimpleX Chat. All rights reserved.
//
import SwiftUI
import SimpleXChat
struct ContactRequestView: View {
@EnvironmentObject var chatModel: ChatModel
@EnvironmentObject var theme: AppTheme
@Environment(\.dynamicTypeSize) private var userFont: DynamicTypeSize
var contactRequest: UserContactRequest
@ObservedObject var chat: Chat
var body: some View {
HStack(spacing: 8) {
ChatInfoImage(chat: chat, size: dynamicSize(userFont).profileImageSize)
.padding(.leading, 4)
VStack(alignment: .leading, spacing: 0) {
HStack(alignment: .top) {
NameWithBadge(
Text(contactRequest.chatViewName)
.font(.title3)
.fontWeight(.bold)
.foregroundColor(theme.colors.primary),
chat.chatInfo.nameBadge,
.title3
)
.padding(.leading, 8)
.frame(alignment: .topLeading)
Spacer()
formatTimestampText(contactRequest.updatedAt)
.font(.subheadline)
.padding(.trailing, 8)
.padding(.top, 4)
.frame(minWidth: 60, alignment: .trailing)
.foregroundColor(theme.colors.secondary)
}
.padding(.bottom, 2)
Text("wants to connect to you!")
.frame(alignment: .topLeading)
.padding([.leading, .trailing], 8)
Spacer()
}
.frame(maxHeight: .infinity)
}
}
}
struct ContactRequestView_Previews: PreviewProvider {
static var previews: some View {
var contactRequest = UserContactRequest.sampleData
contactRequest.updatedAt = previewDate
return ContactRequestView(contactRequest: contactRequest, chat: Chat(chatInfo: ChatInfo.sampleData.contactRequest , chatItems: []))
.previewLayout(.fixed(width: 360, height: 80))
}
}