Skip to content

Commit

Permalink
Merge branch 'jellyfin:main' into tvOSTabConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
JPKribs authored Aug 22, 2024
2 parents 6e23d9b + 556696b commit 6d96117
Show file tree
Hide file tree
Showing 20 changed files with 73 additions and 32 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/testflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ jobs:
if: ${{ github.event.client_payload.hasCheckoutCommit }}
run: |
git checkout ${{ github.event.client_payload.commitSHA }}
- run: 'echo "$SSH_KEY" > key'
shell: bash
env:
SSH_KEY: ${{secrets.P12_PASSWORD}}
- name: Install SwiftGen
run: brew install swiftgen

- name: Update Carthage
run: carthage update --use-xcframeworks --cache-builds

- name: Install the Apple certificate and provisioning profile
env:
Expand Down
2 changes: 1 addition & 1 deletion Shared/Services/SwiftfinDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ extension Defaults.Keys {

enum VideoPlayer {

static let appMaximumBitrate: Key<PlaybackBitrate> = UserKey("appMaximumBitrate", default: .auto)
static let appMaximumBitrate: Key<PlaybackBitrate> = UserKey("appMaximumBitrate", default: .max)
static let appMaximumBitrateTest: Key<PlaybackBitrateTestSize> = UserKey("appMaximumBitrateTest", default: .regular)
static let autoPlayEnabled: Key<Bool> = UserKey("autoPlayEnabled", default: true)
static let barActionButtons: Key<[VideoPlayerActionButton]> = UserKey(
Expand Down
24 changes: 24 additions & 0 deletions Shared/ViewModels/VideoPlayerManager/VideoPlayerManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//

import AVFoundation
import Combine
import Defaults
import Foundation
import JellyfinAPI
import MediaPlayer
import UIKit
import VLCUI

Expand Down Expand Up @@ -66,6 +68,14 @@ class VideoPlayerManager: ViewModel {
private var currentProgressWorkItem: DispatchWorkItem?
private var hasSentStart = false

private let commandCenter = MPRemoteCommandCenter.shared()

override init() {
super.init()

setupControlListeners()
}

func selectNextViewModel() {
guard let nextViewModel else { return }
currentViewModel = nextViewModel
Expand Down Expand Up @@ -285,4 +295,18 @@ class VideoPlayerManager: ViewModel {
logger.debug("sent progress task")
}
}

func setupControlListeners() {
commandCenter.pauseCommand.addTarget { [weak self] _ in
self?.proxy.pause()

return .success
}

commandCenter.playCommand.addTarget { [weak self] _ in
self?.proxy.play()

return .success
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,32 @@ import JellyfinAPI
import SwiftUI

extension SeriesEpisodeSelector {

struct EpisodeCard: View {

@EnvironmentObject
private var router: ItemCoordinator.Router

let episode: BaseItemDto

@FocusState
private var isFocused: Bool

@ViewBuilder
private var imageOverlay: some View {
ZStack {
if episode.userData?.isPlayed ?? false {
WatchedIndicator(size: 45)
} else {
if (episode.userData?.playbackPositionTicks ?? 0) > 0 {
LandscapePosterProgressBar(
title: episode.progressLabel ?? L10n.continue,
progress: (episode.userData?.playedPercentage ?? 0) / 100
)
}
} else if (episode.userData?.playbackPositionTicks ?? 0) > 0 {
LandscapePosterProgressBar(
title: episode.progressLabel ?? L10n.continue,
progress: (episode.userData?.playedPercentage ?? 0) / 100
)
}

if isFocused {
Image(systemName: "play.fill")
.resizable()
.frame(width: 50, height: 50)
.foregroundColor(.white)
}
}
}
Expand Down Expand Up @@ -64,6 +70,7 @@ extension SeriesEpisodeSelector {
}
.buttonStyle(.card)
.posterShadow()
.focused($isFocused)

SeriesEpisodeSelector.EpisodeContent(
subHeader: episode.episodeLocator ?? .emptyDash,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import JellyfinAPI
import SwiftUI

extension SeriesEpisodeSelector {

struct EpisodeContent: View {

@Default(.accentColor)
private var accentColor

Expand Down Expand Up @@ -60,6 +58,8 @@ extension SeriesEpisodeSelector {
headerView

contentView
// Removing the alignment below makes the text center
.frame(maxWidth: .infinity, alignment: .leading)

L10n.seeMore.text
.font(.caption.weight(.light))
Expand All @@ -73,7 +73,6 @@ extension SeriesEpisodeSelector {
}

extension SeriesEpisodeSelector.EpisodeContent {

init(
subHeader: String,
header: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ extension SeriesEpisodeSelector {
guard let newValue else { return }
lastFocusedEpisodeID = newValue
}
.onChange(of: viewModel.state) { _, newValue in
if newValue == .content {
lastFocusedEpisodeID = viewModel.elements.first?.id
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Swiftfin/App/SwiftfinApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct SwiftfinApp: App {
// - atow, background video playback isn't officially supported
let backgroundedInterval = Date.now.timeIntervalSince(Defaults[.backgroundTimeStamp])

if backgroundedInterval > Defaults[.backgroundSignOutInterval] {
if Defaults[.signOutOnBackground], backgroundedInterval > Defaults[.backgroundSignOutInterval] {
Defaults[.lastSignedInUserID] = nil
Container.shared.currentUserSession.reset()
Notifications[.didSignOut].post()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ extension SettingsView {
} label: {
HStack {

// TODO: check properly with non-uniform images and look for workaround
// Note: for an unknown reason, using a non uniform aspect ratio will cause a
// "view origin is invalid" crash within SwiftUI
imageView
.aspectRatio(1, contentMode: .fill)
.clipShape(.circle)
.frame(width: 50, height: 50)
// `.aspectRatio(contentMode: .fill)` on `imageView` alone
// causes a crash on some iOS versions
ZStack {
imageView
}
.aspectRatio(1, contentMode: .fill)
.clipShape(.circle)
.frame(width: 50, height: 50)

Text(userSession.user.username)
.fontWeight(.semibold)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ struct UserProfileSettingsView: View {
isPresentingProfileImageOptions = true
} label: {
ZStack(alignment: .bottomTrailing) {
imageView
.aspectRatio(contentMode: .fill)
.clipShape(.circle)
.frame(width: 150, height: 150)
.shadow(radius: 5)
// `.aspectRatio(contentMode: .fill)` on `imageView` alone
// causes a crash on some iOS versions
ZStack {
imageView
}
.aspectRatio(1, contentMode: .fill)
.clipShape(.circle)
.frame(width: 150, height: 150)
.shadow(radius: 5)

Image(systemName: "pencil.circle.fill")
.resizable()
Expand Down
Binary file modified Translations/ar.lproj/Localizable.strings
Binary file not shown.
Binary file modified Translations/ca.lproj/Localizable.strings
Binary file not shown.
Binary file modified Translations/de.lproj/Localizable.strings
Binary file not shown.
Binary file modified Translations/es.lproj/Localizable.strings
Binary file not shown.
Binary file modified Translations/fr.lproj/Localizable.strings
Binary file not shown.
Binary file modified Translations/hi.lproj/Localizable.strings
Binary file not shown.
Binary file modified Translations/hu.lproj/Localizable.strings
Binary file not shown.
Binary file modified Translations/it.lproj/Localizable.strings
Binary file not shown.
Binary file modified Translations/nl.lproj/Localizable.strings
Binary file not shown.
2 changes: 1 addition & 1 deletion fastlane/Fastfile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class Fastfile: LaneFile {
)

uploadToTestflight(
ipa: "Swiftfin.ipa"
ipa: "Swiftfin iOS.ipa"
)
}

Expand Down
Binary file added fastlane/FastlaneRunner
Binary file not shown.

0 comments on commit 6d96117

Please sign in to comment.