Skip to content

Commit af231c8

Browse files
committed
Advanced mode
1 parent dc30ee0 commit af231c8

10 files changed

Lines changed: 1208 additions & 10 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ endif
55
DEBUG=0
66
FINALPACKAGE=1
77
ARCHS = arm64
8-
PACKAGE_VERSION = 1.0
8+
PACKAGE_VERSION = 2.0
99
TARGET := iphone:clang:latest:11.0
1010

1111
include $(THEOS)/makefiles/common.mk
1212

1313
TWEAK_NAME = YTLite
1414
$(TWEAK_NAME)_FRAMEWORKS = UIKit Foundation
1515
$(TWEAK_NAME)_CFLAGS = -fobjc-arc -DTWEAK_VERSION=$(PACKAGE_VERSION)
16-
$(TWEAK_NAME)_FILES = YTLite.x Settings.x
16+
$(TWEAK_NAME)_FILES = YTLite.x Settings.x Sideloading.x
1717

1818
include $(THEOS_MAKE_PATH)/tweak.mk

Settings.x

Lines changed: 216 additions & 3 deletions
Large diffs are not rendered by default.

Sideloading.x

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#import <UIKit/UIKit.h>
2+
#import <Foundation/Foundation.h>
3+
#import <dlfcn.h>
4+
5+
#define YT_BUNDLE_ID @"com.google.ios.youtube"
6+
#define YT_NAME @"YouTube"
7+
8+
@interface SSOConfiguration : NSObject
9+
@end
10+
11+
%group gSideloading
12+
// Keychain patching
13+
static NSString *accessGroupID() {
14+
NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys:
15+
(__bridge NSString *)kSecClassGenericPassword, (__bridge NSString *)kSecClass,
16+
@"bundleSeedID", kSecAttrAccount,
17+
@"", kSecAttrService,
18+
(id)kCFBooleanTrue, kSecReturnAttributes,
19+
nil];
20+
CFDictionaryRef result = nil;
21+
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, (CFTypeRef *)&result);
22+
if (status == errSecItemNotFound)
23+
status = SecItemAdd((__bridge CFDictionaryRef)query, (CFTypeRef *)&result);
24+
if (status != errSecSuccess)
25+
return nil;
26+
NSString *accessGroup = [(__bridge NSDictionary *)result objectForKey:(__bridge NSString *)kSecAttrAccessGroup];
27+
28+
return accessGroup;
29+
}
30+
31+
// IAmYouTube (https://github.com/PoomSmart/IAmYouTube/)
32+
%hook YTVersionUtils
33+
+ (NSString *)appName { return YT_NAME; }
34+
+ (NSString *)appID { return YT_BUNDLE_ID; }
35+
%end
36+
37+
%hook GCKBUtils
38+
+ (NSString *)appIdentifier { return YT_BUNDLE_ID; }
39+
%end
40+
41+
%hook GPCDeviceInfo
42+
+ (NSString *)bundleId { return YT_BUNDLE_ID; }
43+
%end
44+
45+
%hook OGLBundle
46+
+ (NSString *)shortAppName { return YT_NAME; }
47+
%end
48+
49+
%hook GVROverlayView
50+
+ (NSString *)appName { return YT_NAME; }
51+
%end
52+
53+
%hook OGLPhenotypeFlagServiceImpl
54+
- (NSString *)bundleId { return YT_BUNDLE_ID; }
55+
%end
56+
57+
%hook APMAEU
58+
+ (BOOL)isFAS { return YES; }
59+
%end
60+
61+
%hook GULAppEnvironmentUtil
62+
+ (BOOL)isFromAppStore { return YES; }
63+
%end
64+
65+
%hook SSOConfiguration
66+
- (id)initWithClientID:(id)clientID supportedAccountServices:(id)supportedAccountServices {
67+
self = %orig;
68+
[self setValue:YT_NAME forKey:@"_shortAppName"];
69+
[self setValue:YT_BUNDLE_ID forKey:@"_applicationIdentifier"];
70+
return self;
71+
}
72+
%end
73+
74+
%hook NSBundle
75+
- (NSString *)bundleIdentifier {
76+
NSArray *address = [NSThread callStackReturnAddresses];
77+
Dl_info info = {0};
78+
if (dladdr((void *)[address[2] longLongValue], &info) == 0)
79+
return %orig;
80+
NSString *path = [NSString stringWithUTF8String:info.dli_fname];
81+
if ([path hasPrefix:NSBundle.mainBundle.bundlePath])
82+
return YT_BUNDLE_ID;
83+
return %orig;
84+
}
85+
- (id)objectForInfoDictionaryKey:(NSString *)key {
86+
if ([key isEqualToString:@"CFBundleIdentifier"])
87+
return YT_BUNDLE_ID;
88+
if ([key isEqualToString:@"CFBundleDisplayName"] || [key isEqualToString:@"CFBundleName"])
89+
return YT_NAME;
90+
return %orig;
91+
}
92+
// Fix Google Sign in by @PoomSmart and @level3tjg (qnblackcat/uYouPlus#684)
93+
- (NSDictionary *)infoDictionary {
94+
NSMutableDictionary *info = %orig.mutableCopy;
95+
NSString *altBundleIdentifier = info[@"ALTBundleIdentifier"];
96+
if (altBundleIdentifier) info[@"CFBundleIdentifier"] = altBundleIdentifier;
97+
return info;
98+
}
99+
%end
100+
101+
// Fix login for YouTube 18.13.2 and higher
102+
%hook SSOKeychainHelper
103+
+ (NSString *)accessGroup {
104+
return accessGroupID();
105+
}
106+
+ (NSString *)sharedAccessGroup {
107+
return accessGroupID();
108+
}
109+
%end
110+
111+
// Fix login for YouTube 17.33.2 and higher
112+
%hook SSOKeychainCore
113+
+ (NSString *)accessGroup {
114+
return accessGroupID();
115+
}
116+
117+
+ (NSString *)sharedAccessGroup {
118+
return accessGroupID();
119+
}
120+
%end
121+
122+
// Fix App Group Directory by moving it to documents directory
123+
%hook NSFileManager
124+
- (NSURL *)containerURLForSecurityApplicationGroupIdentifier:(NSString *)groupIdentifier {
125+
if (groupIdentifier != nil) {
126+
NSArray *paths = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask];
127+
NSURL *documentsURL = [paths lastObject];
128+
return [documentsURL URLByAppendingPathComponent:@"AppGroup"];
129+
}
130+
return %orig(groupIdentifier);
131+
}
132+
%end
133+
%end
134+
135+
%ctor {
136+
NSString *embeddedMobileProvisionPath = [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"];
137+
if ([[NSFileManager defaultManager] fileExistsAtPath:embeddedMobileProvisionPath]) %init(gSideloading);
138+
}

YTLite.h

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
#import <UIKit/UIKit.h>
22
#import <Foundation/Foundation.h>
33
#import <rootless.h>
4+
#import "../YouTubeHeader/YTIGuideResponse.h"
5+
#import "../YouTubeHeader/YTIGuideResponseSupportedRenderers.h"
46
#import "../YouTubeHeader/YTIPivotBarSupportedRenderers.h"
57
#import "../YouTubeHeader/YTIPivotBarRenderer.h"
8+
#import "../YouTubeHeader/YTIBrowseRequest.h"
69
#import "../YouTubeHeader/YTISectionListRenderer.h"
710
#import "../YouTubeHeader/YTQTMButton.h"
11+
#import "../YouTubeHeader/YTVideoQualitySwitchOriginalController.h"
12+
#import "../YouTubeHeader/YTPlayerViewController.h"
13+
#import "../YouTubeHeader/YTPlayerOverlay.h"
14+
#import "../YouTubeHeader/YTPlayerOverlayProvider.h"
815
#import "../YouTubeHeader/YTSettingsViewController.h"
916
#import "../YouTubeHeader/YTSettingsSectionItem.h"
1017
#import "../YouTubeHeader/YTSettingsSectionItemManager.h"
@@ -23,16 +30,62 @@ BOOL kBackgroundPlayback;
2330
BOOL kNoCast;
2431
BOOL kNoNotifsButton;
2532
BOOL kNoSearchButton;
33+
BOOL kStickyNavbar;
34+
BOOL kNoSubbar;
35+
BOOL kNoYTLogo;
36+
BOOL kHideAutoplay;
37+
BOOL kHideSubs;
38+
BOOL kNoHUDMsgs;
39+
BOOL kHidePrevNext;
40+
BOOL kReplacePrevNext;
41+
BOOL kNoDarkBg;
42+
BOOL kEndScreenCards;
43+
BOOL kNoFullscreenActions;
44+
BOOL kNoRelatedVids;
45+
BOOL kNoPromotionCards;
46+
BOOL kNoWatermarks;
47+
BOOL kMiniplayer;
48+
BOOL kDisableAutoplay;
49+
BOOL kNoContentWarning;
50+
BOOL kClassicQuality;
51+
BOOL kDontSnapToChapter;
52+
BOOL kRedProgressBar;
53+
BOOL kNoHints;
54+
BOOL kNoFreeZoom;
55+
BOOL kExitFullscreen;
56+
BOOL kNoDoubleTapToSeek;
57+
BOOL kHideShorts;
58+
BOOL kShortsProgress;
59+
BOOL kResumeShorts;
60+
BOOL kHideShortsLogo;
61+
BOOL kHideShortsSearch;
62+
BOOL kHideShortsCamera;
63+
BOOL kHideShortsMore;
64+
BOOL kHideShortsSubscriptions;
65+
BOOL kHideShortsLike;
66+
BOOL kHideShortsDislike;
67+
BOOL kHideShortsComments;
68+
BOOL kHideShortsRemix;
69+
BOOL kHideShortsShare;
70+
BOOL kHideShortsAvatars;
71+
BOOL kHideShortsThanks;
72+
BOOL kHideShortsChannelName;
73+
BOOL kHideShortsDescription;
74+
BOOL kHideShortsAudioTrack;
2675
BOOL kRemoveLabels;
76+
BOOL kReExplore;
2777
BOOL kRemoveShorts;
2878
BOOL kRemoveSubscriptions;
2979
BOOL kRemoveUploads;
3080
BOOL kRemoveLibrary;
81+
BOOL kAdvancedMode;
82+
int kPivotIndex;
3183

3284
@interface YTSettingsSectionItemManager (Custom)
3385
@property (nonatomic, strong) NSMutableDictionary *prefs;
3486
@property (nonatomic, strong) NSString *prefsPath;
3587
- (void)updatePrefsForKey:(NSString *)key enabled:(BOOL)enabled;
88+
- (void)updateIntegerPrefsForKey:(NSString *)key intValue:(NSInteger)intValue;
3689
@end
3790

3891
@interface YTPivotBarView : UIView
@@ -41,7 +94,53 @@ BOOL kRemoveLibrary;
4194
@interface YTPivotBarItemView : UIView
4295
@end
4396

97+
@interface YTPivotBarViewController : UIViewController
98+
- (void)selectItemWithPivotIdentifier:(id)pivotIndentifier;
99+
@end
100+
44101
@interface YTRightNavigationButtons : UIView
45102
@property (nonatomic, strong) YTQTMButton *notificationButton;
46103
@property (nonatomic, strong) YTQTMButton *searchButton;
47104
@end
105+
106+
@interface YTNavigationBarTitleView : UIView
107+
@end
108+
109+
@interface YTSegmentableInlinePlayerBarView
110+
@property (nonatomic, assign, readwrite) BOOL enableSnapToChapter;
111+
@end
112+
113+
@interface YTPlayabilityResolutionUserActionUIController : NSObject
114+
- (void)confirmAlertDidPressConfirm;
115+
@end
116+
117+
@interface YTReelPlayerButton : UIButton
118+
@end
119+
120+
@interface ELMCellNode
121+
@end
122+
123+
@interface _ASCollectionViewCell : UICollectionViewCell
124+
- (id)node;
125+
@end
126+
127+
@interface YTAsyncCollectionView : UICollectionView
128+
- (void)removeShortsCellAtIndexPath:(NSIndexPath *)indexPath;
129+
@end
130+
131+
@interface YTReelWatchPlaybackOverlayView : UIView
132+
@end
133+
134+
@interface YTReelTransparentStackView : UIView
135+
@end
136+
137+
@interface YTReelWatchHeaderView : UIView
138+
@end
139+
140+
@interface YTAlertView : UIView
141+
@property (nonatomic, copy, readwrite) NSString *title;
142+
@property (nonatomic, copy, readwrite) NSString *subtitle;
143+
+ (instancetype)infoDialog;
144+
+ (instancetype)confirmationDialogWithAction:(void (^)(void))action actionTitle:(NSString *)actionTitle cancelTitle:(NSString *)cancelTitle;
145+
- (void)show;
146+
@end

0 commit comments

Comments
 (0)