Skip to content

Commit

Permalink
YouTube Reborn v4.2.7
Browse files Browse the repository at this point in the history
Includes more stuff from v5.0.0 beta! #50 & #51
  • Loading branch information
arichornlover authored May 17, 2024
1 parent 4e817d9 commit b4e97fd
Show file tree
Hide file tree
Showing 6 changed files with 301 additions and 52 deletions.
25 changes: 21 additions & 4 deletions Controllers/OtherOptionsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 12;
return 13;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
Expand Down Expand Up @@ -106,27 +106,34 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell.accessoryView = disableHints;
}
if (indexPath.row == 8) {
cell.textLabel.text = @"Premium YouTube Logo";
UISwitch *premiumYouTubeLogo = [[UISwitch alloc] initWithFrame:CGRectZero];
[premiumYouTubeLogo addTarget:self action:@selector(togglePremiumYouTubeLogo:) forControlEvents:UIControlEventValueChanged];
premiumYouTubeLogo.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"kPremiumYouTubeLogo"];
cell.accessoryView = premiumYouTubeLogo;
}
if (indexPath.row == 9) {
cell.textLabel.text = @"Hide YouTube Logo";
UISwitch *hideYouTubeLogo = [[UISwitch alloc] initWithFrame:CGRectZero];
[hideYouTubeLogo addTarget:self action:@selector(toggleHideYouTubeLogo:) forControlEvents:UIControlEventValueChanged];
hideYouTubeLogo.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"kHideYouTubeLogo"];
cell.accessoryView = hideYouTubeLogo;
}
if (indexPath.row == 9) {
if (indexPath.row == 10) {
cell.textLabel.text = @"Stick Navigation Bar";
UISwitch *stickNavigationBar = [[UISwitch alloc] initWithFrame:CGRectZero];
[stickNavigationBar addTarget:self action:@selector(toggleStickNavigationBar:) forControlEvents:UIControlEventValueChanged];
stickNavigationBar.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"kStickNavigationBar"];
cell.accessoryView = stickNavigationBar;
}
if (indexPath.row == 10) {
if (indexPath.row == 11) {
cell.textLabel.text = @"Low Contrast Mode";
UISwitch *lowContrastMode = [[UISwitch alloc] initWithFrame:CGRectZero];
[lowContrastMode addTarget:self action:@selector(toggleLowContrastMode:) forControlEvents:UIControlEventValueChanged];
lowContrastMode.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"kLowContrastMode"];
cell.accessoryView = lowContrastMode;
}
if (indexPath.row == 11) {
if (indexPath.row == 12) {
cell.textLabel.text = @"Auto-Hide Home Bar";
UISwitch *autoHideHomeBar = [[UISwitch alloc] initWithFrame:CGRectZero];
[autoHideHomeBar addTarget:self action:@selector(toggleAutoHideHomeBar:) forControlEvents:UIControlEventValueChanged];
Expand Down Expand Up @@ -263,6 +270,16 @@ - (void)toggleDisableHints:(UISwitch *)sender {
}
}

- (void)togglePremiumYouTubeLogo:(UISwitch *)sender {
if ([sender isOn]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"kPremiumYouTubeLogo"];
[[NSUserDefaults standardUserDefaults] synchronize];
} else {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"kPremiumYouTubeLogo"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}

- (void)toggleHideYouTubeLogo:(UISwitch *)sender {
if ([sender isOn]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"kHideYouTubeLogo"];
Expand Down
4 changes: 3 additions & 1 deletion Controllers/RootOptionsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSIntege

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {
if (section == 2) {
return @"YouTube Reborn v4.2.5";
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *appVersion = infoDictionary[@"CFBundleShortVersionString"];
return [NSString stringWithFormat:@"YouTube: v%@\nYouTube Reborn: v4.2.7", appVersion];
}
return nil;
}
Expand Down
52 changes: 43 additions & 9 deletions Controllers/VideoOptionsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"kEnableCustomDoubleTapToSkipDuration"] == YES) {
return 14;
return 19;
}
return 17;
return 18;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
Expand Down Expand Up @@ -137,14 +137,28 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
grayBufferProgress.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"kGrayBufferProgress"];
cell.accessoryView = grayBufferProgress;
}
if (indexPath.row == 11) {
if (indexPath.row == 11) {
cell.textLabel.text = @"Hide Collapse (Arrow) Button";
UISwitch *hideCollapseButton = [[UISwitch alloc] initWithFrame:CGRectZero];
[hideCollapseButton addTarget:self action:@selector(toggleHideCollapseButton:) forControlEvents:UIControlEventValueChanged];
hideCollapseButton.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"kHideCollapseButton"];
cell.accessoryView = hideCollapseButton;
}
if (indexPath.row == 12) {
cell.textLabel.text = @"Hide Fullscreen Button";
UISwitch *hideFullscreenButton = [[UISwitch alloc] initWithFrame:CGRectZero];
[hideFullscreenButton addTarget:self action:@selector(toggleHideFullscreenButton:) forControlEvents:UIControlEventValueChanged];
hideFullscreenButton.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"kHideFullscreenButton"];
cell.accessoryView = hideFullscreenButton;
}
if (indexPath.row == 13) {
cell.textLabel.text = @"Hide Player Bar Heatwave";
UISwitch *hidePlayerBarHeatwave = [[UISwitch alloc] initWithFrame:CGRectZero];
[hidePlayerBarHeatwave addTarget:self action:@selector(toggleHidePlayerBarHeatwave:) forControlEvents:UIControlEventValueChanged];
hidePlayerBarHeatwave.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"kHidePlayerBarHeatwave"];
cell.accessoryView = hidePlayerBarHeatwave;
}
if (indexPath.row == 12) {
if (indexPath.row == 14) {
cell.textLabel.text = @"Always Show Player Bar";
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"kDisableRelatedVideosInOverlay"] == NO || [[NSUserDefaults standardUserDefaults] boolForKey:@"kHideOverlayQuickActions"] == NO) {
cell.accessoryType = UITableViewCellAccessoryDetailButton;
Expand All @@ -155,28 +169,28 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell.accessoryView = alwaysShowPlayerBar;
}
}
if (indexPath.row == 13) {
if (indexPath.row == 15) {
cell.textLabel.text = @"Enable Extra Speed Options";
UISwitch *enableExtraSpeedOptions = [[UISwitch alloc] initWithFrame:CGRectZero];
[enableExtraSpeedOptions addTarget:self action:@selector(toggleExtraSpeedOptions:) forControlEvents:UIControlEventValueChanged];
enableExtraSpeedOptions.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"kEnableExtraSpeedOptions"];
cell.accessoryView = enableExtraSpeedOptions;
}
if (indexPath.row == 14) {
if (indexPath.row == 16) {
cell.textLabel.text = @"Disable Double Tap To Skip";
UISwitch *disableDoubleTapToSkip = [[UISwitch alloc] initWithFrame:CGRectZero];
[disableDoubleTapToSkip addTarget:self action:@selector(toggleDisableDoubleTapToSkip:) forControlEvents:UIControlEventValueChanged];
disableDoubleTapToSkip.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"kDisableDoubleTapToSkip"];
cell.accessoryView = disableDoubleTapToSkip;
}
if (indexPath.row == 15) {
if (indexPath.row == 17) {
cell.textLabel.text = @"Enable Custom Double Tap To Skip Duration";
UISwitch *enableCustomDoubleTapToSkipDuration = [[UISwitch alloc] initWithFrame:CGRectZero];
[enableCustomDoubleTapToSkipDuration addTarget:self action:@selector(toggleEnableCustomDoubleTapToSkipDuration:) forControlEvents:UIControlEventValueChanged];
enableCustomDoubleTapToSkipDuration.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"kEnableCustomDoubleTapToSkipDuration"];
cell.accessoryView = enableCustomDoubleTapToSkipDuration;
}
if (indexPath.row == 16) {
if (indexPath.row == 18) {
UIStepper *customDoubleTapToSkipDurationStepper = [[UIStepper alloc] initWithFrame:CGRectZero];
customDoubleTapToSkipDurationStepper.stepValue = 1;
customDoubleTapToSkipDurationStepper.minimumValue = 1;
Expand Down Expand Up @@ -204,7 +218,7 @@ - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexP

[self presentViewController:alertError animated:YES completion:nil];
}
if (indexPath.row == 10) {
if (indexPath.row == 14) {
UIAlertController *alertError = [UIAlertController alertControllerWithTitle:@"Notice" message:@"You must enable 'Disable Related Videos In Overlay' and 'Hide Overlay Quick Actions' in YouTube Reborn settings to use 'Always Show Player Bar'" preferredStyle:UIAlertControllerStyleAlert];

[alertError addAction:[UIAlertAction actionWithTitle:@"Okay" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
Expand Down Expand Up @@ -380,6 +394,26 @@ - (void)toggleGrayBufferProgress:(UISwitch *)sender {
}
}

- (void)toggleHideCollapseButton:(UISwitch *)sender {
if ([sender isOn]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"kHideCollapseButton"];
[[NSUserDefaults standardUserDefaults] synchronize];
} else {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"kHideCollapseButton"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}

- (void)toggleHideFullscreenButton:(UISwitch *)sender {
if ([sender isOn]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"kHideFullscreenButton"];
[[NSUserDefaults standardUserDefaults] synchronize];
} else {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"kHideFullscreenButton"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}

- (void)toggleHidePlayerBarHeatwave:(UISwitch *)sender {
if ([sender isOn]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"kHidePlayerBarHeatwave"];
Expand Down
53 changes: 52 additions & 1 deletion Tweak.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
#import "YouTubeHeader/YTIElementRenderer.h"
#import "YouTubeHeader/YTISectionListRenderer.h"
#import "YouTubeHeader/YTWatchNextResultsViewController.h"
#import "YouTubeHeader/YTReelModel.h"
#import "YouTubeHeader/ELMCellNode.h"
#import "YouTubeHeader/ELMNodeController.h"
#import "YouTubeHeader/YTIMenuConditionalServiceItemRenderer.h"
#import "YouTubeHeader/YTInnerTubeCollectionViewController.h"
#import "YouTubeHeader/YTIFormattedString.h"
#import "YouTubeHeader/GPBMessage.h"
#import "YouTubeHeader/YTIStringRun.h"

@interface YTQTMButton : UIButton
@property (strong, nonatomic) UIImageView *imageView;
Expand Down Expand Up @@ -64,6 +69,7 @@
@property(readonly, nonatomic) YTQTMButton *nextButton;
@property(readonly, nonatomic) ABCSwitch *autonavSwitch;
@property(readonly, nonatomic) YTQTMButton *closedCaptionsOrSubtitlesButton;
@property(readonly, nonatomic) YTQTMButton *watchCollapseButton;
@property(strong, nonatomic) UIButton *rebornOverlayButton;
- (id)playPauseButton;
- (void)didPressPause:(id)button;
Expand Down Expand Up @@ -165,6 +171,46 @@
- (NSMutableArray <YTIPivotBarSupportedRenderers *> *)itemsArray;
@end

@interface YTITopbarLogoRenderer : NSObject
@property(readonly, nonatomic) YTIIcon *iconImage;
@end
@interface YTIIconThumbnailRenderer : GPBMessage
@property (nonatomic, strong) YTIIcon *icon;
- (bool)hasIcon;
@end
@interface YTICompactListItemThumbnailSupportedRenderers : GPBMessage
@property (nonatomic, strong) YTIIconThumbnailRenderer *iconThumbnailRenderer;
- (bool)hasIconThumbnailRenderer;
@end
@interface YTICompactListItemRenderer : GPBMessage
@property (nonatomic, strong) YTICompactListItemThumbnailSupportedRenderers *thumbnail;
@property (nonatomic, strong) YTIFormattedString *title;
- (bool)hasThumbnail;
- (bool)hasTitle;
@end
@interface YTIIcon (uYouEnhanced)
- (bool)hasIconType;
@end
@interface YTICompactLinkRenderer : GPBMessage
@property (nonatomic, strong) YTIIcon *icon;
@property (nonatomic, strong) YTIFormattedString *title;
@property (nonatomic, strong) YTICompactListItemThumbnailSupportedRenderers *thumbnail;
- (bool)hasIcon;
- (bool)hasThumbnail;
@end
@interface YTIItemSectionSupportedRenderers (uYouEnhanced)
@property(readonly, nonatomic) YTICompactLinkRenderer *compactLinkRenderer;
@property(readonly, nonatomic) YTICompactListItemRenderer *compactListItemRenderer;
- (bool)hasCompactLinkRenderer;
- (bool)hasCompactListItemRenderer;
@end
@interface YTAppCollectionViewController : YTInnerTubeCollectionViewController
- (void)uYouEnhancedFakePremiumModel:(YTISectionListRenderer *)model;
@end
@interface YTInnerTubeCollectionViewController (uYouEnhanced)
@property(readonly, nonatomic) YTISectionListRenderer *model;
@end

@interface YTSingleVideo : NSObject
- (NSString *)videoId;
@end
Expand Down Expand Up @@ -203,8 +249,13 @@
@end

@interface YTInlinePlayerBarContainerView : UIView
@property(readonly, nonatomic) YTLabel *durationLabel;
@property(readonly, nonatomic) YTLabel *currentTimeLabel;
@property(readonly, nonatomic) YTLabel *durationLabel;
@property (nonatomic, assign, readwrite) BOOL canShowFullscreenButton;
@property (nonatomic, assign, readwrite) BOOL showOnlyFullscreenButton;
@property (nonatomic, assign, readwrite) BOOL fullscreenButtonDisabled;
- (YTQTMButton *)exitFullscreenButton;
- (YTQTMButton *)enterFullscreenButton;
@end

@interface YTColorPalette : NSObject
Expand Down
Loading

0 comments on commit b4e97fd

Please sign in to comment.