App icon, group member annotations, variable spacing
This commit is contained in:
@@ -15,13 +15,13 @@ struct TranscriptView: View
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
LazyVStack(spacing: 17.0) {
|
||||
LazyVStack(spacing: 6.0) {
|
||||
ForEach($model.displayItems.reversed()) { item in
|
||||
displayItemView(item.wrappedValue)
|
||||
.id(item.id)
|
||||
.scaleEffect(CGSize(width: 1.0, height: -1.0))
|
||||
.transition(
|
||||
.push(from: .bottom)
|
||||
.push(from: .top)
|
||||
.combined(with: .opacity)
|
||||
)
|
||||
}
|
||||
@@ -39,7 +39,7 @@ struct TranscriptView: View
|
||||
case .attachmentDownloaded(let attachmentId):
|
||||
model.attachmentDownloaded(id: attachmentId)
|
||||
case .messagesUpdated(let conversationId):
|
||||
if conversationId == model.displayedConversation {
|
||||
if let displayedConversation = model.displayedConversation, conversationId == displayedConversation.id {
|
||||
model.setNeedsReload(animated: true)
|
||||
}
|
||||
case .updateStreamReconnected:
|
||||
@@ -54,18 +54,24 @@ struct TranscriptView: View
|
||||
private func displayItemView(_ item: DisplayItem) -> some View {
|
||||
switch item {
|
||||
case .message(let message):
|
||||
TextBubbleItemView(text: message.text, isFromMe: message.isFromMe)
|
||||
TextBubbleItemView(text: message.text, sender: message.sender, date: message.date)
|
||||
case .date(let date):
|
||||
DateItemView(date: date)
|
||||
case .senderAttribition(let message):
|
||||
SenderAttributionView(sender: message.sender)
|
||||
case .spacer(let length, _):
|
||||
Spacer(minLength: length)
|
||||
case .attachment(let attachment):
|
||||
if attachment.isPreviewDownloaded {
|
||||
ImageItemView(
|
||||
isFromMe: attachment.sender.isMe,
|
||||
sender: attachment.sender,
|
||||
date: attachment.dateSent,
|
||||
attachment: attachment
|
||||
)
|
||||
} else {
|
||||
PlaceholderImageItemView(
|
||||
isFromMe: attachment.sender.isMe,
|
||||
sender: attachment.sender,
|
||||
date: attachment.dateSent,
|
||||
size: attachment.size
|
||||
)
|
||||
}
|
||||
@@ -78,7 +84,7 @@ struct TranscriptView: View
|
||||
class ViewModel
|
||||
{
|
||||
var displayItems: [DisplayItem] = []
|
||||
var displayedConversation: Display.Conversation.ID? = nil
|
||||
var displayedConversation: Display.Conversation? = nil
|
||||
|
||||
internal var needsReload: NeedsReload = .no
|
||||
internal var messages: [Display.Message]
|
||||
@@ -127,7 +133,7 @@ struct TranscriptView: View
|
||||
guard let displayedConversation else { return }
|
||||
|
||||
do {
|
||||
try await client.markConversationAsRead(conversationId: displayedConversation)
|
||||
try await client.markConversationAsRead(conversationId: displayedConversation.id)
|
||||
} catch {
|
||||
print("Error triggering sync: \(error)")
|
||||
}
|
||||
@@ -137,7 +143,7 @@ struct TranscriptView: View
|
||||
guard let displayedConversation else { return }
|
||||
|
||||
do {
|
||||
try await client.syncConversation(conversationId: displayedConversation)
|
||||
try await client.syncConversation(conversationId: displayedConversation.id)
|
||||
} catch {
|
||||
print("Error triggering sync: \(error)")
|
||||
}
|
||||
@@ -150,7 +156,7 @@ struct TranscriptView: View
|
||||
guard let displayedConversation else { return }
|
||||
|
||||
do {
|
||||
let clientMessages = try await client.getMessages(conversationId: displayedConversation)
|
||||
let clientMessages = try await client.getMessages(conversationId: displayedConversation.id)
|
||||
.map { Display.Message(from: $0) }
|
||||
|
||||
self.messages = clientMessages
|
||||
|
||||
Reference in New Issue
Block a user