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,
app: .invidious,
instanceURL: account.instance.apiURL,
id: id,
videoID: videoID,
title: json["title"].stringValue,
author: json["author"].stringValue,

View File

@ -217,7 +217,15 @@ struct Video: Identifiable, Equatable, Hashable {
}
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? {

View File

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

View File

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

View File

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

View File

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

View File

@ -120,7 +120,7 @@ struct VideoDetails: View {
descriptionVisibility = true
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
.transition(.opacity)