mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-03-11 17:15:32 +00:00
Use language-independent method
This commit is contained in:
parent
13f1aa783a
commit
572ebf3e3b
2 changed files with 26 additions and 9 deletions
|
|
@ -66,12 +66,13 @@
|
|||
@end
|
||||
|
||||
// Hide Premium Promo in You tab - @bhackel
|
||||
@interface YTFormattedStringLabel : UILabel
|
||||
@interface YTIconBadgeView : UIView
|
||||
@end
|
||||
@interface YTLinkCell : YTCollectionViewCell
|
||||
@property(readonly, nonatomic) YTFormattedStringLabel *titleLabel;
|
||||
@property(readonly, nonatomic) YTIconBadgeView *_iconBadgeView;
|
||||
@end
|
||||
|
||||
|
||||
// uYouPlus
|
||||
@interface YTHeaderLogoController : UIView
|
||||
@property(readonly, nonatomic) long long pageStyle;
|
||||
|
|
|
|||
|
|
@ -280,13 +280,29 @@ BOOL isAd(YTIElementRenderer *self) {
|
|||
%hook YTLinkCell
|
||||
- (void)layoutSubviews {
|
||||
%orig;
|
||||
// Get the text label object for this cell
|
||||
YTFormattedStringLabel *label = self.titleLabel;
|
||||
// Check if the cell is a premium promo
|
||||
if ([label.accessibilityLabel isEqualToString:@"Get YouTube Premium"]) {
|
||||
// Hide the cell
|
||||
self.hidden = YES;
|
||||
self.frame = CGRectZero;
|
||||
// Get the badge of this cell, as it is language-independent and unique
|
||||
YTIconBadgeView *badgeView = self._iconBadgeView;
|
||||
// First null check for badgeView
|
||||
if (!badgeView) {
|
||||
return; // Early return if badgeView is nil
|
||||
}
|
||||
// Walk down the subviews to get to a specific view
|
||||
UIView *subview = badgeView.subviews.firstObject;
|
||||
// Second null check for the first subview
|
||||
if (!subview) {
|
||||
return;
|
||||
}
|
||||
UIImageView *imageView = subview.subviews.firstObject;
|
||||
// Third null check for the imageView
|
||||
if (!imageView) {
|
||||
return;
|
||||
}
|
||||
// Get the description of this view
|
||||
NSString *description = imageView.description;
|
||||
// Check if "yt_outline_youtube_logo_icon" is in the description
|
||||
if ([description containsString:@"yt_outline_youtube_logo_icon"]) {
|
||||
self.hidden = YES; // Hide the cell
|
||||
self.frame = CGRectZero; // Eliminate free space
|
||||
}
|
||||
}
|
||||
%end
|
||||
|
|
|
|||
Loading…
Reference in a new issue