Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion SwiftLeeds/Views/Components/FancyHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ struct FancyHeaderView: View {
}

private var foregroundImageCount: Int {
foregroundImageURLs.count + (foregroundImageName == nil ? 0 : 1)
let count = foregroundImageURLs.count + (foregroundImageName == nil ? 0 : 1)
// Ensure we always have at least 1 for the fallback image
return count == 0 ? 1 : count
}

private var shadowColor: Color {
Expand Down
23 changes: 15 additions & 8 deletions SwiftLeeds/Views/My Conference/ActivityView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,29 @@ struct ActivityView: View {
foregroundImageURLs: foregroundImageURLs
)

StackedTileView(
primaryText: activity.subtitle,
secondaryText: activity.description,
secondaryColor: Color.primary
)
.padding(Padding.screen)
let hasSubtitle = activity.subtitle != nil && !activity.subtitle!.isEmpty
let hasDescription = activity.description != nil && !activity.description!.isEmpty

if hasSubtitle || hasDescription {
StackedTileView(
primaryText: activity.subtitle,
secondaryText: activity.description,
secondaryColor: Color.primary
)
.padding(Padding.screen)
}
}
}

private var foregroundImageURLs: [URL] {
if let image = activity.image?.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed), let url = URL(string: image) {
if let image = activity.image,
!image.isEmpty,
let encodedImage = image.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed),
let url = URL(string: encodedImage) {
return [url]
} else {
return []
}

}
}

Expand Down
4 changes: 3 additions & 1 deletion SwiftLeeds/Views/My Conference/MyConferenceViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ class MyConferenceViewModel: ObservableObject {

for date in individualDates {
let key = Helper.shortDateFormatter.string(from: date)
slots[key] = schedule.data.slots.filter { Calendar.current.compare(date, to: $0.date ?? Date(), toGranularity: .day) == .orderedSame }
slots[key] = schedule.data.slots
.filter { Calendar.current.compare(date, to: $0.date ?? Date(), toGranularity: .day) == .orderedSame }
.sorted { $0.startTime < $1.startTime }
}

hasLoaded = true
Expand Down
17 changes: 11 additions & 6 deletions SwiftLeeds/Views/My Conference/SpeakerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ struct SpeakerView: View {
private var content: some View {
VStack(spacing: Padding.stackGap) {
if presentation.speakers.isEmpty == false {
let imageURLs = presentation.speakers.compactMap { speaker in
speaker.profileImage.isEmpty ? nil : URL(string: speaker.profileImage)
}
FancyHeaderView(
title: presentation.speakers.joinedNames,
foregroundImageURLs: presentation.speakers.map { URL(string: $0.profileImage)! }
foregroundImageURLs: imageURLs
)
}

Expand Down Expand Up @@ -69,11 +72,13 @@ struct SpeakerView: View {
}

ForEach(presentation.speakers) { speaker in
StackedTileView(
primaryText: "About\(presentation.speakers.count == 1 ? "" : ": \(speaker.name)")",
secondaryText: speaker.biography,
secondaryColor: Color.primary
)
if !speaker.biography.isEmpty {
StackedTileView(
primaryText: "About\(presentation.speakers.count == 1 ? "" : ": \(speaker.name)")",
secondaryText: speaker.biography,
secondaryColor: Color.primary
)
}

if let twitter = speaker.twitter, twitter.isEmpty == false {
CommonTileView(
Expand Down
Loading