Merge remote-tracking branch 'refs/remotes/origin/main'

This commit is contained in:
Stephen Byatt 2021-06-22 13:01:52 +10:00
commit 21c4fa29c1
3 changed files with 23 additions and 16 deletions

View File

@ -52,6 +52,7 @@ struct EpisodeItemView: View {
.stroke(Color.secondary, lineWidth: 1)) .stroke(Color.secondary, lineWidth: 1))
} }
} }
.padding(.top, 1)
} }
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 98 : 30) .padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 98 : 30)
} }
@ -89,10 +90,10 @@ struct EpisodeItemView: View {
viewModel.updateWatchState() viewModel.updateWatchState()
} label: { } label: {
if viewModel.isWatched { if viewModel.isWatched {
Image(systemName: "checkmark.rectangle.fill").foregroundColor(Color.primary) Image(systemName: "checkmark.circle.fill").foregroundColor(Color.primary)
.font(.system(size: 20)) .font(.system(size: 20))
} else { } else {
Image(systemName: "xmark.rectangle").foregroundColor(Color.primary) Image(systemName: "checkmark.circle").foregroundColor(Color.primary)
.font(.system(size: 20)) .font(.system(size: 20))
} }
} }
@ -254,6 +255,8 @@ struct EpisodeItemView: View {
Spacer() Spacer()
}.frame(maxWidth: .infinity, alignment: .leading) }.frame(maxWidth: .infinity, alignment: .leading)
.offset(x: 14) .offset(x: 14)
.padding(.top, 1)
}.frame(maxWidth: .infinity, alignment: .leading) }.frame(maxWidth: .infinity, alignment: .leading)
Spacer() Spacer()
HStack { HStack {
@ -273,10 +276,10 @@ struct EpisodeItemView: View {
viewModel.updateWatchState() viewModel.updateWatchState()
} label: { } label: {
if viewModel.isWatched { if viewModel.isWatched {
Image(systemName: "checkmark.rectangle.fill").foregroundColor(Color.primary) Image(systemName: "checkmark.circle.fill").foregroundColor(Color.primary)
.font(.system(size: 20)) .font(.system(size: 20))
} else { } else {
Image(systemName: "xmark.rectangle").foregroundColor(Color.primary) Image(systemName: "checkmark.circle").foregroundColor(Color.primary)
.font(.system(size: 20)) .font(.system(size: 20))
} }
} }

View File

@ -58,6 +58,7 @@ struct MovieItemView: View {
.stroke(Color.secondary, lineWidth: 1)) .stroke(Color.secondary, lineWidth: 1))
} }
} }
.padding(.top, 1)
} }
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 98 : 30) .padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 98 : 30)
} }
@ -95,10 +96,10 @@ struct MovieItemView: View {
viewModel.updateWatchState() viewModel.updateWatchState()
} label: { } label: {
if viewModel.isWatched { if viewModel.isWatched {
Image(systemName: "checkmark.rectangle.fill").foregroundColor(Color.primary) Image(systemName: "checkmark.circle.fill").foregroundColor(Color.primary)
.font(.system(size: 20)) .font(.system(size: 20))
} else { } else {
Image(systemName: "xmark.rectangle").foregroundColor(Color.primary) Image(systemName: "checkmark.circle").foregroundColor(Color.primary)
.font(.system(size: 20)) .font(.system(size: 20))
} }
} }
@ -270,6 +271,7 @@ struct MovieItemView: View {
Spacer() Spacer()
}.frame(maxWidth: .infinity, alignment: .leading) }.frame(maxWidth: .infinity, alignment: .leading)
.offset(x: 14) .offset(x: 14)
.padding(.top, 1)
}.frame(maxWidth: .infinity, alignment: .leading) }.frame(maxWidth: .infinity, alignment: .leading)
Spacer() Spacer()
HStack { HStack {
@ -289,10 +291,10 @@ struct MovieItemView: View {
viewModel.updateWatchState() viewModel.updateWatchState()
} label: { } label: {
if viewModel.isWatched { if viewModel.isWatched {
Image(systemName: "checkmark.rectangle.fill").foregroundColor(Color.primary) Image(systemName: "checkmark.circle.fill").foregroundColor(Color.primary)
.font(.system(size: 20)) .font(.system(size: 20))
} else { } else {
Image(systemName: "xmark.rectangle").foregroundColor(Color.primary) Image(systemName: "checkmark.circle").foregroundColor(Color.primary)
.font(.system(size: 20)) .font(.system(size: 20))
} }
} }

View File

@ -104,14 +104,16 @@ extension BaseItemDto {
// MARK: Calculations // MARK: Calculations
func getItemRuntime() -> String { func getItemRuntime() -> String {
let seconds = (self.runTimeTicks ?? 0) / 10_000_000 let timeHMSFormatter: DateComponentsFormatter = {
let hours = (seconds / 3600) let formatter = DateComponentsFormatter()
let minutes = ((seconds - (hours * 3600)) / 60) formatter.unitsStyle = .brief
if hours != 0 { formatter.allowedUnits = [.hour, .minute]
return "\(hours):\(String(minutes).leftPad(toWidth: 2, withString: "0"))" return formatter
} else { }()
return "\(String(minutes))m"
} let text = timeHMSFormatter.string(from: Double(self.runTimeTicks! / 10_000_000)) ?? ""
return text
} }
func getItemProgressString() -> String { func getItemProgressString() -> String {