mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-03-11 17:15:32 +00:00
Rewrite Sign-In Patch
Sign-in patch now includes the system where it automatically turns off if app restarted “2” times, and if the app somehow crashes when using Sign-In Patch in the future, I made sure it turns off automatically if the app ever crashes. Sign-In Patch was never meant to always stay on.
This commit is contained in:
parent
96238f6130
commit
912c340ff3
1 changed files with 30 additions and 1 deletions
|
|
@ -6,12 +6,41 @@
|
||||||
%group gGoogleSignInPatch
|
%group gGoogleSignInPatch
|
||||||
%hook NSBundle
|
%hook NSBundle
|
||||||
- (NSDictionary *)infoDictionary {
|
- (NSDictionary *)infoDictionary {
|
||||||
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
BOOL patchEnabled = [defaults boolForKey:@"kGoogleSignInPatch"];
|
||||||
|
if (!patchEnabled) {
|
||||||
|
return %orig;
|
||||||
|
}
|
||||||
|
NSInteger restartCount = [defaults integerForKey:@"kGoogleSignInPatchRestartCount"];
|
||||||
|
if (restartCount >= 2) {
|
||||||
|
[defaults setBool:NO forKey:@"kGoogleSignInPatch"];
|
||||||
|
[defaults synchronize];
|
||||||
|
return %orig;
|
||||||
|
}
|
||||||
|
[defaults setInteger:restartCount + 1 forKey:@"kGoogleSignInPatchRestartCount"];
|
||||||
|
[defaults synchronize];
|
||||||
|
BOOL crashDetected = [defaults boolForKey:@"kGoogleSignInPatchCrashFlag"];
|
||||||
|
if (crashDetected) {
|
||||||
|
[defaults setBool:NO forKey:@"kGoogleSignInPatchCrashFlag"];
|
||||||
|
[defaults setBool:NO forKey:@"kGoogleSignInPatch"];
|
||||||
|
[defaults synchronize];
|
||||||
|
return %orig;
|
||||||
|
}
|
||||||
NSMutableDictionary *info = %orig.mutableCopy;
|
NSMutableDictionary *info = %orig.mutableCopy;
|
||||||
if ([self isEqual:NSBundle.mainBundle])
|
if ([self isEqual:NSBundle.mainBundle]) {
|
||||||
info[@"CFBundleIdentifier"] = @"com.google.ios.youtube";
|
info[@"CFBundleIdentifier"] = @"com.google.ios.youtube";
|
||||||
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
%hook NSException
|
||||||
|
+ (void)raise:(NSException *)exception {
|
||||||
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
[defaults setBool:YES forKey:@"kGoogleSignInPatchCrashFlag"];
|
||||||
|
[defaults synchronize];
|
||||||
|
%orig(exception);
|
||||||
|
}
|
||||||
|
%end
|
||||||
%end
|
%end
|
||||||
|
|
||||||
// Workaround for MiRO92/uYou-for-YouTube#12, qnblackcat/uYouPlus#263
|
// Workaround for MiRO92/uYou-for-YouTube#12, qnblackcat/uYouPlus#263
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue