We are temporary hiding the kiwixServer feature from Custom Apps.

* Since we are now using fd (FileDescriptor) to read the zim file from the asset folder. Currently, 'KiwixServer' is unable to host zim files via fd. This feature is temporarily hidden for custom apps. We will re-enable it for custom apps once the issue is resolved.
This commit is contained in:
MohitMali 2023-11-06 15:58:36 +05:30 committed by Kelson
parent bdb00d7aae
commit 8b1cb8bc7e
2 changed files with 12 additions and 1 deletions

View File

@ -49,6 +49,7 @@ import org.kiwix.kiwixmobile.core.base.BaseFragment
import org.kiwix.kiwixmobile.core.databinding.ActivityZimHostBinding
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.cachedComponent
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.hasNotificationPermission
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.isCustomApp
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.requestNotificationPermission
import org.kiwix.kiwixmobile.core.extensions.toast
import org.kiwix.kiwixmobile.core.navigateToAppSettings
@ -483,7 +484,7 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
@Suppress("NestedBlockDepth")
override fun addBooks(books: List<BooksOnDiskListItem>) {
// Check if this is the app module, as custom apps may have multiple package names
if (requireActivity().packageName == "org.kiwix.kiwixmobile") {
if (!requireActivity().isCustomApp()) {
booksAdapter.items = books
} else {
val updatedBooksList: MutableList<BooksOnDiskListItem> = arrayListOf()

View File

@ -95,6 +95,16 @@ class CustomMainActivity : CoreMainActivity() {
override fun setupDrawerToggle(toolbar: Toolbar) {
super.setupDrawerToggle(toolbar)
activityCustomMainBinding.drawerNavView.apply {
/**
* Hide the 'ZimHostFragment' option from the navigation menu
* because we are now using fd (FileDescriptor)
* to read the zim file from the asset folder. Currently,
* 'KiwixServer' is unable to host zim files via fd.
* This feature is temporarily hidden for custom apps.
* We will re-enable it for custom apps once the issue is resolved.
* For more info see https://github.com/kiwix/kiwix-android/pull/3516
*/
menu.findItem(R.id.menu_host_books)?.isVisible = false
setNavigationItemSelectedListener { item ->
closeNavigationDrawer()
onNavigationItemSelected(item)