Skip to content

Commit

Permalink
PLAYNEXT-1278 Remove view counts linked to Social View
Browse files Browse the repository at this point in the history
  • Loading branch information
mutaben committed Nov 21, 2024
1 parent f430ee7 commit 288228c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 79 deletions.
26 changes: 0 additions & 26 deletions Application/Sources/Player/MediaPlayerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ @interface MediaPlayerViewController ()
@property (nonatomic, weak) IBOutlet UILabel *titleLabel;
@property (nonatomic, weak) IBOutlet UILabel *availabilityLabel;
@property (nonatomic, weak) IBOutlet UIStackView *viewCountStackView;
@property (nonatomic, weak) IBOutlet UIImageView *viewCountImageView;
@property (nonatomic, weak) IBOutlet UILabel *viewCountLabel;
@property (nonatomic, weak) IBOutlet UIButton *detailsButton;
@property (nonatomic, weak) IBOutlet UILabel *summaryLabel;

Expand Down Expand Up @@ -829,30 +827,6 @@ - (void)reloadDetailsWithMedia:(SRGMedia *)media mainChapterMedia:(SRGMedia *)ma

[self removeSongPanel];

self.viewCountLabel.font = [SRGFont fontWithStyle:SRGFontStyleSubtitle1];

NSPredicate *socialViewsPredicate = [NSPredicate predicateWithFormat:@"%K == %@", @keypath(SRGSocialCount.new, type), @(SRGSocialCountTypeSRGView)];
SRGSocialCount *socialCount = [media.socialCounts filteredArrayUsingPredicate:socialViewsPredicate].firstObject;
if (socialCount && socialCount.value >= ApplicationConfiguration.sharedApplicationConfiguration.minimumSocialViewCount) {
NSString *viewCountString = [NSNumberFormatter localizedStringFromNumber:@(socialCount.value) numberStyle:NSNumberFormatterDecimalStyle];
if (media.mediaType == SRGMediaTypeAudio) {
self.viewCountLabel.text = [NSString stringWithFormat:NSLocalizedString(@"%@ listenings", @"Label displaying the number of listenings on the player"), viewCountString];
self.viewCountLabel.accessibilityLabel = [NSString stringWithFormat:PlaySRGAccessibilityLocalizedString(@"%@ listenings", @"Label displaying the number of listenings on the player"), viewCountString];
self.viewCountImageView.image = [UIImage imageNamed:@"view_count_audio"];
}
else {
self.viewCountLabel.text = [NSString stringWithFormat:NSLocalizedString(@"%@ views", @"Label displaying the number of views on the player"), viewCountString];
self.viewCountLabel.accessibilityLabel = [NSString stringWithFormat:PlaySRGAccessibilityLocalizedString(@"%@ views", @"Label displaying the number of views on the player"), viewCountString];
self.viewCountImageView.image = [UIImage imageNamed:@"view_count_video"];
}
self.viewCountImageView.hidden = NO;
self.viewCountLabel.hidden = NO;
}
else {
self.viewCountImageView.hidden = YES;
self.viewCountLabel.hidden = YES;
}

[self reloadDetailsWithShow:media.show];

SRGResource *resource = self.letterboxController.resource;
Expand Down
Loading

0 comments on commit 288228c

Please sign in to comment.