mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Fix crashes
This commit is contained in:
@@ -99,10 +99,11 @@ struct OpenURLHandler {
|
||||
Windows.main.open()
|
||||
#endif
|
||||
|
||||
player.videoBeingOpened = Video(app: accounts.current.app!, videoID: id)
|
||||
let video = Video(app: accounts.current.app!, videoID: id)
|
||||
player.videoBeingOpened = video
|
||||
|
||||
player
|
||||
.playerAPI(player.videoBeingOpened!)
|
||||
.playerAPI(video)?
|
||||
.video(id)
|
||||
.load()
|
||||
.onSuccess { response in
|
||||
|
@@ -40,7 +40,9 @@ struct WatchView: View {
|
||||
if finished, let watch {
|
||||
PlayerModel.shared.removeWatch(watch)
|
||||
} else {
|
||||
Watch.markAsWatched(videoID: watch?.videoID ?? videoID, account: AccountsModel.shared.current, duration: watch?.videoDuration ?? duration, context: backgroundContext)
|
||||
if let account = AccountsModel.shared.current {
|
||||
Watch.markAsWatched(videoID: watch?.videoID ?? videoID, account: account, duration: watch?.videoDuration ?? duration, context: backgroundContext)
|
||||
}
|
||||
}
|
||||
|
||||
FeedModel.shared.calculateUnwatchedFeed()
|
||||
|
@@ -47,7 +47,7 @@ struct ShareButton<LabelView: View>: View {
|
||||
private var instanceActions: some View {
|
||||
Group {
|
||||
Button(labelForShareURL(accounts.app.name)) {
|
||||
if let url = player.playerAPI(contentItem.video).shareURL(contentItem) {
|
||||
if let url = player.playerAPI(contentItem.video)?.shareURL(contentItem) {
|
||||
shareAction(url)
|
||||
} else {
|
||||
navigation.presentAlert(
|
||||
@@ -59,12 +59,16 @@ struct ShareButton<LabelView: View>: View {
|
||||
|
||||
if contentItemIsPlayerCurrentVideo {
|
||||
Button(labelForShareURL(accounts.app.name, withTime: true)) {
|
||||
shareAction(
|
||||
player.playerAPI(player.currentVideo!).shareURL(
|
||||
contentItem,
|
||||
time: player.backend.currentTime
|
||||
)!
|
||||
)
|
||||
if let video = player.videoForDisplay,
|
||||
let api = player.playerAPI(video)
|
||||
{
|
||||
shareAction(
|
||||
api.shareURL(
|
||||
contentItem,
|
||||
time: player.backend.currentTime
|
||||
)!
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,7 +97,7 @@ struct ShareButton<LabelView: View>: View {
|
||||
}
|
||||
|
||||
private var contentItemIsPlayerCurrentVideo: Bool {
|
||||
contentItem.contentType == .video && contentItem.video?.videoID == player.currentVideo?.videoID
|
||||
contentItem.contentType == .video && contentItem.video?.videoID == player.videoForDisplay?.videoID
|
||||
}
|
||||
|
||||
@ViewBuilder private var remoteURLAction: some View {
|
||||
|
Reference in New Issue
Block a user