Vkontakte-iOS-SDK icon indicating copy to clipboard operation
Vkontakte-iOS-SDK copied to clipboard

Blocked Controls in Authorization View

Open rsv91 opened this issue 11 years ago • 2 comments

When clicked on other links, except login or cancel, in authorization form - controls blocked by activity indicator.

rsv91 avatar Mar 14 '13 13:03 rsv91

You can change container view for your _hud to _webView, so cancel button will be acceptable for user. I use this method:

  • (void)webViewDidStartLoad:(UIWebView *)webView { [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; _hud = [[MBProgressHUD alloc] initWithView:_webView]; [_webView addSubview:_hud]; _hud.dimBackground = YES; _hud.delegate = self; [_hud show:YES]; } I know, that this code doesn't solve the problem, but it makes this situation avoidable for user.

Akhrameev avatar Apr 03 '13 20:04 Akhrameev

  • (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    NSURL *URL = [request URL]; if ([[URL absoluteString] isEqualToString:@"http://api.vk.com/blank.html#error=access_denied&error_reason=user_denied&error_description=User%20denied%20your%20request"]) { if (self.delegate && [self.delegate respondsToSelector:@selector(authorizationDidCanceled)]) { [self.delegate authorizationDidCanceled]; } return NO; } NSString *const vkPagePrefix = @"http://vk.com"; NSString *const vkPageMobilePrefix = @"http://m.vk.com"; NSString *const vkPageMobileSettingsPrefix = @"http://m.vk.com/settings?act=change_regional&"; NSString *const iTunesPagePrefix = @"http://itunes.apple.com"; if ([[URL absoluteString] length] >= [vkPagePrefix length] && [[[URL absoluteString] substringWithRange: NSMakeRange(0, [vkPagePrefix length])] isEqualToString:vkPagePrefix]) return NO; if ([[URL absoluteString] length] >= [vkPageMobilePrefix length] && [[[URL absoluteString] substringWithRange: NSMakeRange(0, [vkPageMobilePrefix length])] isEqualToString:vkPageMobilePrefix]) { if ([[URL absoluteString] length] >= [vkPageMobileSettingsPrefix length] && [[[URL absoluteString] substringWithRange: NSMakeRange(0, [vkPageMobileSettingsPrefix length])] isEqualToString:vkPageMobileSettingsPrefix]) return YES; return NO; } if ([[[URL absoluteString] substringWithRange: NSMakeRange(0, [iTunesPagePrefix length])] isEqualToString:iTunesPagePrefix]) return NO; NSLog(@"Request: %@", [URL absoluteString]); return YES; }

Now user can only change language from suggested by default and click "Login" or "Cancel". All settings page, mobile and full version of site, itunes and app page are blocked.

Akhrameev avatar Apr 05 '13 15:04 Akhrameev