mirror of
https://github.com/Chesire/Nekome.git
synced 2026-03-13 09:01:28 +08:00
fix: crash when navigating to series with slash in name (#1164)
* fix: crash when navigating to series with slash in name Remove passing the series name through to the Item screen as it is never used. This stops the crash occurring as titles such as Fate/Stay night would cause an exception. * chore: update version name and code * style: fix extra comma ktlint issue
This commit is contained in:
@@ -14,8 +14,8 @@ android {
|
||||
applicationId = "com.chesire.nekome"
|
||||
minSdk = 21
|
||||
targetSdk = libs.versions.sdk.get().toInt()
|
||||
versionCode = 24012009 // Date of build formatted as 'yyMMddHH'
|
||||
versionName = "2.2.1"
|
||||
versionCode = 24012317 // Date of build formatted as 'yyMMddHH'
|
||||
versionName = "2.2.2"
|
||||
testInstrumentationRunner = "com.chesire.nekome.TestRunner"
|
||||
resourceConfigurations += listOf("en", "ja")
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ fun NavGraphBuilder.addSeriesRoutes(navController: NavHostController) {
|
||||
arguments = Screen.Anime.args
|
||||
) {
|
||||
CollectionScreen(
|
||||
navigateToItem = { seriesId, seriesTitle ->
|
||||
navController.navigate("${Screen.Item.destination}/$seriesId/$seriesTitle")
|
||||
navigateToItem = { seriesId ->
|
||||
navController.navigate("${Screen.Item.destination}/$seriesId")
|
||||
},
|
||||
navigateToSearch = {
|
||||
navController.navigate(Screen.Search.route)
|
||||
@@ -57,8 +57,8 @@ fun NavGraphBuilder.addSeriesRoutes(navController: NavHostController) {
|
||||
arguments = Screen.Manga.args
|
||||
) {
|
||||
CollectionScreen(
|
||||
navigateToItem = { seriesId, seriesTitle ->
|
||||
navController.navigate("${Screen.Item.destination}/$seriesId/$seriesTitle")
|
||||
navigateToItem = { seriesId ->
|
||||
navController.navigate("${Screen.Item.destination}/$seriesId")
|
||||
},
|
||||
navigateToSearch = {
|
||||
navController.navigate(Screen.Search.route)
|
||||
|
||||
@@ -78,12 +78,11 @@ sealed class Screen {
|
||||
}
|
||||
|
||||
data object Item : Screen() {
|
||||
override val route = "item/{seriesId}/{seriesTitle}"
|
||||
override val route = "item/{seriesId}"
|
||||
const val destination = "item"
|
||||
|
||||
override val args = listOf(
|
||||
navArgument("seriesId") { type = NavType.IntType },
|
||||
navArgument("seriesTitle") { type = NavType.StringType }
|
||||
navArgument("seriesId") { type = NavType.IntType }
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
1
fastlane/metadata/android/en-GB/changelogs/24012317.txt
Normal file
1
fastlane/metadata/android/en-GB/changelogs/24012317.txt
Normal file
@@ -0,0 +1 @@
|
||||
* Fix crash when navigating to series detail view, if series has a / in the name
|
||||
1
fastlane/metadata/android/en-US/changelogs/24012317.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/24012317.txt
Normal file
@@ -0,0 +1 @@
|
||||
* Fix crash when navigating to series detail view, if series has a / in the name
|
||||
@@ -82,14 +82,14 @@ import com.chesire.nekome.resources.StringResource
|
||||
@Composable
|
||||
fun CollectionScreen(
|
||||
viewModel: CollectionViewModel = hiltViewModel(),
|
||||
navigateToItem: (Int, String) -> Unit,
|
||||
navigateToItem: (Int) -> Unit,
|
||||
navigateToSearch: () -> Unit
|
||||
) {
|
||||
val state = viewModel.uiState.collectAsState()
|
||||
|
||||
state.value.seriesDetails?.let {
|
||||
LaunchedEffect(it.show) {
|
||||
navigateToItem(it.seriesId, it.seriesTitle)
|
||||
navigateToItem(it.seriesId)
|
||||
viewModel.execute(ViewAction.SeriesNavigationObserved)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,8 +117,7 @@ class CollectionViewModel @Inject constructor(
|
||||
state = state.copy(
|
||||
seriesDetails = SeriesDetails(
|
||||
show = true,
|
||||
seriesId = series.userId,
|
||||
seriesTitle = series.title
|
||||
seriesId = series.userId
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -68,8 +68,7 @@ data class SnackbarData(
|
||||
|
||||
data class SeriesDetails(
|
||||
val show: Boolean,
|
||||
val seriesId: Int,
|
||||
val seriesTitle: String
|
||||
val seriesId: Int
|
||||
)
|
||||
|
||||
data class Sort(
|
||||
|
||||
@@ -143,8 +143,7 @@ class CollectionViewModelTest {
|
||||
assertEquals(
|
||||
SeriesDetails(
|
||||
show = true,
|
||||
seriesId = model.userId,
|
||||
seriesTitle = model.title
|
||||
seriesId = model.userId
|
||||
),
|
||||
viewModel.uiState.value.seriesDetails
|
||||
)
|
||||
@@ -158,8 +157,7 @@ class CollectionViewModelTest {
|
||||
assertEquals(
|
||||
SeriesDetails(
|
||||
show = true,
|
||||
seriesId = model.userId,
|
||||
seriesTitle = model.title
|
||||
seriesId = model.userId
|
||||
),
|
||||
viewModel.uiState.value.seriesDetails
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user