mirror of
https://github.com/yattee/yattee.git
synced 2026-08-06 07:11:28 +00:00
Fix timed links resuming at watch position instead of URL timestamp
Timed links arrive wrapped as yattee://open?url=... from the share extension, but the timestamp was parsed from the wrapper URL, where a single-? form like youtu.be/ID?t=N hides t inside the url query item. With no startTime the player fell back to saved watch progress. - Add URLRouter.unwrapped(_:) resolving the wrapper to the inner URL (raw remainder after ?url=, since the share extension does not encode & and URLComponents would drop &t= parts) and use it in handleDeepLink - Thread forceStartTime through openVideo/playPreferringDownloaded/play so explicit link timestamps beat the 90%-watched restart threshold, clamped to just before the end; resume flows keep the old behavior - Carry the parsed timestamp through OpenLinkSheet's play action, which dropped it entirely - Cover timestamp parsing and wrapper unwrapping in NavigationTests
This commit is contained in:
@@ -500,6 +500,9 @@ struct YatteeApp: App {
|
||||
/// Handle incoming deep link URLs.
|
||||
private func handleDeepLink(_ url: URL) {
|
||||
let router = URLRouter()
|
||||
// Resolve yattee://open?url=… wrappers first so timestamp parsing and
|
||||
// sheet prefill below see the real link, not the wrapper.
|
||||
let url = router.unwrapped(url)
|
||||
guard let destination = router.route(url) else { return }
|
||||
|
||||
let action = appEnvironment.settingsManager.defaultLinkAction
|
||||
@@ -671,7 +674,7 @@ struct YatteeApp: App {
|
||||
)
|
||||
LoggingService.shared.info("Deep link play: fetched video, opening player", category: .general)
|
||||
appEnvironment.toastManager.dismiss(id: toastID)
|
||||
appEnvironment.playerService.openVideo(video, startTime: startTime)
|
||||
appEnvironment.playerService.openVideo(video, startTime: startTime, forceStartTime: startTime != nil)
|
||||
} catch {
|
||||
LoggingService.shared.error(
|
||||
"Deep link play: video fetch failed (\(error.localizedDescription)), falling back to info view",
|
||||
|
||||
Reference in New Issue
Block a user