Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
GMRouter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMRouter
Commits
aa800b9b
Commit
aa800b9b
authored
Jan 03, 2020
by
乔金柱
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ly/master' into 'master'
优化GMRouter See merge request
!1
parents
690f4542
51e19d12
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
GMRouter+gm.m
GMRouter/Classes/GMRouter+gm.m
+11
-3
No files found.
GMRouter/Classes/GMRouter+gm.m
View file @
aa800b9b
...
@@ -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
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment