mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
Improved the saving of tabs
history.
* Fixed: `testPreviouslyLoadedArticleLoadsAgainWhenSwitchingToAnotherScreen` which sometimes failing on API level 33.
This commit is contained in:
parent
1824390703
commit
f8a339624a
@ -2232,10 +2232,6 @@ abstract class CoreReaderFragment :
|
||||
private fun saveTabStates(onComplete: () -> Unit = {}) {
|
||||
CoroutineScope(Dispatchers.Main).launch {
|
||||
savingTabsMutex.withLock {
|
||||
// clear the previous history saved in database
|
||||
withContext(Dispatchers.IO) {
|
||||
repositoryActions?.clearWebViewPageHistory()
|
||||
}
|
||||
val coreApp = sharedPreferenceUtil?.context as CoreApp
|
||||
val settings = coreApp.getSharedPreferences(
|
||||
SharedPreferenceUtil.PREF_KIWIX_MOBILE,
|
||||
@ -2247,6 +2243,9 @@ abstract class CoreReaderFragment :
|
||||
getWebViewHistoryEntity(view, index)?.let(webViewHistoryEntityList::add)
|
||||
}
|
||||
withContext(Dispatchers.IO) {
|
||||
// clear the previous history saved in database
|
||||
repositoryActions?.clearWebViewPageHistory()
|
||||
// Store new history in database.
|
||||
repositoryActions?.saveWebViewPageHistory(webViewHistoryEntityList)
|
||||
}
|
||||
settings.edit {
|
||||
|
@ -299,7 +299,9 @@ class SearchFragmentTestForCustomApp {
|
||||
clickOnHomeButton(composeTestRule)
|
||||
// click on an article to load the other page.
|
||||
clickOnAFoolForYouArticle(composeTestRule)
|
||||
composeTestRule.mainClock.advanceTimeByFrame()
|
||||
assertAFoolForYouArticleLoaded(composeTestRule)
|
||||
composeTestRule.waitUntilTimeout()
|
||||
// open note screen.
|
||||
openNoteFragment(customMainActivity as CoreMainActivity, composeTestRule)
|
||||
composeTestRule.waitUntilTimeout()
|
||||
|
Loading…
x
Reference in New Issue
Block a user