Skip to content

Commit

Permalink
Remove handling of stopName via deep link
Browse files Browse the repository at this point in the history
  • Loading branch information
parkcheayeon committed Jan 15, 2025
1 parent 66c89e1 commit 5fe1c6c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ internal class StopDetailViewModel(savedStateHandle: SavedStateHandle) : ViewMod
private val dummyData = MutableLiveData<List<Bus>>()
private val isLoadingData = MutableLiveData<Boolean>()
private val stopIdData = MutableLiveData<String>(savedStateHandle.get(BUS_STOP_ID))
private val stopNameData = MutableLiveData<String>(savedStateHandle.get(BUS_STOP_NAME))
val busInfos: LiveData<List<Bus>> = dummyData
val isLoading: LiveData<Boolean> = isLoadingData
val stopId: LiveData<String> = stopIdData
val stopName: LiveData<String> = stopNameData

private val dummyDataMapCreators: Map<String, List<Bus>> = mapOf(
"16206" to listOf(
Expand Down Expand Up @@ -142,6 +140,5 @@ internal class StopDetailViewModel(savedStateHandle: SavedStateHandle) : ViewMod

companion object {
private const val BUS_STOP_ID = "stopId"
private const val BUS_STOP_NAME = "stopName"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@
tools:layout="@layout/fragment_stop_detail">

<deepLink
app:uri="android-app://com.chaeny.busoda/fragment_stop_detail?stopId={stopId}&amp;stopName={stopName}" />
app:uri="android-app://com.chaeny.busoda/fragment_stop_detail?stopId={stopId}" />

<argument
android:name="stopId"
app:argType="string" />

<argument
android:name="stopName"
app:argType="string" />
</fragment>

</navigation>
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ internal class StopListAdapter : ListAdapter<BusStop, StopListAdapter.BusStopVie

class BusStopViewHolder(private val binding: ListItemStopBinding) : RecyclerView.ViewHolder(binding.root) {

private fun navigateToStopDetail(stopId: String, stopName: String) {
val uri = "android-app://com.chaeny.busoda/fragment_stop_detail?stopId=$stopId&stopName=$stopName"
private fun navigateToStopDetail(stopId: String) {
val uri = "android-app://com.chaeny.busoda/fragment_stop_detail?stopId=$stopId"
val request = NavDeepLinkRequest.Builder
.fromUri(uri.toUri())
.build()
Expand All @@ -46,7 +46,7 @@ internal class StopListAdapter : ListAdapter<BusStop, StopListAdapter.BusStopVie
textStopName.text = stopData.stopName
textNextStop.text = stopData.formatNextStopName()
root.setOnClickListener {
navigateToStopDetail(stopData.stopId, stopData.stopName)
navigateToStopDetail(stopData.stopId)
}
}
}
Expand Down

0 comments on commit 5fe1c6c

Please sign in to comment.