mirror of
https://github.com/yattee/yattee.git
synced 2025-08-04 01:34:10 +00:00
Initial PeerTube Support
This commit is contained in:
@@ -34,7 +34,6 @@ struct HistoryView: View {
|
||||
.onAppear {
|
||||
visibleWatches
|
||||
.prefix(Self.detailsPreloadLimit)
|
||||
.map(\.videoID)
|
||||
.forEach(player.loadHistoryVideoDetails)
|
||||
}
|
||||
#if os(tvOS)
|
||||
|
@@ -82,7 +82,7 @@ struct AppSidebarNavigation: View {
|
||||
.help(
|
||||
"Switch Instances and Accounts\n" +
|
||||
"Current Instance: \n" +
|
||||
"\(accounts.current?.url ?? "Not Set")\n" +
|
||||
"\(accounts.current?.urlString ?? "Not Set")\n" +
|
||||
"Current User: \(accounts.current?.description ?? "Not set")"
|
||||
)
|
||||
}
|
||||
|
@@ -113,9 +113,9 @@ struct OpenURLHandler {
|
||||
Windows.main.open()
|
||||
#endif
|
||||
|
||||
player.videoBeingOpened = Video(videoID: id)
|
||||
player.videoBeingOpened = Video(app: accounts.current.app!, videoID: id)
|
||||
|
||||
player.playerAPI.video(id)
|
||||
player.playerAPI(player.videoBeingOpened!).video(id)
|
||||
.load()
|
||||
.onSuccess { response in
|
||||
if let video: Video = response.typedContent() {
|
||||
|
@@ -58,7 +58,7 @@ struct SearchView: View {
|
||||
VStack {
|
||||
SearchTextField(favoriteItem: $favoriteItem)
|
||||
|
||||
if state.query.query != state.queryText {
|
||||
if accounts.app.supportsSearchSuggestions, state.query.query != state.queryText {
|
||||
SearchSuggestions()
|
||||
.opacity(state.queryText.isEmpty ? 0 : 1)
|
||||
} else {
|
||||
@@ -72,7 +72,7 @@ struct SearchView: View {
|
||||
results
|
||||
|
||||
#if os(macOS)
|
||||
if state.query.query != state.queryText {
|
||||
if accounts.app.supportsSearchSuggestions, state.query.query != state.queryText {
|
||||
HStack {
|
||||
Spacer()
|
||||
SearchSuggestions()
|
||||
@@ -122,6 +122,9 @@ struct SearchView: View {
|
||||
state.store.replace(ContentItem.array(of: videos))
|
||||
}
|
||||
}
|
||||
.onChange(of: accounts.current) { _ in
|
||||
state.reloadQuery()
|
||||
}
|
||||
.onChange(of: state.queryText) { newQuery in
|
||||
if newQuery.isEmpty {
|
||||
favoriteItem = nil
|
||||
|
@@ -143,8 +143,8 @@ struct AccountForm: View {
|
||||
private var validator: AccountValidator {
|
||||
AccountValidator(
|
||||
app: .constant(instance.app),
|
||||
url: instance.apiURL,
|
||||
account: Account(instanceID: instance.id, url: instance.apiURL, username: username, password: password),
|
||||
url: instance.apiURLString,
|
||||
account: Account(instanceID: instance.id, urlString: instance.apiURLString, username: username, password: password),
|
||||
id: $username,
|
||||
isValid: $isValid,
|
||||
isValidated: $isValidated,
|
||||
|
@@ -100,7 +100,7 @@ struct LocationsSettings: View {
|
||||
@ViewBuilder var countryFooter: some View {
|
||||
if let account = accounts.current {
|
||||
let locationType = account.isPublic ? (account.country ?? "Unknown") : "Custom".localized()
|
||||
let description = account.isPublic ? account.url : account.instance?.description ?? "unknown".localized()
|
||||
let description = account.isPublic ? account.urlString : account.instance?.description ?? "unknown".localized()
|
||||
|
||||
Text("Current: \(locationType)\n\(description)")
|
||||
.foregroundColor(.secondary)
|
||||
|
@@ -14,7 +14,7 @@ struct VideoCell: View {
|
||||
@Environment(\.verticalSizeClass) private var verticalSizeClass
|
||||
#endif
|
||||
|
||||
@ObservedObject var thumbnails = ThumbnailsModel.shared
|
||||
@ObservedObject private var thumbnails = ThumbnailsModel.shared
|
||||
|
||||
@Default(.channelOnThumbnail) private var channelOnThumbnail
|
||||
@Default(.timeOnThumbnail) private var timeOnThumbnail
|
||||
|
@@ -20,6 +20,7 @@ struct ShareButton<LabelView: View>: View {
|
||||
}
|
||||
|
||||
@ViewBuilder var body: some View {
|
||||
// TODO: this should work with other content item types
|
||||
if let video = contentItem.video, !video.localStreamIsFile {
|
||||
Menu {
|
||||
if video.localStreamIsRemoteURL {
|
||||
@@ -44,7 +45,7 @@ struct ShareButton<LabelView: View>: View {
|
||||
private var instanceActions: some View {
|
||||
Group {
|
||||
Button(labelForShareURL(accounts.app.name)) {
|
||||
if let url = player.playerAPI.shareURL(contentItem) {
|
||||
if let url = player.playerAPI(contentItem.video).shareURL(contentItem) {
|
||||
shareAction(url)
|
||||
} else {
|
||||
navigation.presentAlert(
|
||||
@@ -57,7 +58,7 @@ struct ShareButton<LabelView: View>: View {
|
||||
if contentItemIsPlayerCurrentVideo {
|
||||
Button(labelForShareURL(accounts.app.name, withTime: true)) {
|
||||
shareAction(
|
||||
player.playerAPI.shareURL(
|
||||
player.playerAPI(player.currentVideo!).shareURL(
|
||||
contentItem,
|
||||
time: player.backend.currentTime
|
||||
)!
|
||||
|
@@ -148,7 +148,7 @@ struct VideoContextMenuView: View {
|
||||
|
||||
var markAsWatchedButton: some View {
|
||||
Button {
|
||||
Watch.markAsWatched(videoID: video.videoID, duration: video.length, context: backgroundContext)
|
||||
Watch.markAsWatched(videoID: video.videoID, account: accounts.current, duration: video.length, context: backgroundContext)
|
||||
} label: {
|
||||
Label("Mark as watched", systemImage: "checkmark.circle.fill")
|
||||
}
|
||||
|
Reference in New Issue
Block a user