Fixed: Kiwix now opens in the Samsung file navigator.

This commit is contained in:
MohitMaliFtechiz 2024-11-07 10:39:01 +05:30 committed by Kelson
parent 4c773e27a5
commit 071dc96c9a
2 changed files with 9 additions and 4 deletions

View File

@ -28,7 +28,7 @@
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTop"
android:launchMode="singleInstance"
android:theme="@style/KiwixTheme.Launcher"
android:windowSoftInputMode="adjustPan">

View File

@ -117,9 +117,6 @@ class KiwixMainActivity : CoreMainActivity() {
super.onCreate(savedInstanceState)
activityKiwixMainBinding = ActivityKiwixMainBinding.inflate(layoutInflater)
setContentView(activityKiwixMainBinding.root)
if (intent.action == "GET_CONTENT") {
navigate(R.id.downloadsFragment)
}
navController.addOnDestinationChangedListener(finishActionModeOnDestinationChange)
activityKiwixMainBinding.drawerNavView.setupWithNavController(navController)
@ -130,6 +127,7 @@ class KiwixMainActivity : CoreMainActivity() {
activityKiwixMainBinding.bottomNavView.setupWithNavController(navController)
migrateInternalToPublicAppDirectory()
handleZimFileIntent(intent)
handleGetContentIntent(intent)
}
private fun migrateInternalToPublicAppDirectory() {
@ -220,11 +218,18 @@ class KiwixMainActivity : CoreMainActivity() {
super.onNewIntent(intent)
handleNotificationIntent(intent)
handleZimFileIntent(intent)
handleGetContentIntent(intent)
supportFragmentManager.fragments.filterIsInstance<FragmentActivityExtensions>().forEach {
it.onNewIntent(intent, this)
}
}
private fun handleGetContentIntent(intent: Intent?) {
if (intent?.action == ACTION_GET_CONTENT) {
navigate(R.id.downloadsFragment)
}
}
private fun handleZimFileIntent(intent: Intent?) {
intent?.data?.let {
when (it.scheme) {