Skip to content

Commit

Permalink
Fixed: Kiwix now opens in the Samsung file navigator.
Browse files Browse the repository at this point in the history
  • Loading branch information
MohitMaliDeveloper authored and kelson42 committed Nov 7, 2024
1 parent 4c773e2 commit 071dc96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -130,6 +127,7 @@ class KiwixMainActivity : CoreMainActivity() {
activityKiwixMainBinding.bottomNavView.setupWithNavController(navController)
migrateInternalToPublicAppDirectory()
handleZimFileIntent(intent)
handleGetContentIntent(intent)
}

private fun migrateInternalToPublicAppDirectory() {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 071dc96

Please sign in to comment.