Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.45.1 Release #2952

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6e01f62
Add system message when adding a member in the DemoApp (#2932)
nuno-vieira Dec 12, 2023
0ffb112
[Background Mapping] Avoid crash when accessing DTOs while DB is bein…
nuno-vieira Dec 13, 2023
e7cd4e1
Merge branch 'main' into develop
testableapple Dec 13, 2023
c5d9894
Added cookbook for custom channel list (#2929)
martinmitrevski Dec 13, 2023
70857b2
Update Docs related to min iOS version (#2935)
nuno-vieira Dec 14, 2023
77b3dbb
Fix duplicated Runpath Search Paths (#2937)
nuno-vieira Dec 14, 2023
a16d1d9
Fix `_dispatch_lane_resume` crash in RepeatingTimer (#2938)
nuno-vieira Dec 15, 2023
ea823b4
Added docs for custom Firebase CND (#2940)
martinmitrevski Dec 18, 2023
0bc0a1f
Fix file attachments not rendering file size (#2941)
nuno-vieira Dec 19, 2023
9ddaa51
Fix editing voice attachments (#2943)
martinmitrevski Dec 20, 2023
892c21e
[CI] Sync Mock Server (#2939)
Stream-iOS-Bot Dec 20, 2023
3f82c6c
Added docs for the async voice feature on SwiftUI (#2942)
martinmitrevski Dec 20, 2023
44f5477
Fix quoted chat message view with wrong text (#2946)
nuno-vieira Dec 21, 2023
bf7e4a1
Fix jumping to bottom when loading new messages (#2945)
nuno-vieira Dec 21, 2023
a26f3c2
Add custom location attachment to the Demo App (#2947)
nuno-vieira Dec 21, 2023
804b42a
Fix messages failing to be deleted when pending updates to the server…
nuno-vieira Dec 21, 2023
1814daa
Revert "Add custom location attachment to the Demo App (#2947)"
nuno-vieira Dec 21, 2023
5dbfd42
Bump 4.45.1
nuno-vieira Dec 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions Brewfile.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,45 +56,45 @@
}
},
"vale": {
"version": "2.29.6",
"version": "2.30.0",
"bottle": {
"rebuild": 0,
"root_url": "https://ghcr.io/v2/homebrew/core",
"files": {
"arm64_sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:05e3a10167a5eb5a006ee84b9475667ecffb905c91b96c8e2f14d1c8155c33f7",
"sha256": "05e3a10167a5eb5a006ee84b9475667ecffb905c91b96c8e2f14d1c8155c33f7"
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:c7705e7772367c6d82cfd41dd0fe1662065aac1a50b3a35fa9fa58d652327d1c",
"sha256": "c7705e7772367c6d82cfd41dd0fe1662065aac1a50b3a35fa9fa58d652327d1c"
},
"arm64_ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:1c76354047dbab61dd6eabd57a7696fa1e018c734195f2a3162e8d7391e972ae",
"sha256": "1c76354047dbab61dd6eabd57a7696fa1e018c734195f2a3162e8d7391e972ae"
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:f12ab9bf3e44bbca9c8aa65ea06058fba07c3d97739d9b44a041f607a9f4c988",
"sha256": "f12ab9bf3e44bbca9c8aa65ea06058fba07c3d97739d9b44a041f607a9f4c988"
},
"arm64_monterey": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:47b93b5bdfd92c399e94b0410504316fdef6a52eb63b8a2a2f02a5d78e04c47b",
"sha256": "47b93b5bdfd92c399e94b0410504316fdef6a52eb63b8a2a2f02a5d78e04c47b"
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:df1119b58d493a2fa7087886587e8cf602ad73419c9307a18a3e64ce4f7e0ea3",
"sha256": "df1119b58d493a2fa7087886587e8cf602ad73419c9307a18a3e64ce4f7e0ea3"
},
"sonoma": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:e62675ee738a215135d0b89d10ce6cd55d0f2ca09ec38e4a5655c70470a5417b",
"sha256": "e62675ee738a215135d0b89d10ce6cd55d0f2ca09ec38e4a5655c70470a5417b"
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:e1bfa5074b197f158b34d16a0b99a774469c01b261df0f12434e0fd8221b8c81",
"sha256": "e1bfa5074b197f158b34d16a0b99a774469c01b261df0f12434e0fd8221b8c81"
},
"ventura": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:6e50c718f460a0a77f6a62faebc94e951a4f45ac7e8701f0e26dd5508b3d79a6",
"sha256": "6e50c718f460a0a77f6a62faebc94e951a4f45ac7e8701f0e26dd5508b3d79a6"
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:c95d989401b9bc4f7d0e1ee50bf8b7411fc6285c126ec3c6245a4a5eb2aba4e8",
"sha256": "c95d989401b9bc4f7d0e1ee50bf8b7411fc6285c126ec3c6245a4a5eb2aba4e8"
},
"monterey": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:80f5018f609ee0e62f47b0cda14dfdc17c63bce9f3acc71d1415e1c0f634e575",
"sha256": "80f5018f609ee0e62f47b0cda14dfdc17c63bce9f3acc71d1415e1c0f634e575"
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:03c7c04cee73031c63520a208fa3d775ec4ebb776b7e8df79aedaf4054713e1e",
"sha256": "03c7c04cee73031c63520a208fa3d775ec4ebb776b7e8df79aedaf4054713e1e"
},
"x86_64_linux": {
"cellar": ":any_skip_relocation",
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:b94563d083ab001aeac3d6753b4cf3f5a2ae911c71794414794d1887b9726424",
"sha256": "b94563d083ab001aeac3d6753b4cf3f5a2ae911c71794414794d1887b9726424"
"url": "https://ghcr.io/v2/homebrew/core/vale/blobs/sha256:539523fa46cdefe2a4aa752756f5724fc85dddce2b7ca1163fb41cb3c613efc3",
"sha256": "539523fa46cdefe2a4aa752756f5724fc85dddce2b7ca1163fb41cb3c613efc3"
}
}
}
Expand All @@ -118,12 +118,12 @@
"system": {
"macos": {
"ventura": {
"HOMEBREW_VERSION": "4.1.17",
"HOMEBREW_VERSION": "4.1.22",
"HOMEBREW_PREFIX": "/usr/local",
"Homebrew/homebrew-core": "api",
"CLT": "15.0.0.0.1.1694021235",
"Xcode": "14.3.1",
"macOS": "13.6"
"macOS": "13.6.1"
}
}
}
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### 🔄 Changed

# [4.45.1](https://github.com/GetStream/stream-chat-swift/releases/tag/4.45.1)
_December 21, 2023_

## StreamChat
### 🐞 Fixed
- Fix duplicated Runpath Search Paths [#2937](https://github.com/GetStream/stream-chat-swift/pull/2937)
- Fix `_dispatch_lane_resume` crash in `RepeatingTimer` [#2938](https://github.com/GetStream/stream-chat-swift/pull/2938)
- Fix editing of async voice messages [#2943](https://github.com/GetStream/stream-chat-swift/pull/2943)

## StreamChatUI
### 🐞 Fixed
- Fix duplicated Runpath Search Paths [#2937](https://github.com/GetStream/stream-chat-swift/pull/2937)
- Fix file attachments not rendering file size [#2941](https://github.com/GetStream/stream-chat-swift/pull/2941)
- Fix quoted chat message view with wrong text [#2946](https://github.com/GetStream/ios-issues-tracking/issues/683)
- Fix jumping to bottom when loading new messages [#2945](https://github.com/GetStream/stream-chat-swift/pull/2945)
- Fix messages failing to be deleted when pending updates to the server [#2949](https://github.com/GetStream/stream-chat-swift/pull/2949)

# [4.45.0](https://github.com/GetStream/stream-chat-swift/releases/tag/4.45.0)
_December 11, 2023_

Expand All @@ -29,6 +46,9 @@ _December 11, 2023_
- Fix edit action possible in giphy messages [#2926](https://github.com/GetStream/stream-chat-swift/pull/2926)
- Fix not adding a space in the message input when mentioning a user [#2927](https://github.com/GetStream/stream-chat-swift/pull/2927)

## ⚠️ Important
- iOS 11 support has been dropped since Xcode 15 does not allow publishing apps with iOS 11.

# [4.44.0](https://github.com/GetStream/stream-chat-swift/releases/tag/4.44.0)
_November 30, 2023_

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ final class DemoChatChannelListRouter: ChatChannelListRouter {
self.rootViewController.presentAlert(title: "User ID is not valid")
return
}
channelController.addMembers(userIds: [id]) { error in
channelController.addMembers(
userIds: [id],
message: "Members added to the channel"
) { error in
if let error = error {
self.rootViewController.presentAlert(
title: "Couldn't add user \(id) to channel \(cid)",
Expand Down
2 changes: 1 addition & 1 deletion Documentation.docc/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This is the official iOS SDK for [Stream Chat](https://getstream.io/chat/sdk/ios
- **`SwiftUI` support:** We have developed a brand new SDK to help you have smoother Stream Chat integration in your SwiftUI apps.
- **First-class support for `Combine`**: The StreamChat SDK (Low Level Client) has Combine wrappers to make it really easy use in an app that uses `Combine`.
- **Fully open-source implementation:** You have access to the complete source code of the SDK here on GitHub.
- **Supports iOS 11+:** We proudly support older versions of iOS, so your app can stay available to almost everyone.
- **Supports iOS 12+:** We proudly support older versions of iOS, so your app can stay available to almost everyone.

## Quick Links

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The **StreamChatSwiftUI SDK** is our UI SDK for SwiftUI components. If your appl
- **`SwiftUI` support:** We have developed a brand new SDK to help you have smoother Stream Chat integration in your SwiftUI apps.
- **First-class support for `Combine`**: The StreamChat SDK (Low Level Client) has Combine wrappers to make it really easy use in an app that uses `Combine`.
- **Fully open-source implementation:** You have access to the complete source code of the SDK here on GitHub.
- **Supports iOS 11+:** We proudly support older versions of iOS, so your app can stay available to almost everyone.
- **Supports iOS 12+:** We proudly support older versions of iOS, so your app can stay available to almost everyone.

## **Quick Links**

Expand Down
2 changes: 1 addition & 1 deletion Sources/StreamChat/ChatClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class ChatClient {
.video: VideoAttachmentPayload.self,
.audio: AudioAttachmentPayload.self,
.file: FileAttachmentPayload.self,
.voiceRecording: VideoAttachmentPayload.self
.voiceRecording: VoiceRecordingAttachmentPayload.self
]

let connectionRepository: ConnectionRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,12 +715,11 @@ public class ChatMessageController: DataController, DelegateCallable, DataStoreP
extension ChatMessageController {
struct Environment {
var messageObserverBuilder: (
_ isBackgroundMappingEnabled: Bool,
_ databaseContainer: DatabaseContainer,
_ context: NSManagedObjectContext,
_ fetchRequest: NSFetchRequest<MessageDTO>,
_ itemCreator: @escaping (MessageDTO) throws -> ChatMessage,
_ fetchedResultsControllerType: NSFetchedResultsController<MessageDTO>.Type
) -> EntityDatabaseObserverWrapper<ChatMessage, MessageDTO> = EntityDatabaseObserverWrapper.init
) -> EntityDatabaseObserver<ChatMessage, MessageDTO> = EntityDatabaseObserver.init

var repliesObserverBuilder: (
_ isBackgroundMappingEnabled: Bool,
Expand All @@ -745,10 +744,9 @@ extension ChatMessageController {
// MARK: - Private

private extension ChatMessageController {
func createMessageObserver() -> EntityDatabaseObserverWrapper<ChatMessage, MessageDTO> {
func createMessageObserver() -> EntityDatabaseObserver<ChatMessage, MessageDTO> {
let observer = environment.messageObserverBuilder(
StreamRuntimeCheck._isBackgroundMappingEnabled,
client.databaseContainer,
client.databaseContainer.viewContext,
MessageDTO.message(withID: messageId),
{ try $0.asModel() },
NSFetchedResultsController<MessageDTO>.self
Expand Down
2 changes: 1 addition & 1 deletion Sources/StreamChat/Database/DTOs/MessageDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ extension MessageDTO {

var isLocalOnly: Bool {
if let localMessageState = self.localMessageState {
return localMessageState.isWaitingToBeSentToServer
return localMessageState.isLocalOnly
}

return type == MessageType.ephemeral.rawValue || type == MessageType.error.rawValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import Foundation

extension SystemEnvironment {
/// A Stream Chat version.
public static let version: String = "4.45.0"
public static let version: String = "4.45.1"
}
2 changes: 1 addition & 1 deletion Sources/StreamChat/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>4.45.0</string>
<string>4.45.1</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
Expand Down
12 changes: 4 additions & 8 deletions Sources/StreamChat/Models/ChatMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public extension ChatMessage {

var isLocalOnly: Bool {
if let localState = self.localState {
return localState.isWaitingToBeSentToServer
return localState.isLocalOnly
}

return type == .ephemeral || type == .error
Expand Down Expand Up @@ -463,13 +463,9 @@ public enum LocalMessageState: String {
/// Deleting of the message failed after multiple of tries. The system is not trying to delete this message anymore.
case deletingFailed

var isWaitingToBeSentToServer: Bool {
switch self {
case .pendingSync, .syncing, .syncingFailed, .pendingSend, .sending, .sendingFailed:
return true
case .deleting, .deletingFailed:
return false
}
/// If the message is available only locally. The message is not on the server.
var isLocalOnly: Bool {
self == .pendingSend || self == .sendingFailed || self == .sending
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ extension Notification {
}

/// An Internet Connection monitor.
///
/// Basically, it's a wrapper over legacy monitor based on `Reachability` (iOS 11 only)
/// and default monitor based on `Network`.`NWPathMonitor` (iOS 12+).
class InternetConnection {
/// The current Internet connection status.
private(set) var status: InternetConnection.Status {
Expand Down
29 changes: 18 additions & 11 deletions Sources/StreamChat/Utils/Timers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private class RepeatingTimer: RepeatingTimerControl {
case resumed
}

private let queue = DispatchQueue(label: "io.getstream.repeating-timer")
private var state: State = .suspended
private let timer: DispatchSourceTimer

Expand All @@ -97,24 +98,30 @@ private class RepeatingTimer: RepeatingTimerControl {
timer.cancel()
// If the timer is suspended, calling cancel without resuming
// triggers a crash. This is documented here https://forums.developer.apple.com/thread/15902
resume()
if state == .suspended {
timer.resume()
}
}

func resume() {
if state == .resumed {
return
}
queue.async {
if self.state == .resumed {
return
}

state = .resumed
timer.resume()
self.state = .resumed
self.timer.resume()
}
}

func suspend() {
if state == .suspended {
return
}
queue.async {
if self.state == .suspended {
return
}

state = .suspended
timer.suspend()
self.state = .suspended
self.timer.suspend()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ extension ChatMessageFileAttachmentListView {
fileNameLabel.text = content?.payload.title ?? content?.type.rawValue

switch content?.uploadingState?.state {
case .uploaded:
case .uploaded, .none:
fileSizeLabel.text = content?.payload.file.sizeString
case .uploadingFailed:
fileSizeLabel.text = L10n.Message.Sending.attachmentUploadingFailed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1177,12 +1177,14 @@ private extension ChatMessageListVC {
}

// Scroll to the bottom if the new message was sent by
// the current user, or moved by the current user, and the first page is loaded.
// the current user, or moved by the current user (ex: Giphy publish),
// and the first page is loaded.
func scrollToBottomIfNeeded(with changes: [ListChange<ChatMessage>], newestChange: ListChange<ChatMessage>?) {
guard isFirstPageLoaded else { return }
guard let newMessage = newestChange?.item else { return }
let newestChangeIsInsertionOrMove = newestChange?.isInsertion == true || newestChange?.isMove == true
if newestChangeIsInsertionOrMove && newMessage.isSentByCurrentUser {
let numberOfInsertions = changes.filter(\.isInsertion).count
let isNewMessage = newestChange?.isInsertion == true && numberOfInsertions == 1
if (isNewMessage || newestChange?.isMove == true) && newMessage.isSentByCurrentUser {
scrollToBottom()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,11 @@ open class QuotedChatMessageView: _View, ThemeProvider, SwiftUIRepresentable {
guard let message = content?.message else { return }
guard let avatarAlignment = content?.avatarAlignment else { return }

if let currentUserLang = content?.channel?.membership?.language,
let translatedText = content?.message.translatedText(for: currentUserLang) {
textView.text = translatedText
} else {
textView.text = message.text
}

contentContainerView.backgroundColor = message.linkAttachments.isEmpty
? appearance.colorPalette.popoverBackground
: appearance.colorPalette.highlightedAccentBackground1


textView.text = message.text
setAvatar(imageUrl: message.author.imageURL)
setAvatarAlignment(avatarAlignment)

Expand All @@ -183,6 +177,11 @@ open class QuotedChatMessageView: _View, ThemeProvider, SwiftUIRepresentable {
setAttachmentPreview(for: message)
showAttachmentPreview()
}

if let currentUserLang = content?.channel?.membership?.language,
let translatedText = content?.message.translatedText(for: currentUserLang) {
textView.text = translatedText
}
}

/// Sets the avatar image from a url or sets the placeholder image if the url is `nil`.
Expand Down Expand Up @@ -232,35 +231,27 @@ open class QuotedChatMessageView: _View, ThemeProvider, SwiftUIRepresentable {
if let filePayload = message.fileAttachments.first?.payload {
attachmentPreviewView.contentMode = .scaleAspectFit
attachmentPreviewView.image = appearance.images.fileIcons[filePayload.file.type] ?? appearance.images.fileFallback
if textView.text.isEmpty {
textView.text = filePayload.title
}
textView.text = message.text.isEmpty ? filePayload.title : message.text
} else if let imagePayload = message.imageAttachments.first?.payload {
attachmentPreviewView.contentMode = .scaleAspectFill
setAttachmentPreviewImage(url: imagePayload.imageURL)
if textView.text.isEmpty {
textView.text = L10n.Composer.QuotedMessage.photo
}
textView.text = message.text.isEmpty ? L10n.Composer.QuotedMessage.photo : message.text
} else if let linkPayload = message.linkAttachments.first?.payload {
attachmentPreviewView.contentMode = .scaleAspectFill
setAttachmentPreviewImage(url: linkPayload.previewURL)
textView.text = linkPayload.originalURL.absoluteString
} else if let giphyPayload = message.giphyAttachments.first?.payload {
attachmentPreviewView.contentMode = .scaleAspectFill
setAttachmentPreviewImage(url: giphyPayload.previewURL)
if textView.text.isEmpty {
textView.text = L10n.Composer.QuotedMessage.giphy
}
textView.text = message.text.isEmpty ? L10n.Composer.QuotedMessage.giphy : message.text
} else if let videoPayload = message.videoAttachments.first?.payload {
attachmentPreviewView.contentMode = .scaleAspectFill
textView.text = message.text.isEmpty ? videoPayload.title : message.text
if let thumbnailURL = videoPayload.thumbnailURL {
setVideoAttachmentThumbnail(url: thumbnailURL)
} else {
setVideoAttachmentPreviewImage(url: videoPayload.videoURL)
}
if textView.text.isEmpty {
textView.text = videoPayload.title
}
} else if let voiceRecordingPayload = message.voiceRecordingAttachments.first?.payload {
voiceRecordingAttachmentQuotedPreview.content = .init(
title: voiceRecordingPayload.title ?? message.text,
Expand All @@ -272,6 +263,7 @@ open class QuotedChatMessageView: _View, ThemeProvider, SwiftUIRepresentable {
} else {
voiceRecordingAttachmentQuotedPreview.isHidden = true
contentContainerView.isHidden = false
textView.text = nil
}
}

Expand Down
Loading
Loading