Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
edab5d1
[CI] Bump fastlane plugin version
testableapple Aug 16, 2024
a41b992
Merge branch 'main' into develop
testableapple Aug 16, 2024
04986d8
[CI] Bump fastlane plugin version
testableapple Aug 16, 2024
e5c85bd
[CI] Update publish release flow (#589)
testableapple Aug 22, 2024
85d6ec5
Typing users did not update reliably in the message list because view…
laevandus Aug 30, 2024
4a583be
Bump rexml from 3.3.3 to 3.3.6 (#590)
dependabot[bot] Aug 30, 2024
7bb436f
[CI] Do not cache iOS Simulator Runtimes nightly (#592)
testableapple Aug 30, 2024
28d2095
Improved subtitle info in pinned messages view (#594)
martinmitrevski Sep 3, 2024
642662f
[CI] Clean up some disk space on CI before downloading iOS runtimes (…
testableapple Sep 3, 2024
da9a7db
Made the image method in channel header loader open (#595)
martinmitrevski Sep 4, 2024
9163837
Channel was sometimes marked as read on open (#593)
laevandus Sep 4, 2024
80a37f8
[CI] Update git fetch-depth on release (#597)
testableapple Sep 4, 2024
23bdfd9
Added configuration for padding for quoted message views (#598)
martinmitrevski Sep 5, 2024
1cdd74e
Only show "Flag message" Action if user has permission (#599)
bpollman Sep 9, 2024
c845814
Fixed a broken test
martinmitrevski Sep 9, 2024
73c70ec
Jump to first unread message button in the message list was not possi…
laevandus Sep 9, 2024
896c118
Fixed the broken tests
martinmitrevski Sep 9, 2024
9a0e85c
iOS 18 fixes for the swipeable channel list item (#601)
martinmitrevski Sep 11, 2024
5d69420
Updated StreamChat dependency to 4.63.0 (#603)
laevandus Sep 12, 2024
3d7a554
Bump 4.63.0
Sep 12, 2024
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
9 changes: 2 additions & 7 deletions .github/actions/setup-ios-runtime/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ description: 'Download and Install requested iOS Runtime'
runs:
using: "composite"
steps:
- name: Cache iOS Simulator Runtime
uses: actions/cache@v4
id: runtime-cache
with:
path: ./*.dmg
key: ipsw-runtime-ios-${{ inputs.version }}
restore-keys: ipsw-runtime-ios-${{ inputs.version }}
- name: Setup iOS Simulator Runtime
shell: bash
run: |
sudo rm -rfv ~/Library/Developer/CoreSimulator/* || true
brew install blacktop/tap/ipsw
bundle exec fastlane install_runtime ios:${{ inputs.version }}
sudo rm -rfv *.dmg || true
xcrun simctl list runtimes
- name: Create Custom iOS Simulator
shell: bash
Expand Down
32 changes: 4 additions & 28 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,32 @@
name: "Publish new release"

on:
pull_request:
push:
branches:
- main
types:
- closed

workflow_dispatch:
inputs:
version:
description: 'Release version'
type: string
required: true

jobs:
release:
name: Publish new release
runs-on: macos-13
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} # only merged pull requests must trigger this job
steps:
- name: Connect Bot
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.BOT_SSH_PRIVATE_KEY }}

- uses: actions/[email protected]
with:
fetch-depth: 0

- uses: ./.github/actions/ruby-cache

- name: Extract version from input (for workflow dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
if [ "$BRANCH_NAME" != "main" ]; then
echo "This workflow can only be run on the main branch."
exit 1
fi
echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV

- name: Extract version from branch name (for release branches)
if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'release/') }}
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV

- name: "Fastlane - Publish Release"
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.pull_request.head.ref, 'release/') }}
env:
GITHUB_TOKEN: ${{ secrets.CI_BOT_GITHUB_TOKEN }}
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }}
run: bundle exec fastlane publish_release version:${{ env.RELEASE_VERSION }} --verbose
run: bundle exec fastlane publish_release --verbose
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### πŸ”„ Changed

# [4.63.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.63.0)
_September 12, 2024_

### βœ… Added
- Configuration for padding for quoted message views [#598](https://github.com/GetStream/stream-chat-swiftui/pull/598)

### πŸ”„ Changed
- Improved subtitle info in pinned messages view [#594](https://github.com/GetStream/stream-chat-swiftui/pull/594)
- The `image(for channel: ChatChannel)` in `ChannelHeaderLoader` is now open [#595](https://github.com/GetStream/stream-chat-swiftui/pull/595)
- FlagMessage Action is now only shown if the user has a permission to perform the action [#599](https://github.com/GetStream/stream-chat-swiftui/pull/599)

### 🐞 Fixed
- Typing users did not update reliably in the message list [#591](https://github.com/GetStream/stream-chat-swiftui/pull/591)
- Channel was sometimes marked as read when the first unread message was one of the first not visible messages [#593](https://github.com/GetStream/stream-chat-swiftui/pull/593)
- Jump to first unread message button in the message list was not possible to close in some cases [#600](https://github.com/GetStream/stream-chat-swiftui/pull/600)

# [4.62.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.62.0)
_August 16, 2024_

Expand Down
26 changes: 14 additions & 12 deletions DemoAppSwiftUI/DemoAppSwiftUIApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,20 @@ struct DemoAppSwiftUIApp: App {
}
.onChange(of: appState.userState) { newValue in
if newValue == .loggedIn {
if let currentUserId = chatClient.currentUserId {
let pinnedByKey = ChatChannel.isPinnedBy(keyForUserId: currentUserId)
let channelListQuery = ChannelListQuery(
filter: .containMembers(userIds: [currentUserId]),
sort: [
.init(key: .custom(keyPath: \.isPinned, key: pinnedByKey), isAscending: true),
.init(key: .lastMessageAt),
.init(key: .updatedAt)
]
)
appState.channelListController = chatClient.channelListController(query: channelListQuery)
}
/*
if let currentUserId = chatClient.currentUserId {
let pinnedByKey = ChatChannel.isPinnedBy(keyForUserId: currentUserId)
let channelListQuery = ChannelListQuery(
filter: .containMembers(userIds: [currentUserId]),
sort: [
.init(key: .custom(keyPath: \.isPinned, key: pinnedByKey), isAscending: true),
.init(key: .lastMessageAt),
.init(key: .updatedAt)
]
)
appState.channelListController = chatClient.channelListController(query: channelListQuery)
}
*/
notificationsHandler.setupRemoteNotifications()
}
}
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ GEM
fastlane
pry
fastlane-plugin-sonarcloud_metric_kit (0.2.1)
fastlane-plugin-stream_actions (0.3.62)
fastlane-plugin-stream_actions (0.3.63)
xctest_list (= 1.2.1)
fastlane-plugin-versioning (0.5.2)
ffi (1.17.0)
Expand Down Expand Up @@ -328,7 +328,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.3.3)
rexml (3.3.6)
strscan
rouge (2.0.7)
rubocop (1.38.0)
Expand Down Expand Up @@ -427,7 +427,7 @@ DEPENDENCIES
fastlane-plugin-create_xcframework
fastlane-plugin-lizard
fastlane-plugin-sonarcloud_metric_kit
fastlane-plugin-stream_actions (= 0.3.62)
fastlane-plugin-stream_actions (= 0.3.63)
fastlane-plugin-versioning
jazzy
json
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.62.0"),
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.63.0"),
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p align="center">
<a href="https://sonarcloud.io/summary/new_code?id=GetStream_stream-chat-swiftui"><img src="https://sonarcloud.io/api/project_badges/measure?project=GetStream_stream-chat-swiftui&metric=coverage" /></a>

<img id="stream-chat-swiftui-label" alt="StreamChatSwiftUI" src="https://img.shields.io/badge/StreamChatSwiftUI-7.01%20MB-blue"/>
<img id="stream-chat-swiftui-label" alt="StreamChatSwiftUI" src="https://img.shields.io/badge/StreamChatSwiftUI-7.11%20MB-blue"/>
</p>

## SwiftUI StreamChat SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public struct PinnedMessagesView: View {
ScrollView {
LazyVStack(spacing: 0) {
ForEach(viewModel.pinnedMessages) { message in
PinnedMessageView(message: message)
PinnedMessageView(message: message, channel: viewModel.channel)
Divider()
}
}
Expand All @@ -52,6 +52,7 @@ struct PinnedMessageView: View {
private let avatarSize = CGSize(width: 56, height: 56)

var message: ChatMessage
var channel: ChatChannel

var body: some View {
HStack {
Expand All @@ -66,7 +67,7 @@ struct PinnedMessageView: View {
.foregroundColor(Color(colors.text))

HStack {
Text(message.adjustedText)
Text(pinnedMessageSubtitle)
.font(fonts.footnote)
.foregroundColor(Color(colors.textLowEmphasis))

Expand All @@ -80,4 +81,11 @@ struct PinnedMessageView: View {
}
.padding(.all, 8)
}

private var pinnedMessageSubtitle: String {
if message.poll != nil {
return "πŸ“Š \(L10n.Channel.Item.poll)"
}
return channel.attachmentPreviewText(for: message) ?? message.adjustedText
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI
/// View model for the `PinnedMessagesView`.
public class PinnedMessagesViewModel: ObservableObject {

private let channel: ChatChannel
let channel: ChatChannel

@Published var pinnedMessages: [ChatMessage]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
}
}

public var channel: ChatChannel? {
channelController.channel
}
@Published public private(set) var channel: ChatChannel?

public var isMessageThread: Bool {
messageController != nil
Expand Down Expand Up @@ -150,6 +148,7 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
}
channelDataSource.delegate = self
messages = channelDataSource.messages
channel = channelController.channel

DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] in
if let scrollToMessage, let parentMessageId = scrollToMessage.parentMessageId, messageController == nil {
Expand Down Expand Up @@ -445,6 +444,7 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
didUpdateChannel channel: EntityChange<ChatChannel>,
channelController: ChatChannelController
) {
self.channel = channel.item
checkReadIndicators(for: channel)
checkTypingIndicator()
checkHeaderType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,14 @@ public struct MessagePaddings {

/// Horizontal padding for messages.
public let horizontal: CGFloat
public let quotedViewPadding: CGFloat

public init(horizontal: CGFloat = 8) {
public init(
horizontal: CGFloat = 8,
quotedViewPadding: CGFloat = 8
) {
self.horizontal = horizontal
self.quotedViewPadding = quotedViewPadding
}
}

Expand Down Expand Up @@ -131,7 +136,7 @@ public struct MessageDisplayOptions {
overlayDateLabelSize: CGFloat = 40,
lastInGroupHeaderSize: CGFloat = 0,
newMessagesSeparatorSize: CGFloat = 50,
minimumSwipeGestureDistance: CGFloat = 10,
minimumSwipeGestureDistance: CGFloat = 20,
currentUserMessageTransition: AnyTransition = .identity,
otherUserMessageTransition: AnyTransition = .identity,
shouldAnimateReactions: Bool = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
@State private var pendingKeyboardUpdate: Bool?
@State private var scrollDirection = ScrollDirection.up
@State private var unreadMessagesBannerShown = false
@State private var unreadButtonDismissed = false

private var messageRenderingUtil = MessageRenderingUtil.shared
private var skipRenderingMessageIds = [String]()
Expand Down Expand Up @@ -202,6 +203,7 @@ public struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
}
.id(listId)
}
.delayedRendering()
.modifier(factory.makeMessageListModifier())
.modifier(ScrollTargetLayoutModifier(enabled: loadingNextMessages))
}
Expand Down Expand Up @@ -292,14 +294,15 @@ public struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
}
})
.overlay(
(channel.unreadCount.messages > 0 && !unreadMessagesBannerShown && !isMessageThread) ?
(channel.unreadCount.messages > 0 && !unreadMessagesBannerShown && !isMessageThread && !unreadButtonDismissed) ?
factory.makeJumpToUnreadButton(
channel: channel,
onJumpToMessage: {
_ = onJumpToMessage?(firstUnreadMessageId ?? .unknownMessageId)
},
onClose: {
firstUnreadMessageId = nil
unreadButtonDismissed = true
}
) : nil
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ public struct QuotedMessageView<Factory: ViewFactory>: View {
}
}
.id(quotedMessage.messageId)
.padding(hasVoiceAttachments ? [.leading, .top, .bottom] : .all, 8)
.padding(
hasVoiceAttachments ? [.leading, .top, .bottom] : .all, utils.messageListConfig.messagePaddings.quotedViewPadding
)
.modifier(
factory.makeMessageViewModifier(
for: MessageModifierInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,17 @@ extension MessageAction {
messageActions.append(markUnreadAction)
}

let flagAction = flagMessageAction(
for: message,
channel: channel,
chatClient: chatClient,
onFinish: onFinish,
onError: onError
)

messageActions.append(flagAction)
if channel.canFlagMessage {
let flagAction = flagMessageAction(
for: message,
channel: channel,
chatClient: chatClient,
onFinish: onFinish,
onError: onError
)

messageActions.append(flagAction)
}

if channel.config.mutesEnabled {
let author = message.author
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ open class ChannelHeaderLoader: ObservableObject {
/// If the image is not downloaded, placeholder is returned.
/// - Parameter channel: the provided channel.
/// - Returns: the available image.
public func image(for channel: ChatChannel) -> UIImage {
open func image(for channel: ChatChannel) -> UIImage {
if let image = loadedImages[channel.cid] {
return image
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ extension ChatChannel {
/// The message preview text in case it contains attachments.
/// - Parameter previewMessage: The preview message of the channel.
/// - Returns: A string representing the message preview text.
private func attachmentPreviewText(for previewMessage: ChatMessage) -> String? {
func attachmentPreviewText(for previewMessage: ChatMessage) -> String? {
guard let attachment = previewMessage.allAttachments.first, !previewMessage.isDeleted else {
return nil
}
Expand Down
Loading
Loading