Support read, search, and saved-search deep link formats

This commit is contained in:
Jackson Harper
2023-05-24 16:12:48 +08:00
parent bf8b0c0034
commit 8ba320e3d5
2 changed files with 23 additions and 5 deletions

View File

@ -11,6 +11,8 @@ public struct LinkRequest: Identifiable, Hashable {
}
public enum DeepLink {
case search(query: String)
case savedSearch(named: String)
case webAppLinkRequest(requestID: String)
}
@ -32,6 +34,13 @@ public extension DeepLink {
private static func deepLinkFromOmnivoreScheme(url: URL) -> DeepLink? {
switch url.host {
case "search":
let query = url.path.replacingOccurrences(of: "/", with: "")
return .search(query: query)
case "saved-search":
let named = url.path.replacingOccurrences(of: "/", with: "")
return .savedSearch(named: named)
case "read":
case "shareExtensionRequestID":
let requestID = url.path.replacingOccurrences(of: "/", with: "")
return .webAppLinkRequest(requestID: requestID)