fix infinite load for subtitles. also save last used user.
This commit is contained in:
parent
d98776f655
commit
e8439830f2
|
@ -71,6 +71,7 @@
|
|||
535870AD2669D8DD00D05A09 /* Typings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535870AC2669D8DD00D05A09 /* Typings.swift */; };
|
||||
535BAE9F2649E569005FA86D /* ItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535BAE9E2649E569005FA86D /* ItemView.swift */; };
|
||||
535BAEA5264A151C005FA86D /* VideoPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535BAEA4264A151C005FA86D /* VideoPlayer.swift */; };
|
||||
53628C6D26B5AA0D008A64A0 /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = 53628C6C26B5AA0D008A64A0 /* Defaults */; };
|
||||
53649AAD269CFAEA00A2D8B7 /* Puppy in Frameworks */ = {isa = PBXBuildFile; productRef = 53649AAC269CFAEA00A2D8B7 /* Puppy */; };
|
||||
53649AAF269CFAF600A2D8B7 /* Puppy in Frameworks */ = {isa = PBXBuildFile; productRef = 53649AAE269CFAF600A2D8B7 /* Puppy */; };
|
||||
53649AB1269CFB1900A2D8B7 /* LogManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53649AB0269CFB1900A2D8B7 /* LogManager.swift */; };
|
||||
|
@ -413,6 +414,7 @@
|
|||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
53628C6D26B5AA0D008A64A0 /* Defaults in Frameworks */,
|
||||
628B95332670CAEA0091AF3B /* NukeUI in Frameworks */,
|
||||
628B95242670CABD0091AF3B /* SwiftUI.framework in Frameworks */,
|
||||
531ABF6C2671F5CC00C0FE20 /* WidgetKit.framework in Frameworks */,
|
||||
|
@ -837,6 +839,7 @@
|
|||
628B95392670CE250091AF3B /* KeychainSwift */,
|
||||
536D3D7C267BD5F90004248C /* ActivityIndicator */,
|
||||
53649AB4269D423A00A2D8B7 /* Puppy */,
|
||||
53628C6C26B5AA0D008A64A0 /* Defaults */,
|
||||
);
|
||||
productName = WidgetExtensionExtension;
|
||||
productReference = 628B95202670CABD0091AF3B /* WidgetExtension.appex */;
|
||||
|
@ -1706,6 +1709,11 @@
|
|||
package = 621C637E26672A30004216EA /* XCRemoteSwiftPackageReference "NukeUI" */;
|
||||
productName = NukeUI;
|
||||
};
|
||||
53628C6C26B5AA0D008A64A0 /* Defaults */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 62CB3F442685BAF7003D0A6F /* XCRemoteSwiftPackageReference "Defaults" */;
|
||||
productName = Defaults;
|
||||
};
|
||||
53649AAC269CFAEA00A2D8B7 /* Puppy */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 53649AAB269CFAEA00A2D8B7 /* XCRemoteSwiftPackageReference "Puppy" */;
|
||||
|
|
|
@ -654,7 +654,9 @@ class PlayerViewController: UIViewController, GCKDiscoveryManagerListener, GCKRe
|
|||
if fetchCaptions {
|
||||
mediaPlayer.pause()
|
||||
subtitleTrackArray.forEach { sub in
|
||||
if sub.id != -1 && sub.delivery == .external {
|
||||
//stupid fxcking jeff decides to re-encode these when added.
|
||||
//only add playback streams when codec not supported by VLC.
|
||||
if sub.id != -1 && sub.delivery == .external && sub.codec != "subrip" {
|
||||
mediaPlayer.addPlaybackSlave(sub.url!, type: .subtitle, enforce: false)
|
||||
}
|
||||
}
|
||||
|
@ -1013,7 +1015,7 @@ struct VLCPlayerWithControls: UIViewControllerRepresentable {
|
|||
func showLoadingView(_ viewController: PlayerViewController) {
|
||||
self.loadBinding.wrappedValue = true
|
||||
}
|
||||
|
||||
|
||||
func exitPlayer(_ viewController: PlayerViewController) {
|
||||
self.pBinding.wrappedValue = false
|
||||
}
|
||||
|
|
|
@ -23,14 +23,15 @@ final class SessionManager {
|
|||
fileprivate(set) var user: SignedInUser!
|
||||
fileprivate(set) var deviceID: String = ""
|
||||
fileprivate(set) var accessToken: String = ""
|
||||
|
||||
|
||||
#if os(tvOS)
|
||||
let tvUserManager = TVUserManager()
|
||||
#endif
|
||||
let userDefaults = UserDefaults()
|
||||
|
||||
init() {
|
||||
let savedUserRequest: NSFetchRequest<SignedInUser> = SignedInUser.fetchRequest()
|
||||
|
||||
let lastUsedUserID = userDefaults.string(forKey: "lastUsedUserID")
|
||||
let savedUsers = try? PersistenceController.shared.container.viewContext.fetch(savedUserRequest)
|
||||
|
||||
#if os(tvOS)
|
||||
|
@ -40,7 +41,15 @@ final class SessionManager {
|
|||
}
|
||||
}
|
||||
#else
|
||||
user = savedUsers?.first
|
||||
if(lastUsedUserID != nil) {
|
||||
savedUsers?.forEach { savedUser in
|
||||
if(savedUser.user_id ?? "" == lastUsedUserID!) {
|
||||
user = savedUser;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
user = savedUsers?.first
|
||||
}
|
||||
#endif
|
||||
|
||||
if user != nil {
|
||||
|
@ -116,7 +125,7 @@ final class SessionManager {
|
|||
|
||||
func loginWithSavedSession(user: SignedInUser) {
|
||||
let accessToken = getAuthToken(userID: user.user_id!)
|
||||
|
||||
userDefaults.set(user.user_id!, forKey: "lastUsedUserID")
|
||||
self.user = user
|
||||
generateAuthHeader(with: accessToken, deviceID: user.device_uuid)
|
||||
print(JellyfinAPI.customHeaders)
|
||||
|
@ -135,7 +144,7 @@ final class SessionManager {
|
|||
user.device_uuid = self.deviceID
|
||||
|
||||
#if os(tvOS)
|
||||
// user.appletv_id = tvUserManager.currentUserIdentifier ?? ""
|
||||
user.appletv_id = tvUserManager.currentUserIdentifier ?? ""
|
||||
#endif
|
||||
|
||||
return (user, response.accessToken)
|
||||
|
|
Loading…
Reference in New Issue