Minor fixes

This commit is contained in:
Arkadiusz Fal 2022-12-18 13:39:39 +01:00
parent ba1ec7c559
commit af85c67163
7 changed files with 17 additions and 6 deletions

View File

@ -464,6 +464,7 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
instanceID: account.instanceID, instanceID: account.instanceID,
app: .invidious, app: .invidious,
instanceURL: account.instance.apiURL, instanceURL: account.instance.apiURL,
id: id,
videoID: videoID, videoID: videoID,
title: json["title"].stringValue, title: json["title"].stringValue,
author: json["author"].stringValue, author: json["author"].stringValue,

View File

@ -217,7 +217,15 @@ struct Video: Identifiable, Equatable, Hashable {
} }
var publishedDate: String? { var publishedDate: String? {
(published.isEmpty || published == "0 seconds ago") ? publishedAt?.timeIntervalSince1970.formattedAsRelativeTime() : published guard let publishedAt else {
return (published.isEmpty || published == "0 seconds ago") ? nil : published
}
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .short
dateFormatter.timeStyle = .none
return dateFormatter.string(from: publishedAt)
} }
var viewsCount: String? { var viewsCount: String? {

View File

@ -2,7 +2,7 @@ import SwiftUI
struct NoDocumentsView: View { struct NoDocumentsView: View {
var body: some View { var body: some View {
VStack(alignment: .center, spacing: 20) { VStack(spacing: 20) {
HStack { HStack {
Image(systemName: "doc") Image(systemName: "doc")
Text("No documents") Text("No documents")

View File

@ -101,7 +101,9 @@ struct OpenURLHandler {
player.videoBeingOpened = Video(app: accounts.current.app!, videoID: id) player.videoBeingOpened = Video(app: accounts.current.app!, videoID: id)
player.playerAPI(player.videoBeingOpened!).video(id) player
.playerAPI(player.videoBeingOpened!)
.video(id)
.load() .load()
.onSuccess { response in .onSuccess { response in
if let video: Video = response.typedContent() { if let video: Video = response.typedContent() {

View File

@ -5,7 +5,7 @@ struct NoCommentsView: View {
var systemImage: String var systemImage: String
var body: some View { var body: some View {
VStack(alignment: .center, spacing: 10) { VStack(spacing: 10) {
Image(systemName: systemImage) Image(systemName: systemImage)
.font(.system(size: 36)) .font(.system(size: 36))

View File

@ -55,7 +55,7 @@ struct VideoDescription: View {
Button { Button {
NavigationModel.shared.openSearchQuery(keyword) NavigationModel.shared.openSearchQuery(keyword)
} label: { } label: {
HStack(alignment: .center, spacing: 0) { HStack(spacing: 0) {
Text("#") Text("#")
.font(.system(size: 14).bold()) .font(.system(size: 14).bold())

View File

@ -120,7 +120,7 @@ struct VideoDetails: View {
descriptionVisibility = true descriptionVisibility = true
return return
} }
Delay.by(0.3) { withAnimation(.easeOut(duration: 0.2)) { self.descriptionVisibility = true } } Delay.by(0.4) { withAnimation(.easeIn(duration: 0.25)) { self.descriptionVisibility = true } }
} }
#endif #endif
.transition(.opacity) .transition(.opacity)