Skip to content

Commit d24b439

Browse files
Major refactor: split codebase into multiple files
Now for the fun part: will this compile?
1 parent 0a4bfd8 commit d24b439

17 files changed

+762
-785
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TWEAK_NAME = uYouPlus
2626
DISPLAY_NAME = YouTube
2727
BUNDLE_ID = com.google.ios.youtube
2828

29-
$(TWEAK_NAME)_FILES = Sources/uYouPlus.xm Sources/Settings.xm Sources/Patches.xm
29+
$(TWEAK_NAME)_FILES = Sources/uYouPlus.xm Sources/Settings.xm Sources/Patches.xm Sources/BigYTMiniPlayer.xm Sources/Themes.xm Sources/YTCastConfirm.xm Sources/YTMiniPlayerEnabler.x Sources/YTNoHoverCards.x Sources/YTNoPaidPromo.x Sources/YTReExplore.x Sources/YTStockVolumeHUD.xm
3030
$(TWEAK_NAME)_FRAMEWORKS = UIKit Security
3131
$(TWEAK_NAME)_CFLAGS = -fobjc-arc -DTWEAK_VERSION=\"$(PACKAGE_VERSION)\"
3232
$(TWEAK_NAME)_INJECT_DYLIBS = Tweaks/uYou/Library/MobileSubstrate/DynamicLibraries/uYou.dylib $(THEOS_OBJ_DIR)/libFLEX.dylib $(THEOS_OBJ_DIR)/iSponsorBlock.dylib $(THEOS_OBJ_DIR)/YouPiP.dylib $(THEOS_OBJ_DIR)/YouTubeDislikesReturn.dylib $(THEOS_OBJ_DIR)/YTABConfig.dylib $(THEOS_OBJ_DIR)/YTUHD.dylib $(THEOS_OBJ_DIR)/DontEatMyContent.dylib $(THEOS_OBJ_DIR)/IAmYouTube.dylib $(THEOS_OBJ_DIR)/YTClassicVideoQuality.dylib $(THEOS_OBJ_DIR)/NoYTPremium.dylib $(THEOS_OBJ_DIR)/YTSpeed.dylib

Sources/BigYTMiniPlayer.h

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#import "uYouPlus.h"
2+
3+
@interface YTMainAppVideoPlayerOverlayView : UIView
4+
- (UIViewController *)_viewControllerForAncestor;
5+
@end
6+
7+
@interface YTWatchMiniBarView : UIView
8+
@end

Sources/BigYTMiniPlayer.xm

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#import "BigYTMiniPlayer.h"
2+
3+
%group BigYTMiniPlayer // https://github.com/Galactic-Dev/BigYTMiniPlayer
4+
%hook YTWatchMiniBarView
5+
- (void)setWatchMiniPlayerLayout:(int)arg1 {
6+
%orig(1);
7+
}
8+
- (int)watchMiniPlayerLayout {
9+
return 1;
10+
}
11+
- (void)layoutSubviews {
12+
%orig;
13+
self.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width - self.frame.size.width), self.frame.origin.y, self.frame.size.width, self.frame.size.height);
14+
}
15+
%end
16+
17+
%hook YTMainAppVideoPlayerOverlayView
18+
- (BOOL)isUserInteractionEnabled {
19+
if([[self _viewControllerForAncestor].parentViewController.parentViewController isKindOfClass:%c(YTWatchMiniBarViewController)]) {
20+
return NO;
21+
}
22+
return %orig;
23+
}
24+
%end
25+
%end
26+
27+
%ctor {
28+
if (IS_ENABLED(@"bigYTMiniPlayer_enabled") && (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad)) {
29+
%init(BigYTMiniPlayer);
30+
}
31+
}

Sources/Patches.h

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#import "../Tweaks/YouTubeHeader/YTCommonColorPalette.h"
2+
#import "uYouPlus.h"
3+
4+
// Prevent uYou player bar from showing when not playing downloaded media
5+
@interface PlayerManager : NSObject
6+
- (float)progress;
7+
@end
8+
9+
// iOS 16 uYou crash fix - @level3tjg: https://github.com/qnblackcat/uYouPlus/pull/224
10+
@interface OBPrivacyLinkButton : UIButton
11+
- (instancetype)initWithCaption:(NSString *)caption
12+
buttonText:(NSString *)buttonText
13+
image:(UIImage *)image
14+
imageSize:(CGSize)imageSize
15+
useLargeIcon:(BOOL)useLargeIcon
16+
displayLanguage:(NSString *)displayLanguage;
17+
@end
18+
19+
// uYouLocal fix
20+
// @interface YTLocalPlaybackController : NSObject
21+
// - (id)activeVideo;
22+
// @end
23+
24+
// uYou theme fix
25+
// @interface YTAppDelegate ()
26+
// @property(nonatomic, strong) id downloadsVC;
27+
// @end

Sources/Patches.xm

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#import "uYouPlus.h"
1+
#import "Patches.h"
22

33
# pragma mark - YouTube patches
44

@@ -95,6 +95,13 @@
9595
}
9696
%end
9797

98+
// Fix navigation bar showing a lighter grey with default dark mode - https://github.com/therealFoxster/uYouPlus/commit/8db8197
99+
%hook YTCommonColorPalette
100+
- (UIColor *)brandBackgroundSolid {
101+
return self.pageStyle == 1 ? [UIColor colorWithRed:0.05882352941176471 green:0.05882352941176471 blue:0.05882352941176471 alpha:1.0] : %orig;
102+
}
103+
%end
104+
98105
%ctor {
99106
%init;
100107
if (@available(iOS 16, *)) {

Sources/Settings.h

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#import "../Tweaks/YouTubeHeader/YTSettingsViewController.h"
2+
#import "../Tweaks/YouTubeHeader/YTSearchableSettingsViewController.h"
3+
#import "../Tweaks/YouTubeHeader/YTSettingsSectionItem.h"
4+
#import "../Tweaks/YouTubeHeader/YTSettingsSectionItemManager.h"
5+
#import "../Tweaks/YouTubeHeader/YTUIUtils.h"
6+
#import "../Tweaks/YouTubeHeader/YTSettingsPickerViewController.h"
7+
#import "uYouPlus.h"
8+
9+
// For displaying snackbars
10+
@interface YTHUDMessage : NSObject
11+
+ (id)messageWithText:(id)text;
12+
- (void)setAction:(id)action;
13+
@end
14+
15+
@interface GOOHUDMessageAction : NSObject
16+
- (void)setTitle:(NSString *)title;
17+
- (void)setHandler:(void (^)(id))handler;
18+
@end
19+
20+
@interface GOOHUDManagerInternal : NSObject
21+
- (void)showMessageMainThread:(id)message;
22+
+ (id)sharedInstance;
23+
@end

Sources/Settings.xm

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
#import "../Tweaks/YouTubeHeader/YTSettingsViewController.h"
2-
#import "../Tweaks/YouTubeHeader/YTSearchableSettingsViewController.h"
3-
#import "../Tweaks/YouTubeHeader/YTSettingsSectionItem.h"
4-
#import "../Tweaks/YouTubeHeader/YTSettingsSectionItemManager.h"
5-
#import "../Tweaks/YouTubeHeader/YTUIUtils.h"
6-
#import "../Tweaks/YouTubeHeader/YTSettingsPickerViewController.h"
7-
#import "uYouPlus.h"
1+
#import "Settings.h"
82

93
#define VERSION_STRING [[NSString stringWithFormat:@"%@", @(OS_STRINGIFY(TWEAK_VERSION))] stringByReplacingOccurrencesOfString:@"\"" withString:@""]
4+
#define SHOW_RELAUNCH_YT_SNACKBAR [[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:LOC(@"RESTART_YOUTUBE")]]
105

116
#define SECTION_HEADER(s) [sectionItems addObject:[%c(YTSettingsSectionItem) itemWithTitle:@"\t" titleDescription:[s uppercaseString] accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger sectionItemIndex) { return NO; }]]
127

138
#define SWITCH_ITEM(t, d, k) [sectionItems addObject:[YTSettingsSectionItemClass switchItemWithTitle:t titleDescription:d accessibilityIdentifier:nil switchOn:IS_ENABLED(k) switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:k];return YES;} settingItemId:0]]
149

15-
#define SHOW_RELAUNCH_YT_SNACKBAR [[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:LOC(@"RESTART_YOUTUBE")]]
16-
1710
#define SWITCH_ITEM2(t, d, k) [sectionItems addObject:[YTSettingsSectionItemClass switchItemWithTitle:t titleDescription:d accessibilityIdentifier:nil switchOn:IS_ENABLED(k) switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:k];SHOW_RELAUNCH_YT_SNACKBAR;return YES;} settingItemId:0]]
1811

1912
static const NSInteger uYouPlusSection = 500;

Sources/Themes.h

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#import "../Tweaks/YouTubeHeader/YTCommonColorPalette.h"
2+
#import "../Tweaks/YouTubeHeader/ASCollectionView.h"
3+
#import "uYouPlus.h"
4+
5+
@interface YCHLiveChatView : UIView
6+
@end
7+
8+
@interface YTFullscreenEngagementOverlayView : UIView
9+
@end
10+
11+
@interface YTRelatedVideosView : UIView
12+
@end
13+
14+
@interface ELMView : UIView
15+
@end
16+
17+
@interface ASWAppSwitcherCollectionViewCell : UIView
18+
@end
19+
20+
@interface ASScrollView : UIView
21+
@end
22+
23+
@interface UIKeyboardLayoutStar : UIView
24+
@end
25+
26+
@interface UIKeyboardDockView : UIView
27+
@end
28+
29+
@interface _ASDisplayView : UIView
30+
@end
31+
32+
@interface YTCommentDetailHeaderCell : UIView
33+
@end
34+
35+
@interface SponsorBlockSettingsController : UITableViewController
36+
@end
37+
38+
@interface SponsorBlockViewController : UIViewController
39+
@end
40+
41+
@interface UICandidateViewController : UIViewController
42+
@end
43+
44+
@interface UIPredictionViewController : UIViewController
45+
@end
46+
47+
@interface FRPreferences : UITableViewController
48+
@end
49+
50+
@interface FRPSelectListTable : UITableViewController
51+
@end
52+
53+
@interface settingsReorderTable : UIViewController
54+
@property(nonatomic, strong) UITableView *tableView;
55+
@end

0 commit comments

Comments
 (0)