Skip to content

Commit

Permalink
Merge pull request #1251 from da-batt/fix-1247
Browse files Browse the repository at this point in the history
Fix #1247
  • Loading branch information
z-huang authored Aug 4, 2024
2 parents ff2ecdc + f6c95d4 commit 0dbeb20
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions app/src/main/java/com/zionhuang/music/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.net.URLDecoder
import java.net.URLEncoder
import javax.inject.Inject

Expand Down Expand Up @@ -293,7 +292,7 @@ class MainActivity : ComponentActivity() {
LaunchedEffect(navBackStackEntry) {
if (navBackStackEntry?.destination?.route?.startsWith("search/") == true) {
val searchQuery = withContext(Dispatchers.IO) {
URLDecoder.decode(navBackStackEntry?.arguments?.getString("query")!!, "UTF-8")
navBackStackEntry?.arguments?.getString("query")!!
}
onQueryChange(TextFieldValue(searchQuery, TextRange(searchQuery.length)))
} else if (navigationItems.fastAny { it.route == navBackStackEntry?.destination?.route }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ import com.zionhuang.music.utils.reportException
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import java.net.URLDecoder
import javax.inject.Inject

@HiltViewModel
class OnlineSearchViewModel @Inject constructor(
savedStateHandle: SavedStateHandle,
) : ViewModel() {
val query = URLDecoder.decode(savedStateHandle.get<String>("query")!!, "UTF-8")!!
val query = savedStateHandle.get<String>("query")!!
val filter = MutableStateFlow<YouTube.SearchFilter?>(null)
var summaryPage by mutableStateOf<SearchSummaryPage?>(null)
val viewStateMap = mutableStateMapOf<String, ItemsPage?>()
Expand Down

0 comments on commit 0dbeb20

Please sign in to comment.