Commit aa800b9b authored by 乔金柱's avatar 乔金柱

Merge branch 'ly/master' into 'master'

优化GMRouter

See merge request !1
parents 690f4542 51e19d12
...@@ -143,9 +143,10 @@ static NSMutableDictionary *routeMap = nil; ...@@ -143,9 +143,10 @@ static NSMutableDictionary *routeMap = nil;
NSArray *array = [encodeUrlScheme componentsSeparatedByString:@"url="]; NSArray *array = [encodeUrlScheme componentsSeparatedByString:@"url="];
if (([host isEqualToString:@"third_webview"] || [host isEqualToString:@"common_webview"]) && array.count > 1) { if (([host isEqualToString:@"third_webview"] || [host isEqualToString:@"common_webview"]) && array.count > 1) {
NSString *value = array[1]; NSString *value = array[1];
//拦截所有的即将调转的url(value),如果不在白名单之中,让其使用GMThirdWebViewController加载. //拦截所有的即将调转的url(value),如果不在白名单之中,让其使用GMThirdWebViewController加载. 必须要用while 因为url部分包含 %3A gengmei://common_webview?url=http%3A//backend.paas.env/hybrid/base_wiki/item/285
NSString *valueHost = [[NSURL URLWithString:value] host];
if ([value rangeOfString:@"%"].length != 0) {
while ([value rangeOfString:@"%"].length != 0) {
value = [self URLDecodedString:value]; value = [self URLDecodedString:value];
} }
params = @{@"url":value}; params = @{@"url":value};
...@@ -159,6 +160,9 @@ static NSMutableDictionary *routeMap = nil; ...@@ -159,6 +160,9 @@ static NSMutableDictionary *routeMap = nil;
NSArray *array = [encodeUrlScheme componentsSeparatedByString:@"url="]; NSArray *array = [encodeUrlScheme componentsSeparatedByString:@"url="];
if (([host isEqualToString:@"third_webview"] || [host isEqualToString:@"common_webview"]) && array.count > 1) { if (([host isEqualToString:@"third_webview"] || [host isEqualToString:@"common_webview"]) && array.count > 1) {
NSString *value = array[1]; NSString *value = array[1];
while ([value rangeOfString:@"%"].length != 0) {
value = [ self URLDecodedString:value];
}
//拦截所有的即将调转的url(value),如果不在白名单之中,让其使用GMThirdWebViewController加载. //拦截所有的即将调转的url(value),如果不在白名单之中,让其使用GMThirdWebViewController加载.
NSString *valueHost = [[NSURL URLWithString:value] host]; NSString *valueHost = [[NSURL URLWithString:value] host];
Class cls = NSClassFromString(@"GMServerDomains"); Class cls = NSClassFromString(@"GMServerDomains");
...@@ -172,6 +176,8 @@ static NSMutableDictionary *routeMap = nil; ...@@ -172,6 +176,8 @@ static NSMutableDictionary *routeMap = nil;
return host; return host;
} }
//-(void)
- (id)pushScheme:(NSString *)urlScheme params:(NSDictionary *)params { - (id)pushScheme:(NSString *)urlScheme params:(NSDictionary *)params {
NSString *encodeUrlScheme = [self URLEncodeString:urlScheme]; NSString *encodeUrlScheme = [self URLEncodeString:urlScheme];
NSURL *url = [NSURL URLWithString:encodeUrlScheme]; NSURL *url = [NSURL URLWithString:encodeUrlScheme];
...@@ -195,6 +201,8 @@ static NSMutableDictionary *routeMap = nil; ...@@ -195,6 +201,8 @@ static NSMutableDictionary *routeMap = nil;
return [self queryToDictionary:query]; return [self queryToDictionary:query];
} }
- (NSDictionary*)queryToDictionary:(NSString *)query { - (NSDictionary*)queryToDictionary:(NSString *)query {
@try { @try {
NSMutableDictionary* dict = [NSMutableDictionary dictionary]; NSMutableDictionary* dict = [NSMutableDictionary dictionary];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment