ios cleanup and fix
This commit is contained in:
parent
bfe557c86c
commit
e170e0671e
|
@ -68,7 +68,7 @@ struct HomeView: View {
|
||||||
|
|
||||||
ForEach(viewModel.libraries, id: \.self) { library in
|
ForEach(viewModel.libraries, id: \.self) { library in
|
||||||
|
|
||||||
LatestMediaView(viewModel: LatestMediaViewModel(libraryID: library.id!)) {
|
LatestMediaView(viewModel: LatestMediaViewModel(library: library)) {
|
||||||
HStack {
|
HStack {
|
||||||
Text(L10n.latestWithString(library.name ?? ""))
|
Text(L10n.latestWithString(library.name ?? ""))
|
||||||
.font(.title2)
|
.font(.title2)
|
||||||
|
|
|
@ -51,24 +51,6 @@ private struct ItemView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
|
||||||
var toolbarItemContent: some View {
|
|
||||||
switch viewModel.item.itemType {
|
|
||||||
case .season:
|
|
||||||
Menu {
|
|
||||||
Button {
|
|
||||||
(viewModel as? SeasonItemViewModel)?.routeToSeriesItem()
|
|
||||||
} label: {
|
|
||||||
Label("Show Series", systemImage: "text.below.photo")
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "ellipsis.circle.fill")
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
EmptyView()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Group {
|
Group {
|
||||||
if hSizeClass == .compact && vSizeClass == .regular {
|
if hSizeClass == .compact && vSizeClass == .regular {
|
||||||
|
@ -79,10 +61,5 @@ private struct ItemView: View {
|
||||||
.environmentObject(viewModel)
|
.environmentObject(viewModel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.toolbar {
|
|
||||||
ToolbarItemGroup(placement: .navigationBarTrailing) {
|
|
||||||
toolbarItemContent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,18 +73,6 @@ final class SeasonItemViewModel: ItemViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func routeToSeriesItem() {
|
|
||||||
guard let id = item.seriesId else { return }
|
|
||||||
UserLibraryAPI.getItem(userId: SessionManager.main.currentLogin.user.id, itemId: id)
|
|
||||||
.trackActivity(loading)
|
|
||||||
.sink(receiveCompletion: { [weak self] completion in
|
|
||||||
self?.handleAPIRequestError(completion: completion)
|
|
||||||
}, receiveValue: { [weak self] item in
|
|
||||||
self?.itemRouter?.route(to: \.item, item)
|
|
||||||
})
|
|
||||||
.store(in: &cancellables)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func getSeriesItem() {
|
private func getSeriesItem() {
|
||||||
guard let seriesID = item.seriesId else { return }
|
guard let seriesID = item.seriesId else { return }
|
||||||
UserLibraryAPI.getItem(userId: SessionManager.main.currentLogin.user.id,
|
UserLibraryAPI.getItem(userId: SessionManager.main.currentLogin.user.id,
|
||||||
|
|
Loading…
Reference in New Issue