mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Fix url handling
This commit is contained in:
parent
7c24a86a6a
commit
9d2e6f117d
@ -14,6 +14,13 @@ struct OpenURLHandler {
|
|||||||
var navigationStyle: NavigationStyle
|
var navigationStyle: NavigationStyle
|
||||||
|
|
||||||
func handle(_ url: URL) {
|
func handle(_ url: URL) {
|
||||||
|
if Self.firstHandle {
|
||||||
|
Self.firstHandle = false
|
||||||
|
|
||||||
|
Delay.by(1) { handle(url) }
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if accounts.current.isNil {
|
if accounts.current.isNil {
|
||||||
accounts.setCurrent(accounts.any)
|
accounts.setCurrent(accounts.any)
|
||||||
}
|
}
|
||||||
@ -99,7 +106,8 @@ struct OpenURLHandler {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
let video = Video(app: accounts.current.app!, videoID: id)
|
let video = Video(app: accounts.current.app!, videoID: id)
|
||||||
player.videoBeingOpened = video
|
player.videoBeingOpened = .init(app: accounts.current.app!, videoID: id, title: "Loading video...")
|
||||||
|
player.show()
|
||||||
|
|
||||||
player
|
player
|
||||||
.playerAPI(video)?
|
.playerAPI(video)?
|
||||||
@ -108,8 +116,9 @@ struct OpenURLHandler {
|
|||||||
.onSuccess { response in
|
.onSuccess { response in
|
||||||
if let video: Video = response.typedContent() {
|
if let video: Video = response.typedContent() {
|
||||||
let time = parser.time.isNil ? nil : CMTime.secondsInDefaultTimescale(TimeInterval(parser.time!))
|
let time = parser.time.isNil ? nil : CMTime.secondsInDefaultTimescale(TimeInterval(parser.time!))
|
||||||
|
Delay.by(0.5) {
|
||||||
self.player.playNow(video, at: time)
|
self.player.playNow(video, at: time)
|
||||||
self.player.show()
|
}
|
||||||
} else {
|
} else {
|
||||||
navigation.presentAlert(title: "Error", message: "This video could not be opened")
|
navigation.presentAlert(title: "Error", message: "This video could not be opened")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user