URL.yep_matchProfile

This commit is contained in:
nixzhu
2015-11-09 14:31:43 +08:00
parent 2d58695c80
commit e023ed8975
2 changed files with 27 additions and 7 deletions
+5 -7
View File
@@ -312,17 +312,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
private func handleUniversalLink(URL: NSURL) -> Bool {
let matchSharedFeed = URL.yep_matchSharedFeed({ feed in
return URL.yep_matchSharedFeed({ feed in
println("matchSharedFeed: \(feed)")
}) || URL.yep_matchProfile({
println("matchProfile")
})
if !matchSharedFeed {
}
return true
/*
guard let host = URL.host else {
return false
+22
View File
@@ -51,5 +51,27 @@ extension NSURL {
return false
}
// make sure put it in last
func yep_matchProfile(completion: () -> Void) -> Bool {
guard let host = host where host == yepHost else {
return false
}
guard let pathComponents = pathComponents else {
return false
}
if let username = safeFindElement(pathComponents, index: 1) {
completion()
return true
}
return false
}
}