From fb840eb9ce122e13f2e45e9705279d8ccebdc5cb Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Thu, 13 Jun 2024 10:01:51 -0400 Subject: [PATCH 1/3] Rename HotwireDestination annotation -> HotwireDestinationDeepLink --- .../demo/features/imageviewer/ImageViewerFragment.kt | 4 ++-- .../demo/features/numbers/NumberBottomSheetFragment.kt | 4 ++-- .../dev/hotwire/demo/features/numbers/NumbersFragment.kt | 4 ++-- .../hotwire/demo/features/web/WebBottomSheetFragment.kt | 4 ++-- .../kotlin/dev/hotwire/demo/features/web/WebFragment.kt | 4 ++-- .../dev/hotwire/demo/features/web/WebHomeFragment.kt | 4 ++-- .../dev/hotwire/demo/features/web/WebModalFragment.kt | 4 ++-- ...otwireDestination.kt => HotwireDestinationDeepLink.kt} | 8 ++++---- .../navigation/fragments/HotwireWebBottomSheetFragment.kt | 4 ++-- .../hotwire/navigation/fragments/HotwireWebFragment.kt | 4 ++-- .../hotwire/navigation/navigator/NavigatorGraphBuilder.kt | 6 +++--- .../dev/hotwire/navigation/navigator/NavigatorRule.kt | 4 ++-- 12 files changed, 27 insertions(+), 27 deletions(-) rename navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/{HotwireDestination.kt => HotwireDestinationDeepLink.kt} (73%) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/imageviewer/ImageViewerFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/imageviewer/ImageViewerFragment.kt index 9703e3c..a3a8dd1 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/imageviewer/ImageViewerFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/imageviewer/ImageViewerFragment.kt @@ -7,11 +7,11 @@ import android.view.ViewGroup import android.widget.ImageView import coil.load import dev.hotwire.demo.R -import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.fragments.HotwireFragment import dev.hotwire.navigation.util.displayBackButtonAsCloseIcon -@HotwireDestination(uri = "turbo://fragment/image_viewer") +@HotwireDestinationDeepLink(uri = "turbo://fragment/image_viewer") class ImageViewerFragment : HotwireFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_image_viewer, container, false) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumberBottomSheetFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumberBottomSheetFragment.kt index e3d06c6..02958a5 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumberBottomSheetFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumberBottomSheetFragment.kt @@ -8,10 +8,10 @@ import android.view.ViewGroup import com.google.android.material.textview.MaterialTextView import dev.hotwire.core.turbo.config.PathConfigurationProperties import dev.hotwire.demo.R -import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.fragments.HotwireBottomSheetFragment -@HotwireDestination(uri = "turbo://fragment/numbers/sheet") +@HotwireDestinationDeepLink(uri = "turbo://fragment/numbers/sheet") class NumberBottomSheetFragment : HotwireBottomSheetFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_number_bottom_sheet, container, false) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumbersFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumbersFragment.kt index d6892c3..256e57d 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumbersFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumbersFragment.kt @@ -8,10 +8,10 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import dev.hotwire.demo.R import dev.hotwire.demo.Urls -import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.fragments.HotwireFragment -@HotwireDestination(uri = "turbo://fragment/numbers") +@HotwireDestinationDeepLink(uri = "turbo://fragment/numbers") class NumbersFragment : HotwireFragment(), NumbersFragmentCallback { private val numbersAdapter = NumbersAdapter(this) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebBottomSheetFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebBottomSheetFragment.kt index c0bdda8..334a5b1 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebBottomSheetFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebBottomSheetFragment.kt @@ -4,10 +4,10 @@ import android.os.Bundle import android.view.MenuItem import android.view.View import dev.hotwire.demo.R -import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.fragments.HotwireWebBottomSheetFragment -@HotwireDestination(uri = "turbo://fragment/web/modal/sheet") +@HotwireDestinationDeepLink(uri = "turbo://fragment/web/modal/sheet") class WebBottomSheetFragment : HotwireWebBottomSheetFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebFragment.kt index aa11d10..e390151 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebFragment.kt @@ -9,10 +9,10 @@ import dev.hotwire.core.turbo.visit.VisitAction.REPLACE import dev.hotwire.core.turbo.visit.VisitOptions import dev.hotwire.demo.R import dev.hotwire.demo.Urls -import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.fragments.HotwireWebFragment -@HotwireDestination(uri = "turbo://fragment/web") +@HotwireDestinationDeepLink(uri = "turbo://fragment/web") open class WebFragment : HotwireWebFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebHomeFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebHomeFragment.kt index be3919d..9752ea9 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebHomeFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebHomeFragment.kt @@ -6,10 +6,10 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import dev.hotwire.core.turbo.errors.VisitError -import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.demo.R -@HotwireDestination(uri = "turbo://fragment/web/home") +@HotwireDestinationDeepLink(uri = "turbo://fragment/web/home") class WebHomeFragment : WebFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_web_home, container, false) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebModalFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebModalFragment.kt index 85d98b3..2b3fedd 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebModalFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebModalFragment.kt @@ -1,6 +1,6 @@ package dev.hotwire.demo.features.web -import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink -@HotwireDestination(uri = "turbo://fragment/web/modal") +@HotwireDestinationDeepLink(uri = "turbo://fragment/web/modal") class WebModalFragment : WebFragment() diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestination.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestinationDeepLink.kt similarity index 73% rename from navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestination.kt rename to navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestinationDeepLink.kt index beee101..fc22ffa 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestination.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestinationDeepLink.kt @@ -7,7 +7,7 @@ import kotlin.reflect.full.findAnnotation * Annotation for each Fragment that will be registered as a navigation destination. * * For example: - * `@HotwireDestination(uri = "turbo://fragment/search")` + * `@HotwireDestinationDeepLink(uri = "turbo://fragment/search")` * `class SearchFragment : TurboWebFragment()` * * @property uri The URI to be registered with the Android Navigation component nav graph. @@ -15,13 +15,13 @@ import kotlin.reflect.full.findAnnotation @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) @MustBeDocumented -annotation class HotwireDestination( +annotation class HotwireDestinationDeepLink( val uri: String ) { companion object { - internal fun from(klass: KClass): HotwireDestination { + internal fun from(klass: KClass): HotwireDestinationDeepLink { return requireNotNull(klass.findAnnotation()) { - "A HotwireDestination annotation is required for the destination: ${klass.simpleName}" + "A HotwireDestinationDeepLink annotation is required for the destination: ${klass.simpleName}" } } } diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebBottomSheetFragment.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebBottomSheetFragment.kt index a5f60ba..3ff5a1e 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebBottomSheetFragment.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebBottomSheetFragment.kt @@ -15,7 +15,7 @@ import dev.hotwire.core.turbo.views.TurboWebChromeClient import dev.hotwire.core.turbo.views.TurboWebView import dev.hotwire.navigation.R import dev.hotwire.navigation.config.HotwireNavigation -import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.views.TurboView /** @@ -24,7 +24,7 @@ import dev.hotwire.navigation.views.TurboView * * For native bottom sheet fragments, refer to [HotwireBottomSheetFragment]. */ -@HotwireDestination(uri = "turbo://fragment/web/modal/sheet") +@HotwireDestinationDeepLink(uri = "turbo://fragment/web/modal/sheet") open class HotwireWebBottomSheetFragment : HotwireBottomSheetFragment(), HotwireWebFragmentCallback { private lateinit var webDelegate: HotwireWebFragmentDelegate diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragment.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragment.kt index 1f69939..8267bba 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragment.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragment.kt @@ -14,7 +14,7 @@ import dev.hotwire.core.turbo.views.TurboWebChromeClient import dev.hotwire.core.turbo.views.TurboWebView import dev.hotwire.navigation.R import dev.hotwire.navigation.config.HotwireNavigation -import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.session.SessionModalResult import dev.hotwire.navigation.views.TurboView @@ -24,7 +24,7 @@ import dev.hotwire.navigation.views.TurboView * * For native fragments, refer to [HotwireFragment]. */ -@HotwireDestination(uri = "turbo://fragment/web") +@HotwireDestinationDeepLink(uri = "turbo://fragment/web") open class HotwireWebFragment : HotwireFragment(), HotwireWebFragmentCallback { private lateinit var webDelegate: HotwireWebFragmentDelegate diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/NavigatorGraphBuilder.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/NavigatorGraphBuilder.kt index e25d2a9..f505966 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/NavigatorGraphBuilder.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/NavigatorGraphBuilder.kt @@ -16,7 +16,7 @@ import androidx.navigation.get import dev.hotwire.core.turbo.config.PathConfiguration import dev.hotwire.core.turbo.config.uri import dev.hotwire.navigation.config.HotwireNavigation -import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import java.util.UUID import kotlin.reflect.KClass import kotlin.reflect.full.isSubclassOf @@ -40,7 +40,7 @@ internal class NavigatorGraphBuilder( val fragmentDestinations = registeredFragments.map { FragmentDestination( route = currentRoute.also { currentRoute++ }.toString(), - uri = HotwireDestination.from(it).uri.toUri(), + uri = HotwireDestinationDeepLink.from(it).uri.toUri(), kClass = it ) } @@ -94,7 +94,7 @@ internal class NavigatorGraphBuilder( private fun List.startDestination(): FragmentDestination { val startDestinationUri = pathConfiguration.properties(startLocation).uri ?: - HotwireDestination.from(HotwireNavigation.defaultFragmentDestination).uri.toUri() + HotwireDestinationDeepLink.from(HotwireNavigation.defaultFragmentDestination).uri.toUri() return requireNotNull(firstOrNull { it.uri == startDestinationUri }) { "A start Fragment destination was not found for uri: $startDestinationUri" diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/NavigatorRule.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/NavigatorRule.kt index 5c7c8d5..fadb999 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/NavigatorRule.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/NavigatorRule.kt @@ -21,7 +21,7 @@ import dev.hotwire.core.turbo.nav.TurboNavQueryStringPresentation import dev.hotwire.core.turbo.visit.VisitAction import dev.hotwire.core.turbo.visit.VisitOptions import dev.hotwire.navigation.config.HotwireNavigation -import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.session.SessionModalResult import dev.hotwire.navigation.util.location @@ -35,7 +35,7 @@ internal class NavigatorRule( pathConfiguration: PathConfiguration, val controller: NavController ) { - val defaultUri = HotwireDestination.from(HotwireNavigation.defaultFragmentDestination).uri.toUri() + val defaultUri = HotwireDestinationDeepLink.from(HotwireNavigation.defaultFragmentDestination).uri.toUri() // Current destination val previousLocation = controller.previousBackStackEntry.location From fd84192483d65e5d9a5685cc90bfce8715ff5116 Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Thu, 13 Jun 2024 10:10:03 -0400 Subject: [PATCH 2/3] Rename HotwireNavDestination -> HotwireDestination --- .../dev/hotwire/demo/bridge/FormComponent.kt | 6 +++--- .../dev/hotwire/demo/bridge/MenuComponent.kt | 6 +++--- .../hotwire/demo/bridge/OverflowMenuComponent.kt | 6 +++--- .../navigation/config/HotwireNavigation.kt | 8 ++++---- ...reNavDestination.kt => HotwireDestination.kt} | 2 +- ...estination.kt => HotwireDialogDestination.kt} | 2 +- .../fragments/HotwireBottomSheetFragment.kt | 8 ++++---- .../navigation/fragments/HotwireFragment.kt | 6 +++--- .../fragments/HotwireFragmentDelegate.kt | 4 ++-- .../fragments/HotwireWebFragmentDelegate.kt | 7 +++---- .../hotwire/navigation/navigator/Navigator.kt | 16 ++++++++-------- .../observers/HotwireWindowThemeObserver.kt | 4 ++-- 12 files changed, 37 insertions(+), 38 deletions(-) rename navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/{HotwireNavDestination.kt => HotwireDestination.kt} (99%) rename navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/{HotwireNavDialogDestination.kt => HotwireDialogDestination.kt} (84%) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/bridge/FormComponent.kt b/demo/src/main/kotlin/dev/hotwire/demo/bridge/FormComponent.kt index 162f642..260c01a 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/bridge/FormComponent.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/bridge/FormComponent.kt @@ -11,7 +11,7 @@ import dev.hotwire.core.bridge.BridgeDelegate import dev.hotwire.core.bridge.Message import dev.hotwire.demo.R import dev.hotwire.demo.databinding.FormComponentSubmitBinding -import dev.hotwire.navigation.destinations.HotwireNavDestination +import dev.hotwire.navigation.destinations.HotwireDestination import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -21,8 +21,8 @@ import kotlinx.serialization.Serializable */ class FormComponent( name: String, - private val delegate: BridgeDelegate -) : BridgeComponent(name, delegate) { + private val delegate: BridgeDelegate +) : BridgeComponent(name, delegate) { private val submitButtonItemId = 37 private var submitMenuItem: MenuItem? = null diff --git a/demo/src/main/kotlin/dev/hotwire/demo/bridge/MenuComponent.kt b/demo/src/main/kotlin/dev/hotwire/demo/bridge/MenuComponent.kt index e572d7b..b5c60ea 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/bridge/MenuComponent.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/bridge/MenuComponent.kt @@ -9,7 +9,7 @@ import dev.hotwire.core.bridge.BridgeComponent import dev.hotwire.core.bridge.BridgeDelegate import dev.hotwire.core.bridge.Message import dev.hotwire.demo.databinding.MenuComponentBottomSheetBinding -import dev.hotwire.navigation.destinations.HotwireNavDestination +import dev.hotwire.navigation.destinations.HotwireDestination import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -19,8 +19,8 @@ import kotlinx.serialization.Serializable */ class MenuComponent( name: String, - private val delegate: BridgeDelegate -) : BridgeComponent(name, delegate) { + private val delegate: BridgeDelegate +) : BridgeComponent(name, delegate) { private val fragment: Fragment get() = delegate.destination.fragment diff --git a/demo/src/main/kotlin/dev/hotwire/demo/bridge/OverflowMenuComponent.kt b/demo/src/main/kotlin/dev/hotwire/demo/bridge/OverflowMenuComponent.kt index 569ae83..018e42f 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/bridge/OverflowMenuComponent.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/bridge/OverflowMenuComponent.kt @@ -7,7 +7,7 @@ import dev.hotwire.core.bridge.BridgeComponent import dev.hotwire.core.bridge.BridgeDelegate import dev.hotwire.core.bridge.Message import dev.hotwire.demo.R -import dev.hotwire.navigation.destinations.HotwireNavDestination +import dev.hotwire.navigation.destinations.HotwireDestination import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -17,8 +17,8 @@ import kotlinx.serialization.Serializable */ class OverflowMenuComponent( name: String, - private val delegate: BridgeDelegate -) : BridgeComponent(name, delegate) { + private val delegate: BridgeDelegate +) : BridgeComponent(name, delegate) { private val fragment: Fragment get() = delegate.destination.fragment diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/config/HotwireNavigation.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/config/HotwireNavigation.kt index 4176505..0869b0a 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/config/HotwireNavigation.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/config/HotwireNavigation.kt @@ -4,7 +4,7 @@ import androidx.fragment.app.Fragment import dev.hotwire.core.bridge.BridgeComponent import dev.hotwire.core.bridge.BridgeComponentFactory import dev.hotwire.core.config.Hotwire -import dev.hotwire.navigation.destinations.HotwireNavDestination +import dev.hotwire.navigation.destinations.HotwireDestination import dev.hotwire.navigation.fragments.HotwireWebBottomSheetFragment import dev.hotwire.navigation.fragments.HotwireWebFragment import dev.hotwire.navigation.routing.AppNavigationRouteDecisionHandler @@ -26,8 +26,8 @@ internal object HotwireNavigation { ) @Suppress("UNCHECKED_CAST") - var registeredBridgeComponentFactories: List>> - get() = Hotwire.config.registeredBridgeComponentFactories as List>> + var registeredBridgeComponentFactories: List>> + get() = Hotwire.config.registeredBridgeComponentFactories as List>> set(value) { Hotwire.config.registeredBridgeComponentFactories = value } } @@ -43,7 +43,7 @@ fun Hotwire.registerRouteDecisionHandlers(decisionHandlers: List>>) { +fun Hotwire.registerBridgeComponents(factories: List>>) { config.registeredBridgeComponentFactories = factories } diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireNavDestination.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestination.kt similarity index 99% rename from navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireNavDestination.kt rename to navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestination.kt index 20a67c0..caa2352 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireNavDestination.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestination.kt @@ -25,7 +25,7 @@ import dev.hotwire.navigation.routing.Router * The primary interface that a navigable Fragment implements to provide the library with * the information it needs to properly navigate. */ -interface HotwireNavDestination : BridgeDestination { +interface HotwireDestination : BridgeDestination { /** * Gets the navigator instance associated with this destination. */ diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireNavDialogDestination.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDialogDestination.kt similarity index 84% rename from navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireNavDialogDestination.kt rename to navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDialogDestination.kt index e8ff79c..e734971 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireNavDialogDestination.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDialogDestination.kt @@ -4,6 +4,6 @@ package dev.hotwire.navigation.destinations * The interface that a navigable DialogFragment implements to provide the library with * the information it needs to properly navigate. */ -interface HotwireNavDialogDestination { +interface HotwireDialogDestination { fun closeDialog() } diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireBottomSheetFragment.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireBottomSheetFragment.kt index 1f8b7f4..85c5db8 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireBottomSheetFragment.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireBottomSheetFragment.kt @@ -8,8 +8,8 @@ import androidx.appcompat.widget.Toolbar import com.google.android.material.bottomsheet.BottomSheetDialogFragment import dev.hotwire.core.turbo.config.title import dev.hotwire.navigation.R -import dev.hotwire.navigation.destinations.HotwireNavDestination -import dev.hotwire.navigation.destinations.HotwireNavDialogDestination +import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDialogDestination import dev.hotwire.navigation.navigator.Navigator import dev.hotwire.navigation.navigator.NavigatorHost @@ -20,7 +20,7 @@ import dev.hotwire.navigation.navigator.NavigatorHost * For web bottom sheet fragments, refer to [HotwireWebBottomSheetFragment]. */ abstract class HotwireBottomSheetFragment : BottomSheetDialogFragment(), - HotwireNavDestination, HotwireNavDialogDestination { + HotwireDestination, HotwireDialogDestination { override lateinit var navigator: Navigator internal lateinit var delegate: HotwireFragmentDelegate @@ -61,7 +61,7 @@ abstract class HotwireBottomSheetFragment : BottomSheetDialogFragment(), * Use [registerForActivityResult] with the appropriate * [androidx.activity.result.contract.ActivityResultContract] and its callback. * - * Turbo provides the [HotwireNavDestination.activityResultLauncher] interface + * Turbo provides the [HotwireDestination.activityResultLauncher] interface * to obtain registered result launchers from any destination. */ @Suppress("DEPRECATION") diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireFragment.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireFragment.kt index 6333cae..fd33d0a 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireFragment.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireFragment.kt @@ -9,7 +9,7 @@ import dev.hotwire.core.turbo.config.context import dev.hotwire.core.turbo.config.title import dev.hotwire.core.turbo.nav.TurboNavPresentationContext import dev.hotwire.navigation.R -import dev.hotwire.navigation.destinations.HotwireNavDestination +import dev.hotwire.navigation.destinations.HotwireDestination import dev.hotwire.navigation.navigator.Navigator import dev.hotwire.navigation.navigator.NavigatorHost import dev.hotwire.navigation.observers.HotwireWindowThemeObserver @@ -21,7 +21,7 @@ import dev.hotwire.navigation.session.SessionModalResult * * For web fragments, refer to [HotwireWebFragment]. */ -abstract class HotwireFragment : Fragment(), HotwireNavDestination { +abstract class HotwireFragment : Fragment(), HotwireDestination { override lateinit var navigator: Navigator internal lateinit var delegate: HotwireFragmentDelegate @@ -66,7 +66,7 @@ abstract class HotwireFragment : Fragment(), HotwireNavDestination { * Use [registerForActivityResult] with the appropriate * [androidx.activity.result.contract.ActivityResultContract] and its callback. * - * Turbo provides the [HotwireNavDestination.activityResultLauncher] interface + * Turbo provides the [HotwireDestination.activityResultLauncher] interface * to obtain registered result launchers from any destination. */ @Suppress("DEPRECATION") diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireFragmentDelegate.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireFragmentDelegate.kt index 05c1083..fbd0e01 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireFragmentDelegate.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireFragmentDelegate.kt @@ -1,7 +1,7 @@ package dev.hotwire.navigation.fragments import dev.hotwire.navigation.logging.logEvent -import dev.hotwire.navigation.destinations.HotwireNavDestination +import dev.hotwire.navigation.destinations.HotwireDestination import dev.hotwire.navigation.session.SessionModalResult import dev.hotwire.navigation.session.SessionViewModel import dev.hotwire.navigation.util.displayBackButton @@ -12,7 +12,7 @@ import dev.hotwire.navigation.util.displayBackButtonAsCloseIcon * to this class. Note: This class should not need to be used directly * from within your app. */ -class HotwireFragmentDelegate(private val navDestination: HotwireNavDestination) { +class HotwireFragmentDelegate(private val navDestination: HotwireDestination) { private val fragment = navDestination.fragment private val location = navDestination.location private val navigator = navDestination.navigator diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragmentDelegate.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragmentDelegate.kt index 4f93ee5..b4b0514 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragmentDelegate.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragmentDelegate.kt @@ -18,7 +18,7 @@ import dev.hotwire.core.turbo.visit.Visit import dev.hotwire.core.turbo.visit.VisitAction import dev.hotwire.core.turbo.visit.VisitDestination import dev.hotwire.core.turbo.visit.VisitOptions -import dev.hotwire.navigation.destinations.HotwireNavDestination +import dev.hotwire.navigation.destinations.HotwireDestination import dev.hotwire.navigation.session.SessionModalResult import dev.hotwire.navigation.util.dispatcherProvider import dev.hotwire.navigation.views.TurboView @@ -32,7 +32,7 @@ import kotlin.random.Random */ internal class HotwireWebFragmentDelegate( private val delegate: HotwireFragmentDelegate, - private val navDestination: HotwireNavDestination, + private val navDestination: HotwireDestination, private val callback: HotwireWebFragmentCallback ) : SessionCallback, VisitDestination { @@ -129,8 +129,7 @@ internal class HotwireWebFragmentDelegate( } /** - * Should be called by the implementing Fragment during - * [dev.hotwire.core.turbo.nav.HotwireNavDestination.refresh] + * Should be called by the implementing Fragment during [HotwireDestination.refresh]. */ fun refresh(displayProgress: Boolean) { if (webView.url == null) return diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/Navigator.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/Navigator.kt index 59c965a..a819259 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/Navigator.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/navigator/Navigator.kt @@ -15,8 +15,8 @@ import dev.hotwire.core.turbo.session.Session import dev.hotwire.core.turbo.visit.VisitAction import dev.hotwire.core.turbo.visit.VisitOptions import dev.hotwire.navigation.config.HotwireNavigation -import dev.hotwire.navigation.destinations.HotwireNavDestination -import dev.hotwire.navigation.destinations.HotwireNavDialogDestination +import dev.hotwire.navigation.destinations.HotwireDestination +import dev.hotwire.navigation.destinations.HotwireDialogDestination import dev.hotwire.navigation.logging.logEvent import dev.hotwire.navigation.routing.Router import dev.hotwire.navigation.util.location @@ -28,10 +28,10 @@ class Navigator( private val navController = host.navController /** - * Retrieves the currently active [HotwireNavDestination] on the backstack. + * Retrieves the currently active [HotwireDestination] on the backstack. */ - val currentDestination: HotwireNavDestination - get() = host.childFragmentManager.primaryNavigationFragment as HotwireNavDestination? + val currentDestination: HotwireDestination + get() = host.childFragmentManager.primaryNavigationFragment as HotwireDestination? ?: throw IllegalStateException("No current destination found in NavigatorHost") /** @@ -74,7 +74,7 @@ class Navigator( fun pop() { navigateWhenReady { val currentFragment = currentDestination.fragment - if (currentFragment is HotwireNavDialogDestination) { + if (currentFragment is HotwireDialogDestination) { currentFragment.closeDialog() } else { navController.popBackStack() @@ -150,7 +150,7 @@ class Navigator( navigateWhenReady { val currentFragment = currentDestination.fragment - if (currentFragment is HotwireNavDialogDestination) { + if (currentFragment is HotwireDialogDestination) { currentFragment.closeDialog() } @@ -251,7 +251,7 @@ class Navigator( ) navigateWhenReady { - val isDialog = currentDestination.fragment is HotwireNavDialogDestination + val isDialog = currentDestination.fragment is HotwireDialogDestination if (isDialog) { // Pop the backstack before sending the modal result, since the // underlying fragment is still active and will receive the diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/observers/HotwireWindowThemeObserver.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/observers/HotwireWindowThemeObserver.kt index 4c6e91e..af847ec 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/observers/HotwireWindowThemeObserver.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/observers/HotwireWindowThemeObserver.kt @@ -9,10 +9,10 @@ import android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS import androidx.annotation.RequiresApi import androidx.lifecycle.DefaultLifecycleObserver import androidx.lifecycle.LifecycleOwner -import dev.hotwire.navigation.destinations.HotwireNavDestination +import dev.hotwire.navigation.destinations.HotwireDestination import dev.hotwire.navigation.util.animateColorTo -internal class HotwireWindowThemeObserver(val destination: HotwireNavDestination) : DefaultLifecycleObserver { +internal class HotwireWindowThemeObserver(val destination: HotwireDestination) : DefaultLifecycleObserver { private val window: Window? get() = destination.fragment.activity?.window From 7c6d0e2a0efcc188e817f03f37fefdbee23b6013 Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Thu, 13 Jun 2024 10:37:13 -0400 Subject: [PATCH 3/3] Rename turbo:// deeplink scheme -> hotwire:// --- .../src/main/assets/json/test-configuration.json | 12 ++++++------ demo/src/main/assets/json/configuration.json | 16 ++++++++-------- .../features/imageviewer/ImageViewerFragment.kt | 2 +- .../numbers/NumberBottomSheetFragment.kt | 2 +- .../demo/features/numbers/NumbersFragment.kt | 2 +- .../demo/features/web/WebBottomSheetFragment.kt | 2 +- .../dev/hotwire/demo/features/web/WebFragment.kt | 2 +- .../hotwire/demo/features/web/WebHomeFragment.kt | 2 +- .../demo/features/web/WebModalFragment.kt | 2 +- docs/ADVANCED-OPTIONS.md | 6 +++--- docs/NAVIGATION.md | 4 ++-- docs/PATH-CONFIGURATION.md | 2 +- .../destinations/HotwireDestinationDeepLink.kt | 6 +++--- .../fragments/HotwireWebBottomSheetFragment.kt | 2 +- .../navigation/fragments/HotwireWebFragment.kt | 2 +- .../navigation/navigator/NavigatorRuleTest.kt | 6 +++--- 16 files changed, 35 insertions(+), 35 deletions(-) diff --git a/core/src/main/assets/json/test-configuration.json b/core/src/main/assets/json/test-configuration.json index ea95136..ff38e98 100644 --- a/core/src/main/assets/json/test-configuration.json +++ b/core/src/main/assets/json/test-configuration.json @@ -9,7 +9,7 @@ ], "properties": { "context": "default", - "uri": "turbo://fragment/web", + "uri": "hotwire://fragment/web", "pull_to_refresh_enabled": true } }, @@ -19,7 +19,7 @@ "/home" ], "properties": { - "uri": "turbo://fragment/web/home", + "uri": "hotwire://fragment/web/home", "presentation": "clear_all" } }, @@ -28,7 +28,7 @@ "/new-home" ], "properties": { - "uri": "turbo://fragment/web/home", + "uri": "hotwire://fragment/web/home", "presentation": "replace_root" } }, @@ -47,7 +47,7 @@ ], "properties": { "context": "modal", - "uri": "turbo://fragment/web/modal", + "uri": "hotwire://fragment/web/modal", "query_string_presentation": "default", "pull_to_refresh_enabled": false } @@ -57,7 +57,7 @@ ".+\\.(?:bmp|gif|heic|jpg|jpeg|png|svg|webp)" ], "properties": { - "uri": "turbo://fragment/image_viewer", + "uri": "hotwire://fragment/image_viewer", "title": "Image Viewer" } }, @@ -91,7 +91,7 @@ ], "properties": { "context": "modal", - "uri": "turbo://fragment/web/modal", + "uri": "hotwire://fragment/web/modal", "presentation": "replace_root" } } diff --git a/demo/src/main/assets/json/configuration.json b/demo/src/main/assets/json/configuration.json index 4868f84..b1bb752 100644 --- a/demo/src/main/assets/json/configuration.json +++ b/demo/src/main/assets/json/configuration.json @@ -7,8 +7,8 @@ ], "properties": { "context": "default", - "uri": "turbo://fragment/web", - "fallback_uri": "turbo://fragment/web", + "uri": "hotwire://fragment/web", + "fallback_uri": "hotwire://fragment/web", "pull_to_refresh_enabled": true } }, @@ -18,7 +18,7 @@ "^/$" ], "properties": { - "uri": "turbo://fragment/web/home", + "uri": "hotwire://fragment/web/home", "presentation": "replace_root" } }, @@ -29,7 +29,7 @@ ], "properties": { "context": "modal", - "uri": "turbo://fragment/web/modal", + "uri": "hotwire://fragment/web/modal", "pull_to_refresh_enabled": false } }, @@ -39,7 +39,7 @@ ], "properties": { "context": "modal", - "uri": "turbo://fragment/web/modal/sheet", + "uri": "hotwire://fragment/web/modal/sheet", "pull_to_refresh_enabled": false } }, @@ -48,7 +48,7 @@ "/numbers$" ], "properties": { - "uri": "turbo://fragment/numbers", + "uri": "hotwire://fragment/numbers", "title": "Numbers" } }, @@ -58,7 +58,7 @@ ], "properties": { "context": "modal", - "uri": "turbo://fragment/numbers/sheet", + "uri": "hotwire://fragment/numbers/sheet", "title": "Number", "description": "This is a native bottom sheet fragment" } @@ -68,7 +68,7 @@ ".+\\.(?:bmp|gif|heic|jpg|jpeg|png|svg|webp)" ], "properties": { - "uri": "turbo://fragment/image_viewer" + "uri": "hotwire://fragment/image_viewer" } } ] diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/imageviewer/ImageViewerFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/imageviewer/ImageViewerFragment.kt index a3a8dd1..302096a 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/imageviewer/ImageViewerFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/imageviewer/ImageViewerFragment.kt @@ -11,7 +11,7 @@ import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.fragments.HotwireFragment import dev.hotwire.navigation.util.displayBackButtonAsCloseIcon -@HotwireDestinationDeepLink(uri = "turbo://fragment/image_viewer") +@HotwireDestinationDeepLink(uri = "hotwire://fragment/image_viewer") class ImageViewerFragment : HotwireFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_image_viewer, container, false) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumberBottomSheetFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumberBottomSheetFragment.kt index 02958a5..a658b01 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumberBottomSheetFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumberBottomSheetFragment.kt @@ -11,7 +11,7 @@ import dev.hotwire.demo.R import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.fragments.HotwireBottomSheetFragment -@HotwireDestinationDeepLink(uri = "turbo://fragment/numbers/sheet") +@HotwireDestinationDeepLink(uri = "hotwire://fragment/numbers/sheet") class NumberBottomSheetFragment : HotwireBottomSheetFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_number_bottom_sheet, container, false) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumbersFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumbersFragment.kt index 256e57d..5a18321 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumbersFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/numbers/NumbersFragment.kt @@ -11,7 +11,7 @@ import dev.hotwire.demo.Urls import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.fragments.HotwireFragment -@HotwireDestinationDeepLink(uri = "turbo://fragment/numbers") +@HotwireDestinationDeepLink(uri = "hotwire://fragment/numbers") class NumbersFragment : HotwireFragment(), NumbersFragmentCallback { private val numbersAdapter = NumbersAdapter(this) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebBottomSheetFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebBottomSheetFragment.kt index 334a5b1..7b7fc73 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebBottomSheetFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebBottomSheetFragment.kt @@ -7,7 +7,7 @@ import dev.hotwire.demo.R import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.fragments.HotwireWebBottomSheetFragment -@HotwireDestinationDeepLink(uri = "turbo://fragment/web/modal/sheet") +@HotwireDestinationDeepLink(uri = "hotwire://fragment/web/modal/sheet") class WebBottomSheetFragment : HotwireWebBottomSheetFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebFragment.kt index e390151..c272df5 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebFragment.kt @@ -12,7 +12,7 @@ import dev.hotwire.demo.Urls import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.navigation.fragments.HotwireWebFragment -@HotwireDestinationDeepLink(uri = "turbo://fragment/web") +@HotwireDestinationDeepLink(uri = "hotwire://fragment/web") open class WebFragment : HotwireWebFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebHomeFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebHomeFragment.kt index 9752ea9..21232ce 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebHomeFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebHomeFragment.kt @@ -9,7 +9,7 @@ import dev.hotwire.core.turbo.errors.VisitError import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink import dev.hotwire.demo.R -@HotwireDestinationDeepLink(uri = "turbo://fragment/web/home") +@HotwireDestinationDeepLink(uri = "hotwire://fragment/web/home") class WebHomeFragment : WebFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_web_home, container, false) diff --git a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebModalFragment.kt b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebModalFragment.kt index 2b3fedd..9045805 100644 --- a/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebModalFragment.kt +++ b/demo/src/main/kotlin/dev/hotwire/demo/features/web/WebModalFragment.kt @@ -2,5 +2,5 @@ package dev.hotwire.demo.features.web import dev.hotwire.navigation.destinations.HotwireDestinationDeepLink -@HotwireDestinationDeepLink(uri = "turbo://fragment/web/modal") +@HotwireDestinationDeepLink(uri = "hotwire://fragment/web/modal") class WebModalFragment : WebFragment() diff --git a/docs/ADVANCED-OPTIONS.md b/docs/ADVANCED-OPTIONS.md index 14c572b..1df64a8 100644 --- a/docs/ADVANCED-OPTIONS.md +++ b/docs/ADVANCED-OPTIONS.md @@ -14,7 +14,7 @@ In its simplest form, your web Fragment will look like: **`WebFragment.kt`:** ```kotlin -@TurboNavGraphDestination(uri = "turbo://fragment/web") +@TurboNavGraphDestination(uri = "hotwire://fragment/web") class WebFragment : TurboWebFragment() ``` @@ -56,7 +56,7 @@ In its simplest form, your native Fragment will look like: **`ImageViewerFragment.kt`:** ```kotlin -@TurboNavGraphDestination(uri = "turbo://fragment/image_viewer") +@TurboNavGraphDestination(uri = "hotwire://fragment/image_viewer") class ImageViewerFragment : TurboFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_image_viewer, container, false) @@ -87,7 +87,7 @@ In its simplest form, your web bottom sheet Fragment will look like: **`WebBottomSheetFragment.kt`:** ```kotlin -@TurboNavGraphDestination(uri = "turbo://fragment/web/modal/sheet") +@TurboNavGraphDestination(uri = "hotwire://fragment/web/modal/sheet") class WebBottomSheetFragment : TurboWebBottomSheetDialogFragment() ``` The library automatically inflates a default `R.layout.turbo_fragment_web_bottom_sheet` layout to host a `TurboView`. If you'd like to create your own custom layout for your web bottom sheet Fragment, you can override the `onCreateView()` function and inflate your own layout. diff --git a/docs/NAVIGATION.md b/docs/NAVIGATION.md index 15b725b..a939789 100644 --- a/docs/NAVIGATION.md +++ b/docs/NAVIGATION.md @@ -9,7 +9,7 @@ In your web Fragment, this would look like: **`WebFragment.kt`:** ```kotlin -@TurboNavGraphDestination(uri = "turbo://fragment/web") +@TurboNavGraphDestination(uri = "hotwire://fragment/web") class WebFragment : TurboWebFragment() { // ... @@ -52,7 +52,7 @@ In your Fragment, this would look like: **`WebFragment.kt`:** ```kotlin -@TurboNavGraphDestination(uri = "turbo://fragment/web") +@TurboNavGraphDestination(uri = "hotwire://fragment/web") class WebFragment : TurboWebFragment() { // ... diff --git a/docs/PATH-CONFIGURATION.md b/docs/PATH-CONFIGURATION.md index 5445338..c87d2b4 100644 --- a/docs/PATH-CONFIGURATION.md +++ b/docs/PATH-CONFIGURATION.md @@ -19,7 +19,7 @@ In its simplest form, your JSON configuration will look like: ], "properties": { "context": "default", - "uri": "turbo://fragment/web", + "uri": "hotwire://fragment/web", "pull_to_refresh_enabled": true } } diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestinationDeepLink.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestinationDeepLink.kt index fc22ffa..a6d1923 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestinationDeepLink.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/destinations/HotwireDestinationDeepLink.kt @@ -7,10 +7,10 @@ import kotlin.reflect.full.findAnnotation * Annotation for each Fragment that will be registered as a navigation destination. * * For example: - * `@HotwireDestinationDeepLink(uri = "turbo://fragment/search")` - * `class SearchFragment : TurboWebFragment()` + * `@HotwireDestinationDeepLink(uri = "hotwire://fragment/search")` + * `class SearchFragment : HotwireWebFragment()` * - * @property uri The URI to be registered with the Android Navigation component nav graph. + * @property uri The deeplink URI to be registered with the Android Navigation component nav graph. */ @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebBottomSheetFragment.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebBottomSheetFragment.kt index 3ff5a1e..5440e6a 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebBottomSheetFragment.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebBottomSheetFragment.kt @@ -24,7 +24,7 @@ import dev.hotwire.navigation.views.TurboView * * For native bottom sheet fragments, refer to [HotwireBottomSheetFragment]. */ -@HotwireDestinationDeepLink(uri = "turbo://fragment/web/modal/sheet") +@HotwireDestinationDeepLink(uri = "hotwire://fragment/web/modal/sheet") open class HotwireWebBottomSheetFragment : HotwireBottomSheetFragment(), HotwireWebFragmentCallback { private lateinit var webDelegate: HotwireWebFragmentDelegate diff --git a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragment.kt b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragment.kt index 8267bba..3305282 100644 --- a/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragment.kt +++ b/navigation-fragments/src/main/java/dev/hotwire/navigation/fragments/HotwireWebFragment.kt @@ -24,7 +24,7 @@ import dev.hotwire.navigation.views.TurboView * * For native fragments, refer to [HotwireFragment]. */ -@HotwireDestinationDeepLink(uri = "turbo://fragment/web") +@HotwireDestinationDeepLink(uri = "hotwire://fragment/web") open class HotwireWebFragment : HotwireFragment(), HotwireWebFragmentCallback { private lateinit var webDelegate: HotwireWebFragmentDelegate diff --git a/navigation-fragments/src/test/kotlin/dev/hotwire/navigation/navigator/NavigatorRuleTest.kt b/navigation-fragments/src/test/kotlin/dev/hotwire/navigation/navigator/NavigatorRuleTest.kt index f04b7e1..bee250c 100644 --- a/navigation-fragments/src/test/kotlin/dev/hotwire/navigation/navigator/NavigatorRuleTest.kt +++ b/navigation-fragments/src/test/kotlin/dev/hotwire/navigation/navigator/NavigatorRuleTest.kt @@ -48,9 +48,9 @@ class NavigatorRuleTest { private val webModalDestinationId = 2 private val webHomeDestinationId = 3 - private val webUri = Uri.parse("turbo://fragment/web") - private val webModalUri = Uri.parse("turbo://fragment/web/modal") - private val webHomeUri = Uri.parse("turbo://fragment/web/home") + private val webUri = Uri.parse("hotwire://fragment/web") + private val webModalUri = Uri.parse("hotwire://fragment/web/modal") + private val webHomeUri = Uri.parse("hotwire://fragment/web/home") private val extras = null private val navOptions = navOptions {