KyPass 2.4 was rejected by Apple! (part 4)

Last week, I have installed Google Play Books on my iPhone.

This application doesn’t have the signup link!

I don’t think that Google remove link as I do. Thus, I have installed Charles Proxy to spy the https connection between my iPhone and my Mac.
And bing! Google Play Books doesn’t use the official link to display the logon screen. They add ltmpl=nosignup as parameter in the ServiceLogin url to hide automatically the sign-up button.

This method is cleaner that my previous hack in DriveAPI.

I’ve thus modified my code with this:

A few line of code in the shouldStartLoadWithRequest function in the file GTMOAuth2ViewControllerTouch.m

- (BOOL)webView:(UIWebView *)webView
  shouldStartLoadWithRequest:(NSURLRequest *)request
              navigationType:(UIWebViewNavigationType)navigationType {
    
    if ([[[request URL] lastPathComponent] isEqualToString:@"ServiceLogin"]) {
        NSRange textRange = [[[request URL] absoluteString] rangeOfString:@"ltmpl=nosignup"];
        if (textRange.location == NSNotFound) {
            NSString *URLString = [[[request URL] absoluteString] stringByReplacingOccurrencesOfString:@"ServiceLogin?"
                                                                                            withString:@"ServiceLogin?ltmpl=nosignup&"];
            
            NSMutableURLRequest *newRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:URLString]];
            [webView loadRequest:newRequest];
            
            return NO;
        }
    }
[...]

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.