I need to intercept a URL and go outside the WebView
if the URL contains MAPS
or DOCUMENTS
constants. I must also go outside if url
does not contain the value of DOMAIN
and LOGIN_SALES_FORCE
.
This is working nice, but seems ugly for me. Any ideas?
if ([request.URL.absoluteString rangeOfString:MAPS ].location != NSNotFound ||
[request.URL.absoluteString rangeOfString:DOCUMENTS ].location != NSNotFound)
{
NSURL *url = [NSURL URLWithString:request.URL.absoluteString];
return [[UIApplication sharedApplication] openURL:url];
} else if ([request.URL.absoluteString rangeOfString:DOMINIO ].location == NSNotFound &&
[request.URL.absoluteString rangeOfString:LOGIN_SALES_FORCE ].location == NSNotFound) {
NSURL *url = [NSURL URLWithString:request.URL.absoluteString];
return [[UIApplication sharedApplication] openURL:url];
}