@@ -39,6 +39,7 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
39
39
40
40
private var loadingPreviousMessages : Bool = false
41
41
private var lastMessageRead : String ?
42
+ private var disableDateIndicator = false
42
43
43
44
public var channelController : ChatChannelController
44
45
public var messageController : ChatMessageController ?
@@ -74,7 +75,14 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
74
75
}
75
76
}
76
77
77
- @Published public var quotedMessage : ChatMessage ?
78
+ @Published public var quotedMessage : ChatMessage ? {
79
+ didSet {
80
+ if oldValue != nil && quotedMessage == nil {
81
+ disableDateIndicator = true
82
+ }
83
+ }
84
+ }
85
+
78
86
@Published public var editedMessage : ChatMessage ?
79
87
@Published public var channelHeaderType : ChannelHeaderType = . regular
80
88
@@ -232,6 +240,11 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
232
240
}
233
241
234
242
private func save( lastDate: Date ) {
243
+ if disableDateIndicator {
244
+ enableDateIndicator ( )
245
+ return
246
+ }
247
+
235
248
currentDate = lastDate
236
249
timer? . invalidate ( )
237
250
timer = Timer . scheduledTimer (
@@ -339,6 +352,12 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
339
352
return false
340
353
}
341
354
355
+ private func enableDateIndicator( ) {
356
+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.3 ) { [ weak self] in
357
+ self ? . disableDateIndicator = false
358
+ }
359
+ }
360
+
342
361
deinit {
343
362
messageCachingUtils. clearCache ( )
344
363
}
@@ -377,7 +396,11 @@ extension ChatMessage: Identifiable {
377
396
states += fileAttachments. compactMap { $0. uploadingState? . state }
378
397
379
398
if states. isEmpty {
380
- return " empty "
399
+ if localState == . sendingFailed {
400
+ return " failed "
401
+ } else {
402
+ return " empty "
403
+ }
381
404
}
382
405
383
406
let strings = states. map { " \( $0) " }
0 commit comments