Commit 8f0b8afd authored by jz's avatar jz

update

parent 5b08c241
...@@ -43,27 +43,24 @@ static NSMutableDictionary *routeMap = nil; ...@@ -43,27 +43,24 @@ static NSMutableDictionary *routeMap = nil;
} }
- (id)pushScheme:(NSString *)urlScheme completeBlock:(GMRouterBlock)routerBlock { - (id)pushScheme:(NSString *)urlScheme completeBlock:(GMRouterBlock)routerBlock {
NSString *encodeUrlScheme; if (![urlScheme hasPrefix:GMRouterProtocolPrefix]) {
if ([encodeUrlScheme hasPrefix:GMRouterProtocolPrefix]) { urlScheme = [NSString stringWithFormat:@"%@%@", GMRouterProtocolPrefix ,urlScheme];
encodeUrlScheme = [self URLEncodeString:urlScheme];
} else {
encodeUrlScheme = [NSString stringWithFormat:@"%@%@", GMRouterProtocolPrefix ,urlScheme];
} }
if (!urlScheme.length) { return nil; }
NSString *encodeUrlScheme = [self URLEncodeString:urlScheme];
NSDictionary *params = [self getParams:encodeUrlScheme]; NSDictionary *params = [self getParams:encodeUrlScheme];
return [self pushScheme:urlScheme params:params completeBlock:routerBlock]; return [self pushScheme:encodeUrlScheme params:params completeBlock:routerBlock];
} }
- (id)pushScheme:(NSString *)urlScheme params:(NSDictionary *)params completeBlock:(GMRouterBlock)routerBlock { - (id)pushScheme:(NSString *)urlScheme params:(NSDictionary *)params completeBlock:(GMRouterBlock)routerBlock {
NSMutableDictionary *allParams = [NSMutableDictionary dictionaryWithDictionary:params]; NSMutableDictionary *allParams = [NSMutableDictionary dictionaryWithDictionary:params];
NSString *encodeUrlScheme = [self URLEncodeString:urlScheme]; NSString *encodeUrlScheme = [self URLEncodeString:urlScheme];
NSString *host = [self getHost:urlScheme]; NSString *host = [self getHost:urlScheme];
NSString *targetName = [routeMap objectForKey:host]; NSString *targetName = [routeMap objectForKey:host];
NSDictionary *paramsDict = [self getParams:encodeUrlScheme]; NSDictionary *paramsDict = [self getParams:encodeUrlScheme];
[allParams addEntriesFromDictionary:paramsDict]; [allParams addEntriesFromDictionary:paramsDict];
host = [self safeHostWithEncodeUrlScheme:encodeUrlScheme host:host]; host = [self safeHostWithEncodeUrlScheme:encodeUrlScheme host:host];
id vc = [self performTarget:targetName action:host params:params shouldCacheTarget:NO]; id vc = [self performTarget:targetName action:host params:params shouldCacheTarget:NO];
//如果是push 过来的 或者需要回调的在此赋值 //如果是push 过来的 或者需要回调的在此赋值
......
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