-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
127 additions
and
535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...igation/src/main/java/com/stslex93/notes/core/navigation/di/NavigationComponentBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package com.stslex93.notes.core.navigation.di | ||
|
||
import com.stslex93.notes.core.navigation.v2.controller.NavExtrasHostController | ||
import androidx.navigation.NavHostController | ||
import com.stslex93.notes.core.ui.di.NavigationApi | ||
|
||
object NavigationComponentBuilder { | ||
|
||
fun build( | ||
navController: NavExtrasHostController | ||
navHostController: NavHostController | ||
): NavigationApi = DaggerNavigationComponent | ||
.builder() | ||
.controller(navController) | ||
.controller(navHostController) | ||
.build() | ||
} |
2 changes: 1 addition & 1 deletion
2
core/navigation/src/main/java/com/stslex93/notes/core/navigation/di/NavigationModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 36 additions & 29 deletions
65
core/navigation/src/main/java/com/stslex93/notes/core/navigation/navigator/NavigatorImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,38 @@ | ||
package com.stslex93.notes.core.navigation.navigator | ||
|
||
//class NavigatorImpl @Inject constructor( | ||
// private val navController: NavHostController | ||
//) : Navigator { | ||
// | ||
// override fun invoke(screen: Screen) { | ||
// when (screen) { | ||
// is NavigationScreen.PopBackStack -> navController.popBackStack() | ||
// is NavigationScreen -> navigateScreen(screen) | ||
// else -> { | ||
// Logger.debug("unresolve navigation route", this::class.simpleName) | ||
// } | ||
// } | ||
// } | ||
// | ||
// private fun navigateScreen(screen: NavigationScreen) { | ||
// val currentRoute = navController.currentDestination?.route ?: return | ||
// if (currentRoute == screen.screen.navigationRoute) return | ||
// | ||
// navController.navigate(screen.screenRoute) { | ||
// if (screen.isSingleTop.not()) return@navigate | ||
// | ||
// popUpTo(currentRoute) { | ||
// inclusive = true | ||
// saveState = true | ||
// } | ||
// launchSingleTop = true | ||
// } | ||
// } | ||
//} | ||
import androidx.navigation.NavHostController | ||
import com.stslex.aproselection.core.core.Logger | ||
import com.stslex93.notes.core.navigation.model.NavigationScreen | ||
import com.stslex93.notes.core.ui.di.Navigator | ||
import com.stslex93.notes.core.ui.di.Screen | ||
import javax.inject.Inject | ||
|
||
class NavigatorImpl @Inject constructor( | ||
private val navController: NavHostController | ||
) : Navigator { | ||
|
||
override fun invoke(screen: Screen) { | ||
when (screen) { | ||
is NavigationScreen.PopBackStack -> navController.popBackStack() | ||
is NavigationScreen -> navigateScreen(screen) | ||
else -> { | ||
Logger.debug("unresolve navigation route", this::class.simpleName) | ||
} | ||
} | ||
} | ||
|
||
private fun navigateScreen(screen: NavigationScreen) { | ||
val currentRoute = navController.currentDestination?.route ?: return | ||
if (currentRoute == screen.screen.navigationRoute) return | ||
|
||
navController.navigate(screen.screenRoute) { | ||
if (screen.isSingleTop.not()) return@navigate | ||
|
||
popUpTo(currentRoute) { | ||
inclusive = true | ||
saveState = true | ||
} | ||
launchSingleTop = true | ||
} | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
core/navigation/src/main/java/com/stslex93/notes/core/navigation/v2/NoteEditArgs.kt
This file was deleted.
Oops, something went wrong.
64 changes: 0 additions & 64 deletions
64
core/navigation/src/main/java/com/stslex93/notes/core/navigation/v2/compose/ComposeGraph.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.