Skip to content

Commit

Permalink
Merge pull request #6575 from Bnyro/master
Browse files Browse the repository at this point in the history
fix: can't paste channel/playlist urls to search bar
  • Loading branch information
Bnyro authored Oct 2, 2024
2 parents b5cf18f + 3df65cf commit 9e41f8a
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,11 @@ class MainActivity : BaseActivity() {
if (query.toHttpUrlOrNull() != null) {
val queryIntent = IntentHelper.resolveType(query.toUri())

if (navigateToMediaByIntent(queryIntent)) {
val didNavigate = navigateToMediaByIntent(queryIntent) {
navController.popBackStack(R.id.searchFragment, true)
searchItem.collapseActionView()
return true
}
if (didNavigate) return true
}

navController.navigate(NavDirections.showSearchResults(query))
Expand Down Expand Up @@ -502,20 +502,24 @@ class MainActivity : BaseActivity() {
*
* @return Whether the method handled the event and triggered the navigation to a new fragment
*/
fun navigateToMediaByIntent(intent: Intent): Boolean {
fun navigateToMediaByIntent(intent: Intent, actionBefore: () -> Unit = {}): Boolean {
intent.getStringExtra(IntentData.channelId)?.let {
actionBefore()
navController.navigate(NavDirections.openChannel(channelId = it))
return true
}
intent.getStringExtra(IntentData.channelName)?.let {
actionBefore()
navController.navigate(NavDirections.openChannel(channelName = it))
return true
}
intent.getStringExtra(IntentData.playlistId)?.let {
actionBefore()
navController.navigate(NavDirections.openPlaylist(playlistId = it))
return true
}
intent.getStringArrayExtra(IntentData.videoIds)?.let {
actionBefore()
ImportTempPlaylistDialog()
.apply {
arguments = bundleOf(
Expand Down

0 comments on commit 9e41f8a

Please sign in to comment.