mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-01-11 22:40:19 +00:00
Improvements to uYouPlus.xm
This commit is contained in:
parent
3c61c08531
commit
af35a71ec5
1 changed files with 24 additions and 116 deletions
|
|
@ -57,6 +57,30 @@ static NSString *accessGroupID() {
|
|||
}
|
||||
%end
|
||||
|
||||
// Workaround: uYou 3.0.3 Adblock fix.
|
||||
BOOL isAd(YTIElementRenderer *self) {
|
||||
if ([NSUserDefaults.standardUserDefaults boolForKey:@"removeYouTubeAds"]) {
|
||||
if (self != nil) {
|
||||
NSString *description = [self description];
|
||||
if ([description containsString:@"brand_promo"]
|
||||
|| [description containsString:@"statement_banner"]
|
||||
|| [description containsString:@"product_carousel"]
|
||||
|| [description containsString:@"product_engagement_panel"]
|
||||
|| [description containsString:@"product_item"]
|
||||
|| [description containsString:@"expandable_list"]
|
||||
|| [description containsString:@"text_search_ad"]
|
||||
|| [description containsString:@"text_image_button_layout"]
|
||||
|| [description containsString:@"carousel_headered_layout"]
|
||||
|| [description containsString:@"carousel_footered_layout"]
|
||||
|| [description containsString:@"square_image_layout"]
|
||||
|| [description containsString:@"landscape_image_wide_button_layout"]
|
||||
|| [description containsString:@"feed_ad_metadata"])
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Hide YouTube Logo - @dayanch96
|
||||
%group gHideYouTubeLogo
|
||||
%hook YTHeaderLogoController
|
||||
|
|
@ -101,30 +125,6 @@ static NSString *accessGroupID() {
|
|||
}
|
||||
%end
|
||||
|
||||
// Workaround: uYou 3.0.3 Adblock fix.
|
||||
BOOL isAd(YTIElementRenderer *self) {
|
||||
if ([NSUserDefaults.standardUserDefaults boolForKey:@"removeYouTubeAds"]) {
|
||||
if (self != nil) {
|
||||
NSString *description = [self description];
|
||||
if ([description containsString:@"brand_promo"]
|
||||
|| [description containsString:@"statement_banner"]
|
||||
|| [description containsString:@"product_carousel"]
|
||||
|| [description containsString:@"product_engagement_panel"]
|
||||
|| [description containsString:@"product_item"]
|
||||
|| [description containsString:@"expandable_list"]
|
||||
|| [description containsString:@"text_search_ad"]
|
||||
|| [description containsString:@"text_image_button_layout"]
|
||||
|| [description containsString:@"carousel_headered_layout"]
|
||||
|| [description containsString:@"carousel_footered_layout"]
|
||||
|| [description containsString:@"square_image_layout"]
|
||||
|| [description containsString:@"landscape_image_wide_button_layout"]
|
||||
|| [description containsString:@"feed_ad_metadata"])
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
%hook YTSectionListViewController
|
||||
- (void)loadWithModel:(YTISectionListRenderer *)model {
|
||||
if ([NSUserDefaults.standardUserDefaults boolForKey:@"removeYouTubeAds"]) {
|
||||
|
|
@ -172,98 +172,6 @@ BOOL isAd(YTIElementRenderer *self) {
|
|||
%end
|
||||
%end
|
||||
|
||||
// IAmYouTube - https://github.com/PoomSmart/IAmYouTube/
|
||||
%hook YTVersionUtils
|
||||
+ (NSString *)appName { return YT_NAME; }
|
||||
+ (NSString *)appID { return YT_BUNDLE_ID; }
|
||||
%end
|
||||
|
||||
%hook GCKBUtils
|
||||
+ (NSString *)appIdentifier { return YT_BUNDLE_ID; }
|
||||
%end
|
||||
|
||||
%hook GPCDeviceInfo
|
||||
+ (NSString *)bundleId { return YT_BUNDLE_ID; }
|
||||
%end
|
||||
|
||||
%hook OGLBundle
|
||||
+ (NSString *)shortAppName { return YT_NAME; }
|
||||
%end
|
||||
|
||||
%hook GVROverlayView
|
||||
+ (NSString *)appName { return YT_NAME; }
|
||||
%end
|
||||
|
||||
%hook OGLPhenotypeFlagServiceImpl
|
||||
- (NSString *)bundleId { return YT_BUNDLE_ID; }
|
||||
%end
|
||||
|
||||
%hook APMAEU
|
||||
+ (BOOL)isFAS { return YES; }
|
||||
%end
|
||||
|
||||
%hook GULAppEnvironmentUtil
|
||||
+ (BOOL)isFromAppStore { return YES; }
|
||||
%end
|
||||
|
||||
%hook SSOConfiguration
|
||||
- (id)initWithClientID:(id)clientID supportedAccountServices:(id)supportedAccountServices {
|
||||
self = %orig;
|
||||
[self setValue:YT_NAME forKey:@"_shortAppName"];
|
||||
[self setValue:YT_BUNDLE_ID forKey:@"_applicationIdentifier"];
|
||||
return self;
|
||||
}
|
||||
%end
|
||||
|
||||
%hook NSBundle
|
||||
- (NSString *)bundleIdentifier {
|
||||
NSArray *address = [NSThread callStackReturnAddresses];
|
||||
Dl_info info = {0};
|
||||
if (dladdr((void *)[address[2] longLongValue], &info) == 0)
|
||||
return %orig;
|
||||
NSString *path = [NSString stringWithUTF8String:info.dli_fname];
|
||||
if ([path hasPrefix:NSBundle.mainBundle.bundlePath])
|
||||
return YT_BUNDLE_ID;
|
||||
return %orig;
|
||||
}
|
||||
- (id)objectForInfoDictionaryKey:(NSString *)key {
|
||||
if ([key isEqualToString:@"CFBundleIdentifier"])
|
||||
return YT_BUNDLE_ID;
|
||||
if ([key isEqualToString:@"CFBundleDisplayName"] || [key isEqualToString:@"CFBundleName"])
|
||||
return YT_NAME;
|
||||
return %orig;
|
||||
}
|
||||
// Fix Google Sign in by @PoomSmart & @level3tjg (qnblackcat/uYouPlus#684)
|
||||
- (NSDictionary *)infoDictionary {
|
||||
NSMutableDictionary *info = %orig.mutableCopy;
|
||||
NSString *altBundleIdentifier = info[@"ALTBundleIdentifier"];
|
||||
if (altBundleIdentifier) info[@"CFBundleIdentifier"] = altBundleIdentifier;
|
||||
return info;
|
||||
}
|
||||
%end
|
||||
|
||||
// Fix login for YouTube 18.13.2 and higher - @BandarHL
|
||||
%hook SSOKeychainHelper
|
||||
+ (NSString *)accessGroup {
|
||||
return accessGroupID();
|
||||
}
|
||||
+ (NSString *)sharedAccessGroup {
|
||||
return accessGroupID();
|
||||
}
|
||||
%end
|
||||
|
||||
// Fix login for YouTube 17.33.2 and higher - @BandarHL
|
||||
// https://gist.github.com/BandarHL/492d50de46875f9ac7a056aad084ac10
|
||||
%hook SSOKeychainCore
|
||||
+ (NSString *)accessGroup {
|
||||
return accessGroupID();
|
||||
}
|
||||
|
||||
+ (NSString *)sharedAccessGroup {
|
||||
return accessGroupID();
|
||||
}
|
||||
%end
|
||||
|
||||
// Fix App Group Directory by move it to document directory
|
||||
%hook NSFileManager
|
||||
- (NSURL *)containerURLForSecurityApplicationGroupIdentifier:(NSString *)groupIdentifier {
|
||||
|
|
|
|||
Loading…
Reference in a new issue