mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-05-23 07:32:20 +00:00
Update uYouPlusPatches.xm
This commit is contained in:
parent
c382150867
commit
5ee37a88cf
1 changed files with 28 additions and 9 deletions
|
|
@ -1,20 +1,39 @@
|
|||
#import "uYouPlusPatches.h"
|
||||
|
||||
#define YT_BUNDLE_ID @"com.google.ios.youtube"
|
||||
#define YT_NAME @"YouTube"
|
||||
|
||||
# pragma mark - YouTube patches
|
||||
|
||||
// Fix Google Sign in Patch
|
||||
%group gGoogleSignInPatch
|
||||
%hook NSBundle
|
||||
+ (NSBundle *)bundleWithIdentifier:(NSString *)identifier {
|
||||
if ([identifier isEqualToString:YT_BUNDLE_ID])
|
||||
return NSBundle.mainBundle;
|
||||
return %orig(identifier);
|
||||
}
|
||||
- (NSString *)bundleIdentifier {
|
||||
return [self isEqual:NSBundle.mainBundle] ? YT_BUNDLE_ID : %orig;
|
||||
}
|
||||
- (NSDictionary *)infoDictionary {
|
||||
NSDictionary *orig = %orig;
|
||||
if ([self isEqual:NSBundle.mainBundle]) {
|
||||
NSMutableDictionary *patched = [orig mutableCopy];
|
||||
if (patched) {
|
||||
patched[@"CFBundleIdentifier"] = @"com.google.ios.youtube";
|
||||
return [patched copy];
|
||||
}
|
||||
}
|
||||
return orig;
|
||||
NSDictionary *dict = %orig;
|
||||
if (![self isEqual:NSBundle.mainBundle])
|
||||
return %orig;
|
||||
NSMutableDictionary *info = [dict mutableCopy];
|
||||
if (info[@"CFBundleIdentifier"]) info[@"CFBundleIdentifier"] = YT_BUNDLE_ID;
|
||||
if (info[@"CFBundleDisplayName"]) info[@"CFBundleDisplayName"] = YT_NAME;
|
||||
if (info[@"CFBundleName"]) info[@"CFBundleName"] = YT_NAME;
|
||||
return info;
|
||||
}
|
||||
- (id)objectForInfoDictionaryKey:(NSString *)key {
|
||||
if (![self isEqual:NSBundle.mainBundle])
|
||||
return %orig;
|
||||
if ([key isEqualToString:@"CFBundleIdentifier"])
|
||||
return YT_BUNDLE_ID;
|
||||
if ([key isEqualToString:@"CFBundleDisplayName"] || [key isEqualToString:@"CFBundleName"])
|
||||
return YT_NAME;
|
||||
return %orig;
|
||||
}
|
||||
%end
|
||||
%end
|
||||
|
|
|
|||
Loading…
Reference in a new issue