Skip to content

Commit

Permalink
Resolve some todos (jellyfin#1295)
Browse files Browse the repository at this point in the history
* Partially resolve color todo

* Update localizations for quick connect steps. use bulleted list

* Same change for tvos

* Remove padding2 modifier

* Localisation
  • Loading branch information
chickdan authored Oct 29, 2024
1 parent 56fa032 commit fed9c65
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 70 deletions.
7 changes: 2 additions & 5 deletions Shared/Extensions/Color.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@

import SwiftUI

// TODO: add all other missing colors from UIColor and fix usages
// - move row dividers to divider color

extension Color {

static let jellyfinPurple = Color(uiColor: .jellyfinPurple)
static let jellyfinPurple = Color(red: 172 / 255, green: 92 / 255, blue: 195 / 255, opacity: 1)

var uiColor: UIColor {
UIColor(self)
}

var overlayColor: Color {
Color(uiColor: uiColor.overlayColor)
Color(uiColor: uiColor.overlayColor) // TODO: move from UIColor
}

// TODO: Correct and add colors
Expand Down
9 changes: 4 additions & 5 deletions Shared/Extensions/JellyfinAPI/ItemFilter+ItemTrait.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ extension ItemTrait: ItemFilter {
}

extension ItemTrait: Displayable {
// TODO: Localize
var displayTitle: String {
switch self {
case .isUnplayed:
return "Unplayed"
return L10n.unplayed
case .isPlayed:
return "Played"
return L10n.played
case .isFavorite:
return "Favorites"
return L10n.favorites
case .likes:
return "Liked Items"
return L10n.likedItems
default:
return ""
}
Expand Down
3 changes: 0 additions & 3 deletions Shared/Extensions/UIColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import UIKit

extension UIColor {

static let jellyfinPurple = UIColor(red: 172 / 255, green: 92 / 255, blue: 195 / 255, alpha: 1)

var overlayColor: UIColor {
var red: CGFloat = 0
var green: CGFloat = 0
Expand Down
6 changes: 0 additions & 6 deletions Shared/Extensions/ViewExtensions/ViewExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,6 @@ extension View {
})
}

// TODO: remove
@inlinable
func padding2(_ edges: Edge.Set = .all) -> some View {
padding(edges).padding(edges)
}

func scrollViewOffset(_ scrollViewOffset: Binding<CGFloat>) -> some View {
modifier(ScrollViewOffsetModifier(scrollViewOffset: scrollViewOffset))
}
Expand Down
14 changes: 8 additions & 6 deletions Shared/Strings/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ internal enum L10n {
internal static let library = L10n.tr("Localizable", "library", fallback: "Library")
/// Represents the light theme setting
internal static let light = L10n.tr("Localizable", "light", fallback: "Light")
/// Liked Items
internal static let likedItems = L10n.tr("Localizable", "likedItems", fallback: "Liked Items")
/// List
internal static let list = L10n.tr("Localizable", "list", fallback: "List")
/// Live TV
Expand Down Expand Up @@ -658,12 +660,12 @@ internal enum L10n {
internal static let quickConnectInvalidError = L10n.tr("Localizable", "quickConnectInvalidError", fallback: "Invalid Quick Connect code")
/// Note: Quick Connect not enabled
internal static let quickConnectNotEnabled = L10n.tr("Localizable", "quickConnectNotEnabled", fallback: "Note: Quick Connect not enabled")
/// 1. Open the Jellyfin app on your phone or web browser and sign in with your account
internal static let quickConnectStep1 = L10n.tr("Localizable", "quickConnectStep1", fallback: "1. Open the Jellyfin app on your phone or web browser and sign in with your account")
/// 2. Open the user menu and go to the Quick Connect page
internal static let quickConnectStep2 = L10n.tr("Localizable", "quickConnectStep2", fallback: "2. Open the user menu and go to the Quick Connect page")
/// 3. Enter the following code:
internal static let quickConnectStep3 = L10n.tr("Localizable", "quickConnectStep3", fallback: "3. Enter the following code:")
/// Open the Jellyfin app on your phone or web browser and sign in with your account
internal static let quickConnectStep1 = L10n.tr("Localizable", "quickConnectStep1", fallback: "Open the Jellyfin app on your phone or web browser and sign in with your account")
/// Open the user menu and go to the Quick Connect page
internal static let quickConnectStep2 = L10n.tr("Localizable", "quickConnectStep2", fallback: "Open the user menu and go to the Quick Connect page")
/// Enter the following code:
internal static let quickConnectStep3 = L10n.tr("Localizable", "quickConnectStep3", fallback: "Enter the following code:")
/// Authorizing Quick Connect successful. Please continue on your other device.
internal static let quickConnectSuccessMessage = L10n.tr("Localizable", "quickConnectSuccessMessage", fallback: "Authorizing Quick Connect successful. Please continue on your other device.")
/// Random
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extension ItemView.AboutView {
content()
.eraseToAnyView()
}
.padding2()
.padding()
.frame(width: 700, height: 405)
}
.buttonStyle(.card)
Expand Down
2 changes: 1 addition & 1 deletion Swiftfin tvOS/Views/MediaSourceInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct MediaSourceInfoView: View {
}
}
}
.padding2(.horizontal)
.padding(.horizontal)
}
.frame(maxWidth: .infinity)
}
Expand Down
19 changes: 8 additions & 11 deletions Swiftfin tvOS/Views/QuickConnectView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,14 @@ struct QuickConnectView: View {

private func pollingView(code: String) -> some View {
VStack(alignment: .leading, spacing: 20) {

// TODO: change strings so that numbers are removed
// and use `BulletedList`
// - also probably rephrase/change steps

L10n.quickConnectStep1.text

L10n.quickConnectStep2.text

L10n.quickConnectStep3.text
.padding(.bottom)
BulletedList {
L10n.quickConnectStep1.text
.padding(.bottom)
L10n.quickConnectStep2.text
.padding(.bottom)
L10n.quickConnectStep3.text
.padding(.bottom)
}

Text(code)
.tracking(10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ extension LiveVideoPlayer {
Spacer()

Overlay.LiveBottomBarView()
.padding2()
.padding2()
.padding()
.padding()
.background {
LinearGradient(
stops: [
Expand Down
8 changes: 4 additions & 4 deletions Swiftfin tvOS/Views/VideoPlayer/Overlays/ChapterOverlay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ extension VideoPlayer {

Spacer()
}
.padding2()
.padding2()
.padding()
.padding()

ScrollViewReader { proxy in
ScrollView(.horizontal) {
Expand Down Expand Up @@ -90,8 +90,8 @@ extension VideoPlayer {
}
}
}
.padding2()
.padding2(.horizontal)
.padding()
.padding(.horizontal)
}
.onChange(of: currentOverlayType) { _, newValue in
guard newValue == .chapters else { return }
Expand Down
4 changes: 2 additions & 2 deletions Swiftfin tvOS/Views/VideoPlayer/Overlays/MainOverlay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ extension VideoPlayer {
Spacer()

VideoPlayer.Overlay.BottomBarView()
.padding2()
.padding2()
.padding()
.padding()
.background {
LinearGradient(
stops: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "323b2ad9aaa9c000faf264d68272f0e9fab1349d9f910a0b95ee6aea10460f31",
"originHash" : "651194fc1966b57201a0de2cba27dc40798bbdf515febdc83f00d634d916fea4",
"pins" : [
{
"identity" : "blurhashkit",
Expand Down Expand Up @@ -132,8 +132,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/kean/Pulse",
"state" : {
"revision" : "d1e39ffaaa8b8becff80cb193c93a78e32077af8",
"version" : "4.2.0"
"revision" : "3ac5ee35ab233e900aa484919803d51791d1e351",
"version" : "4.2.7"
}
},
{
Expand Down
19 changes: 8 additions & 11 deletions Swiftfin/Views/QuickConnectView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@ struct QuickConnectView: View {

private func pollingView(code: String) -> some View {
VStack(alignment: .leading, spacing: 20) {

// TODO: change strings so that numbers are removed
// and use `BulletedList`
// - also probably rephrase/change steps

L10n.quickConnectStep1.text

L10n.quickConnectStep2.text

L10n.quickConnectStep3.text
.padding(.bottom)
BulletedList {
L10n.quickConnectStep1.text
.padding(.bottom)
L10n.quickConnectStep2.text
.padding(.bottom)
L10n.quickConnectStep3.text
.padding(.bottom)
}

Text(code)
.tracking(10)
Expand Down
6 changes: 2 additions & 4 deletions Swiftfin/Views/VideoPlayer/LiveOverlays/LiveMainOverlay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ extension LiveVideoPlayer {
.padding(.trailing, splitContentViewProxy.isPresentingSplitView ? 0 : safeAreaInsets.trailing)
}
.if(UIDevice.isPad) { view in
view.padding(.top)
.padding2(.horizontal)
view.padding()
}
.background {
LinearGradient(
Expand All @@ -68,8 +67,7 @@ extension LiveVideoPlayer {
.padding(.trailing, splitContentViewProxy.isPresentingSplitView ? 0 : safeAreaInsets.trailing)
}
.if(UIDevice.isPad) { view in
view.padding2(.bottom)
.padding2(.horizontal)
view.padding()
}
.background {
LinearGradient(
Expand Down
6 changes: 3 additions & 3 deletions Swiftfin/Views/VideoPlayer/Overlays/MainOverlay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension VideoPlayer {
}
.if(UIDevice.isPad) { view in
view.padding(.top)
.padding2(.horizontal)
.padding(.horizontal)
}
.background {
LinearGradient(
Expand All @@ -68,8 +68,8 @@ extension VideoPlayer {
.padding(.trailing, splitContentViewProxy.isPresentingSplitView ? 0 : safeAreaInsets.trailing)
}
.if(UIDevice.isPad) { view in
view.padding2(.bottom)
.padding2(.horizontal)
view.padding(.bottom)
.padding(.horizontal)
}
.background {
LinearGradient(
Expand Down
7 changes: 4 additions & 3 deletions Translations/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@
"quickConnectInvalidError" = "Invalid Quick Connect code";
"quickConnectSuccessMessage" = "Authorizing Quick Connect successful. Please continue on your other device.";
"showChaptersInfoInBottomOverlay" = "Show Chapters Info In Bottom Overlay";
"quickConnectStep1" = "1. Open the Jellyfin app on your phone or web browser and sign in with your account";
"quickConnectStep2" = "2. Open the user menu and go to the Quick Connect page";
"quickConnectStep3" = "3. Enter the following code:";
"quickConnectStep1" = "Open the Jellyfin app on your phone or web browser and sign in with your account";
"quickConnectStep2" = "Open the user menu and go to the Quick Connect page";
"quickConnectStep3" = "Enter the following code:";
"quickConnectNotEnabled" = "Note: Quick Connect not enabled";
"episodeNumber" = "Episode %1$@";
"compactPoster" = "Compact Poster";
Expand Down Expand Up @@ -278,6 +278,7 @@
"grid" = "Grid";
"list" = "List";
"logs" = "Logs";
"likedItems" = "Liked Items";

"onNow" = "On Now";
"sports" = "Sports";
Expand Down

0 comments on commit fed9c65

Please sign in to comment.