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.69.0 Release #696

Merged
merged 13 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions .github/workflows/cron-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ jobs:
strategy:
matrix:
include:
- ios: 18.1
xcode: 16.1
os: macos-15
device: "iPhone 16 Pro"
setup_runtime: false
- ios: 17.4
xcode: 15.4
os: macos-14
Expand Down Expand Up @@ -117,8 +122,15 @@ jobs:
strategy:
matrix:
include:
- xcode: 16.1
os: macos-15
- xcode: 15.4
os: macos-14
- ios: 18.1
xcode: 16.1
os: macos-15
device: "iPhone 16 Pro"
setup_runtime: false
- xcode: 15.0.1
os: macos-14
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.CI_BOT_GITHUB_TOKEN }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }}
XCODE_VERSION: "15.0.1"
10 changes: 4 additions & 6 deletions .github/workflows/smoke-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:

env:
HOMEBREW_NO_INSTALL_CLEANUP: 1 # Disable cleanup for homebrew, we don't need it on CI
IOS_SIMULATOR_DEVICE: "iPhone 15 Pro (17.4)"
IOS_SIMULATOR_DEVICE: "iPhone 16 Pro (18.1)"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_NUM: ${{ github.event.pull_request.number }}

Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:

test-ui-debug:
name: Test SwiftUI (Debug)
runs-on: macos-14
runs-on: macos-15
needs: build-test-app-and-frameworks
steps:
- uses: actions/[email protected]
Expand All @@ -107,7 +107,7 @@ jobs:
- uses: ./.github/actions/python-cache
- name: Run UI Tests (Debug)
run: bundle exec fastlane test_ui device:"${{ env.IOS_SIMULATOR_DEVICE }}" skip_build:true record:${{ github.event.inputs.snapshots }}
timeout-minutes: 60
timeout-minutes: 120
env:
GITHUB_TOKEN: ${{ secrets.CI_BOT_GITHUB_TOKEN }} # to open a PR
- name: Run Sonar analysis
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:

test-e2e-debug:
name: Test E2E UI (Debug)
runs-on: macos-14
runs-on: macos-15
if: ${{ github.event_name != 'push' && github.event.inputs.snapshots != 'true' }}
needs:
- allure_testops_launch
Expand All @@ -191,8 +191,6 @@ jobs:
run: bundle exec fastlane test_e2e_mock device:"${{ env.IOS_SIMULATOR_DEVICE }}" batch:'${{ matrix.batch }}' test_without_building:true
timeout-minutes: 100
env:
XCODE_VERSION: "15.2" # the most stable pair of Xcode
IOS_SIMULATOR_DEVICE: "iPhone 15 Pro (17.2)" # and iOS
MATRIX_SIZE: ${{ strategy.job-total }}
- name: Allure TestOps Upload
if: env.LAUNCH_ID != '' && (success() || failure())
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ buildcache
App Thinning Size Report.txt
app-thinning.plist
*.dmg
yeetd-normal.pkg

# VSCode
.vscode
Expand Down
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.69.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.69.0)
_December 18, 2024_

### ✅ Added
- Make `CreatePollView` public [#685](https://github.com/GetStream/stream-chat-swiftui/pull/685)
- Make `ChatChannelListViewModel.searchType` public and observable [#693](https://github.com/GetStream/stream-chat-swiftui/pull/693)
- Allow customizing channel and message search in the `ChatChannelListViewModel` [#690](https://github.com/GetStream/stream-chat-swiftui/pull/690)
- Allow overriding `ChatChannelListViewModel.performChannelSearch` and `ChatChannelListViewModel.performMessageSearch`
- Make `ChatChannelListViewModel.channelListSearchController` and `ChatChannelListViewModel.messageSearchController` public
### 🐞 Fixed
- Fix message thread reply footnote view not shown if parent message not in cache [#681](https://github.com/GetStream/stream-chat-swiftui/pull/681)
### ⚡ Performance
- Improve message search performance [#680](https://github.com/GetStream/stream-chat-swiftui/pull/680)
### 🔄 Changed
- Update `VoiceRecordingContainerView` background colors and layout by moving the message text outside of the recording cell [#689](https://github.com/GetStream/stream-chat-swiftui/pull/689/)

# [4.68.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.68.0)
_December 03, 2024_

Expand Down
26 changes: 26 additions & 0 deletions DemoAppSwiftUI/ChannelHeader/ChannelListQueryIdentifier.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright © 2024 Stream.io Inc. All rights reserved.
//

import Foundation
import StreamChat

enum ChannelListQueryIdentifier: String, CaseIterable, Identifiable {
case initial
case archived
case pinned
case unarchivedAndPinnedSorted

var id: String {
rawValue
}

var title: String {
switch self {
case .initial: "Initial Channels"
case .archived: "Archived Channels"
case .pinned: "Pinned Channels"
case .unarchivedAndPinnedSorted: "Sort by Pinned and Ignore Archived Channels"
}
}
}
21 changes: 21 additions & 0 deletions DemoAppSwiftUI/ChannelHeader/ChooseChannelQueryView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// Copyright © 2024 Stream.io Inc. All rights reserved.
//

import StreamChat
import StreamChatSwiftUI
import SwiftUI

struct ChooseChannelQueryView: View {
static let queryIdentifiers = ChannelListQueryIdentifier.allCases.sorted(using: KeyPathComparator(\.title))

var body: some View {
ForEach(Self.queryIdentifiers) { queryIdentifier in
Button {
AppState.shared.setChannelQueryIdentifier(queryIdentifier)
} label: {
Text(queryIdentifier.title)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct CustomChannelModifier: ChannelListHeaderViewModifier {

var title: String

@State var isChooseChannelQueryShown = false
@State var isNewChatShown = false
@State var logoutAlertShown = false
@State var actionsPopupShown = false
Expand Down Expand Up @@ -99,18 +100,26 @@ struct CustomChannelModifier: ChannelListHeaderViewModifier {
)
}
.confirmationDialog("", isPresented: $actionsPopupShown) {
Button("Blocked users") {
Button("Choose Channel Query") {
isChooseChannelQueryShown = true
}
Button("Show Blocked Users") {
blockedUsersShown = true
}

Button("Logout") {
Button("Logout", role: .destructive) {
logoutAlertShown = true
}

Button("Cancel", role: .cancel) {}
} message: {
Text("Select an action")
}
.confirmationDialog("", isPresented: $isChooseChannelQueryShown) {
ChooseChannelQueryView()
} message: {
Text("Choose a channel query")
}
}
}
}
116 changes: 85 additions & 31 deletions DemoAppSwiftUI/DemoAppSwiftUIApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright © 2024 Stream.io Inc. All rights reserved.
//

import Combine
import StreamChat
import StreamChatSwiftUI
import SwiftUI
Expand Down Expand Up @@ -39,25 +40,11 @@ struct DemoAppSwiftUIApp: App {
.tabItem { Label("Threads", systemImage: "text.bubble") }
.badge(appState.unreadCount.threads)
}
.id(appState.contentIdentifier)
}
}
.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)
}
*/
appState.currentUserController = chatClient.currentUserController()
notificationsHandler.setupRemoteNotifications()
}
}
Expand Down Expand Up @@ -86,28 +73,55 @@ struct DemoAppSwiftUIApp: App {
}

class AppState: ObservableObject, CurrentChatUserControllerDelegate {
@Injected(\.chatClient) var chatClient: ChatClient

@Published var userState: UserState = .launchAnimation {
willSet {
if newValue == .notLoggedIn && userState == .loggedIn {
channelListController = nil
}
}
}

// Recreate the content view when channel query changes.
@Published private(set) var contentIdentifier: String = ""

@Published var userState: UserState = .launchAnimation
@Published var unreadCount: UnreadCount = .noUnread

var channelListController: ChatChannelListController?
var currentUserController: CurrentChatUserController? {
didSet {
currentUserController?.delegate = self
currentUserController?.synchronize()
}
}
private(set) var channelListController: ChatChannelListController?
private(set) var currentUserController: CurrentChatUserController?
private var cancellables = Set<AnyCancellable>()

static let shared = AppState()

private init() {}
private init() {
$userState
.removeDuplicates()
.filter { $0 == .notLoggedIn }
.sink { [weak self] _ in
self?.didLogout()
}
.store(in: &cancellables)
$userState
.removeDuplicates()
.filter { $0 == .loggedIn }
.sink { [weak self] _ in
self?.didLogin()
}
.store(in: &cancellables)
}

private func didLogout() {
channelListController = nil
currentUserController = nil
}

private func didLogin() {
setChannelQueryIdentifier(.initial)

currentUserController = chatClient.currentUserController()
currentUserController?.delegate = self
currentUserController?.synchronize()
}

func setChannelQueryIdentifier(_ identifier: ChannelListQueryIdentifier) {
let query = AppState.channelListQuery(forIdentifier: identifier, chatClient: chatClient)
channelListController = chatClient.channelListController(query: query)
contentIdentifier = identifier.rawValue
}

func currentUserController(_ controller: CurrentChatUserController, didChangeCurrentUserUnreadCount: UnreadCount) {
unreadCount = didChangeCurrentUserUnreadCount
Expand All @@ -125,3 +139,43 @@ enum UserState {
case notLoggedIn
case loggedIn
}

extension AppState {
private static func channelListQuery(
forIdentifier identifier: ChannelListQueryIdentifier,
chatClient: ChatClient
) -> ChannelListQuery {
guard let currentUserId = chatClient.currentUserId else { fatalError("Not logged in") }
switch identifier {
case .initial:
return ChannelListQuery(
filter: .containMembers(userIds: [currentUserId])
)
case .unarchivedAndPinnedSorted:
return ChannelListQuery(
filter: .and([
.containMembers(userIds: [currentUserId]),
.equal(.archived, to: false)
]),
sort: [
.init(key: .pinnedAt, isAscending: false),
.init(key: .default)
]
)
case .archived:
return ChannelListQuery(
filter: .and([
.containMembers(userIds: [currentUserId]),
.equal(.archived, to: true)
])
)
case .pinned:
return ChannelListQuery(
filter: .and([
.containMembers(userIds: [currentUserId]),
.equal(.pinned, to: true)
])
)
}
}
}
12 changes: 0 additions & 12 deletions DemoAppSwiftUI/PinChannelHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ import StreamChat
import StreamChatSwiftUI
import SwiftUI

extension ChatChannel {
static func isPinnedBy(keyForUserId userId: UserId) -> String {
"is_pinned_by_\(userId)"
}

var isPinned: Bool {
guard let userId = membership?.id else { return false }
let key = Self.isPinnedBy(keyForUserId: userId)
return extraData[key]?.boolValue ?? false
}
}

struct DemoAppChatChannelListItem: View {

@Injected(\.fonts) private var fonts
Expand Down
Loading
Loading