Skip to content

Commit a06f43a

Browse files
Updated icon for pendingSend local message state
1 parent bf925f5 commit a06f43a

File tree

8 files changed

+44
-7
lines changed

8 files changed

+44
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1010

1111
### 🔄 Changed
1212
- `AddedAsset`'s `extraData` property is now of type `[String: RawJSON]`
13+
- New icon for `pendingSend` local message state
1314

1415
# [4.25.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.25.0)
1516
_December 16, 2022_

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright © 2022 Stream.io Inc. All rights reserved.
2+
// Copyright © 2023 Stream.io Inc. All rights reserved.
33
//
44

55
import StreamChat
@@ -81,10 +81,12 @@ public struct MessageReadIndicatorView: View {
8181

8282
var readUsers: [ChatUser]
8383
var showReadCount: Bool
84+
var localState: LocalMessageState?
8485

85-
public init(readUsers: [ChatUser], showReadCount: Bool) {
86+
public init(readUsers: [ChatUser], showReadCount: Bool, localState: LocalMessageState? = nil) {
8687
self.readUsers = readUsers
8788
self.showReadCount = showReadCount
89+
self.localState = localState
8890
}
8991

9092
public var body: some View {
@@ -96,7 +98,7 @@ public struct MessageReadIndicatorView: View {
9698
.accessibilityIdentifier("readIndicatorCount")
9799
}
98100
Image(
99-
uiImage: !readUsers.isEmpty ? images.readByAll : images.messageSent
101+
uiImage: image
100102
)
101103
.customizable()
102104
.foregroundColor(!readUsers.isEmpty ? colors.tintColor : Color(colors.textLowEmphasis))
@@ -106,6 +108,10 @@ public struct MessageReadIndicatorView: View {
106108
.accessibilityElement(children: .contain)
107109
.accessibilityIdentifier("MessageReadIndicatorView")
108110
}
111+
112+
private var image: UIImage {
113+
!readUsers.isEmpty ? images.readByAll : (localState == .pendingSend ? images.messageReceiptSending : images.messageSent)
114+
}
109115
}
110116

111117
/// Message spacer view, used for adding space depending on who sent the message..

Sources/StreamChatSwiftUI/DefaultViewFactory.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright © 2022 Stream.io Inc. All rights reserved.
2+
// Copyright © 2023 Stream.io Inc. All rights reserved.
33
//
44

55
import Photos
@@ -819,7 +819,8 @@ extension ViewFactory {
819819
let showReadCount = channel.memberCount > 2
820820
return MessageReadIndicatorView(
821821
readUsers: readUsers,
822-
showReadCount: showReadCount
822+
showReadCount: showReadCount,
823+
localState: message.localState
823824
)
824825
}
825826
}

Sources/StreamChatSwiftUI/Images.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright © 2022 Stream.io Inc. All rights reserved.
2+
// Copyright © 2023 Stream.io Inc. All rights reserved.
33
//
44

55
import Foundation
@@ -51,6 +51,7 @@ public class Images {
5151
public var messageSent: UIImage = loadImageSafely(with: "checkmark_grey")
5252
public var whiteCheckmark: UIImage = loadImageSafely(with: "checkmark_white")
5353
public var readByAll: UIImage = loadImageSafely(with: "checkmark_double")
54+
public var messageReceiptSending: UIImage = loadImageSafely(with: "message_receipt_sending")
5455
public var confirmCheckmark: UIImage = loadImageSafely(with: "checkmark_confirm")
5556
public var bigConfirmCheckmark: UIImage = loadImageSafely(with: "checkmark_confirm_big")
5657
public var folder: UIImage = loadImageSafely(with: "folder")
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "Union.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
},
12+
"properties" : {
13+
"template-rendering-intent" : "template"
14+
}
15+
}

StreamChatSwiftUITests/Tests/ChatChannel/MessageReadIndicatorView_Tests.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright © 2022 Stream.io Inc. All rights reserved.
2+
// Copyright © 2023 Stream.io Inc. All rights reserved.
33
//
44

55
import SnapshotTesting
@@ -44,4 +44,17 @@ class MessageReadIndicatorView_Tests: StreamChatTestCase {
4444
// Then
4545
assertSnapshot(matching: view, as: .image)
4646
}
47+
48+
func test_messageReadIndicatorView_snapshotPendingSend() {
49+
// Given
50+
let view = MessageReadIndicatorView(
51+
readUsers: [],
52+
showReadCount: false,
53+
localState: .pendingSend
54+
)
55+
.frame(width: 50, height: 16)
56+
57+
// Then
58+
assertSnapshot(matching: view, as: .image)
59+
}
4760
}
Loading

0 commit comments

Comments
 (0)