formating, remove old code, update IAmYouTube

This commit is contained in:
qnblackcat
2022-09-01 11:40:09 +07:00
parent e5b9ff21cf
commit e2cd37a8b6
+39 -72
View File
@@ -12,7 +12,6 @@
#import "Tweaks/YouTubeHeader/YTIPivotBarRenderer.h" #import "Tweaks/YouTubeHeader/YTIPivotBarRenderer.h"
#import "Tweaks/YouTubeHeader/YTIBrowseRequest.h" #import "Tweaks/YouTubeHeader/YTIBrowseRequest.h"
#import "Tweaks/YouTubeHeader/YTCommonColorPalette.h" #import "Tweaks/YouTubeHeader/YTCommonColorPalette.h"
#import "Tweaks/YouTubeHeader/YTColorPalette.h"
#import "Tweaks/YouTubeHeader/ASCollectionView.h" #import "Tweaks/YouTubeHeader/ASCollectionView.h"
#import "Tweaks/YouTubeHeader/YTPlayerOverlay.h" #import "Tweaks/YouTubeHeader/YTPlayerOverlay.h"
#import "Tweaks/YouTubeHeader/YTPlayerOverlayProvider.h" #import "Tweaks/YouTubeHeader/YTPlayerOverlayProvider.h"
@@ -202,7 +201,7 @@ BOOL hidePaidPromotionCard() {
// Workaround for MiRO92/uYou-for-YouTube#12, qnblackcat/uYouPlus#263 // Workaround for MiRO92/uYou-for-YouTube#12, qnblackcat/uYouPlus#263
%hook YTDataUtils %hook YTDataUtils
+ (NSMutableDictionary *)spamSignalsDictionary { + (NSMutableDictionary *)spamSignalsDictionary {
return nil; return nil;
} }
%end %end
@@ -210,7 +209,7 @@ BOOL hidePaidPromotionCard() {
%hook UIResponder %hook UIResponder
%new %new
- (id)entry { - (id)entry {
return nil; return nil;
} }
%end %end
@@ -218,7 +217,7 @@ BOOL hidePaidPromotionCard() {
%hook YTLocalPlaybackController %hook YTLocalPlaybackController
%new %new
- (id)activeVideoController { - (id)activeVideoController {
return [self activeVideo]; return [self activeVideo];
} }
%end %end
@@ -248,7 +247,6 @@ BOOL hidePaidPromotionCard() {
// YouRememberCaption: https://poomsmart.github.io/repo/depictions/youremembercaption.html // YouRememberCaption: https://poomsmart.github.io/repo/depictions/youremembercaption.html
%hook YTColdConfig %hook YTColdConfig
- (BOOL)respectDeviceCaptionSetting { return NO; } - (BOOL)respectDeviceCaptionSetting { return NO; }
- (BOOL)shouldUseAppThemeSetting { return YES; } // v16.xx
%end %end
// NOYTPremium - https://github.com/PoomSmart/NoYTPremium/ // NOYTPremium - https://github.com/PoomSmart/NoYTPremium/
@@ -287,10 +285,6 @@ BOOL hidePaidPromotionCard() {
- (void)setUserInteractionEnabled:(BOOL)enabled { %orig(YES); } - (void)setUserInteractionEnabled:(BOOL)enabled { %orig(YES); }
%end %end
%hook YTReelPlayerViewControllerSub // v16.42.3 - @level3tjg: https://reddit.com/r/jailbreak/comments/v29yvk/_/iasl1l0/
- (BOOL)shouldEnablePlayerBar { return YES; }
%end
// Workaround for issue #54 // Workaround for issue #54
%hook YTMainAppVideoPlayerOverlayViewController %hook YTMainAppVideoPlayerOverlayViewController
- (void)updateRelatedVideos { - (void)updateRelatedVideos {
@@ -302,10 +296,10 @@ BOOL hidePaidPromotionCard() {
// Workaround for qnblackcat/uYouPlus#253, qnblackcat/uYouPlus#170 // Workaround for qnblackcat/uYouPlus#253, qnblackcat/uYouPlus#170
%hook YTReelWatchPlaybackOverlayView %hook YTReelWatchPlaybackOverlayView
- (YTQTMButton *)overflowButton { - (YTQTMButton *)overflowButton {
if ([self respondsToSelector:@selector(orderedRightSideButtons)] && if ([self respondsToSelector:@selector(orderedRightSideButtons)] &&
[self orderedRightSideButtons].count != 0) [self orderedRightSideButtons].count != 0)
return [self orderedRightSideButtons][0]; return [self orderedRightSideButtons][0];
return %orig; return %orig;
} }
%end %end
@@ -317,32 +311,31 @@ BOOL hidePaidPromotionCard() {
attribute:(NSLayoutAttribute)attr2 attribute:(NSLayoutAttribute)attr2
multiplier:(CGFloat)multiplier multiplier:(CGFloat)multiplier
constant:(CGFloat)c { constant:(CGFloat)c {
if (![view1 isKindOfClass:%c(YTReelPlayerBottomButton)] && if (![view1 isKindOfClass:%c(YTReelPlayerBottomButton)] &&
![view1.accessibilityIdentifier isEqualToString:@"com.miro.uyou"]) ![view1.accessibilityIdentifier isEqualToString:@"com.miro.uyou"])
return %orig; return %orig;
if (!view2) { if (!view2) {
view1.hidden = YES; view1.hidden = YES;
return [NSLayoutConstraint alloc]; return [NSLayoutConstraint alloc];
} }
YTReelPlayerBottomButton *uYouButton = (YTReelPlayerBottomButton *)view1; YTReelPlayerBottomButton *uYouButton = (YTReelPlayerBottomButton *)view1;
YTReelPlayerBottomButton *topButton = (YTReelPlayerBottomButton *)view2; YTReelPlayerBottomButton *topButton = (YTReelPlayerBottomButton *)view2;
NSString *uYouButtonTitle = NSString *uYouButtonTitle =
[view2.accessibilityIdentifier isEqualToString:@"com.miro.uyou"] [view2.accessibilityIdentifier isEqualToString:@"com.miro.uyou"]
? @"uYou" ? @"uYou"
: @"uYouLocal"; : @"uYouLocal";
uYouButton.accessibilityLabel = uYouButtonTitle; uYouButton.accessibilityLabel = uYouButtonTitle;
uYouButton.uppercaseTitle = NO; uYouButton.uppercaseTitle = NO;
[uYouButton setTitle:uYouButtonTitle forState:UIControlStateNormal]; [uYouButton setTitle:uYouButtonTitle forState:UIControlStateNormal];
[uYouButton [uYouButton
setTitleTypeKind:MSHookIvar<NSInteger>(topButton, "_typeKind") setTitleTypeKind:MSHookIvar<NSInteger>(topButton, "_typeKind")
typeVariant:MSHookIvar<NSInteger>(topButton, "_typeVariant")]; typeVariant:MSHookIvar<NSInteger>(topButton, "_typeVariant")];
uYouButton.applyRightSideLayoutImageSize = uYouButton.applyRightSideLayoutImageSize = topButton.applyRightSideLayoutImageSize;
topButton.applyRightSideLayoutImageSize; uYouButton.buttonImageTitlePadding = topButton.buttonImageTitlePadding;
uYouButton.buttonImageTitlePadding = topButton.buttonImageTitlePadding; uYouButton.buttonLayoutStyle = topButton.buttonLayoutStyle;
uYouButton.buttonLayoutStyle = topButton.buttonLayoutStyle; uYouButton.sizeWithPaddingAndInsets = topButton.sizeWithPaddingAndInsets;
uYouButton.sizeWithPaddingAndInsets = topButton.sizeWithPaddingAndInsets; uYouButton.verticalContentPadding = topButton.verticalContentPadding;
uYouButton.verticalContentPadding = topButton.verticalContentPadding; return %orig;
return %orig;
} }
%end %end
@@ -441,6 +434,14 @@ BOOL hidePaidPromotionCard() {
} }
%end %end
%hook APMAEU
+ (BOOL)isFAS { return YES; }
%end
%hook GULAppEnvironmentUtil
+ (BOOL)isFromAppStore { return YES; }
%end
%hook NSBundle %hook NSBundle
- (NSString *)bundleIdentifier { - (NSString *)bundleIdentifier {
NSArray *address = [NSThread callStackReturnAddresses]; NSArray *address = [NSThread callStackReturnAddresses];
@@ -543,39 +544,6 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:
} }
%end %end
%hook YTColorPalette // v16.42.3
- (UIColor *)brandBackgroundSolid {
if (self.pageStyle == 1) {
return [UIColor blackColor];
}
return %orig;
}
- (UIColor *)brandBackgroundPrimary {
if (self.pageStyle == 1) {
return [UIColor blackColor];
}
return %orig;
}
- (UIColor *)brandBackgroundSecondary {
if (self.pageStyle == 1) {
return [[UIColor blackColor] colorWithAlphaComponent:0.9];
}
return %orig;
}
- (UIColor *)staticBrandBlack {
if (self.pageStyle == 1) {
return [UIColor blackColor];
}
return %orig;
}
- (UIColor *)generalBackgroundA {
if (self.pageStyle == 1) {
return [UIColor blackColor];
}
return %orig;
}
%end
// Account view controller // Account view controller
%hook YTAccountPanelBodyViewController %hook YTAccountPanelBodyViewController
- (UIColor *)backgroundColor:(NSInteger)pageStyle { - (UIColor *)backgroundColor:(NSInteger)pageStyle {
@@ -601,7 +569,7 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:
- (void)didMoveToWindow { - (void)didMoveToWindow {
%orig; %orig;
if (isDarkMode() && [self.nextResponder isKindOfClass:%c(_ASDisplayView)]) { if (isDarkMode() && [self.nextResponder isKindOfClass:%c(_ASDisplayView)]) {
self.superview.backgroundColor = [UIColor clearColor]; self.superview.backgroundColor = [UIColor blackColor];
} }
} }
%end %end
@@ -726,7 +694,6 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:
if ([self.accessibilityIdentifier isEqualToString:@"rich_header"]) { self.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"rich_header"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { self.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.cancel.button"]) { self.superview.backgroundColor = [UIColor clearColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.ui.cancel.button"]) { self.superview.backgroundColor = [UIColor clearColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.filter_chip_bar"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.backgroundColor = [UIColor blackColor]; }