Skip to content

Commit

Permalink
move as much DeepLink code as possible to common
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielittner committed Oct 6, 2023
1 parent 626766c commit 3df5ca5
Show file tree
Hide file tree
Showing 25 changed files with 398 additions and 300 deletions.
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ plugins {
dependencyAnalysis {
issues {
all {
onAny {
// issue with Kotlin multiplatform artifacts
exclude(
"com.eygraber:uri-kmp",
"com.eygraber:uri-kmp-android",
"com.eygraber:uri-kmp-android-debug",
)
}
onUsedTransitiveDependencies {
exclude("dev.drewhamilton.poko:poko-annotations")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ internal class FileGeneratorTestNavHostActivity {
import androidx.compose.runtime.Composable
import com.freeletics.khonshu.codegen.compose.NavHostActivity
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.compose.NavDestination
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.test.parent.TestParentScope
@NavHostActivity(
Expand Down Expand Up @@ -96,10 +96,10 @@ internal class FileGeneratorTestNavHostActivity {
import com.freeletics.khonshu.codegen.`internal`.asComposeState
import com.freeletics.khonshu.codegen.`internal`.component
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.compose.NavDestination
import com.freeletics.khonshu.navigation.compose.NavHost
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.squareup.anvil.annotations.ContributesSubcomponent
import com.squareup.anvil.annotations.ContributesTo
import com.squareup.anvil.annotations.optional.ForScope
Expand Down Expand Up @@ -234,7 +234,7 @@ internal class FileGeneratorTestNavHostActivity {
import com.freeletics.khonshu.codegen.ActivityScope
import com.freeletics.khonshu.codegen.compose.NavHostActivity
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
@NavHostActivity(
Expand Down Expand Up @@ -269,10 +269,10 @@ internal class FileGeneratorTestNavHostActivity {
import com.freeletics.khonshu.codegen.`internal`.asComposeState
import com.freeletics.khonshu.codegen.`internal`.component
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.compose.NavDestination
import com.freeletics.khonshu.navigation.compose.NavHost
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.squareup.anvil.annotations.ContributesSubcomponent
import com.squareup.anvil.annotations.ContributesTo
import com.squareup.anvil.annotations.optional.ForScope
Expand Down Expand Up @@ -422,9 +422,9 @@ internal class FileGeneratorTestNavHostActivity {
import androidx.compose.runtime.Composable
import com.freeletics.khonshu.codegen.compose.NavHostActivity
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.compose.NavDestination
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.test.other.TestClass2
import com.test.parent.TestParentScope
Expand Down Expand Up @@ -464,10 +464,10 @@ internal class FileGeneratorTestNavHostActivity {
import com.freeletics.khonshu.codegen.`internal`.asComposeState
import com.freeletics.khonshu.codegen.`internal`.component
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.compose.NavDestination
import com.freeletics.khonshu.navigation.compose.NavHost
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.squareup.anvil.annotations.ContributesSubcomponent
import com.squareup.anvil.annotations.ContributesTo
import com.squareup.anvil.annotations.optional.ForScope
Expand Down Expand Up @@ -620,9 +620,9 @@ internal class FileGeneratorTestNavHostActivity {
import androidx.compose.runtime.Composable
import com.freeletics.khonshu.codegen.compose.NavHostActivity
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.compose.NavDestination
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.test.parent.TestParentScope
@NavHostActivity(
Expand Down Expand Up @@ -655,10 +655,10 @@ internal class FileGeneratorTestNavHostActivity {
import com.freeletics.khonshu.codegen.`internal`.asComposeState
import com.freeletics.khonshu.codegen.`internal`.component
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.compose.NavDestination
import com.freeletics.khonshu.navigation.compose.NavHost
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.squareup.anvil.annotations.ContributesSubcomponent
import com.squareup.anvil.annotations.ContributesTo
import com.squareup.anvil.annotations.optional.ForScope
Expand Down Expand Up @@ -788,9 +788,9 @@ internal class FileGeneratorTestNavHostActivity {
import androidx.compose.runtime.Composable
import com.freeletics.khonshu.codegen.compose.NavHostActivity
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.compose.NavDestination
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.test.parent.TestParentScope
@NavHostActivity(
Expand Down Expand Up @@ -824,10 +824,10 @@ internal class FileGeneratorTestNavHostActivity {
import com.freeletics.khonshu.codegen.`internal`.asComposeState
import com.freeletics.khonshu.codegen.`internal`.component
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.compose.NavDestination
import com.freeletics.khonshu.navigation.compose.NavHost
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.squareup.anvil.annotations.ContributesSubcomponent
import com.squareup.anvil.annotations.ContributesTo
import com.squareup.anvil.annotations.optional.ForScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal val composeLocalNavigationExecutor =
MemberName("com.freeletics.khonshu.navigation.compose", "LocalNavigationExecutor")
internal val fragmentFindNavigationExecutor =
MemberName("com.freeletics.khonshu.navigation.fragment", "findNavigationExecutor")
internal val deepLinkHandler = ClassName("com.freeletics.khonshu.navigation", "DeepLinkHandler")
internal val deepLinkHandler = ClassName("com.freeletics.khonshu.navigation.deeplinks", "DeepLinkHandler")
internal val deepLinkPrefix = deepLinkHandler.nestedClass("Prefix")
internal val fragmentNavigationHandler = MemberName("com.freeletics.khonshu.navigation.fragment", "handleNavigation")
internal val fragmentDestination = ClassName("com.freeletics.khonshu.navigation.fragment", "NavDestination")
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ androidx-fragment = { module = "androidx.fragment:fragment", version.ref = "andr
androidx-savedstate = { module = "androidx.savedstate:savedstate", version.ref = "androidx-savedstate" }
androidx-viewbinding = { module = "androidx.databinding:viewbinding", version.ref = "android-gradle" }

uri = { module = "com.eygraber:uri-kmp-android", version.ref = "uri" }
uri = { module = "com.eygraber:uri-kmp", version.ref = "uri" }

inject = { module = "javax.inject:javax.inject", version.ref = "inject" }
dagger = { module = "com.google.dagger:dagger", version.ref = "dagger" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import androidx.navigation.NavController.Companion.KEY_DEEP_LINK_IDS
import com.eygraber.uri.Uri
import com.freeletics.khonshu.navigation.ActivityRoute
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLink
import com.freeletics.khonshu.navigation.DeepLink.Companion.EXTRA_DEEPLINK_ROUTES
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.deeplinks.DeepLink
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.freeletics.khonshu.navigation.deeplinks.EXTRA_DEEPLINK_ROUTES
import com.freeletics.khonshu.navigation.deeplinks.buildIntent
import com.freeletics.khonshu.navigation.deeplinks.createDeepLinkIfMatching

/**
* Handles 2 different kind of deep links:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import androidx.navigation.compose.rememberNavController
import androidx.navigation.createGraph
import androidx.navigation.get
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.NavRoute
import com.freeletics.khonshu.navigation.compose.internal.OverlayHost
import com.freeletics.khonshu.navigation.compose.internal.OverlayNavigator
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.freeletics.khonshu.navigation.internal.AndroidXNavigationExecutor
import com.freeletics.khonshu.navigation.internal.CustomActivityNavigator
import com.freeletics.khonshu.navigation.internal.InternalNavigationApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import androidx.compose.runtime.saveable.rememberSaveableStateHolder
import androidx.compose.runtime.snapshotFlow
import androidx.compose.runtime.staticCompositionLocalOf
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.compose.internal.MultiStackNavigationExecutor
import com.freeletics.khonshu.navigation.compose.internal.StackEntry
import com.freeletics.khonshu.navigation.compose.internal.rememberNavigationExecutor
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.freeletics.khonshu.navigation.internal.InternalNavigationApi
import com.freeletics.khonshu.navigation.internal.NavigationExecutor
import java.io.Closeable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ import androidx.compose.ui.platform.LocalContext
import androidx.lifecycle.SavedStateViewModelFactory
import androidx.lifecycle.viewmodel.compose.viewModel
import com.eygraber.uri.Uri
import com.freeletics.khonshu.navigation.DeepLink.Companion.EXTRA_DEEPLINK_ROUTES
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.NavRoot
import com.freeletics.khonshu.navigation.compose.ActivityDestination
import com.freeletics.khonshu.navigation.compose.ContentDestination
import com.freeletics.khonshu.navigation.compose.NavDestination
import com.freeletics.khonshu.navigation.compose.findActivity
import com.freeletics.khonshu.navigation.compose.internal.MultiStackNavigationExecutor.Companion.SAVED_STATE_STACK
import com.freeletics.khonshu.navigation.internal.createDeepLinkIfMatching
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.freeletics.khonshu.navigation.deeplinks.EXTRA_DEEPLINK_ROUTES
import com.freeletics.khonshu.navigation.deeplinks.buildIntent
import com.freeletics.khonshu.navigation.deeplinks.createDeepLinkIfMatching

@Composable
internal fun rememberNavigationExecutor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.navigation.fragment.FragmentNavigator
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.get
import com.freeletics.khonshu.navigation.BaseRoute
import com.freeletics.khonshu.navigation.DeepLinkHandler
import com.freeletics.khonshu.navigation.deeplinks.DeepLinkHandler
import com.freeletics.khonshu.navigation.internal.CustomActivityNavigator
import com.freeletics.khonshu.navigation.internal.destinationId
import com.freeletics.khonshu.navigation.internal.getArguments
Expand Down
Loading

0 comments on commit 3df5ca5

Please sign in to comment.