Skip to content

Commit

Permalink
bugs bugs bugs *squash*
Browse files Browse the repository at this point in the history
  • Loading branch information
acvigue committed Jun 11, 2021
1 parent 6cf0bc1 commit 18cc3ac
Show file tree
Hide file tree
Showing 15 changed files with 210 additions and 133 deletions.
12 changes: 6 additions & 6 deletions JellyfinPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 41;
DEVELOPMENT_ASSET_PATHS = "\"JellyfinPlayer tvOS/Preview Content\"";
DEVELOPMENT_TEAM = 9R8RREG67J;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -706,7 +706,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 41;
DEVELOPMENT_ASSET_PATHS = "\"JellyfinPlayer tvOS/Preview Content\"";
DEVELOPMENT_TEAM = 9R8RREG67J;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -857,7 +857,7 @@
CODE_SIGN_ENTITLEMENTS = JellyfinPlayer/JellyfinPlayer.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 41;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9R8RREG67J;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -889,7 +889,7 @@
CODE_SIGN_ENTITLEMENTS = JellyfinPlayer/JellyfinPlayer.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 41;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9R8RREG67J;
Expand Down Expand Up @@ -920,7 +920,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = WidgetExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 41;
DEVELOPMENT_TEAM = 9R8RREG67J;
INFOPLIST_FILE = WidgetExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
Expand All @@ -945,7 +945,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = WidgetExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 41;
DEVELOPMENT_TEAM = 9R8RREG67J;
INFOPLIST_FILE = WidgetExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
Expand Down
12 changes: 6 additions & 6 deletions JellyfinPlayer/ConnectToServerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,23 +274,23 @@ struct ConnectToServerView: View {
ForEach(publicUsers, id: \.id) { publicUser in
HStack {
Button() {
if publicUser.hasPassword! {
if (publicUser.hasPassword ?? true) {
lastPublicUsers = publicUsers
username = publicUser.name!
username = publicUser.name ?? ""
usernameDisabled = true
publicUsers = []
} else {
publicUsers = []
password = ""
username = publicUser.name!
username = publicUser.name ?? ""
doLogin()
}
} label: {
HStack {
Text(publicUser.name!).font(.subheadline).fontWeight(.semibold)
Text(publicUser.name ?? "").font(.subheadline).fontWeight(.semibold)
Spacer()
if publicUser.primaryImageTag != "" {
LazyImage(source: URL(string: "\(uri)/Users/\(publicUser.id!)/Images/Primary?width=200&quality=80&tag=\(publicUser.primaryImageTag!)"))
if publicUser.primaryImageTag != nil {
LazyImage(source: URL(string: "\(uri)/Users/\(publicUser.id ?? "")/Images/Primary?width=200&quality=80&tag=\(publicUser.primaryImageTag!)"))
.contentMode(.aspectFill)
.frame(width: 60, height: 60)
.cornerRadius(30.0)
Expand Down
117 changes: 60 additions & 57 deletions JellyfinPlayer/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,74 +147,77 @@ struct ContentView: View {
.environmentObject(globalData)
} else {
if !jsi.did {
LoadingView(isShowing: $isLoading) {
if(isLoading) {
ProgressView()
} else {
VStack {
if loadState == 0 {
TabView(selection: $tabSelection) {
NavigationView {
VStack(alignment: .leading) {
ScrollView {
Spacer().frame(height: orientationInfo.orientation == .portrait ? 0 : 16)
ContinueWatchingView()
NextUpView()
ForEach(librariesShowRecentlyAdded, id: \.self) { library_id in
VStack(alignment: .leading) {
HStack {
Text("Latest \(library_names[library_id] ?? "")").font(.title2).fontWeight(.bold)
.padding(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 16))
Spacer()
NavigationLink(destination: LazyView {
LibraryView(usingParentID: library_id,
title: library_names[library_id] ?? "", usingFilters: recentFilterSet)
}) {
TabView(selection: $tabSelection) {
NavigationView {
VStack(alignment: .leading) {
ScrollView {
Spacer().frame(height: orientationInfo.orientation == .portrait ? 0 : 16)
ContinueWatchingView()
NextUpView()

ForEach(librariesShowRecentlyAdded, id: \.self) { library_id in
VStack(alignment: .leading) {
HStack {
Text("Latest \(library_names[library_id] ?? "")").font(.title2).fontWeight(.bold)
.padding(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 16))
Spacer()
NavigationLink(destination: LazyView {
LibraryView(usingParentID: library_id,
title: library_names[library_id] ?? "", usingFilters: recentFilterSet)
}) {
HStack() {
Text("See All").font(.subheadline).fontWeight(.bold)
Image(systemName: "chevron.right").font(Font.subheadline.bold())
}
}.padding(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16))
LatestMediaView(usingParentID: library_id)
}.padding(EdgeInsets(top: 4, leading: 0, bottom: 0, trailing: 0))
}
Spacer().frame(height: UIDevice.current.userInterfaceIdiom == .phone ? 20 : 30)
}
}.padding(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16))
LatestMediaView(usingParentID: library_id)
}.padding(EdgeInsets(top: 4, leading: 0, bottom: 0, trailing: 0))
}
.navigationTitle("Home")
.toolbar {
ToolbarItemGroup(placement: .navigationBarTrailing) {
Button {
showSettingsPopover = true
} label: {
Image(systemName: "gear")
}

Spacer().frame(height: UIDevice.current.userInterfaceIdiom == .phone ? 20 : 30)
}
.navigationTitle("Home")
.toolbar {
ToolbarItemGroup(placement: .navigationBarTrailing) {
Button {
showSettingsPopover = true
} label: {
Image(systemName: "gear")
}
}
.fullScreenCover(isPresented: $showSettingsPopover) {
SettingsView(viewModel: SettingsViewModel(), close: $showSettingsPopover)
}
}
.fullScreenCover(isPresented: $showSettingsPopover) {
SettingsView(viewModel: SettingsViewModel(), close: $showSettingsPopover)
}
}
.navigationViewStyle(StackNavigationViewStyle())
.tabItem {
Text("Home")
Image(systemName: "house")
}
.tag("Home")
NavigationView {
LibraryListView(libraries: library_names)
}
.navigationViewStyle(StackNavigationViewStyle())
.tabItem {
Text("All Media")
Image(systemName: "folder")
}
.tag("All Media")
}
} else {
Text("Loading...")
.navigationViewStyle(StackNavigationViewStyle())
.tabItem {
Text("Home")
Image(systemName: "house")
}
.tag("Home")
NavigationView {
LibraryListView(libraries: library_names)
}
.navigationViewStyle(StackNavigationViewStyle())
.tabItem {
Text("All Media")
Image(systemName: "folder")
}
.tag("All Media")
}
}
}
.environmentObject(globalData)
.onAppear(perform: startup)
.alert(isPresented: $globalData.networkError) {
Alert(title: Text("Network Error"), message: Text("An error occured while performing a network request"), dismissButton: .default(Text("Ok")))
.environmentObject(globalData)
.onAppear(perform: startup)
.alert(isPresented: $globalData.networkError) {
Alert(title: Text("Network Error"), message: Text("An error occured while performing a network request"), dismissButton: .default(Text("Ok")))
}
}
} else {
Text("Please wait...")
Expand Down
8 changes: 4 additions & 4 deletions JellyfinPlayer/ContinueWatchingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct ContinueWatchingView: View {

func onAppear() {
DispatchQueue.global(qos: .userInitiated).async {
ItemsAPI.getResumeItems(userId: globalData.user.user_id ?? "", limit: 12, fields: [.primaryImageAspectRatio, .seriesPrimaryImage, .seasonUserData, .overview, .genres, .people], mediaTypes: ["Video"], imageTypeLimit: 1, enableImageTypes: [.primary, .backdrop, .thumb])
ItemsAPI.getResumeItems(userId: globalData.user.user_id!, limit: 12, fields: [.primaryImageAspectRatio, .seriesPrimaryImage, .seasonUserData, .overview, .genres, .people], mediaTypes: ["Video"], imageTypeLimit: 1, enableImageTypes: [.primary, .backdrop, .thumb])
.sink(receiveCompletion: { completion in
HandleAPIRequestCompletion(globalData: globalData, completion: completion)
}, receiveValue: { response in
Expand All @@ -56,7 +56,7 @@ struct ContinueWatchingView: View {
NavigationLink(destination: ItemView(item: item)) {
VStack(alignment: .leading) {
Spacer().frame(height: 10)
LazyImage(source: item.getBackdropImage(baseURL: globalData.server.baseURI ?? "", maxWidth: 320))
LazyImage(source: item.getBackdropImage(baseURL: globalData.server.baseURI!, maxWidth: 320))
.placeholderAndFailure {
Image(uiImage: UIImage(blurHash: item.getBackdropImageBlurHash(), size: CGSize(width: 48, height: 32))!)
.resizable()
Expand All @@ -70,7 +70,7 @@ struct ContinueWatchingView: View {
.overlay(
Group {
if item.type == "Episode" {
Text("\(item.name!)")
Text("\(item.name ?? "")")
.font(.caption)
.padding(6)
.foregroundColor(.white)
Expand All @@ -84,7 +84,7 @@ struct ContinueWatchingView: View {
Rectangle()
.fill(Color(red: 172/255, green: 92/255, blue: 195/255))
.mask(ProgressBar())
.frame(width: CGFloat(item.userData!.playedPercentage!*3.2), height: 7)
.frame(width: CGFloat(item.userData?.playedPercentage ?? 0 * 3.2), height: 7)
.padding(0), alignment: .bottomLeading
)
Text(item.seriesName ?? item.name ?? "")
Expand Down
2 changes: 2 additions & 0 deletions JellyfinPlayer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ network.</string>
<true/>
<key>UILaunchScreen</key>
<dict/>
<key>UILaunchStoryboardName</key>
<string>VideoPlayer</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
17 changes: 10 additions & 7 deletions JellyfinPlayer/LatestMediaView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ struct LatestMediaView: View {
NavigationLink(destination: ItemView(item: item)) {
VStack(alignment: .leading) {
Spacer().frame(height: 10)
LazyImage(source: item.getSeriesPrimaryImage(baseURL: globalData.server.baseURI!, maxWidth: 100))
LazyImage(source: item.getPrimaryImage(baseURL: globalData.server.baseURI!, maxWidth: 100))
.placeholderAndFailure {
Image(uiImage: UIImage(blurHash: item.getSeriesPrimaryImageBlurHash(), size: CGSize(width: 16, height: 20))!)
Image(uiImage: UIImage(blurHash: item.getPrimaryImageBlurHash(), size: CGSize(width: 16, height: 20))!)
.resizable()
.frame(width: 100, height: 150)
.cornerRadius(10)
Expand All @@ -61,11 +61,14 @@ struct LatestMediaView: View {
.fontWeight(.semibold)
.foregroundColor(.primary)
.lineLimit(1)
Text(String(item.productionYear ?? 0))
.font(.caption)
.fontWeight(.semibold)
.foregroundColor(.secondary)
.lineLimit(1)
if(item.productionYear != nil) {
Text(String(item.productionYear ?? 0))
.foregroundColor(.secondary)
.font(.caption)
.fontWeight(.medium)
} else {
Text(item.type!)
}
}.frame(width: 100)
Spacer().frame(width: 15)
}
Expand Down
12 changes: 8 additions & 4 deletions JellyfinPlayer/LibrarySearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,14 @@ struct LibrarySearchView: View {
.fontWeight(.semibold)
.foregroundColor(.primary)
.lineLimit(1)
Text(String(item.productionYear ?? 0))
.foregroundColor(.secondary)
.font(.caption)
.fontWeight(.medium)
if(item.productionYear != nil) {
Text(String(item.productionYear ?? 0))
.foregroundColor(.secondary)
.font(.caption)
.fontWeight(.medium)
} else {
Text(item.type!)
}
}.frame(width: 100)
}
}
Expand Down

0 comments on commit 18cc3ac

Please sign in to comment.