Skip to content

Commit

Permalink
Merge branch 'release/03.2023'
Browse files Browse the repository at this point in the history
  • Loading branch information
rts-devops committed Mar 20, 2023
2 parents 0dcb3ea + 6fd3e62 commit 291f3d5
Show file tree
Hide file tree
Showing 88 changed files with 1,340 additions and 343 deletions.
2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
BUNDLE_PATH: "vendor/bundle"
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,5 @@ xcuserdata
/Scripts/generate-icons-caches

/vendor
/.bundle
.ruby-version

.vscode
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AllCops:
Metrics/BlockLength:
Enabled: true
Max: 35
IgnoredMethods: ['platform', 'for_platform', 'abstract_target']
AllowedMethods: ['platform', 'for_platform', 'abstract_target']

# Default is too restrictive, when optional properties have to be checked
Metrics/MethodLength:
Expand All @@ -25,7 +25,7 @@ Metrics/MethodLength:
Layout/LineLength:
Enabled: true
Max: 100
IgnoredPatterns: ['^gem', '^(\s+|)desc', '^(\s+|)UI.']
AllowedPatterns: ['^gem', '^(\s+|)desc', '^(\s+|)UI.']

# They have not to be snake_case
Naming/FileName:
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.3
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"Manages account information" = "Gestire le informazioni sull'account";

/* More button label */
"More" = "Di più";
"More" = "Altro";

/* A more episode button label
Button to access more episodes */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@
/* Message on top screen when trying to open a media in the download list and the media is not downloaded. */
"Media not available yet" = "Media non disponibile";

/* More button label */
"More" = "Altro";

/* Autoplay setting section footer */
"More content is automatically played after playback of the current content ends." = "Un nuovo contenuto viene riprodotto automaticamente al termine di quello corrente.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@
/* Message on top screen when trying to open a media in the download list and the media is not downloaded. */
"Media not available yet" = "Media betg disponibel";

/* More button label */
"More" = "Dapli";

/* Autoplay setting section footer */
"More content is automatically played after playback of the current content ends." = "Automaticamein dapli cuntegn suenter playback sche inabel.";

Expand Down Expand Up @@ -435,7 +438,7 @@
"Notified" = "Notifitgà";

/* Subscription label to be notified in the show view */
"Notify me" = "Trametta messadi a mai";
"Notify me" = "Ma notifitgar";

/* Now button in program guide */
"Now" = "Ussa";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"endTolerance": 10,
"endToleranceRatio": 0.01,
"hiddenOnboardings": "favorites,resume_playback,watch_later",
"searchSettingSubtitledHidden": true
"searchSettingSubtitledHidden": true,
"prefersShowLeadInsteadOfDescription": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@
/* Message on top screen when trying to open a media in the download list and the media is not downloaded. */
"Media not available yet" = "Contenu non disponible";

/* More button label */
"More" = "Plus";

/* Autoplay setting section footer */
"More content is automatically played after playback of the current content ends." = "Joue automatiquement un autre contenu lorsque la lecture d'un contenu se termine.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@
/* Message on top screen when trying to open a media in the download list and the media is not downloaded. */
"Media not available yet" = "Inhalt noch nicht verfügbar";

/* More button label */
"More" = "Mehr";

/* Autoplay setting section footer */
"More content is automatically played after playback of the current content ends." = "Nach Beendigung der Wiedergabe des aktuellen Inhalts werden weitere Inhalte automatisch abgespielt.";

Expand Down Expand Up @@ -432,10 +435,10 @@
"Notifications have been enabled for %@" = "%@ wurde zu den Push-Mitteilungen hinzugefügt";

/* Subscription label when notification enabled in the show view */
"Notified" = "Mitteilungen aktiviert";
"Notified" = "Benachrichtigt";

/* Subscription label to be notified in the show view */
"Notify me" = "Mitteilungen aktivieren";
"Notify me" = "Benachrichtigen";

/* Now button in program guide */
"Now" = "Jetzt";
Expand Down Expand Up @@ -542,7 +545,7 @@
"Resume" = "Weiter abspielen";

/* Title label used to present medias whose playback can be resumed */
"Resume playback" = "Fortsetzen";
"Resume playback" = "Weiterschauen";

/* Label to present the search view
Search shortcut label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@
/* Message on top screen when trying to open a media in the download list and the media is not downloaded. */
"Media not available yet" = "Media not available yet";

/* More button label */
"More" = "More";

/* Autoplay setting section footer */
"More content is automatically played after playback of the current content ends." = "More content is automatically played after playback of the current content ends.";

Expand Down

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,4 @@ name: YYWebImage, nameSpecified: YYWebImage, owner: SRGSSR, version: 1.0.5-srg3,

add-version-numbers: true

LicensePlist Version: 3.23.4
LicensePlist Version: 3.24.3
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<key>FooterText</key>
<string>The MIT License (MIT)
Copyright (c) 2015-2022 Alexander Grebenyuk
Copyright (c) 2015-2023 Alexander Grebenyuk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Application/Sources/Application/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
PlayApplicationRunOnce(^(void (^completionHandler)(BOOL success)) {
[Download updateUnplayableDownloads];
completionHandler(YES);
}, @"updateUnplayableDownloads");
}, @"updateUnplayableDownloads2");

[self checkForForcedUpdates];

Expand Down
1 change: 1 addition & 0 deletions Application/Sources/Bridges/PlaySRG-ObjectiveC.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#import "NSDateFormatter+PlaySRG.h"
#import "Orientation.h"
#import "PlayAccessibilityFormatter.h"
#import "PlayApplication.h"
#import "PlayApplicationNavigation.h"
#import "PlayDurationFormatter.h"
#import "PlayErrors.h"
Expand Down
2 changes: 2 additions & 0 deletions Application/Sources/Configuration/ApplicationConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ OBJC_EXPORT NSString * const ApplicationConfigurationDidChangeNotification;
@property (nonatomic, readonly, getter=isSearchSettingSubtitledHidden) BOOL searchSettingSubtitledHidden;
@property (nonatomic, readonly, getter=isShowsSearchHidden) BOOL showsSearchHidden;

@property (nonatomic, readonly, getter=isShowLeadPreferred) BOOL showLeadPreferred;

- (nullable RadioChannel *)radioChannelForUid:(nullable NSString *)uid;
- (nullable RadioChannel *)radioHomepageChannelForUid:(nullable NSString *)uid; // only returns a result if the radio channel exists and has a corresponding homepage
- (nullable TVChannel *)tvChannelForUid:(nullable NSString *)uid;
Expand Down
4 changes: 4 additions & 0 deletions Application/Sources/Configuration/ApplicationConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ @interface ApplicationConfiguration ()
@property (nonatomic, getter=isSearchSettingSubtitledHidden) BOOL searchSettingSubtitledHidden;
@property (nonatomic, getter=isShowsSearchHidden) BOOL showsSearchHidden;

@property (nonatomic, getter=isShowLeadPreferred) BOOL showLeadPreferred;

#if defined(DEBUG) || defined(NIGHTLY) || defined(BETA)
@property (nonatomic) NSURL *overridePlayURL;
#endif
Expand Down Expand Up @@ -407,6 +409,8 @@ - (BOOL)synchronizeWithFirebaseConfiguration:(PlayFirebaseConfiguration *)fireba
self.searchSettingSubtitledHidden = [firebaseConfiguration boolForKey:@"searchSettingSubtitledHidden"];
self.showsSearchHidden = [firebaseConfiguration boolForKey:@"showsSearchHidden"];

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

[NSNotificationCenter.defaultCenter postNotificationName:ApplicationConfigurationDidChangeNotification
object:self];

Expand Down
2 changes: 1 addition & 1 deletion Application/Sources/Content/SectionShowHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct SectionShowHeaderView: View {

var body: some View {
if horizontalSizeClass == .regular {
LinearGradient(gradient: Gradient(colors: [.clear, .srgGray16]), startPoint: .center, endPoint: .trailing)
LinearGradient(colors: [.clear, .srgGray16], startPoint: .center, endPoint: .trailing)
}
}
}
Expand Down
88 changes: 85 additions & 3 deletions Application/Sources/Content/SectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ final class SectionViewController: UIViewController {
collectionView.insertSubview(refreshControl, at: 0)
self.refreshControl = refreshControl
#endif

self.view = view
}

Expand All @@ -128,20 +128,29 @@ final class SectionViewController: UIViewController {
let globalHeaderViewRegistration = UICollectionView.SupplementaryRegistration<HostSupplementaryView<TitleView>>(elementKind: Header.global.rawValue) { [weak self] view, _, _ in
guard let self else { return }
view.content = TitleView(text: self.globalHeaderTitle)
if let hostController = view.hostController {
self.addChild(hostController)
}
}

let sectionHeaderViewRegistration = UICollectionView.SupplementaryRegistration<HostSupplementaryView<SectionHeaderView>>(elementKind: UICollectionView.elementKindSectionHeader) { [weak self] view, _, indexPath in
guard let self else { return }
let snapshot = self.dataSource.snapshot()
let section = snapshot.sectionIdentifiers[indexPath.section]
view.content = SectionHeaderView(section: section, configuration: self.model.configuration)
if let hostController = view.hostController {
self.addChild(hostController)
}
}

let sectionFooterViewRegistration = UICollectionView.SupplementaryRegistration<HostSupplementaryView<SectionFooterView>>(elementKind: UICollectionView.elementKindSectionFooter) { [weak self] view, _, indexPath in
guard let self else { return }
let snapshot = self.dataSource.snapshot()
let section = snapshot.sectionIdentifiers[indexPath.section]
view.content = SectionFooterView(section: section)
if let hostController = view.hostController {
self.addChild(hostController)
}
}

dataSource.supplementaryViewProvider = { collectionView, kind, indexPath in
Expand All @@ -162,6 +171,15 @@ final class SectionViewController: UIViewController {
self?.reloadData(for: state)
}
.store(in: &cancellables)

#if os(iOS)
ApplicationSignal.settingUpdates(at: \.PlaySRGSettingMediaListLayoutEnabled)
.receive(on: DispatchQueue.main)
.sink { [weak self] _ in
self?.collectionView.reloadData()
}
.store(in: &cancellables)
#endif
}

override func viewWillAppear(_ animated: Bool) {
Expand All @@ -172,6 +190,29 @@ final class SectionViewController: UIViewController {
userActivity = model.configuration.viewModelProperties.userActivity
}

#if os(iOS)
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

if UIDevice.current.userInterfaceIdiom == .pad && !Bundle.main.play_isAppStoreRelease {
if case let .configured(section) = model.configuration.wrappedValue, case .show = section {
PlayApplicationRunOnce({ completionHandler in
let alertController = UIAlertController(title: NSLocalizedString("Beta tests", comment: "Beta tests alert title"),
message: NSLocalizedString("You can preview a new layout to display episodes.\nThis preview can be disable at anytime in the application settings, in profile tab.", comment: "Beta tests alert explanation"),
preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("Enable", comment: "title of enable button"), style: .default, handler: { _ in
UserDefaults.standard.setValue(true, forKey: PlaySRGSettingMediaListLayoutEnabled)
UserDefaults.standard.synchronize()
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Skip", comment: "Title of a Skip button"), style: .cancel, handler: nil))
present(alertController, animated: true, completion: nil)
completionHandler(true)
}, "ShowPageBetaTestsAlert1")
}
}
}
#endif

override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
userActivity = nil
Expand Down Expand Up @@ -386,7 +427,7 @@ extension SectionViewController {
@objc static func downloadsViewController() -> SectionViewController {
return SectionViewController(section: .configured(.downloads))
}

@objc static func notificationsViewController() -> SectionViewController {
return SectionViewController(section: .configured(.notifications))
}
Expand Down Expand Up @@ -656,6 +697,24 @@ private extension SectionViewController {
let top = section.header.sectionTopInset

switch configuration.viewModelProperties.layout {
case .mediaList:
#if os(iOS)
if horizontalSizeClass == .compact {
return NSCollectionLayoutSection.horizontal(layoutWidth: layoutWidth, spacing: Self.itemSpacing, top: top) { _, _ in
return MediaCellSize.fullWidth()
}
}
else {
let spacing = (layoutWidth - LayoutMaxListWidth) / 4
return NSCollectionLayoutSection.horizontal(layoutWidth: layoutWidth, spacing: spacing, top: top) { layoutWidth, _ in
return MediaCellSize.largeList(layoutWidth: layoutWidth)
}
}
#else
return NSCollectionLayoutSection.grid(layoutWidth: layoutWidth, spacing: Self.itemSpacing, top: top) { layoutWidth, spacing in
return MediaCellSize.grid(layoutWidth: layoutWidth, spacing: spacing)
}
#endif
case .mediaGrid:
if horizontalSizeClass == .compact {
return NSCollectionLayoutSection.horizontal(layoutWidth: layoutWidth, spacing: Self.itemSpacing, top: top) { _, _ in
Expand Down Expand Up @@ -729,7 +788,12 @@ private extension SectionViewController {
case let .configured(configuredSection):
switch configuredSection {
case .show:
MediaCell(media: media, style: .date)
if configuration.viewModelProperties.layout == .mediaList {
MediaCell(media: media, style: .dateAndSummary, layout: .horizontal)
}
else {
MediaCell(media: media, style: .date)
}
case .radioEpisodesForDay, .tvEpisodesForDay:
MediaCell(media: media, style: .time)
default:
Expand Down Expand Up @@ -850,3 +914,21 @@ private extension SectionViewController {
}
}
}

extension SectionViewController: ShowHeaderViewAction {
func showMore(sender: Any?, event: ShowMoreEvent?) {
guard let event else { return }

#if os(iOS)
let sheetTextViewController = UIHostingController(rootView: SheetTextView(content: event.content))
if #available(iOS 15.0, *) {
if let sheet = sheetTextViewController.sheetPresentationController {
sheet.detents = [.medium()]
}
}
present(sheetTextViewController, animated: true, completion: nil)
#else
navigateToText(event.content)
#endif
}
}
7 changes: 7 additions & 0 deletions Application/Sources/Content/SectionViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ extension SectionViewModel {

enum SectionLayout: Hashable {
case liveMediaGrid
case mediaList
case mediaGrid
case showGrid
case topicGrid
Expand Down Expand Up @@ -389,6 +390,12 @@ private extension SectionViewModel {
return .downloadGrid
case .notifications:
return .notificationList
#endif
case .show:
#if os(iOS)
return ApplicationSettingMediaListLayoutEnabled() ? .mediaList : .mediaGrid
#else
return .mediaGrid
#endif
default:
return .mediaGrid
Expand Down
Loading

0 comments on commit 291f3d5

Please sign in to comment.