-
-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving and Restoring the Web View Navigation History Across Sessions #3996
base: main
Are you sure you want to change the base?
Conversation
Hello @MohitMaliFtechiz @kelson42 WhatsApp.Video.2024-09-19.at.11.05.05_9d0b7924.mp4But it has some cons.
On the bright side, the current approach makes sure everything is restored in order, so the navigation history stays consistent. Also, I’ve experimented with a few other approaches to reduce the restoration time, but none of them offered the same level of accuracy. It seems like there’s a trade-off between speed and ensuring the history is restored correctly. I’d appreciate your input on how we might address these challenges and any suggestions you have for further refinement of this approach |
@Saifuddin53 Thanks for your PR, and inputs. I will test and review your PR. I have fixed the detekt issue you were facing, Now, you can continue doing your work. The |
@MohitMaliDeveloper Any news? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Saifuddin53 For the restoration timing issue, I am seeing the possible solution. In the meantime can you please make these review changes?
@@ -1,7 +1,5 @@ | |||
<component name="ProjectCodeStyleConfiguration"> | |||
<code_scheme name="Project" version="173"> | |||
<option name="USE_SAME_INDENTS" value="true" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we are removing these codeStyle from our project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated changes probably
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert these changes.
import org.kiwix.kiwixmobile.core.dao.entities.PageHistoryRoomEntity | ||
|
||
@Dao | ||
abstract class PageHistoryRoomDao { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WebViewHistoryRoomDao
would be a better name for this Dao.
import org.kiwix.kiwixmobile.core.page.history.adapter.PageHistoryItem | ||
|
||
@Entity | ||
data class PageHistoryRoomEntity( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WebViewHistoryEntity
would be a better name for this entity class.
@@ -51,4 +53,8 @@ interface DataSource { | |||
fun saveNote(noteListItem: NoteListItem): Completable | |||
fun deleteNote(noteTitle: String): Completable | |||
fun deleteNotes(noteList: List<NoteListItem>): Completable | |||
|
|||
fun insertPageHistoryItem(pageHistory: PageHistoryItem): Completable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming conventions are not good for these methods. It sounds like it is for getting the page history but which page history? These methods names should be:
insertWebViewHistoryItem()
getAllWebViewPagesHistory()
clearWebViewPagesHistory()
@@ -1,111 +0,0 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we are removing this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated changes
@@ -1,8 +1,4 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- Authors: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not commit this file, it is automatically updated at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these files are automatically updated when I have committed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, these tarask, and tarask+old files are automatically generated while the build task is ongoing. Please do not push these changes as these are automatically done via Gradle.
@@ -68,11 +73,32 @@ class MainRepositoryActions @Inject constructor(private val dataSource: DataSour | |||
.subscribe({}, { e -> Log.e(TAG, "Unable to save book", e) }) | |||
} | |||
|
|||
fun savePageHistory(pageHistory: PageHistoryItem) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for these methods.
|
||
import org.kiwix.kiwixmobile.core.dao.entities.PageHistoryRoomEntity | ||
|
||
data class PageHistoryItem( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name should be WebViewHistoryItem
.
Fixes #398
Still in development
How It Works:
Screenshots