[create-pull-request] automated change
This commit is contained in:
parent
dde00dfa81
commit
4d363b2367
|
@ -10,9 +10,9 @@
|
|||
import SwiftUI
|
||||
|
||||
struct ServerDetailView: View {
|
||||
|
||||
|
||||
@ObservedObject var viewModel = ServerDetailViewModel()
|
||||
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
Section(header: Text("")) {
|
||||
|
@ -22,21 +22,21 @@ struct ServerDetailView: View {
|
|||
Text(ServerEnvironment.current.server.name ?? "")
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
||||
|
||||
HStack {
|
||||
Text("URI")
|
||||
Spacer()
|
||||
Text(ServerEnvironment.current.server.baseURI ?? "")
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
||||
|
||||
HStack {
|
||||
Text("Version")
|
||||
Spacer()
|
||||
Text(ServerEnvironment.current.server.version ?? "")
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
||||
|
||||
HStack {
|
||||
Text("Operating System")
|
||||
Spacer()
|
||||
|
@ -44,7 +44,7 @@ struct ServerDetailView: View {
|
|||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Button(action: {
|
||||
viewModel.refreshServerLibrary()
|
||||
}, label: {
|
||||
|
|
|
@ -34,7 +34,7 @@ struct SettingsView: View {
|
|||
Text(SessionManager.current.user.username ?? "")
|
||||
.foregroundColor(.jellyfinPurple)
|
||||
}
|
||||
|
||||
|
||||
NavigationLink(
|
||||
destination: ServerDetailView(),
|
||||
label: {
|
||||
|
@ -45,7 +45,7 @@ struct SettingsView: View {
|
|||
.foregroundColor(.jellyfinPurple)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Button {
|
||||
close = false
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
|
@ -70,13 +70,13 @@ struct SettingsView: View {
|
|||
Text(bitrate.name).tag(bitrate.value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Picker("Jump Forward Length", selection: $jumpForwardLength) {
|
||||
ForEach(self.viewModel.videoPlayerJumpLengths, id: \.self) { length in
|
||||
Text(length.label).tag(length.rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Picker("Jump Backward Length", selection: $jumpBackwardLength) {
|
||||
ForEach(self.viewModel.videoPlayerJumpLengths, id: \.self) { length in
|
||||
Text(length.label).tag(length.rawValue)
|
||||
|
|
|
@ -83,12 +83,12 @@ class PlayerViewController: UIViewController, GCKDiscoveryManagerListener, GCKRe
|
|||
var jumpBackwardLength: VideoPlayerJumpLength {
|
||||
return Defaults[.videoPlayerJumpBackward]
|
||||
}
|
||||
|
||||
|
||||
var manifest: BaseItemDto = BaseItemDto()
|
||||
var playbackItem = PlaybackItem()
|
||||
var remoteTimeUpdateTimer: Timer?
|
||||
var upNextViewModel: UpNextViewModel = UpNextViewModel()
|
||||
var lastOri: UIInterfaceOrientation? = nil
|
||||
var lastOri: UIInterfaceOrientation?
|
||||
|
||||
// MARK: IBActions
|
||||
@IBAction func seekSliderStart(_ sender: Any) {
|
||||
|
@ -104,24 +104,24 @@ class PlayerViewController: UIViewController, GCKDiscoveryManagerListener, GCKRe
|
|||
let videoDuration: Double = Double(manifest.runTimeTicks! / Int64(10_000_000))
|
||||
let secondsScrubbedTo = round(Double(seekSlider.value) * videoDuration)
|
||||
let secondsScrubbedRemaining = videoDuration - secondsScrubbedTo
|
||||
|
||||
|
||||
timeText.text = calculateTimeText(from: secondsScrubbedTo)
|
||||
timeLeftText.text = calculateTimeText(from: secondsScrubbedRemaining)
|
||||
}
|
||||
|
||||
|
||||
private func calculateTimeText(from duration: Double) -> String {
|
||||
let hours = floor(duration / 3600)
|
||||
let minutes = (duration.truncatingRemainder(dividingBy: 3600)) / 60
|
||||
let seconds = (duration.truncatingRemainder(dividingBy: 3600)).truncatingRemainder(dividingBy: 60)
|
||||
|
||||
|
||||
let timeText: String
|
||||
|
||||
|
||||
if hours != 0 {
|
||||
timeText = "\(Int(hours)):\(String(Int(floor(minutes))).leftPad(toWidth: 2, withString: "0")):\(String(Int(floor(seconds))).leftPad(toWidth: 2, withString: "0"))"
|
||||
} else {
|
||||
timeText = "\(String(Int(floor(minutes))).leftPad(toWidth: 2, withString: "0")):\(String(Int(floor(seconds))).leftPad(toWidth: 2, withString: "0"))"
|
||||
}
|
||||
|
||||
|
||||
return timeText
|
||||
}
|
||||
|
||||
|
@ -417,8 +417,8 @@ class PlayerViewController: UIViewController, GCKDiscoveryManagerListener, GCKRe
|
|||
DispatchQueue.main.async {
|
||||
self.lastOri = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation ?? nil
|
||||
AppDelegate.orientationLock = .landscape
|
||||
|
||||
if(self.lastOri != nil) {
|
||||
|
||||
if self.lastOri != nil {
|
||||
if !self.lastOri!.isLandscape {
|
||||
UIDevice.current.setValue(UIInterfaceOrientation.landscapeRight.rawValue, forKey: "orientation")
|
||||
UIViewController.attemptRotationToDeviceOrientation()
|
||||
|
@ -470,7 +470,7 @@ class PlayerViewController: UIViewController, GCKDiscoveryManagerListener, GCKRe
|
|||
self.navigationController?.isNavigationBarHidden = false
|
||||
overrideUserInterfaceStyle = .unspecified
|
||||
DispatchQueue.main.async {
|
||||
if(self.lastOri != nil) {
|
||||
if self.lastOri != nil {
|
||||
AppDelegate.orientationLock = .all
|
||||
UIDevice.current.setValue(self.lastOri!.rawValue, forKey: "orientation")
|
||||
UIViewController.attemptRotationToDeviceOrientation()
|
||||
|
@ -625,7 +625,7 @@ class PlayerViewController: UIViewController, GCKDiscoveryManagerListener, GCKRe
|
|||
.store(in: &cancellables)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func setupJumpLengthButtons() {
|
||||
let buttonFont = UIFont.systemFont(ofSize: 35, weight: .regular)
|
||||
jumpForwardButton.setImage(jumpForwardLength.generateForwardImage(with: buttonFont), for: .normal)
|
||||
|
@ -804,7 +804,7 @@ extension PlayerViewController: GCKGenericChannelDelegate {
|
|||
if isSeeking == false {
|
||||
let positiveSeconds = Double(remotePositionTicks/10_000_000)
|
||||
let remainingSeconds = Double((manifest.runTimeTicks! - Int64(remotePositionTicks))/10_000_000)
|
||||
|
||||
|
||||
timeText.text = calculateTimeText(from: positiveSeconds)
|
||||
timeLeftText.text = calculateTimeText(from: remainingSeconds)
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class VideoPlayerSettingsView: UINavigationController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
||||
self.viewControllers = [UIHostingController(rootView: VideoPlayerSettings(delegate: self.playerDelegate ?? PlayerViewController()))]
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
import SwiftUI
|
||||
|
||||
extension Color {
|
||||
|
||||
|
||||
static let jellyfinPurple = Color(red: 172 / 255, green: 92 / 255, blue: 195 / 255)
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,18 +14,18 @@ enum VideoPlayerJumpLength: Int32, CaseIterable, Defaults.Serializable {
|
|||
case thirty = 30
|
||||
case fifteen = 15
|
||||
case ten = 10
|
||||
|
||||
|
||||
// TODO - Uncomment once iOS 15 released
|
||||
// case five = 5
|
||||
|
||||
|
||||
var label: String {
|
||||
return "\(self.rawValue) seconds"
|
||||
}
|
||||
|
||||
|
||||
func generateForwardImage(with font: UIFont) -> UIImage {
|
||||
let config = UIImage.SymbolConfiguration(font: font)
|
||||
let systemName: String
|
||||
|
||||
|
||||
switch self {
|
||||
case .thirty:
|
||||
systemName = "goforward.30"
|
||||
|
@ -36,14 +36,14 @@ enum VideoPlayerJumpLength: Int32, CaseIterable, Defaults.Serializable {
|
|||
// case .five:
|
||||
// systemName = "goforward.5"
|
||||
}
|
||||
|
||||
|
||||
return UIImage(systemName: systemName, withConfiguration: config)!
|
||||
}
|
||||
|
||||
|
||||
func generateBackwardImage(with font: UIFont) -> UIImage {
|
||||
let config = UIImage.SymbolConfiguration(font: font)
|
||||
let systemName: String
|
||||
|
||||
|
||||
switch self {
|
||||
case .thirty:
|
||||
systemName = "gobackward.30"
|
||||
|
@ -54,7 +54,7 @@ enum VideoPlayerJumpLength: Int32, CaseIterable, Defaults.Serializable {
|
|||
// case .five:
|
||||
// systemName = "gobackward.5"
|
||||
}
|
||||
|
||||
|
||||
return UIImage(systemName: systemName, withConfiguration: config)!
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import Foundation
|
|||
import JellyfinAPI
|
||||
|
||||
class ServerDetailViewModel: ViewModel {
|
||||
|
||||
|
||||
func refreshServerLibrary() {
|
||||
LibraryAPI.refreshLibrary()
|
||||
.trackActivity(loading)
|
||||
|
|
Loading…
Reference in New Issue