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