Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
knighthat committed Sep 29, 2024
1 parent 598ac41 commit cb2123d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ import it.fast4x.rimusic.utils.preferences
import it.fast4x.rimusic.utils.rememberPreference
import it.fast4x.rimusic.utils.thumbnailRoundnessKey
import it.fast4x.rimusic.utils.transitionEffectKey
import java.net.URLEncoder
import java.nio.charset.StandardCharsets

@androidx.annotation.OptIn(UnstableApi::class)
@OptIn(ExperimentalFoundationApi::class, ExperimentalAnimationApi::class,
Expand Down Expand Up @@ -380,7 +382,8 @@ fun AppNavigation(
onViewPlaylist = {},
//pop = popDestination,
onSearch = { query ->
navController.navigate(route = "${NavRoutes.searchResults.name}/$query")
val uriSafe = URLEncoder.encode( query, StandardCharsets.UTF_8.toString() )
navController.navigate(route = "${NavRoutes.searchResults.name}/$uriSafe")

if (!context.preferences.getBoolean(pauseSearchHistoryKey, false)) {
it.fast4x.rimusic.query {
Expand All @@ -402,7 +405,6 @@ fun AppNavigation(
)
) { navBackStackEntry ->
val query = navBackStackEntry.arguments?.getString("query") ?: ""

SearchResultScreen(
navController = navController,
playerEssential = playerEssential,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import it.fast4x.innertube.requests.albumPage
import it.fast4x.innertube.requests.searchPage
import it.fast4x.innertube.utils.from
import it.fast4x.rimusic.Database
import it.fast4x.rimusic.EXPLICIT_PREFIX
import it.fast4x.rimusic.LocalPlayerServiceBinder
import it.fast4x.rimusic.R
import it.fast4x.rimusic.enums.NavRoutes
Expand All @@ -56,7 +57,6 @@ import it.fast4x.rimusic.ui.items.AlbumItem
import it.fast4x.rimusic.ui.items.AlbumItemPlaceholder
import it.fast4x.rimusic.ui.items.ArtistItem
import it.fast4x.rimusic.ui.items.ArtistItemPlaceholder
import it.fast4x.rimusic.EXPLICIT_PREFIX
import it.fast4x.rimusic.ui.items.PlaylistItem
import it.fast4x.rimusic.ui.items.PlaylistItemPlaceholder
import it.fast4x.rimusic.ui.items.SongItem
Expand Down Expand Up @@ -86,6 +86,8 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import me.knighthat.uiType
import java.net.URLDecoder
import java.nio.charset.StandardCharsets

@ExperimentalMaterialApi
@ExperimentalTextApi
Expand All @@ -98,7 +100,8 @@ import me.knighthat.uiType
fun SearchResultScreen(
navController: NavController,
playerEssential: @Composable () -> Unit = {},
query: String, onSearchAgain: () -> Unit
query: String,
onSearchAgain: () -> Unit
) {
val context = LocalContext.current
val binder = LocalPlayerServiceBinder.current
Expand All @@ -122,7 +125,7 @@ fun SearchResultScreen(
host {
val headerContent: @Composable (textButton: (@Composable () -> Unit)?) -> Unit = {
Header(
title = query,
title = URLDecoder.decode( query, StandardCharsets.UTF_8.toString() ),
modifier = Modifier
.pointerInput(Unit) {
detectTapGestures {
Expand Down

0 comments on commit cb2123d

Please sign in to comment.