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.66.0 Release #642

Merged
merged 13 commits into from
Nov 6, 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
44 changes: 44 additions & 0 deletions .github/workflows/testflight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test Flight Deploy DemoApp

on:
pull_request:
branches:
- 'main'

release:
types: [published]

workflow_dispatch:

env:
HOMEBREW_NO_INSTALL_CLEANUP: 1

jobs:
deploy:
runs-on: macos-14
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
- uses: ./.github/actions/xcode-cache
- name: Deploy Demo app
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_NUM: ${{ github.event.number }}
run: bundle exec fastlane swiftui_testflight_build
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: "You shall not pass!"
fields: message,commit,author,action,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
if: failure()
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### πŸ”„ Changed

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

### βœ… Added
- Add support for Channel Search in the Channel List [#628](https://github.com/GetStream/stream-chat-swiftui/pull/628)
### 🐞 Fixed
- Fix crash when opening message overlay in iPad with a TabBar [#627](https://github.com/GetStream/stream-chat-swiftui/pull/627)
- Only show Leave Group option if the user has leave-channel permission [#633](https://github.com/GetStream/stream-chat-swiftui/pull/633)
- Fix Channel List stuck in Empty View State in rare conditions [#639](https://github.com/GetStream/stream-chat-swiftui/pull/639)
- Fix a bug with photo attachment picker indicator not displaying [#640](https://github.com/GetStream/stream-chat-swiftui/pull/640)

# [4.65.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.65.0)
_October 18, 2024_

Expand Down
12 changes: 9 additions & 3 deletions DemoAppSwiftUI/DemoAppSwiftUIApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ struct DemoAppSwiftUIApp: App {
var channelListController: ChatChannelListController? {
appState.channelListController
}


var channelListSearchType: ChannelListSearchType {
.messages
}

var body: some Scene {
WindowGroup {
switch appState.userState {
Expand Down Expand Up @@ -64,12 +68,14 @@ struct DemoAppSwiftUIApp: App {
ChatChannelListView(
viewFactory: DemoAppFactory.shared,
channelListController: channelListController,
selectedChannelId: notificationsHandler.notificationChannelId
selectedChannelId: notificationsHandler.notificationChannelId,
searchType: channelListSearchType
)
} else {
ChatChannelListView(
viewFactory: DemoAppFactory.shared,
channelListController: channelListController
channelListController: channelListController,
searchType: channelListSearchType
)
}
}
Expand Down
19 changes: 16 additions & 3 deletions DemoAppSwiftUI/DemoUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,23 @@ public let currentUserIdRegisteredForPush = "currentUserIdRegisteredForPush"
public struct UserCredentials: Codable {
public let id: String
public let name: String
public let avatarURL: URL
public let avatarURL: URL?
public let token: String
public let birthLand: String

var isGuest: Bool {
id == "guest"
}

static var guestUser: UserCredentials {
UserCredentials(
id: "guest",
name: "Guest",
avatarURL: nil,
token: "",
birthLand: ""
)
}
}

extension UserCredentials: Identifiable {
Expand Down Expand Up @@ -135,8 +149,7 @@ extension UserCredentials: Identifiable {
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiZ2VuZXJhbF9ncmlldm91cyJ9.g2UUZdENuacFIxhYCylBuDJZUZ2x59MTWaSpndWGCTU",
"Qymaen jai Sheelal"
)

].map {
UserCredentials(id: $0.0, name: $0.1, avatarURL: URL(string: $0.2)!, token: $0.3, birthLand: $0.4)
}
} + [UserCredentials.guestUser]
}
20 changes: 15 additions & 5 deletions DemoAppSwiftUI/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,25 @@ struct DemoUserView: View {

var body: some View {
HStack {
StreamLazyImage(
url: user.avatarURL,
size: CGSize(width: imageSize, height: imageSize)
)
if user.isGuest {
Image(systemName: "person.fill")
.resizable()
.foregroundColor(colors.tintColor)
.frame(width: imageSize, height: imageSize)
.aspectRatio(contentMode: .fit)
.background(Color(colors.background6))
.clipShape(Circle())
} else {
StreamLazyImage(
url: user.avatarURL,
size: CGSize(width: imageSize, height: imageSize)
)
}

VStack(alignment: .leading, spacing: 4) {
Text(user.name)
.font(fonts.bodyBold)
Text("Stream test account")
Text(user.isGuest ? "Login as Guest" : "Stream test account")
.font(fonts.footnote)
.foregroundColor(Color(colors.textLowEmphasis))
}
Expand Down
28 changes: 27 additions & 1 deletion DemoAppSwiftUI/LoginViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class LoginViewModel: ObservableObject {
@Injected(\.chatClient) var chatClient

func demoUserTapped(_ user: UserCredentials) {
if user.isGuest {
connectGuestUser(withCredentials: user)
return
}

connectUser(withCredentials: user)
}

Expand All @@ -25,7 +30,7 @@ class LoginViewModel: ObservableObject {
chatClient.connectUser(
userInfo: .init(id: credentials.id, name: credentials.name, imageURL: credentials.avatarURL),
token: token
) { error in
) { [weak self] error in
if let error = error {
log.error("connecting the user failed \(error)")
return
Expand All @@ -40,4 +45,25 @@ class LoginViewModel: ObservableObject {
}
}
}

private func connectGuestUser(withCredentials credentials: UserCredentials) {
loading = true
LogConfig.level = .warning

chatClient.connectGuestUser(
userInfo: .init(id: credentials.id, name: credentials.name)
) { [weak self] error in
if let error = error {
log.error("connecting the user failed \(error)")
return
}

DispatchQueue.main.async { [weak self] in
withAnimation {
self?.loading = false
AppState.shared.userState = .loggedIn
}
}
}
}
}
6 changes: 3 additions & 3 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.70)
fastlane-plugin-stream_actions (0.3.71)
xctest_list (= 1.2.1)
fastlane-plugin-versioning (0.6.0)
ffi (1.17.0)
Expand Down Expand Up @@ -329,7 +329,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.3.8)
rexml (3.3.9)
rouge (2.0.7)
rubocop (1.38.0)
json (~> 2.3)
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.70)
fastlane-plugin-stream_actions (= 0.3.71)
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.65.0"),
.package(url: "https://github.com/GetStream/stream-chat-swift.git", from: "4.66.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.97%20MB-blue"/>
<img id="stream-chat-swiftui-label" alt="StreamChatSwiftUI" src="https://img.shields.io/badge/StreamChatSwiftUI-7.99%20MB-blue"/>
</p>

## SwiftUI StreamChat SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ public class ChatChannelInfoViewModel: ObservableObject, ChatChannelControllerDe
@Published public var addUsersShown = false

public var shouldShowLeaveConversationButton: Bool {
channel.ownCapabilities.contains(.deleteChannel)
|| !channel.isDirectMessageChannel
if channel.isDirectMessageChannel {
return channel.ownCapabilities.contains(.deleteChannel)
} else {
return channel.ownCapabilities.contains(.leaveChannel)
}
}

public var canRenameChannel: Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public struct PhotoAttachmentCell: View {
@State private var compressing = false
@State private var loading = false
@State var requestId: PHContentEditingInputRequestID?
@State var idOverlay = UUID()

var asset: PHAsset
var onImageTap: (AddedAsset) -> Void
Expand Down Expand Up @@ -113,6 +114,7 @@ public struct PhotoAttachmentCell: View {
)
)
}
idOverlay = UUID()
}
}
}
Expand Down Expand Up @@ -150,6 +152,7 @@ public struct PhotoAttachmentCell: View {
)
}
}
.id(idOverlay)
)
.onAppear {
self.loading = false
Expand Down
40 changes: 30 additions & 10 deletions Sources/StreamChatSwiftUI/ChatChannel/Gallery/GalleryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,40 @@ public struct GalleryView: View {
}

struct StreamVideoPlayer: View {

@State var player: AVPlayer


@Injected(\.utils) private var utils

private var fileCDN: FileCDN {
utils.fileCDN
}

let url: URL

@State var avPlayer: AVPlayer?
@State var error: Error?

init(url: URL) {
let player = AVPlayer(url: url)
_player = State(wrappedValue: player)
self.url = url
}

var body: some View {
VideoPlayer(player: player)
.clipped()
.onAppear {
try? AVAudioSession.sharedInstance().setCategory(.playback, options: [])
player.play()
VStack {
if let avPlayer {
VideoPlayer(player: avPlayer)
.clipped()
}
}
.onAppear {
fileCDN.adjustedURL(for: url) { result in
switch result {
case let .success(url):
self.avPlayer = AVPlayer(url: url)
try? AVAudioSession.sharedInstance().setCategory(.playback, options: [])
self.avPlayer?.play()
case let .failure(error):
self.error = error
}
}
}
}
}
Loading
Loading