fix single root library nav issue
This commit is contained in:
parent
b049572a89
commit
eb51237d54
|
@ -17,6 +17,8 @@ final class MovieLibrariesCoordinator: NavigationCoordinatable {
|
||||||
|
|
||||||
@Root
|
@Root
|
||||||
var start = makeStart
|
var start = makeStart
|
||||||
|
@Root
|
||||||
|
var rootLibrary = makeRootLibrary
|
||||||
@Route(.push)
|
@Route(.push)
|
||||||
var library = makeLibrary
|
var library = makeLibrary
|
||||||
|
|
||||||
|
@ -36,4 +38,8 @@ final class MovieLibrariesCoordinator: NavigationCoordinatable {
|
||||||
func makeLibrary(library: BaseItemDto) -> LibraryCoordinator {
|
func makeLibrary(library: BaseItemDto) -> LibraryCoordinator {
|
||||||
LibraryCoordinator(viewModel: LibraryViewModel(parentID: library.id), title: library.title)
|
LibraryCoordinator(viewModel: LibraryViewModel(parentID: library.id), title: library.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func makeRootLibrary(library: BaseItemDto) -> LibraryCoordinator {
|
||||||
|
LibraryCoordinator(viewModel: LibraryViewModel(parentID: library.id), title: library.title)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ final class TVLibrariesCoordinator: NavigationCoordinatable {
|
||||||
|
|
||||||
@Root
|
@Root
|
||||||
var start = makeStart
|
var start = makeStart
|
||||||
|
@Root
|
||||||
|
var rootLibrary = makeRootLibrary
|
||||||
@Route(.push)
|
@Route(.push)
|
||||||
var library = makeLibrary
|
var library = makeLibrary
|
||||||
|
|
||||||
|
@ -36,4 +38,8 @@ final class TVLibrariesCoordinator: NavigationCoordinatable {
|
||||||
func makeLibrary(library: BaseItemDto) -> LibraryCoordinator {
|
func makeLibrary(library: BaseItemDto) -> LibraryCoordinator {
|
||||||
LibraryCoordinator(viewModel: LibraryViewModel(parentID: library.id), title: library.title)
|
LibraryCoordinator(viewModel: LibraryViewModel(parentID: library.id), title: library.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func makeRootLibrary(library: BaseItemDto) -> LibraryCoordinator {
|
||||||
|
LibraryCoordinator(viewModel: LibraryViewModel(parentID: library.id), title: library.title)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ final class MovieLibrariesViewModel: ViewModel {
|
||||||
}
|
}
|
||||||
self.rows = self.calculateRows()
|
self.rows = self.calculateRows()
|
||||||
if self.libraries.count == 1, let library = self.libraries.first {
|
if self.libraries.count == 1, let library = self.libraries.first {
|
||||||
// show library
|
// make this library the root of this stack
|
||||||
self.router?.route(to: \.library, library)
|
self.router?.coordinator.root(\.rootLibrary, library)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -54,8 +54,8 @@ final class TVLibrariesViewModel: ViewModel {
|
||||||
}
|
}
|
||||||
self.rows = self.calculateRows()
|
self.rows = self.calculateRows()
|
||||||
if self.libraries.count == 1, let library = self.libraries.first {
|
if self.libraries.count == 1, let library = self.libraries.first {
|
||||||
// show library
|
// make this library the root of this stack
|
||||||
self.router?.route(to: \.library, library)
|
self.router?.coordinator.root(\.rootLibrary, library)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue