Skip to content

Commit

Permalink
We are temporary hiding the kiwixServer feature from Custom Apps.
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
MohitMaliDeveloper authored and kelson42 committed Nov 12, 2023
1 parent bdb00d7 commit 8b1cb8b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8b1cb8b

Please sign in to comment.