Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public struct ChatChannelInfoView<Factory: ViewFactory>: View, KeyboardReadable
} else {
ChatInfoParticipantsView(
factory: factory,
channel: viewModel.channel,
participants: viewModel.displayedParticipants,
onItemAppear: viewModel.onParticipantAppear(_:),
selectedParticipant: $viewModel.selectedParticipant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ public struct ChatInfoParticipantsView<Factory: ViewFactory>: View {
@Binding var selectedParticipant: ParticipantInfo?

let factory: Factory
let channel: ChatChannel
var participants: [ParticipantInfo]
var onItemAppear: (ParticipantInfo) -> Void

public init(
factory: Factory = DefaultViewFactory.shared,
channel: ChatChannel,
participants: [ParticipantInfo],
onItemAppear: @escaping (ParticipantInfo) -> Void,
selectedParticipant: Binding<ParticipantInfo?> = .constant(nil)
) {
self.factory = factory
self.channel = channel
self.participants = participants
self.onItemAppear = onItemAppear
_selectedParticipant = selectedParticipant
Expand All @@ -41,14 +44,8 @@ public struct ChatInfoParticipantsView<Factory: ViewFactory>: View {
)
factory.makeMessageAvatarView(for: displayInfo)

VStack(alignment: .leading, spacing: 4) {
Text(participant.displayName)
.lineLimit(1)
.font(fonts.bodyBold)
Text(participant.onlineInfoText)
.font(fonts.footnote)
.foregroundColor(Color(colors.textLowEmphasis))
}
participantView(participant: participant)

Spacer()
}
.padding(.all, 8)
Expand All @@ -67,6 +64,26 @@ public struct ChatInfoParticipantsView<Factory: ViewFactory>: View {
}
.background(Color(colors.background))
}

private func participantView(participant:ParticipantInfo)-> some View {
HStack(alignment: .center) {
VStack(alignment: .leading, spacing: 4) {
Text(participant.displayName)
.lineLimit(1)
.font(fonts.bodyBold)
Text(participant.onlineInfoText)
.font(fonts.footnote)
.foregroundColor(Color(colors.textLowEmphasis))
}
Spacer()

if channel.createdBy?.id == participant.chatUser.id {
Text(L10n.chatGroupInfoOwner)
.font(fonts.footnote)
.foregroundColor(Color(colors.textLowEmphasis))
}
}
}
}

public struct ParticipantInfo: Identifiable {
Expand Down
2 changes: 2 additions & 0 deletions Sources/StreamChatSwiftUI/Generated/L10n.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import Foundation
// MARK: - Strings

internal enum L10n {
/// Owner
internal static var chatGroupInfoOwner: String { L10n.tr("Localizable", "chat_group_info_owner") }
/// %d of %d
internal static func currentSelection(_ p1: Int, _ p2: Int) -> String {
return L10n.tr("Localizable", "current-selection", p1, p2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,5 @@
"thread.error.message" = "Error loading threads";
"thread.no-content.message" = "No threads here yet...";
"thread.item.replied-to" = "replied to: %@";

"chat_group_info_owner" = "Owner";