mirror of
https://github.com/yattee/yattee.git
synced 2024-12-14 06:10:32 +05:30
Details channel avatar performance improvement
This commit is contained in:
parent
98d26c37ff
commit
52dad5942e
@ -19,20 +19,15 @@ struct ChannelAvatarView: View {
|
|||||||
ThumbnailView(url: url)
|
ThumbnailView(url: url)
|
||||||
} else {
|
} else {
|
||||||
ZStack {
|
ZStack {
|
||||||
Color(white: 0.6)
|
Color("PlaceholderColor")
|
||||||
.opacity(0.5)
|
|
||||||
|
|
||||||
Group {
|
|
||||||
if let video, video.isLocal {
|
if let video, video.isLocal {
|
||||||
Image(systemName: video.localStreamImageSystemName)
|
Image(systemName: video.localStreamImageSystemName)
|
||||||
} else {
|
|
||||||
Image(systemName: "play.rectangle")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.foregroundColor(.accentColor)
|
.foregroundColor(.accentColor)
|
||||||
.font(.system(size: 20))
|
.font(.system(size: 20))
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.onAppear(perform: updateURL)
|
.onAppear(perform: updateURL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ struct VideoDetails: View {
|
|||||||
|
|
||||||
struct ChannelView: View {
|
struct ChannelView: View {
|
||||||
@ObservedObject private var model = PlayerModel.shared
|
@ObservedObject private var model = PlayerModel.shared
|
||||||
|
@Binding var detailsVisibility: Bool
|
||||||
|
|
||||||
var video: Video? { model.videoForDisplay }
|
var video: Video? { model.videoForDisplay }
|
||||||
|
|
||||||
@ -33,14 +34,19 @@ struct VideoDetails: View {
|
|||||||
guard let channel = video?.channel else { return }
|
guard let channel = video?.channel else { return }
|
||||||
NavigationModel.shared.openChannel(channel, navigationStyle: .sidebar)
|
NavigationModel.shared.openChannel(channel, navigationStyle: .sidebar)
|
||||||
} label: {
|
} label: {
|
||||||
|
if detailsVisibility {
|
||||||
ChannelAvatarView(
|
ChannelAvatarView(
|
||||||
channel: video?.channel,
|
channel: video?.channel,
|
||||||
video: video
|
video: video
|
||||||
)
|
)
|
||||||
.frame(maxWidth: 40, maxHeight: 40)
|
} else {
|
||||||
.padding(.trailing, 5)
|
Circle()
|
||||||
|
.foregroundColor(Color(white: 0.6).opacity(0.5))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.frame(width: 40, height: 40)
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
|
.padding(.trailing, 5)
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 2) {
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
HStack {
|
HStack {
|
||||||
@ -56,9 +62,6 @@ struct VideoDetails: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let video, !video.isLocal {
|
if let video, !video.isLocal {
|
||||||
Group {
|
|
||||||
Text("•")
|
|
||||||
|
|
||||||
HStack(spacing: 2) {
|
HStack(spacing: 2) {
|
||||||
Image(systemName: "person.2.fill")
|
Image(systemName: "person.2.fill")
|
||||||
|
|
||||||
@ -70,7 +73,6 @@ struct VideoDetails: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.font(.caption2)
|
.font(.caption2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,8 +96,6 @@ struct VideoDetails: View {
|
|||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
publishedDateSection
|
publishedDateSection
|
||||||
|
|
||||||
Text("•")
|
|
||||||
|
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
if model.videoBeingOpened != nil || video?.viewsCount != nil {
|
if model.videoBeingOpened != nil || video?.viewsCount != nil {
|
||||||
Image(systemName: "eye")
|
Image(systemName: "eye")
|
||||||
@ -194,7 +194,7 @@ struct VideoDetails: View {
|
|||||||
VStack(alignment: .leading, spacing: 0) {
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
TitleView()
|
TitleView()
|
||||||
if video != nil, !video!.isLocal {
|
if video != nil, !video!.isLocal {
|
||||||
ChannelView()
|
ChannelView(detailsVisibility: $detailsVisibility)
|
||||||
.layoutPriority(1)
|
.layoutPriority(1)
|
||||||
.padding(.bottom, 6)
|
.padding(.bottom, 6)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user