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.67.0 Release #665

Merged
merged 19 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
8 changes: 8 additions & 0 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ jobs:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }}
run: bundle exec fastlane publish_release --verbose

- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: "πŸŽ‰ The new release has been shipped! 🚒\n\n⚠️ <!subteam^S030AAHLDLN>, don't forget to merge `main` back to `develop` from `localhost` using the command: `bundle exec fastlane merge_main`"
fields: repo
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,7 @@ buildcache
App Thinning Size Report.txt
app-thinning.plist
*.dmg

# VSCode
.vscode
buildServer.json
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### πŸ”„ Changed

# [4.67.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.67.0)
_November 25, 2024_

### βœ… Added
- Make `VoiceRecordingButton` public [#658](https://github.com/GetStream/stream-chat-swiftui/pull/658)
- Add config to skip edited label for some messages [#660](https://github.com/GetStream/stream-chat-swiftui/pull/665)
### 🐞 Fixed
- Fix message long press taking too much time to show actions [#648](https://github.com/GetStream/stream-chat-swiftui/pull/648)
- Fix rendering link attachment preview with other attachment types [#659](https://github.com/GetStream/stream-chat-swiftui/pull/659)
- Fix not using colors from the palette in some of the poll views [#661](https://github.com/GetStream/stream-chat-swiftui/pull/661)
- Fix a rare crash when handling list change in the `ChatChannelViewModel` [#663](https://github.com/GetStream/stream-chat-swiftui/pull/663)
### πŸ”„ Changed
- Message composer now uses `.uploadFile` capability when showing attachment picker icon [#646](https://github.com/GetStream/stream-chat-swiftui/pull/646)
- `ChannelInfoView` now uses `.updateChannelMembers` capability to show "Add Users" button [#651](https://github.com/GetStream/stream-chat-swiftui/pull/651)

# [4.66.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.66.0)
_November 06, 2024_

Expand Down Expand Up @@ -50,8 +65,8 @@ _September 12, 2024_

### πŸ”„ 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)
- 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)
Expand Down
8 changes: 7 additions & 1 deletion DemoAppSwiftUI/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ class AppDelegate: NSObject, UIApplicationDelegate {
#endif

let utils = Utils(
messageListConfig: MessageListConfig(dateIndicatorPlacement: .messageList, userBlockingEnabled: true),
messageListConfig: MessageListConfig(
dateIndicatorPlacement: .messageList,
userBlockingEnabled: true,
skipEditedMessageLabel: { message in
message.extraData["ai_generated"]?.boolValue == true
}
),
composerConfig: ComposerConfig(isVoiceRecordingEnabled: true)
)
streamChat = StreamChat(chatClient: chatClient, utils: utils)
Expand Down
14 changes: 8 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ GEM
fastlane
pry
fastlane-plugin-sonarcloud_metric_kit (0.2.1)
fastlane-plugin-stream_actions (0.3.71)
fastlane-plugin-stream_actions (0.3.76)
xctest_list (= 1.2.1)
fastlane-plugin-versioning (0.6.0)
ffi (1.17.0)
Expand Down Expand Up @@ -310,9 +310,10 @@ GEM
puma (6.4.3)
nio4r (~> 2.0)
racc (1.8.1)
rack (3.1.7)
rack-protection (4.0.0)
rack (3.1.8)
rack-protection (4.1.0)
base64 (>= 0.1.0)
logger (>= 1.6.0)
rack (>= 3.0.0, < 4)
rack-session (2.0.0)
rack (>= 3.0.0)
Expand Down Expand Up @@ -367,10 +368,11 @@ GEM
simctl (1.6.10)
CFPropertyList
naturally
sinatra (4.0.0)
sinatra (4.1.0)
logger (>= 1.6.0)
mustermann (~> 3.0)
rack (>= 3.0.0, < 4)
rack-protection (= 4.0.0)
rack-protection (= 4.1.0)
rack-session (>= 2.0.0, < 3)
tilt (~> 2.0)
slather (2.8.4)
Expand Down Expand Up @@ -427,7 +429,7 @@ DEPENDENCIES
fastlane-plugin-create_xcframework
fastlane-plugin-lizard
fastlane-plugin-sonarcloud_metric_kit
fastlane-plugin-stream_actions (= 0.3.71)
fastlane-plugin-stream_actions (= 0.3.76)
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.66.0"),
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.67.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.99%20MB-blue"/>
<img id="stream-chat-swiftui-label" alt="StreamChatSwiftUI" src="https://img.shields.io/badge/StreamChatSwiftUI-8.09%20MB-blue"/>
</p>

## SwiftUI StreamChat SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public struct ChatChannelInfoView: View, KeyboardReadable {
}

ToolbarItem(placement: .navigationBarTrailing) {
viewModel.channel.isDirectMessageChannel ? nil :
if viewModel.shouldShowAddUserButton {
Button {
viewModel.addUsersShown = true
} label: {
Expand All @@ -148,6 +148,7 @@ public struct ChatChannelInfoView: View, KeyboardReadable {
.background(colors.tintColor)
.clipShape(Circle())
}
}
}
}
.onReceive(keyboardWillChangePublisher) { visible in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ public class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDe
channel.ownCapabilities.contains(.updateChannel)
}

public var shouldShowAddUserButton: Bool {
if channel.isDirectMessageChannel {
return false
} else {
return channel.ownCapabilities.contains(.updateChannelMembers)
}
}

var channelController: ChatChannelController!
private var memberListController: ChatChannelMemberListController!
private var loadingUsers = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,19 +709,18 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
.remove(_, index: _):
return true
case let .update(message, index: index):
let animateReactions = message.reactionScoresId != messages[index.row].reactionScoresId
guard index.row >= messages.startIndex, index.row < messages.endIndex else { continue }
let existingDisplayedMessage = messages[index.row]
let animateReactions = message.reactionScoresId != existingDisplayedMessage.reactionScoresId
&& utils.messageListConfig.messageDisplayOptions.shouldAnimateReactions
if index.row < messages.count,
message.messageId != messages[index.row].messageId
if animateReactions,
message.messageId != existingDisplayedMessage.messageId
|| message.type == .ephemeral
|| !message.linkAttachments.isEmpty {
if index.row < messages.count
&& animateReactions {
animateChanges = message.linkAttachments.isEmpty
}
animateChanges = message.linkAttachments.isEmpty
}
default:
break
case .move(_, fromIndex: _, toIndex: _):
continue
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public enum AttachmentPickerType {

/// View for picking the attachment type (media or giphy commands).
public struct AttachmentPickerTypeView: View {
@EnvironmentObject private var composerViewModel: MessageComposerViewModel
@Injected(\.images) private var images
@Injected(\.colors) private var colors

Expand All @@ -49,7 +50,7 @@ public struct AttachmentPickerTypeView: View {
HStack(spacing: 16) {
switch pickerTypeState {
case let .expanded(attachmentPickerType):
if channelConfig?.uploadsEnabled == true {
if composerViewModel.channelController.channel?.canUploadFile == true {
PickerTypeButton(
pickerTypeState: $pickerTypeState,
pickerType: .media,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public struct MessageComposerView<Factory: ViewFactory>: View, KeyboardReadable
state: $viewModel.pickerTypeState,
channelConfig: channelConfig
)
.environmentObject(viewModel)

factory.makeComposerInputView(
text: $viewModel.text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public struct TrailingComposerView: View {
}
}

struct VoiceRecordingButton: View {
/// The button responsible to start voice recording.
public struct VoiceRecordingButton: View {
@Injected(\.colors) var colors
@Injected(\.utils) var utils

Expand All @@ -47,7 +48,11 @@ struct VoiceRecordingButton: View {
@State private var longPressed = false
@State private var longPressStarted: Date?

var body: some View {
public init(viewModel: MessageComposerViewModel) {
self.viewModel = viewModel
}

public var body: some View {
Image(systemName: "mic")
.foregroundColor(Color(colors.textLowEmphasis))
.gesture(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,14 @@ public struct MessageContainerView<Factory: ViewFactory>: View {
handleGestureForMessage(showsMessageActions: true)
}
}
.onLongPressGesture(perform: {
if !message.isDeleted {
handleGestureForMessage(showsMessageActions: true)
}
})
.highPriorityGesture(
LongPressGesture()
.onEnded { _ in
if !message.isDeleted {
handleGestureForMessage(showsMessageActions: true)
}
}
)
.offset(x: min(self.offsetX, maximumHorizontalSwipeDisplacement))
.simultaneousGesture(
DragGesture(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public struct MessageListConfig {
localLinkDetectionEnabled: Bool = true,
isMessageEditedLabelEnabled: Bool = true,
markdownSupportEnabled: Bool = true,
userBlockingEnabled: Bool = false
userBlockingEnabled: Bool = false,
skipEditedMessageLabel: @escaping (ChatMessage) -> Bool = { _ in false }
) {
self.messageListType = messageListType
self.typingIndicatorPlacement = typingIndicatorPlacement
Expand All @@ -56,6 +57,7 @@ public struct MessageListConfig {
self.isMessageEditedLabelEnabled = isMessageEditedLabelEnabled
self.markdownSupportEnabled = markdownSupportEnabled
self.userBlockingEnabled = userBlockingEnabled
self.skipEditedMessageLabel = skipEditedMessageLabel
}

public let messageListType: MessageListType
Expand All @@ -81,6 +83,7 @@ public struct MessageListConfig {
public let isMessageEditedLabelEnabled: Bool
public let markdownSupportEnabled: Bool
public let userBlockingEnabled: Bool
public let skipEditedMessageLabel: (ChatMessage) -> Bool
}

/// Contains information about the message paddings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ struct MessageDateView: View {

var text: String {
var text = dateFormatter.string(from: message.createdAt)
let showMessageEditedLabel = utils.messageListConfig.isMessageEditedLabelEnabled
let messageListConfig = utils.messageListConfig
let showMessageEditedLabel = messageListConfig.isMessageEditedLabelEnabled
&& !messageListConfig.skipEditedMessageLabel(message)
&& message.textUpdatedAt != nil
&& !message.isDeleted
if showMessageEditedLabel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public struct MessageView<Factory: ViewFactory>: View {
} else if let poll = message.poll {
factory.makePollView(message: message, poll: poll, isFirst: isFirst)
} else if !message.attachmentCounts.isEmpty {
if messageTypeResolver.hasLinkAttachment(message: message) {
let hasOnlyLinks = { message.attachmentCounts.keys.allSatisfy { $0 == .linkPreview } }
if messageTypeResolver.hasLinkAttachment(message: message) && hasOnlyLinks() {
factory.makeLinkAttachmentView(
for: message,
isFirst: isFirst,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct PollAllOptionsView: View {
viewModel: viewModel,
option: option,
optionFont: fonts.headline,
textColor: Color(colors.text),
alternativeStyle: true,
checkboxButtonSpacing: 8
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public struct PollAttachmentView<Factory: ViewFactory>: View {
HStack {
Text(poll.name)
.font(fonts.bodyBold)
.foregroundColor(textColor(for: message))
Spacer()
}

Expand All @@ -56,7 +57,8 @@ public struct PollAttachmentView<Factory: ViewFactory>: View {
viewModel: viewModel,
option: option,
optionVotes: poll.voteCount(for: option),
maxVotes: poll.currentMaximumVoteCount
maxVotes: poll.currentMaximumVoteCount,
textColor: textColor(for: message)
)
.layoutPriority(1) // do not compress long text
}
Expand Down Expand Up @@ -188,6 +190,7 @@ struct PollOptionView: View {
var optionFont: Font = InjectedValues[\.fonts].body
var optionVotes: Int?
var maxVotes: Int?
var textColor: Color
/// If true, only option name and vote count is shown, otherwise votes indicator and avatars appear as well.
var alternativeStyle: Bool = false
/// The spacing between the checkbox and the option name.
Expand All @@ -211,6 +214,7 @@ struct PollOptionView: View {
HStack(alignment: .top) {
Text(option.text)
.font(optionFont)
.foregroundColor(textColor)
Spacer()
if !alternativeStyle, viewModel.showVoterAvatars {
HStack(spacing: -4) {
Expand All @@ -225,6 +229,7 @@ struct PollOptionView: View {
}
}
Text("\(viewModel.poll.voteCountsByOption?[option.id] ?? 0)")
.foregroundColor(textColor)
}
if !alternativeStyle {
PollVotesIndicatorView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct PollResultsView: View {
Spacer()
}
}
.background(Color(colors.background).ignoresSafeArea())
.toolbar {
ToolbarItem(placement: .principal) {
Text(L10n.Message.Polls.Toolbar.resultsTitle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ struct CreatePollView: View {
Spacer()
.modifier(ListRowModifier())
}
.background(Color(colors.background).ignoresSafeArea())
.listStyle(.plain)
.id(listId)
.toolbar {
Expand Down Expand Up @@ -229,11 +230,14 @@ struct CreatePollItemModifier: ViewModifier {
}

struct ListRowModifier: ViewModifier {


@Injected(\.colors) var colors

func body(content: Content) -> some View {
if #available(iOS 15.0, *) {
content
.listRowSeparator(.hidden)
.listRowBackground(Color(colors.background))
} else {
content
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import Foundation

enum SystemEnvironment {
/// A Stream Chat version.
public static let version: String = "4.66.0"
public static let version: String = "4.67.0"
}
Loading
Loading