Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLAYRTS-5508 Beta only audio content pages #487

Merged
merged 25 commits into from
Jun 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9686286
PLAYRTS-5508 Add optional contentPageid string to channel and use it …
pyby Mar 7, 2024
410baf0
PLAYRTS-5508 Add optional audioContentHomePagePreferred boolean to di…
pyby Mar 7, 2024
81950f8
PLAYRTS-5508 Start audio podcast image integration
pyby Mar 10, 2024
d3388c2
PLAYRTS-5508 Fix show cell layout for podcast variant
pyby Mar 15, 2024
4df4d62
PLAYRTS-5508 Add content type on sections
pyby Mar 15, 2024
aec68c1
PLAYRTS-5508 Try audio podcast image integration for all BUs with aud…
pyby Mar 15, 2024
cf81020
PLAYRTS-5508 Add Podcast square images service override option in Set…
pyby May 4, 2024
818688d
PLAYRTS-5508 Fix channel page id property naming
pyby May 4, 2024
8b50d33
PLAYRTS-5508 Apply new remote config properties only for non producti…
pyby May 4, 2024
6246be5
PLAYRTS-5508 Add audio content home page override option in Settings
pyby May 4, 2024
341d03f
PLAYRTS-5508 Iterate on audio homepage option in Settings
pyby May 4, 2024
5d52617
PLAYRTS-5508 Connect new settings to tvOS debug build only
pyby May 4, 2024
a82c01e
PLAYRTS-5508 Renaming on audio homepage option in Settings
pyby May 4, 2024
4294fa8
Revert "PLAYRTS-5508 Try audio podcast image integration for all BUs …
pyby May 4, 2024
13c015f
PLAYRTS-5508 Apply square image on iOS media detail page show access
pyby May 4, 2024
a7209f8
PLAYRTS-5508 Improve advanced setting descriptions
pyby May 18, 2024
c88266b
PLAYRTS-5508 Remove default square settings state for SRF
pyby May 18, 2024
1c45101
PLAYRTS-5508 Rename shared constants
pyby May 22, 2024
260167c
PLAYRTS-5508 Fix linter
pyby May 29, 2024
6a27d7b
PLAYRTS-5508 Update DataProvider to develop branch
pyby May 29, 2024
a912acd
PLAYRTS-5508 Code refactoring
pyby May 31, 2024
a2a7855
PLAYRTS-5508 Remove unused code
pyby May 31, 2024
df97c65
PLAYRTS-5508 Update to official SRGDataProvider release
pyby May 31, 2024
d8ccd6e
PLAYRTS-5508 Prepare translations
pyby May 31, 2024
2f2b6c1
PLAYRTS-5508 Update romansh translations
pyby Jun 6, 2024
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
Prev Previous commit
Next Next commit
PLAYRTS-5508 Add optional audioContentHomePagePreferred boolean to di…
…splay content audio homepage

Instead of many radio channel homepages
  • Loading branch information
pyby committed May 22, 2024
commit 410baf0808b2f0de7a4a014838160b21a432bdee
2 changes: 2 additions & 0 deletions Application/Sources/Configuration/ApplicationConfiguration.h
Original file line number Diff line number Diff line change
@@ -71,6 +71,8 @@ OBJC_EXPORT NSString * const ApplicationConfigurationDidChangeNotification;

@property (nonatomic, readonly) NSInteger minimumSocialViewCount; // minimum value to display social view count

@property (nonatomic, readonly, getter=isAudioContentHomePagePreferred) BOOL audioContentHomePagePreferred;

@property (nonatomic, readonly) NSArray<RadioChannel *> *radioChannels;
@property (nonatomic, readonly) NSArray<RadioChannel *> *radioHomepageChannels; // radio channels having a corresponding homepage
@property (nonatomic, readonly) NSArray<TVChannel *> *tvChannels;
4 changes: 4 additions & 0 deletions Application/Sources/Configuration/ApplicationConfiguration.m
Original file line number Diff line number Diff line change
@@ -156,6 +156,8 @@ @interface ApplicationConfiguration ()

@property (nonatomic) NSInteger minimumSocialViewCount;

@property (nonatomic, getter=isAudioContentHomePagePreferred) BOOL audioContentHomePagePreferred;

@property (nonatomic) NSArray<RadioChannel *> *radioChannels;
@property (nonatomic) NSArray<NSNumber *> *audioHomeSections; // wrap `HomeSection` values

@@ -456,6 +458,8 @@ - (BOOL)synchronizeWithFirebaseConfiguration:(PlayFirebaseConfiguration *)fireba

self.audioHomeSections = [firebaseConfiguration homeSectionsForKey:@"audioHomeSections"];

self.audioContentHomePagePreferred = [firebaseConfiguration boolForKey:@"audioContentHomePagePreferred"];

self.radioChannels = [firebaseConfiguration radioChannelsForKey:@"radioChannels" defaultHomeSections:self.audioHomeSections];
self.tvChannels = [firebaseConfiguration tvChannelsForKey:@"tvChannels"];
self.satelliteRadioChannels = [firebaseConfiguration radioChannelsForKey:@"satelliteRadioChannels" defaultHomeSections:nil];
4 changes: 4 additions & 0 deletions Application/Sources/Content/PageViewController.swift
Original file line number Diff line number Diff line change
@@ -428,6 +428,10 @@ extension PageViewController {
return PageViewController(id: .video)
}

@objc static func audiosViewController() -> PageViewController {
return PageViewController(id: .audio(channel: nil))
}

@objc static func audiosViewController(forRadioChannel channel: RadioChannel) -> PageViewController {
return PageViewController(id: .audio(channel: channel))
}
34 changes: 28 additions & 6 deletions Application/Sources/Content/PageViewModel.swift
Original file line number Diff line number Diff line change
@@ -160,7 +160,7 @@ final class PageViewModel: Identifiable, ObservableObject {
extension PageViewModel {
enum Id: SectionFiltering {
case video
case audio(channel: RadioChannel)
case audio(channel: RadioChannel?)
case live
case topic(_ topic: SRGTopic)
case show(_ show: SRGShow)
@@ -243,7 +243,12 @@ extension PageViewModel {
case .video:
return [AnalyticsPageLevel.play.rawValue, AnalyticsPageLevel.video.rawValue]
case let .audio(channel: channel):
return [AnalyticsPageLevel.play.rawValue, AnalyticsPageLevel.audio.rawValue, channel.name]
if let channel {
return [AnalyticsPageLevel.play.rawValue, AnalyticsPageLevel.audio.rawValue, channel.name]
}
else {
return [AnalyticsPageLevel.play.rawValue, AnalyticsPageLevel.audio.rawValue]
}
case .live:
return [AnalyticsPageLevel.play.rawValue, AnalyticsPageLevel.live.rawValue]
case .topic:
@@ -270,7 +275,12 @@ extension PageViewModel {
case .video:
return show.transmission == .TV
case let .audio(channel: channel):
return show.transmission == .radio && show.primaryChannelUid == channel.uid
if let channel {
return show.transmission == .radio && show.primaryChannelUid == channel.uid
}
else {
return show.transmission == .radio
}
default:
return false
}
@@ -285,7 +295,12 @@ extension PageViewModel {
case .video:
return medias.filter { $0.mediaType == .video }
case let .audio(channel: channel):
return medias.filter { $0.mediaType == .audio && ($0.channel?.uid == channel.uid || $0.show?.primaryChannelUid == channel.uid) }
if let channel {
return medias.filter { $0.mediaType == .audio && ($0.channel?.uid == channel.uid || $0.show?.primaryChannelUid == channel.uid) }
}
else {
return medias.filter { $0.mediaType == .audio }
}
default:
return medias
}
@@ -421,6 +436,8 @@ extension PageViewModel {
switch id {
case .video:
return true
case let .audio(channel: channel):
return channel == nil
default:
return false
}
@@ -569,16 +586,21 @@ private extension PageViewModel {
.map { Page(uid: $0.uid, sections: $0.sections.enumeratedMap { Section(.content($0), index: $1) }) }
.eraseToAnyPublisher()
case let .audio(channel: channel):
if let uid = channel.contentPageid {
if let channel, let uid = channel.contentPageid {
return SRGDataProvider.current!.contentPage(for: ApplicationConfiguration.shared.vendor, uid: uid)
.map { Page(uid: $0.uid, sections: $0.sections.enumeratedMap { Section(.content($0), index: $1) }) }
.eraseToAnyPublisher()
}
else {
else if let channel {
return Just(Page(uid: nil, sections: channel.configuredSections().enumeratedMap { Section(.configured($0), index: $1) }))
.setFailureType(to: Error.self)
.eraseToAnyPublisher()
}
else {
return SRGDataProvider.current!.contentPage(for: ApplicationConfiguration.shared.vendor, product: .playAudio)
.map { Page(uid: $0.uid, sections: $0.sections.enumeratedMap { Section(.content($0), index: $1) }) }
.eraseToAnyPublisher()
}
case .live:
return Just(Page(uid: nil, sections: ApplicationConfiguration.shared.liveConfiguredSections.enumeratedMap { Section(.configured($0), index: $1) }))
.setFailureType(to: Error.self)
32 changes: 20 additions & 12 deletions Application/Sources/UI/Controllers/TabBarController.m
Original file line number Diff line number Diff line change
@@ -290,23 +290,31 @@ - (UIViewController *)audiosTabViewController
{
ApplicationConfiguration *applicationConfiguration = ApplicationConfiguration.sharedApplicationConfiguration;

NSArray<RadioChannel *> *radioChannels = applicationConfiguration.radioHomepageChannels;
if (radioChannels.count > 1) {
UIViewController *radioChannelsViewController = [[RadioChannelsViewController alloc] initWithRadioChannels:radioChannels];
NavigationController *audiosNavigationController = [[NavigationController alloc] initWithRootViewController:radioChannelsViewController];
audiosNavigationController.tabBarItem = [self audiosTabBarItem];
return audiosNavigationController;
}
else if (radioChannels.count == 1) {
RadioChannel *radioChannel = radioChannels.firstObject;
PageViewController *pageViewController = [PageViewController audiosViewControllerForRadioChannel:radioChannel];
if (applicationConfiguration.audioContentHomePagePreferred) {
PageViewController *pageViewController = [PageViewController audiosViewController];
NavigationController *audiosNavigationController = [[NavigationController alloc] initWithRootViewController:pageViewController];
audiosNavigationController.tabBarItem = [self audiosTabBarItem];
[audiosNavigationController updateWithRadioChannel:radioChannel animated:NO];
return audiosNavigationController;
}
else {
return nil;
NSArray<RadioChannel *> *radioChannels = applicationConfiguration.radioHomepageChannels;
if (radioChannels.count > 1) {
UIViewController *radioChannelsViewController = [[RadioChannelsViewController alloc] initWithRadioChannels:radioChannels];
NavigationController *audiosNavigationController = [[NavigationController alloc] initWithRootViewController:radioChannelsViewController];
audiosNavigationController.tabBarItem = [self audiosTabBarItem];
return audiosNavigationController;
}
else if (radioChannels.count == 1) {
RadioChannel *radioChannel = radioChannels.firstObject;
PageViewController *pageViewController = [PageViewController audiosViewControllerForRadioChannel:radioChannel];
NavigationController *audiosNavigationController = [[NavigationController alloc] initWithRootViewController:pageViewController];
audiosNavigationController.tabBarItem = [self audiosTabBarItem];
[audiosNavigationController updateWithRadioChannel:radioChannel animated:NO];
return audiosNavigationController;
}
else {
return nil;
}
}
}

3 changes: 2 additions & 1 deletion docs/REMOTE_CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -88,7 +88,8 @@ The radio channel JSON dictionaries have one more key:

## Audio homepage

`audioHomeSections` (optional, string, multiple): The sections to be displayed on the audio homepage of a radio channel, in the order they must appear.
* `audioHomeSections` (optional, string, multiple): The sections to be displayed on the audio homepage of a radio channel, in the order they must appear.
* `audioContentHomePagePreferred` (optional, boolean): Set to `true` iff audio tab only needs one content homepage to be displayed and ignores radio channel homepages. If omitted, `false`.

### Home sections: