Skip to content

Commit

Permalink
Merge pull request #52 from hotwired/rename-destination
Browse files Browse the repository at this point in the history
Rename destination classes
  • Loading branch information
jayohms authored Jun 13, 2024
2 parents 6f6be7b + 7c6d0e2 commit 10ec3fb
Show file tree
Hide file tree
Showing 31 changed files with 284 additions and 285 deletions.
12 changes: 6 additions & 6 deletions core/src/main/assets/json/test-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"properties": {
"context": "default",
"uri": "turbo://fragment/web",
"uri": "hotwire://fragment/web",
"pull_to_refresh_enabled": true
}
},
Expand All @@ -19,7 +19,7 @@
"/home"
],
"properties": {
"uri": "turbo://fragment/web/home",
"uri": "hotwire://fragment/web/home",
"presentation": "clear_all"
}
},
Expand All @@ -28,7 +28,7 @@
"/new-home"
],
"properties": {
"uri": "turbo://fragment/web/home",
"uri": "hotwire://fragment/web/home",
"presentation": "replace_root"
}
},
Expand All @@ -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
}
Expand All @@ -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"
}
},
Expand Down Expand Up @@ -91,7 +91,7 @@
],
"properties": {
"context": "modal",
"uri": "turbo://fragment/web/modal",
"uri": "hotwire://fragment/web/modal",
"presentation": "replace_root"
}
}
Expand Down
16 changes: 8 additions & 8 deletions demo/src/main/assets/json/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
},
Expand All @@ -18,7 +18,7 @@
"^/$"
],
"properties": {
"uri": "turbo://fragment/web/home",
"uri": "hotwire://fragment/web/home",
"presentation": "replace_root"
}
},
Expand All @@ -29,7 +29,7 @@
],
"properties": {
"context": "modal",
"uri": "turbo://fragment/web/modal",
"uri": "hotwire://fragment/web/modal",
"pull_to_refresh_enabled": false
}
},
Expand All @@ -39,7 +39,7 @@
],
"properties": {
"context": "modal",
"uri": "turbo://fragment/web/modal/sheet",
"uri": "hotwire://fragment/web/modal/sheet",
"pull_to_refresh_enabled": false
}
},
Expand All @@ -48,7 +48,7 @@
"/numbers$"
],
"properties": {
"uri": "turbo://fragment/numbers",
"uri": "hotwire://fragment/numbers",
"title": "Numbers"
}
},
Expand All @@ -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"
}
Expand All @@ -68,7 +68,7 @@
".+\\.(?:bmp|gif|heic|jpg|jpeg|png|svg|webp)"
],
"properties": {
"uri": "turbo://fragment/image_viewer"
"uri": "hotwire://fragment/image_viewer"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions demo/src/main/kotlin/dev/hotwire/demo/bridge/FormComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -21,8 +21,8 @@ import kotlinx.serialization.Serializable
*/
class FormComponent(
name: String,
private val delegate: BridgeDelegate<HotwireNavDestination>
) : BridgeComponent<HotwireNavDestination>(name, delegate) {
private val delegate: BridgeDelegate<HotwireDestination>
) : BridgeComponent<HotwireDestination>(name, delegate) {

private val submitButtonItemId = 37
private var submitMenuItem: MenuItem? = null
Expand Down
6 changes: 3 additions & 3 deletions demo/src/main/kotlin/dev/hotwire/demo/bridge/MenuComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -19,8 +19,8 @@ import kotlinx.serialization.Serializable
*/
class MenuComponent(
name: String,
private val delegate: BridgeDelegate<HotwireNavDestination>
) : BridgeComponent<HotwireNavDestination>(name, delegate) {
private val delegate: BridgeDelegate<HotwireDestination>
) : BridgeComponent<HotwireDestination>(name, delegate) {

private val fragment: Fragment
get() = delegate.destination.fragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -17,8 +17,8 @@ import kotlinx.serialization.Serializable
*/
class OverflowMenuComponent(
name: String,
private val delegate: BridgeDelegate<HotwireNavDestination>
) : BridgeComponent<HotwireNavDestination>(name, delegate) {
private val delegate: BridgeDelegate<HotwireDestination>
) : BridgeComponent<HotwireDestination>(name, delegate) {

private val fragment: Fragment
get() = delegate.destination.fragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "hotwire://fragment/numbers")
class NumbersFragment : HotwireFragment(), NumbersFragmentCallback {
private val numbersAdapter = NumbersAdapter(this)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "hotwire://fragment/web/modal/sheet")
class WebBottomSheetFragment : HotwireWebBottomSheetFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "hotwire://fragment/web")
open class WebFragment : HotwireWebFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = "hotwire://fragment/web/modal")
class WebModalFragment : WebFragment()
6 changes: 3 additions & 3 deletions docs/ADVANCED-OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
```

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions docs/NAVIGATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

// ...
Expand Down Expand Up @@ -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() {

// ...
Expand Down
2 changes: 1 addition & 1 deletion docs/PATH-CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,8 +26,8 @@ internal object HotwireNavigation {
)

@Suppress("UNCHECKED_CAST")
var registeredBridgeComponentFactories: List<BridgeComponentFactory<HotwireNavDestination, BridgeComponent<HotwireNavDestination>>>
get() = Hotwire.config.registeredBridgeComponentFactories as List<BridgeComponentFactory<HotwireNavDestination, BridgeComponent<HotwireNavDestination>>>
var registeredBridgeComponentFactories: List<BridgeComponentFactory<HotwireDestination, BridgeComponent<HotwireDestination>>>
get() = Hotwire.config.registeredBridgeComponentFactories as List<BridgeComponentFactory<HotwireDestination, BridgeComponent<HotwireDestination>>>
set(value) { Hotwire.config.registeredBridgeComponentFactories = value }
}

Expand All @@ -43,7 +43,7 @@ fun Hotwire.registerRouteDecisionHandlers(decisionHandlers: List<Router.RouteDec
* Register bridge components that the app supports. Every possible bridge
* component, wrapped in a [BridgeComponentFactory], must be provided here.
*/
fun Hotwire.registerBridgeComponents(factories: List<BridgeComponentFactory<HotwireNavDestination, BridgeComponent<HotwireNavDestination>>>) {
fun Hotwire.registerBridgeComponents(factories: List<BridgeComponentFactory<HotwireDestination, BridgeComponent<HotwireDestination>>>) {
config.registeredBridgeComponentFactories = factories
}

Expand Down
Loading

0 comments on commit 10ec3fb

Please sign in to comment.