Skip to content

Commit

Permalink
Address feedback+
Browse files Browse the repository at this point in the history
  • Loading branch information
ipavlidakis committed Jan 25, 2024
1 parent 48aef00 commit 2f25a41
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 30 deletions.
5 changes: 3 additions & 2 deletions Sources/StreamVideoSwiftUI/CallView/CallDurationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,15 @@ public struct CallDurationView: View {
fileprivate struct TimeView: View {

@Injected(\.fonts) private var fonts: Fonts
@Injected(\.colors) private var colors: Colors

var value: NSMutableAttributedString

fileprivate init(_ value: String) {
let attributed = NSMutableAttributedString(string: value)
self.value = attributed
self.value.addAttribute(.foregroundColor, value: UIColor.white.withAlphaComponent(0.6), range: .init(location: 0, length: attributed.length - 3))
self.value.addAttribute(.foregroundColor, value: UIColor.white, range: .init(location: attributed.length - 3, length: 3))
self.value.addAttribute(.foregroundColor, value: colors.callDurationColor.withAlphaComponent(0.6), range: .init(location: 0, length: attributed.length - 3))
self.value.addAttribute(.foregroundColor, value: colors.callDurationColor, range: .init(location: attributed.length - 3, length: 3))
}

fileprivate var body: some View {
Expand Down
6 changes: 1 addition & 5 deletions Sources/StreamVideoSwiftUI/CallView/CallView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ public struct CallView<Factory: ViewFactory>: View {
UIApplication.shared.isIdleTimerDisabled = false
}
.enablePictureInPicture(viewModel.isPictureInPictureEnabled)
.presentParticipantListView(isPresented: $viewModel.participantsShown) {
viewFactory.makeParticipantsListView(viewModel: viewModel)
.opacity(viewModel.hideUIElements ? 0 : 1)
.accessibility(identifier: "trailingTopView")
}
.presentParticipantListView(viewModel: viewModel, viewFactory: viewFactory)
}

@ViewBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,19 @@ import Foundation
import SwiftUI
import StreamVideo

struct ParticipantsListViewModifier<EmbeddedView: View>: ViewModifier {

@Injected(\.fonts) var fonts
@Injected(\.colors) var colors

var isPresented: Binding<Bool>
var embeddedView: () -> EmbeddedView

func body(content: Content) -> some View {
content
.halfSheet(isPresented: isPresented) { embeddedView() }
}
}

extension View {

/// Will use the provided Binding to present the Participants List.
@ViewBuilder
public func presentParticipantListView(
isPresented: Binding<Bool>,
@ViewBuilder embeddedView: @escaping () -> some View
@MainActor
public func presentParticipantListView<Factory: ViewFactory>(
@ObservedObject viewModel: CallViewModel,
viewFactory: Factory
) -> some View {
modifier(
ParticipantsListViewModifier(
isPresented: isPresented,
embeddedView: embeddedView
)
)
self.halfSheet(isPresented: $viewModel.participantsShown) {
viewFactory.makeParticipantsListView(viewModel: viewModel)
.opacity(viewModel.hideUIElements ? 0 : 1)
.accessibility(identifier: "trailingTopView")
}
}
}
1 change: 1 addition & 0 deletions Sources/StreamVideoSwiftUI/Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public struct Colors {
public var livestreamCallControlsColor = Color(.streamWhiteStatic)
public var participantSpeakingHighlightColor = Color(.streamAccentBlue).opacity(0.7)
public var participantInfoBackgroundColor = Color(.streamOverlayDarkStatic)
public var callDurationColor: UIColor = .streamWhiteStatic
}

// Those colors are default defined stream constants, which are fallback values if you don't implement your color theme.
Expand Down

0 comments on commit 2f25a41

Please sign in to comment.