Add files via upload

This commit is contained in:
arichorn 2023-09-07 19:27:09 -05:00 committed by GitHub
parent ccda2827a9
commit c27a33ccff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 71 additions and 0 deletions

View file

@ -1581,6 +1581,16 @@ extern NSBundle *uYouPlusBundle();
}
settingItemId:0],
[YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Enable MrBeastify")
titleDescription:LOC(@"Not Recommended unless you want in Thumbnails like this.")
accessibilityIdentifier:nil
switchOn:IsEnabled(@"flex_enabled")
switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"mrBeastify_enabled"];
return YES;
}
settingItemId:0],
[YTSettingsSectionItemClass switchItemWithTitle:LOC(@"ENABLE_FLEX")
titleDescription:LOC(@"ENABLE_FLEX_DESC")
accessibilityIdentifier:nil

View file

@ -634,6 +634,64 @@ static void replaceTab(YTIGuideResponse *response) {
%end
%end
%group gMrBeastify
int imageCount = 0;
NSArray *flippableText = @[@23, @37, @46];
NSBundle *MrBeastifyBundle() {
static NSBundle *bundle = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString *tweakBundlePath = [[NSBundle mainBundle] pathForResource:@"MrBeastify" ofType:@"bundle"];
if (tweakBundlePath)
bundle = [NSBundle bundleWithPath:tweakBundlePath];
else
bundle = [NSBundle bundleWithPath:ROOT_PATH_NS(@"/Library/Application Support/MrBeastify.bundle")];
});
return bundle;
}
NSString *MrBeastifyBundlePath() {
return [MrBeastifyBundle() bundlePath];
}
%hook _ASDisplayView
-(void)layoutSubviews {
%orig;
if (![self.accessibilityIdentifier isEqualToString:@"eml.timestamp"]) return;
for (UIView *subview in self.superview.superview.subviews) {
if (subview.frame.size.height < 90 || subview.frame.size.height > 300) continue;
if (subview.subviews.count != 1) continue;
BOOL isFlipped = arc4random_uniform(4) == 1;
int imageNumber = 1 + arc4random() % (imageCount - 1);
NSString *filepath = [NSString stringWithFormat:@"%@/%d.png", MrBeastifyBundlePath(), imageNumber];
if (isFlipped && [flippableText containsObject:[NSNumber numberWithInt:imageNumber]]) {
filepath = [NSString stringWithFormat:@"%@/%d_flipped.png", MrBeastifyBundlePath(), imageNumber];
}
UIImage *image = [[UIImage alloc] initWithContentsOfFile:ROOT_PATH_NS_VAR(filepath)];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.frame = subview.frame; // same size as thumbnail
imageView.center = subview.center; // centre of thumbnail
if (isFlipped && ![flippableText containsObject:[NSNumber numberWithInt:imageNumber]]) {
imageView.transform = CGAffineTransformMakeScale(-1, 1);
}
[subview addSubview:imageView];
break;
}
}
%end
%end
# pragma mark - uYouPlus
// Video Player Options
// Skips content warning before playing *some videos - @PoomSmart
@ -1024,6 +1082,9 @@ static void replaceTab(YTIGuideResponse *response) {
if (IsEnabled(@"ytNoModernUI_enabled")) {
%init(gYTNoModernUI);
}
if (IsEnabled(@"mrBeastify_enabled")) {
%init(gMrBeastify);
}
if (IsEnabled(@"disableDontEatMyContentSection_enabled")) {
%init(gDisableDontEatMyContentSection);
}