fix Google sign in, again. Thanks to @AhmedBafkir and @kkirby - https://gist.github.com/AhmedBafkir/0c16b806b3fb233995aa01b93da44f93

This commit is contained in:
qnblackcat
2022-09-20 18:16:35 +07:00
parent 5741ae5584
commit e6835b9e33
2 changed files with 28 additions and 6 deletions
-2
View File
@@ -62,7 +62,6 @@ extern BOOL replacePreviousAndNextButton();
return YES;
};
/*
YTSettingsSectionItem *fixGoogleSigin = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"FIX_GOOGLE_SIGNIN") titleDescription:LOC(@"FIX_GOOGLE_SIGNIN_DESC")];
fixGoogleSigin.hasSwitch = YES;
fixGoogleSigin.switchVisible = YES;
@@ -71,7 +70,6 @@ extern BOOL replacePreviousAndNextButton();
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"fixGoogleSigin_enabled"];
return YES;
};
*/
YTSettingsSectionItem *hidePaidPromotionCard = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"HIDE_PAID_PROMOTION_CARDS") titleDescription:LOC(@"HIDE_PAID_PROMOTION_CARDS_DESC")];
hidePaidPromotionCard.hasSwitch = YES;
+28 -4
View File
@@ -49,6 +49,7 @@ static NSString *accessGroupID() {
return accessGroup;
}
//
BOOL hideHUD() {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"];
}
@@ -482,6 +483,30 @@ BOOL replacePreviousAndNextButton() {
}
%end
// Fix "Google couldn't confirm this attempt to sign in is safe. If you think this is a mistake, you can close and try again to sign in" - qnblackcat/uYouPlus#420
// Thanks to @AhmedBafkir and @kkirby - https://github.com/qnblackcat/uYouPlus/discussions/447#discussioncomment-3672881
%group gFixGoogleSignIn
%hook SSORPCService
+ (id)URLFromURL:(id)arg1 withAdditionalFragmentParameters:(NSDictionary *)arg2 {
NSURL *orig = %orig;
NSURLComponents *urlComponents = [[NSURLComponents alloc] initWithURL:orig resolvingAgainstBaseURL:NO];
NSMutableArray *newQueryItems = [urlComponents.queryItems mutableCopy];
for (NSURLQueryItem *queryItem in urlComponents.queryItems) {
if ([queryItem.name isEqualToString:@"system_version"]
|| [queryItem.name isEqualToString:@"app_version"]
|| [queryItem.name isEqualToString:@"kdlc"]
|| [queryItem.name isEqualToString:@"kss"]
|| [queryItem.name isEqualToString:@"lib_ver"]
|| [queryItem.name isEqualToString:@"device_model"]) {
[newQueryItems removeObject:queryItem];
}
}
urlComponents.queryItems = [newQueryItems copy];
return urlComponents.URL;
}
%end
%end
// Fix "You can't sign in to this app because Google can't confirm that it's safe" warning when signing in. by julioverne & PoomSmart
// https://gist.github.com/PoomSmart/ef5b172fd4c5371764e027bea2613f93
// https://github.com/qnblackcat/uYouPlus/pull/398
@@ -508,7 +533,6 @@ BOOL replacePreviousAndNextButton() {
+ (NSString *)accessGroup {
return accessGroupID();
}
+ (NSString *)sharedAccessGroup {
return accessGroupID();
}
@@ -898,7 +922,7 @@ static void replaceTab(YTIGuideResponse *response) {
if (@available(iOS 16, *)) {
%init(iOS16);
}
// if (!fixGoogleSigin()) {
// %init(gDevice_challenge_request_hack);
// }
if (!fixGoogleSigin()) {
%init(gFixGoogleSignIn);
}
}