Add share extension, rework bookmarks model

This commit is contained in:
Arkadiusz Fal
2022-11-11 12:27:37 +01:00
parent 973596f56c
commit 38454720de
13 changed files with 339 additions and 121 deletions

View File

@@ -10,7 +10,7 @@ struct URLParser {
]
enum Destination {
case video, playlist, channel, search
case fileURL, video, playlist, channel, search
case favorites, subscriptions, popular, trending
}
@@ -48,7 +48,7 @@ struct URLParser {
return .channel
}
return nil
return .fileURL
}
return .video
@@ -64,6 +64,11 @@ struct URLParser {
path.hasPrefix(Self.shortsPrefix)
}
var fileURL: URL? {
guard destination == .fileURL else { return nil }
return url
}
var videoID: String? {
if host == "youtu.be", !path.isEmpty {
return String(path.suffix(from: path.index(path.startIndex, offsetBy: 1)))