Fixed: [Bug] Pop-up Function does not work correctly (fails to automatically “detect” headword and show results).

* Fixed the scenario where "Search kiwix" on any text does not show the expected result. Because we were passing the activity's intent instead of the actual intent we are getting to open the search, which leads to unexpected results. So now we are passing the actual intent to process the request that fixes this issue.
*  Fixed one more scenario that occurred after placing this fix, where one more instance is created of the search screen because the activity has the intent with this type, and we are processing this intent in our `onViewCreated` for the scenario where our application launched(it is not running in the background). So when we close the search screen for then our `onViewCreated` method is called, and the activity has the intent so it creates one more search instance. So to fix this issue we are setting both intents as null after using them.
This commit is contained in:
MohitMaliFtechiz 2024-02-29 16:11:52 +05:30 committed by Kelson
parent a53e86e027
commit 0a8735cbb1
2 changed files with 6 additions and 1 deletions

View File

@ -291,7 +291,7 @@ class KiwixReaderFragment : CoreReaderFragment() {
intent: Intent,
activity: AppCompatActivity
): Super {
super.onNewIntent(activity.intent, activity)
super.onNewIntent(intent, activity)
intent.data?.let {
when (it.scheme) {
"file" -> openZimFile(it.toFile())

View File

@ -1753,21 +1753,26 @@ abstract class CoreReaderFragment :
goToSearchWithText(intent)
// see https://github.com/kiwix/kiwix-android/issues/2607
intent.action = null
// if used once then clear it to avoid affecting any other functionality of the application
requireActivity().intent.action = null
}
CoreSearchWidget.TEXT_CLICKED -> {
goToSearch(false)
intent.action = null
requireActivity().intent.action = null
}
CoreSearchWidget.STAR_CLICKED -> {
goToBookmarks()
intent.action = null
requireActivity().intent.action = null
}
CoreSearchWidget.MIC_CLICKED -> {
goToSearch(true)
intent.action = null
requireActivity().intent.action = null
}
Intent.ACTION_VIEW -> if (intent.type == null ||