diff --git a/Application/Sources/UI/Helpers/MediaDescription.swift b/Application/Sources/UI/Helpers/MediaDescription.swift index 2fb69f823..4cc391e29 100644 --- a/Application/Sources/UI/Helpers/MediaDescription.swift +++ b/Application/Sources/UI/Helpers/MediaDescription.swift @@ -20,6 +20,8 @@ import SRGAppearanceSwift case date /// Time information emphasis case time + /// Title information emphasis + case title } static func title(for media: SRGMedia, style: Style) -> String? { @@ -32,6 +34,8 @@ import SRGAppearanceSwift } case .date, .time: media.title + case .title: + media.title } } @@ -59,6 +63,12 @@ import SRGAppearanceSwift } else { return formattedTime(for: media) } + case .title: + if let show = media.show, !areRedundant(media: media, show: show) { + return show.title + } else { + return summary(for: media) + } } } @@ -243,7 +253,7 @@ import SRGAppearanceSwift } private static func areRedundant(media: SRGMedia, show: SRGShow) -> Bool { - media.title.lowercased() == show.title.lowercased() + media.title.lowercased().contains(show.title.lowercased()) } private static func shouldDisplayExpirationDate(for media: SRGMedia) -> Bool { diff --git a/Application/Sources/UI/Views/HeroMediaCell.swift b/Application/Sources/UI/Views/HeroMediaCell.swift index 043ce25c8..0503e5622 100644 --- a/Application/Sources/UI/Views/HeroMediaCell.swift +++ b/Application/Sources/UI/Views/HeroMediaCell.swift @@ -82,12 +82,12 @@ struct HeroMediaCell: View { private var subtitle: String? { guard let media else { return nil } - return MediaDescription.subtitle(for: media, style: .show) + return MediaDescription.subtitle(for: media, style: .title) } private var title: String? { guard let media else { return nil } - return MediaDescription.title(for: media, style: .show) + return MediaDescription.title(for: media, style: .title) } var body: some View {