fix crashes
This commit is contained in:
parent
a09c369e1d
commit
d98776f655
|
|
@ -151,7 +151,7 @@ struct MovieItemView: View {
|
||||||
HStack {
|
HStack {
|
||||||
Spacer().frame(width: 16)
|
Spacer().frame(width: 16)
|
||||||
ForEach(viewModel.item.people!, id: \.self) { person in
|
ForEach(viewModel.item.people!, id: \.self) { person in
|
||||||
if person.type! == "Actor" {
|
if person.type ?? "" == "Actor" {
|
||||||
NavigationLink(destination: LazyView {
|
NavigationLink(destination: LazyView {
|
||||||
LibraryView(viewModel: .init(person: person), title: person.name ?? "")
|
LibraryView(viewModel: .init(person: person), title: person.name ?? "")
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -163,7 +163,7 @@ struct MovieItemView: View {
|
||||||
.cornerRadius(10)
|
.cornerRadius(10)
|
||||||
Text(person.name ?? "").font(.footnote).fontWeight(.regular).lineLimit(1)
|
Text(person.name ?? "").font(.footnote).fontWeight(.regular).lineLimit(1)
|
||||||
.frame(width: 100).foregroundColor(Color.primary)
|
.frame(width: 100).foregroundColor(Color.primary)
|
||||||
if person.role != "" {
|
if person.role != nil {
|
||||||
Text(person.role!).font(.caption).fontWeight(.medium).lineLimit(1)
|
Text(person.role!).font(.caption).fontWeight(.medium).lineLimit(1)
|
||||||
.foregroundColor(Color.secondary).frame(width: 100)
|
.foregroundColor(Color.secondary).frame(width: 100)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,9 +164,10 @@ final class SessionManager {
|
||||||
keychain.accessGroup = "9R8RREG67J.me.vigue.jellyfin.sharedKeychain"
|
keychain.accessGroup = "9R8RREG67J.me.vigue.jellyfin.sharedKeychain"
|
||||||
keychain.delete("AccessToken_\(user?.user_id ?? "")")
|
keychain.delete("AccessToken_\(user?.user_id ?? "")")
|
||||||
generateAuthHeader(with: nil, deviceID: nil)
|
generateAuthHeader(with: nil, deviceID: nil)
|
||||||
|
if(user != nil) {
|
||||||
let deleteRequest = NSBatchDeleteRequest(objectIDs: [user.objectID])
|
let deleteRequest = NSBatchDeleteRequest(objectIDs: [user.objectID])
|
||||||
user = nil
|
user = nil
|
||||||
_ = try? PersistenceController.shared.container.viewContext.execute(deleteRequest)
|
_ = try? PersistenceController.shared.container.viewContext.execute(deleteRequest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@ final class LibraryFilterViewModel: ViewModel {
|
||||||
init(filters: LibraryFilters? = nil,
|
init(filters: LibraryFilters? = nil,
|
||||||
enabledFilterType: [FilterType] = [.tag, .genre, .sortBy, .sortOrder, .filter], parentId: String) {
|
enabledFilterType: [FilterType] = [.tag, .genre, .sortBy, .sortOrder, .filter], parentId: String) {
|
||||||
self.enabledFilterType = enabledFilterType
|
self.enabledFilterType = enabledFilterType
|
||||||
self.selectedSortBy = filters!.sortBy.first!
|
self.selectedSortBy = filters?.sortBy.first ?? .name;
|
||||||
self.selectedSortOrder = filters!.sortOrder.first!
|
self.selectedSortOrder = filters?.sortOrder.first ?? .descending;
|
||||||
self.parentId = parentId
|
self.parentId = parentId
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ final class LibraryListViewModel: ViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
func requestLibraries() {
|
func requestLibraries() {
|
||||||
UserViewsAPI.getUserViews(userId: SessionManager.current.user.user_id!)
|
UserViewsAPI.getUserViews(userId: SessionManager.current.user.user_id ?? "val was nil")
|
||||||
.trackActivity(loading)
|
.trackActivity(loading)
|
||||||
.sink(receiveCompletion: { completion in
|
.sink(receiveCompletion: { completion in
|
||||||
self.handleAPIRequestCompletion(completion: completion)
|
self.handleAPIRequestCompletion(completion: completion)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue