Update uYouPlus.xm

This commit is contained in:
arichornlover 2024-07-05 09:53:32 -05:00 committed by GitHub
parent b6897d50bc
commit 5caf4a3206
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,53 +60,6 @@ NSBundle *tweakBundle = uYouPlusBundle();
}
%end
// Restore Settings Button - v18.35.4+ - @arichornlover
%hook YTRightNavigationButtons
%property (retain, nonatomic) YTQTMButton *settingsButton;
- (NSMutableArray *)buttons {
NSString *tweakBundlePath = [[NSBundle mainBundle] pathForResource:@"uYouPlus" ofType:@"bundle"];
NSString *buttonSettingsPath;
if (tweakBundlePath) {
NSBundle *tweakBundle = [NSBundle bundleWithPath:tweakBundlePath];
buttonSettingsPath = [tweakBundle pathForResource:@"yt_outline_gear_24pt" ofType:@"png"];
} else {
buttonSettingsPath = ROOT_PATH_NS(@"/Library/Application Support/uYouPlus.bundle/UI/yt_outline_gear_24pt.png");
}
Class YTVersionUtilsClass = %c(YTVersionUtils);
NSString *appVersion = [YTVersionUtilsClass performSelector:@selector(appVersion)];
NSComparisonResult versionCheck = [appVersion compare:@"18.35.4" options:NSNumericSearch];
if (versionCheck == NSOrderedAscending) {
return %orig;
}
NSMutableArray *retVal = %orig.mutableCopy;
[self.settingsButton removeFromSuperview];
[self addSubview:self.settingsButton];
if (!self.settingsButton) {
self.settingsButton = [%c(YTQTMButton) iconButton];
self.settingsButton.frame = CGRectMake(0, 0, 24, 24);
[self.settingsButton setImage:[UIImage imageNamed:@"yt_outline_gear_24pt"] forState:UIControlStateNormal];
[self.settingsButton addTarget:self action:@selector(settingsAction) forControlEvents:UIControlEventTouchUpInside];
[retVal insertObject:self.settingsButton atIndex:0];
}
return retVal;
}
- (NSMutableArray *)visibleButtons {
NSMutableArray *retVal = %orig.mutableCopy;
[self setLeadingPadding:+10];
[self.settingsButton removeFromSuperview];
[self addSubview:self.settingsButton];
[retVal insertObject:self.settingsButton atIndex:0];
return retVal;
}
%new;
- (void)settingsAction {
UIViewController *settingsVC = [UIViewController new];
settingsVC.view.backgroundColor = [UIColor whiteColor];
UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
[rootVC presentViewController:settingsVC animated:YES completion:nil];
}
%end
// uYou AdBlock Workaround LITE (This Version will only remove ads from Videos/Shorts!) - @PoomSmart
%group uYouAdBlockingWorkaroundLite
%hook YTHotConfig
@ -213,101 +166,52 @@ NSString *getAdString(NSString *description) {
return @"video_display_full_buttoned_layout";
return nil;
}
#define cellDividerDataBytesLength 719
static __strong NSData *cellDividerData;
static uint8_t cellDividerDataBytes[] = {
0xa, 0x8c, 0x5, 0xca, 0xeb, 0xea, 0x83, 0x5, 0x85, 0x5,
0x1a, 0x29, 0x92, 0xcb, 0xa1, 0x90, 0x5, 0x23, 0xa, 0x21,
0x63, 0x65, 0x6c, 0x6c, 0x5f, 0x64, 0x69, 0x76, 0x69, 0x64,
0x65, 0x72, 0x2e, 0x65, 0x6d, 0x6c, 0x7c, 0x39, 0x33, 0x62,
0x65, 0x63, 0x30, 0x39, 0x37, 0x37, 0x63, 0x66, 0x64, 0x33,
0x61, 0x31, 0x37, 0x2a, 0xee, 0x3, 0xea, 0x84, 0xef, 0xab,
0xa, 0xe7, 0x3, 0x8, 0x4, 0x12, 0x0, 0x18, 0xff, 0xff,
0xff, 0x7, 0x32, 0xdb, 0x3, 0xfa, 0x3e, 0x4, 0x8, 0x5,
0x10, 0x1, 0x92, 0x3f, 0x4, 0xa, 0x2, 0x8, 0x1, 0xc2,
0xb8, 0x89, 0xbe, 0xa, 0x91, 0x1, 0xa, 0x8c, 0x1, 0x38,
0x1, 0x40, 0x1, 0x50, 0x1, 0x58, 0x1, 0x60, 0x5, 0x70,
0x1, 0x78, 0x1, 0x80, 0x1, 0x1, 0x90, 0x1, 0x1, 0x98,
0x1, 0x1, 0xa0, 0x1, 0x1, 0xa8, 0x1, 0x1, 0xc8, 0x1,
0x1, 0xe0, 0x1, 0x1, 0x88, 0x2, 0x1, 0x90, 0x2, 0x1,
0x98, 0x2, 0x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 0x7c, 0x61, 0x37, 0x39, 0x38, 0x35, 0x39,
0x35, 0x34, 0x37, 0x39, 0x64, 0x62, 0x65, 0x36, 0x64, 0x63,
0x32, 0x67, 0x9a, 0xe8, 0xf9, 0xa9, 0x6, 0x8, 0x8, 0xcd,
0xf0, 0xbd, 0xa5, 0x1, 0x10, 0x7, 0xaa, 0xf1, 0xdf, 0xc1,
0xb, 0x24, 0xa, 0x1c, 0xa, 0x18, 0xa, 0x16, 0x74, 0x68,
0x65, 0x6d, 0x65, 0x7c, 0x66, 0x33, 0x33, 0x38, 0x61, 0x34,
0x35, 0x63, 0x38, 0x62, 0x66, 0x39, 0x30, 0x35, 0x66, 0x64,
0x10, 0x2, 0x10, 0xcd, 0xf0, 0xbd, 0xa5, 0x1, 0xb2, 0xf1,
0xdf, 0xc1, 0xb, 0x29, 0xa, 0x21, 0xa, 0x1d, 0x63, 0x61,
0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73,
0x7c, 0x61, 0x37, 0x39, 0x38, 0x35, 0x39, 0x35, 0x34, 0x37,
0x39, 0x64, 0x62, 0x65, 0x36, 0x64, 0x63, 0x10, 0xa, 0x10,
0xcd, 0xf0, 0xbd, 0xa5, 0x1, 0x12, 0x3e, 0xc2, 0x86, 0xa5,
0xbb, 0x5, 0x38, 0xa, 0x21, 0x63, 0x65, 0x6c, 0x6c, 0x5f,
0x64, 0x69, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x65, 0x6d,
0x6c, 0x7c, 0x39, 0x33, 0x62, 0x65, 0x63, 0x30, 0x39, 0x37,
0x37, 0x63, 0x66, 0x64, 0x33, 0x61, 0x31, 0x37, 0x32, 0x13,
0x31, 0x37, 0x31, 0x39, 0x31, 0x32, 0x32, 0x35, 0x34, 0x39,
0x39, 0x39, 0x36, 0x30, 0x31, 0x37, 0x31, 0x33, 0x38,
};
%hook YTIElementRenderer
- (NSData *)elementData {
if ([self respondsToSelector:@selector(hasCompatibilityOptions)] && self.hasCompatibilityOptions && self.compatibilityOptions.hasAdLoggingData) {
// HBLogInfo(@"YTX adLogging %@", cellDividerData);
NSString *description = [self description];
if ([description containsString:@"cell_divider"]) {
if (!cellDividerData) cellDividerData = %orig;
return cellDividerData;
}
if (!cellDividerData) return %orig;
if ([self respondsToSelector:@selector(hasCompatibilityOptions)] && self.hasCompatibilityOptions && self.compatibilityOptions.hasAdLoggingData) {
// HBLogInfo(@"YTX adLogging 1 %@", cellDividerData);
return cellDividerData;
}
NSString *description = [self description];
NSString *adString = getAdString(description);
if (adString) {
// HBLogInfo(@"YTX getAdString %@ %@", str, cellDividerData);
// HBLogInfo(@"YTX getAdString 1 %@ %@", adString, cellDividerData);
return cellDividerData;
}
return %orig;
}
%end
%hook _ASDisplayView
- (void)didMoveToWindow {
%orig();
if ([self.accessibilityIdentifier isEqualToString:@"id.products_in_video_with_preview_overlay_badge.view"]) self.hidden = YES;
%hook YTInnerTubeCollectionViewController
- (void)loadWithModel:(YTISectionListRenderer *)model {
if ([model isKindOfClass:%c(YTISectionListRenderer)]) {
NSMutableArray <YTISectionListSupportedRenderers *> *contentsArray = model.contentsArray;
NSIndexSet *removeIndexes = [contentsArray indexesOfObjectsPassingTest:^BOOL(YTISectionListSupportedRenderers *renderers, NSUInteger idx, BOOL *stop) {
if (![renderers isKindOfClass:%c(YTISectionListSupportedRenderers)])
return NO;
YTIItemSectionRenderer *sectionRenderer = renderers.itemSectionRenderer;
YTIItemSectionSupportedRenderers *firstObject = [sectionRenderer.contentsArray firstObject];
YTIElementRenderer *elementRenderer = firstObject.elementRenderer;
if ([elementRenderer respondsToSelector:@selector(hasCompatibilityOptions)] && elementRenderer.hasCompatibilityOptions && elementRenderer.compatibilityOptions.hasAdLoggingData) {
// HBLogInfo(@"YTX adLogging 2 %@", elementRenderer);
return YES;
}
NSString *description = [elementRenderer description];
NSString *adString = getAdString(description);
if (adString) {
// HBLogInfo(@"YTX getAdString 2 %@ %@", adString, elementRenderer);
return YES;
}
return NO;
}];
[contentsArray removeObjectsAtIndexes:removeIndexes];
}
%orig;
}
%end
%end
@ -760,15 +664,29 @@ static int contrastMode() {
- (BOOL)cxClientEnableModernizedActionSheet { return NO; }
- (BOOL)enableClientShortsSheetsModernization { return NO; }
- (BOOL)enableTimestampModernizationForNative { return NO; }
- (BOOL)modernizeElementsTextColor { return NO; }
- (BOOL)modernizeElementsBgColor { return NO; }
- (BOOL)mainAppCoreClientEnableModernIaFeedStretchBottom { return NO; }
- (BOOL)mainAppCoreClientEnableModernIaFrostedBottomBar { return NO; }
- (BOOL)mainAppCoreClientEnableModernIaFrostedPivotBar { return NO; }
- (BOOL)mainAppCoreClientEnableModernIaFrostedPivotBarUpdatedBackdrop { return NO; }
- (BOOL)mainAppCoreClientEnableModernIaFrostedTopBar { return NO; }
- (BOOL)mainAppCoreClientEnableModernIaOpacityPivotBar { return NO; }
- (BOOL)mainAppCoreClientEnableModernIaTopAndBottomBarIconRefresh { return NO; }
- (BOOL)mainAppCoreClientEnableModernizedBedtimeReminderU18DefaultSettings { return NO; }
- (BOOL)modernizeCameoNavbar { return NO; }
- (BOOL)modernizeCollectionLockups { return NO; }
- (BOOL)modernizeCollectionLockupsShowVideoCount { return NO; }
- (BOOL)modernizeElementsBgColor { return NO; }
- (BOOL)modernizeElementsTextColor { return NO; }
- (BOOL)postsCreatorClientEnableModernButtonsUi { return NO; }
- (BOOL)pullToFullModernEdu { return NO; }
- (BOOL)showModernMiniplayerRedesign { return NO; }
- (BOOL)uiSystemsClientGlobalConfigEnableModernButtonsForNative { return NO; }
- (BOOL)uiSystemsClientGlobalConfigIosEnableModernTabsForNative { return NO; }
- (BOOL)uiSystemsClientGlobalConfigIosEnableEpUxUpdates { return NO; }
- (BOOL)uiSystemsClientGlobalConfigIosEnableSheetsUxUpdates { return NO; }
- (BOOL)uiSystemsClientGlobalConfigIosEnableSnackbarModernization { return NO; }
- (BOOL)uiSystemsClientGlobalConfigModernizeNativeBgColor { return NO; }
- (BOOL)uiSystemsClientGlobalConfigModernizeNativeTextColor { return NO; }
// Disable Rounded Content
- (BOOL)enableIosFloatingMiniplayerRoundedCornerRadius { return YES; }
- (BOOL)iosDownloadsPageRoundedThumbs { return NO; }
- (BOOL)iosRoundedSearchBarSuggestZeroPadding { return NO; }
- (BOOL)uiSystemsClientGlobalConfigEnableRoundedDialogForNative { return NO; }
@ -1146,8 +1064,9 @@ static int contrastMode() {
}
%end
/*
// LEGACY VERSION ⚠️
// Hide Fullscreen Button - @arichornlover - PoomSmart's Newer Version of the *YouQuality* tweak breaks when enabling this
// Hide Fullscreen Button - @arichornlover - PoomSmart's 1.2.0+ Versions of the *YouQuality* tweak makes the button invisible when enabling this
%hook YTInlinePlayerBarContainerView
- (void)layoutSubviews {
%orig;
@ -1164,12 +1083,18 @@ static int contrastMode() {
}
}
%end
*/
// NEW VERSION
// Hide Fullscreen Button - @arichornlover
// %hook YTInlinePlayerBarContainerView
// ..Work-in-progres..
// %end
%group gHideFullscreenButton
%hook YTInlinePlayerBarContainerView
- (BOOL)fullscreenButtonDisabled { return YES; }
- (BOOL)canShowFullscreenButton { return NO; }
- (BOOL)canShowFullscreenButtonExperimental { return NO; }
// - (void)setFullscreenButtonDisabled:(BOOL) // Uncomment and might implement this if needed - @arichornlover
%end
%end
// Hide HUD Messages
%hook YTHUDMessageView