From 89cb10385b19ac2fa820706a059cba02c1a7ac6d Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Mon, 24 Nov 2025 14:58:52 +0530 Subject: [PATCH 1/3] Fixed: Bookmarks for current books are not showing. * The bookmarks toggle is not showing that current page is bookmarked or not when we opens the ZIM file in custom app, and go into setting and came back to reader. --- .../core/main/reader/CoreReaderFragment.kt | 45 +++++++++++++------ 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/main/reader/CoreReaderFragment.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/main/reader/CoreReaderFragment.kt index 7d0a3cacb7..a9132d87af 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/main/reader/CoreReaderFragment.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/main/reader/CoreReaderFragment.kt @@ -1640,23 +1640,35 @@ abstract class CoreReaderFragment : protected fun setUpBookmarks(zimFileReader: ZimFileReader) { if (!isAdded) return - safelyCancelBookmarkJob() - val zimFileReaderId = zimFileReader.id - bookmarkingJob = viewLifecycleOwner.lifecycleScope.launch { - combine( - libkiwixBookmarks?.bookmarkUrlsForCurrentBook(zimFileReaderId) ?: emptyFlow(), - webUrlsFlow, - List::contains - ).collect { isBookmarked -> - this@CoreReaderFragment.isBookmarked = isBookmarked - readerScreenState.update { - copy( - bookmarkButtonItem = bookmarkButtonItem.copy(third = getBookMarkButtonIcon(isBookmarked)) - ) + runCatching { + safelyCancelBookmarkJob() + val zimFileReaderId = zimFileReader.id + bookmarkingJob = viewLifecycleOwner.lifecycleScope.launch { + combine( + libkiwixBookmarks?.bookmarkUrlsForCurrentBook(zimFileReaderId) ?: emptyFlow(), + webUrlsFlow, + List::contains + ).collect { isBookmarked -> + this@CoreReaderFragment.isBookmarked = isBookmarked + readerScreenState.update { + copy( + bookmarkButtonItem = bookmarkButtonItem.copy( + third = getBookMarkButtonIcon(isBookmarked) + ) + ) + } } } + updateUrlFlow() + }.onFailure { + // Since everything runs on the IO thread, cancelling the ongoing job when the fragment + // detaches from the window may take some time. To avoid crashes during this transition, + // we safely catch and log any exceptions that occur. + Log.e( + TAG_KIWIX, + "Could not set up the bookmark flow. Original exception $it" + ) } - updateUrlFlow() } private fun getBookMarkButtonIcon(isBookmarked: Boolean) = @@ -2454,6 +2466,11 @@ abstract class CoreReaderFragment : currentTab, restoreOrigin ) { + // Set up the bookmark for the currently opened book after all pages are restored. + // This is especially important for custom apps, where the ZIM file is now loaded + // only if it's not already open in the reader. So when the user navigates to another + // screen and returns, we ensure the bookmark is restored correctly. + zimReaderContainer?.zimFileReader?.let(::setUpBookmarks) // This lambda is executed after the tabs have been restored. It checks if there is a // search item to open. If `searchItemToOpen` is not null, it calls `openSearchItem` // to open the specified item, then sets `searchItemToOpen` to null to prevent From 05766021753c67d1e441e39c5f0c55c20843f761 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Mon, 24 Nov 2025 15:57:48 +0530 Subject: [PATCH 2/3] Added the `testBookmarkToggleForCurrentPages` UI test case to ensure this scenario is properly validated and to prevent similar issues in the future. --- .../page/bookmarks/BookmarksRobot.kt | 14 +++++++++ .../page/bookmarks/LibkiwixBookmarkTest.kt | 31 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/BookmarksRobot.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/BookmarksRobot.kt index 2e1b0f4a22..082814a08d 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/BookmarksRobot.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/BookmarksRobot.kt @@ -18,6 +18,7 @@ package org.kiwix.kiwixmobile.page.bookmarks +import androidx.compose.ui.test.assertIsEnabled import androidx.compose.ui.test.assertTextEquals import androidx.compose.ui.test.hasText import androidx.compose.ui.test.isDisplayed @@ -263,4 +264,17 @@ class BookmarksRobot : BaseRobot() { } }) } + + fun assertCurrentPageIsBookmarked(composeTestRule: ComposeContentTestRule) { + composeTestRule.apply { + waitForIdle() + waitUntilTimeout() + waitUntil(TEST_PAUSE_MS_FOR_DOWNLOAD_TEST.toLong()) { + onNodeWithTag(READER_BOTTOM_BAR_BOOKMARK_BUTTON_TESTING_TAG).isDisplayed() + } + composeTestRule + .onNodeWithTag(READER_BOTTOM_BAR_BOOKMARK_BUTTON_TESTING_TAG) + .assertIsEnabled() + } + } } diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/LibkiwixBookmarkTest.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/LibkiwixBookmarkTest.kt index 5ffaa24107..a65f73e610 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/LibkiwixBookmarkTest.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/LibkiwixBookmarkTest.kt @@ -247,6 +247,37 @@ class LibkiwixBookmarkTest : BaseActivityTest() { } } + @Test + fun testBookmarkToggleForCurrentPages() { + // Test the scenario where bookmark toggle shows the current opened page is bookmarked or not. + openZimFileInReader() + bookmarks { + openBookmarkScreen(kiwixMainActivity as CoreMainActivity, composeTestRule) + clickOnTrashIcon(composeTestRule) + assertDeleteBookmarksDialogDisplayed(composeTestRule) + clickOnDeleteButton(composeTestRule) + assertNoBookMarkTextDisplayed(composeTestRule) + pressBack() + waitComposeToSettleViews() + assertZimFileLoadedIntoTheReader(composeTestRule) + clickOnAndroidArticle(composeTestRule) + waitComposeToSettleViews() + assertAndroidArticleLoadedInReader(composeTestRule) + waitComposeToSettleViews() + // Save bookmark + clickOnSaveBookmarkImage(composeTestRule) + topLevel { + // open settings screen + clickSettingsOnSideNav(kiwixMainActivity as CoreMainActivity, composeTestRule, true) { + pressBack() + waitComposeToSettleViews() + assertZimFileLoadedIntoTheReader(composeTestRule) + assertCurrentPageIsBookmarked(composeTestRule) + } + } + } + } + private fun openZimFileInReader() { val zimFile = getZimFile() composeTestRule.apply { From 2224d7eef2548477d140482634a538ffcfbbe41c Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Mon, 24 Nov 2025 21:19:28 +0530 Subject: [PATCH 3/3] Enhanced the `LibkiwixBookmarkTest` to test all scenarios for bookmarks. --- .../page/bookmarks/BookmarksRobot.kt | 36 ++-- .../page/bookmarks/LibkiwixBookmarkTest.kt | 185 +++++++++--------- .../kiwix/kiwixmobile/testutils/TestUtils.kt | 1 + .../core/main/reader/CoreReaderFragment.kt | 4 + 4 files changed, 115 insertions(+), 111 deletions(-) diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/BookmarksRobot.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/BookmarksRobot.kt index 082814a08d..8d127e54bb 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/BookmarksRobot.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/BookmarksRobot.kt @@ -18,7 +18,6 @@ package org.kiwix.kiwixmobile.page.bookmarks -import androidx.compose.ui.test.assertIsEnabled import androidx.compose.ui.test.assertTextEquals import androidx.compose.ui.test.hasText import androidx.compose.ui.test.isDisplayed @@ -44,6 +43,7 @@ import org.kiwix.kiwixmobile.core.R import org.kiwix.kiwixmobile.core.main.CoreMainActivity import org.kiwix.kiwixmobile.core.main.LEFT_DRAWER_BOOKMARK_ITEM_TESTING_TAG import org.kiwix.kiwixmobile.core.main.reader.READER_BOTTOM_BAR_BOOKMARK_BUTTON_TESTING_TAG +import org.kiwix.kiwixmobile.core.main.reader.READER_BOTTOM_BAR_HOME_BUTTON_TESTING_TAG import org.kiwix.kiwixmobile.core.main.reader.READER_BOTTOM_BAR_PREVIOUS_SCREEN_BUTTON_TESTING_TAG import org.kiwix.kiwixmobile.core.page.DELETE_MENU_ICON_TESTING_TAG import org.kiwix.kiwixmobile.core.page.NO_ITEMS_TEXT_TESTING_TAG @@ -152,14 +152,6 @@ class BookmarksRobot : BaseRobot() { }) } - fun assertBookmarkRemoved(composeTestRule: ComposeTestRule) { - pauseForBetterTestPerformance() - composeTestRule.apply { - waitForIdle() - composeTestRule.onNodeWithText("Test Zim").assertDoesNotExist() - } - } - private fun pauseForBetterTestPerformance() { BaristaSleepInteractions.sleep(TestUtils.TEST_PAUSE_MS_FOR_SEARCH_TEST.toLong()) } @@ -256,6 +248,19 @@ class BookmarksRobot : BaseRobot() { } } + fun clickOnHomeButton(composeTestRule: ComposeContentTestRule) { + composeTestRule.apply { + waitForIdle() + // wait for disappearing the snack-bar after removing the bookmark + waitUntilTimeout(TEST_PAUSE_MS_FOR_DOWNLOAD_TEST.toLong()) + waitUntil(TEST_PAUSE_MS_FOR_DOWNLOAD_TEST.toLong()) { + onNodeWithTag(READER_BOTTOM_BAR_HOME_BUTTON_TESTING_TAG).isDisplayed() + } + onNodeWithTag(READER_BOTTOM_BAR_HOME_BUTTON_TESTING_TAG) + .performClick() + } + } + fun openBookmarkInReader(composeTestRule: ComposeContentTestRule) { testFlakyView({ composeTestRule.apply { @@ -264,17 +269,4 @@ class BookmarksRobot : BaseRobot() { } }) } - - fun assertCurrentPageIsBookmarked(composeTestRule: ComposeContentTestRule) { - composeTestRule.apply { - waitForIdle() - waitUntilTimeout() - waitUntil(TEST_PAUSE_MS_FOR_DOWNLOAD_TEST.toLong()) { - onNodeWithTag(READER_BOTTOM_BAR_BOOKMARK_BUTTON_TESTING_TAG).isDisplayed() - } - composeTestRule - .onNodeWithTag(READER_BOTTOM_BAR_BOOKMARK_BUTTON_TESTING_TAG) - .assertIsEnabled() - } - } } diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/LibkiwixBookmarkTest.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/LibkiwixBookmarkTest.kt index a65f73e610..3eae9a38e1 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/LibkiwixBookmarkTest.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/page/bookmarks/LibkiwixBookmarkTest.kt @@ -23,6 +23,8 @@ import android.content.Context import android.content.Intent import androidx.compose.ui.test.junit4.accessibility.enableAccessibilityChecks import androidx.compose.ui.test.junit4.createAndroidComposeRule +import androidx.compose.ui.test.onNodeWithTag +import androidx.compose.ui.test.performClick import androidx.core.content.edit import androidx.core.net.toUri import androidx.navigation.NavOptions @@ -34,6 +36,7 @@ import com.google.android.apps.common.testing.accessibility.framework.Accessibil import com.google.android.apps.common.testing.accessibility.framework.checks.DuplicateClickableBoundsCheck import com.google.android.apps.common.testing.accessibility.framework.checks.SpeakableTextPresentCheck import com.google.android.apps.common.testing.accessibility.framework.integrations.espresso.AccessibilityValidator +import junit.framework.TestCase.assertEquals import kotlinx.coroutines.runBlocking import org.hamcrest.Matchers.anyOf import org.junit.Before @@ -45,6 +48,7 @@ import org.kiwix.kiwixmobile.core.main.CoreMainActivity import org.kiwix.kiwixmobile.core.main.ZIM_FILE_URI_KEY import org.kiwix.kiwixmobile.core.main.reader.CoreReaderFragment import org.kiwix.kiwixmobile.core.page.bookmark.adapter.LibkiwixBookmarkItem +import org.kiwix.kiwixmobile.core.ui.components.NAVIGATION_ICON_TESTING_TAG import org.kiwix.kiwixmobile.core.utils.LanguageUtils.Companion.handleLocaleChange import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil import org.kiwix.kiwixmobile.core.utils.TestingUtils.COMPOSE_TEST_RULE_ORDER @@ -54,6 +58,7 @@ import org.kiwix.kiwixmobile.main.topLevel import org.kiwix.kiwixmobile.testutils.RetryRule import org.kiwix.kiwixmobile.testutils.TestUtils import org.kiwix.kiwixmobile.testutils.TestUtils.TEST_PAUSE_MS_FOR_DOWNLOAD_TEST +import org.kiwix.kiwixmobile.testutils.TestUtils.TEST_PAUSE_MS_FOR_SNACKBAR import org.kiwix.kiwixmobile.testutils.TestUtils.waitUntilTimeout import org.kiwix.kiwixmobile.ui.KiwixDestination import org.kiwix.libkiwix.Book @@ -115,54 +120,6 @@ class LibkiwixBookmarkTest : BaseActivityTest() { composeTestRule.enableAccessibilityChecks(accessibilityValidator) } - @Test - fun testBookmarks() { - openZimFileInReader() - bookmarks { - // delete any bookmark if already saved to properly perform this test case. - longClickOnSaveBookmarkImage(composeTestRule) - clickOnTrashIcon(composeTestRule) - assertDeleteBookmarksDialogDisplayed(composeTestRule) - clickOnDeleteButton(composeTestRule) - assertNoBookMarkTextDisplayed(composeTestRule) - pressBack() - waitComposeToSettleViews() - // Test saving bookmark - clickOnSaveBookmarkImage(composeTestRule) - openBookmarkScreen(kiwixMainActivity as CoreMainActivity, composeTestRule) - assertBookmarkSaved(composeTestRule) - pressBack() - // Test removing bookmark - waitComposeToSettleViews() - clickOnSaveBookmarkImage(composeTestRule) - longClickOnSaveBookmarkImage(composeTestRule, TEST_PAUSE_MS_FOR_DOWNLOAD_TEST.toLong()) - assertBookmarkRemoved(composeTestRule) - pressBack() - // Save the bookmark to test whether it remains saved after the application restarts or not. - waitComposeToSettleViews() - clickOnSaveBookmarkImage(composeTestRule) - waitComposeToSettleViews() - // Close the application. - InstrumentationRegistry.getInstrumentation().uiAutomation.performGlobalAction( - AccessibilityService.GLOBAL_ACTION_HOME - ) - // wait a bit - waitComposeToSettleViews() - // reopen the application to test that book remains saved or not. - val context = ApplicationProvider.getApplicationContext() - val intent = context.packageManager.getLaunchIntentForPackage(context.packageName) - intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) - context.startActivity(intent) - InstrumentationRegistry.getInstrumentation().waitForIdleSync() - waitComposeToSettleViews() - topLevel { - clickBookmarksOnNavDrawer(kiwixMainActivity as CoreMainActivity, composeTestRule) { - assertBookmarkSaved(composeTestRule) - } - } - } - } - private fun waitComposeToSettleViews() { composeTestRule.apply { waitForIdle() @@ -170,35 +127,6 @@ class LibkiwixBookmarkTest : BaseActivityTest() { } } - @Test - fun testBookMarkPageOpenInReader() { - openZimFileInReader() - bookmarks { - openBookmarkScreen(kiwixMainActivity as CoreMainActivity, composeTestRule) - clickOnTrashIcon(composeTestRule) - assertDeleteBookmarksDialogDisplayed(composeTestRule) - clickOnDeleteButton(composeTestRule) - assertNoBookMarkTextDisplayed(composeTestRule) - pressBack() - waitComposeToSettleViews() // to properly load the ZIM file in reader. - assertZimFileLoadedIntoTheReader(composeTestRule) - clickOnAndroidArticle(composeTestRule) - waitComposeToSettleViews() - assertAndroidArticleLoadedInReader(composeTestRule) - waitComposeToSettleViews() - // Save bookmark - clickOnSaveBookmarkImage(composeTestRule) - // open previous page - clickOnBackwardButton(composeTestRule) - // open bookmark screen. - openBookmarkScreen(kiwixMainActivity as CoreMainActivity, composeTestRule) - // tries to open the bookmark page in reader. - openBookmarkInReader(composeTestRule) - waitComposeToSettleViews() - assertAndroidArticleLoadedInReader(composeTestRule) - } - } - @Test fun testSavedBookmarksShowingOnBookmarkScreen() { openZimFileInReader() @@ -248,36 +176,115 @@ class LibkiwixBookmarkTest : BaseActivityTest() { } @Test - fun testBookmarkToggleForCurrentPages() { - // Test the scenario where bookmark toggle shows the current opened page is bookmarked or not. + fun testBookmarks() { + // Open a ZIM file and ensure the reader screen is initialized. openZimFileInReader() bookmarks { + // Ensure a clean starting state by removing any previously saved bookmarks + deletePreviouslySavedBookmarks() + + // Save current page as a bookmark + clickOnSaveBookmarkImage(composeTestRule) + waitComposeToSettleViews() + + // Verify bookmark appears in the bookmark list openBookmarkScreen(kiwixMainActivity as CoreMainActivity, composeTestRule) - clickOnTrashIcon(composeTestRule) - assertDeleteBookmarksDialogDisplayed(composeTestRule) - clickOnDeleteButton(composeTestRule) - assertNoBookMarkTextDisplayed(composeTestRule) - pressBack() + assertBookmarkSaved(composeTestRule) + waitComposeToSettleViews() + + // Open the saved bookmark from the list and verify it loads correctly in the reader + openBookmarkInReader(composeTestRule) waitComposeToSettleViews() assertZimFileLoadedIntoTheReader(composeTestRule) - clickOnAndroidArticle(composeTestRule) + + // Ensure the bookmark toggle reflects the saved state. + assertEquals(true, isBookmarked()) waitComposeToSettleViews() - assertAndroidArticleLoadedInReader(composeTestRule) + + // Remove the bookmark and verify it is removed from the reader and the bookmark list. + clickOnSaveBookmarkImage(composeTestRule) + composeTestRule.waitUntilTimeout(TEST_PAUSE_MS_FOR_SNACKBAR) + assertEquals(false, isBookmarked()) + longClickOnSaveBookmarkImage(composeTestRule, TEST_PAUSE_MS_FOR_DOWNLOAD_TEST.toLong()) + assertNoBookMarkTextDisplayed(composeTestRule) + pressBack() waitComposeToSettleViews() - // Save bookmark clickOnSaveBookmarkImage(composeTestRule) + // Verify going to other pages does not affect the saved + // bookmark(Test scenario of custom apps where ZIM file is already opened + // in reader and user navigate back to reader). topLevel { // open settings screen clickSettingsOnSideNav(kiwixMainActivity as CoreMainActivity, composeTestRule, true) { - pressBack() + composeTestRule.onNodeWithTag(NAVIGATION_ICON_TESTING_TAG).performClick() waitComposeToSettleViews() assertZimFileLoadedIntoTheReader(composeTestRule) - assertCurrentPageIsBookmarked(composeTestRule) + assertEquals(true, isBookmarked()) + } + } + + // Verify saved bookmark properly opened in reader(If some other article is opened in reader). + clickOnSaveBookmarkImage(composeTestRule) + composeTestRule.waitUntilTimeout(TEST_PAUSE_MS_FOR_SNACKBAR) + assertZimFileLoadedIntoTheReader(composeTestRule) + clickOnAndroidArticle(composeTestRule) + waitComposeToSettleViews() + assertAndroidArticleLoadedInReader(composeTestRule) + waitComposeToSettleViews() + clickOnSaveBookmarkImage(composeTestRule) + clickOnBackwardButton(composeTestRule) + openBookmarkScreen(kiwixMainActivity as CoreMainActivity, composeTestRule) + openBookmarkInReader(composeTestRule) + waitComposeToSettleViews() + assertAndroidArticleLoadedInReader(composeTestRule) + assertEquals(true, isBookmarked()) + clickOnSaveBookmarkImage(composeTestRule) + composeTestRule.waitUntilTimeout(TEST_PAUSE_MS_FOR_SNACKBAR) + + // Save again and verify bookmark persistence after app restart. + clickOnHomeButton(composeTestRule) + waitComposeToSettleViews() + clickOnSaveBookmarkImage(composeTestRule) + waitComposeToSettleViews() + InstrumentationRegistry.getInstrumentation().uiAutomation.performGlobalAction( + AccessibilityService.GLOBAL_ACTION_HOME + ) + waitComposeToSettleViews() + + val context = ApplicationProvider.getApplicationContext() + val intent = context.packageManager.getLaunchIntentForPackage(context.packageName) + intent?.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) + context.startActivity(intent) + InstrumentationRegistry.getInstrumentation().waitForIdleSync() + waitComposeToSettleViews() + assertZimFileLoadedIntoTheReader(composeTestRule) + assertEquals(true, isBookmarked()) + topLevel { + // Verify the bookmark appears in the bookmark screen. + clickBookmarksOnNavDrawer(kiwixMainActivity as CoreMainActivity, composeTestRule) { + assertBookmarkSaved(composeTestRule) } } } } + private fun isBookmarked() = kiwixMainActivity.supportFragmentManager.fragments + .filterIsInstance() + .firstOrNull() + ?.getIsBookmarked() ?: false + + private fun deletePreviouslySavedBookmarks() { + bookmarks { + openBookmarkScreen(kiwixMainActivity as CoreMainActivity, composeTestRule) + clickOnTrashIcon(composeTestRule) + assertDeleteBookmarksDialogDisplayed(composeTestRule) + clickOnDeleteButton(composeTestRule) + assertNoBookMarkTextDisplayed(composeTestRule) + pressBack() + waitComposeToSettleViews() + } + } + private fun openZimFileInReader() { val zimFile = getZimFile() composeTestRule.apply { diff --git a/app/src/androidTest/java/org/kiwix/kiwixmobile/testutils/TestUtils.kt b/app/src/androidTest/java/org/kiwix/kiwixmobile/testutils/TestUtils.kt index 498ae765e8..1e404c163a 100644 --- a/app/src/androidTest/java/org/kiwix/kiwixmobile/testutils/TestUtils.kt +++ b/app/src/androidTest/java/org/kiwix/kiwixmobile/testutils/TestUtils.kt @@ -71,6 +71,7 @@ object TestUtils { const val TEST_PAUSE_MS = 3000 const val TEST_PAUSE_MS_FOR_SEARCH_TEST = 1000 const val TEST_PAUSE_MS_FOR_DOWNLOAD_TEST = 10000 + const val TEST_PAUSE_MS_FOR_SNACKBAR = 6000L const val RETRY_COUNT_FOR_FLAKY_TEST = 3 /* diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/main/reader/CoreReaderFragment.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/main/reader/CoreReaderFragment.kt index a9132d87af..487e563dc2 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/main/reader/CoreReaderFragment.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/main/reader/CoreReaderFragment.kt @@ -49,6 +49,7 @@ import android.widget.FrameLayout import android.widget.Toast import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.contract.ActivityResultContracts +import androidx.annotation.VisibleForTesting import androidx.appcompat.app.AppCompatActivity import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Menu @@ -329,6 +330,9 @@ abstract class CoreReaderFragment : return readerLifeCycleScope } + @VisibleForTesting + fun getIsBookmarked() = isBookmarked + /** * Handles actions that require the ZIM file to be fully loaded in the reader * before opening the search screen. The search screen depends on the ZIM file,