Fulguris
Fulguris copied to clipboard
Exporting/Importing the history
Once this PR is fully done exporting and importing the history should be easily possible.
I've opened this draft PR so this functionality hopefully gets added to the official version (when finished and thoroughly tested) as I lost a lot of tabs lately because I didn't know about issue #193 and hope to recover at least some of them through the history, additionally this serves to get some feedback, as while this should work without problems I've never worked with Kotlin before so I'm missing the experience for this language.
Also I've got a question regarding the importing of the history, should the user be asked if they want to append the history or replace it, or should it just always be replaced (with a warning of course)?
Thanks in advance!
@Cook-I-T Sorry you fell victim of #193. We really ought to fix it at some point.
hope to recover at least some of them through the history
You should be able to do that without import or export right? Just go to history and open the pages you want, done. You could also save the history page as PDF through the print option and refer to it later.
Also I've got a question regarding the importing of the history, should the user be asked if they want to append the history or replace it, or should it just always be replaced (with a warning of course)?
Not sure why user would want to import history.
Apologize if my comments feel dismissive of your contribution. I think it's awesome that you try to solve your issue by going into the code 🥳That's what open source is all about. I'm also not saying I don't want to merge that functionality in one form or another. Just trying to have an open mind about it that's all. So the first step is to put my product architect hat on ask myself do we need that new functionality or is it just going to add more bloat to an already bloated product? 😁
You should be able to do that without import or export right? Just go to history and open the pages you want, done. You could also save the history page as PDF through the print option and refer to it later.
Well some of the tabs haven't been loaded in... quite some time so being limited to seeing the last 100 entries in the history is not enough... yeah I really shouldn't have such a backlog of stuff in the first place but that's a bad habit I ain't gonna loose anytime soon XD
Not sure why user would want to import history.
Yeah I thought about asking if such a feature would be needed, but then decided not to. My thought behind that was that it would allow users to export their stuff and save it as a backup in case something happens and also allow easy transfer to a new phone. And as there is already a bookmark export and import function I though also allowing to import the history back would make sense. Also you said "History backup and restore." yourself in #123 ;)
So I'm happy to try to also implement importing the history (by sticking to what importing bookmarks does once I figure out how to create dialog boxes) as I'd say it's useful enough to warrant it's inclusion.
so being limited to seeing the last 100 entries in the history is not enough
How do you export more than the last 100 entries? Can you tap in the actual WebView history?
So I'm happy to try to also implement importing the tabs
Not sure what you mean by that. You know you can backup your sessions right?
Not sure what you mean by that. You know you can backup your sessions right?
Sorry mistyped I meant history not tabs, changed it. That's what I would've done regularly if I had known of #193 XD
How do you export more than the last 100 entries? Can you tap in the actual WebView history?
I get the history directly from the database it gets written to, using a copy of (the seemingly unused) getAllHistoryEntries() function which returns a list inside a single via the getAllHistoryEntriesAsSingle() interface. The export functionality of my fork is already fully working if you want to test it. I've attached a sample export of me clicking wildly through wikipedia and I do indeed get more than 100 entries: FulgurisHistory-2023-03-25-(21_58_21).txt ~Forgot to change the extension to .json but that's already fixed.~ ~It seems to still attach .txt at the end, have to look deeper into that.~ Fixed. :)
So, importing is now fully implemented and working (but untested at the moment), now the question remains if I should add a dialog before that to allow the user to choose between deleting their history before importing it or not.
Currently it gets deleted in the same transaction as it gets imported, which should prevent it from being completely deleted should something go wrong. With an if statement in there I could prevent the deletion, the only question is how do I access a bool set at BackupSettingsFragment from HistoryDatabase? This is where I lack the deeper knowledge on what Kotlin offers for solving that (or if there even is an elegant solution).
I'd say it's not that important as the history can always get combined outside of Fulguris if really needed (one simple ctrl+c & ctrl+v) but some warning for the user would be nice. Perhaps name it "Replace current history with backup" or something along those lines?
For now I would not delete the history while importing. User could still do that through the settings before importing.
That's what I would've done regularly if I had known of #193 XD
You can also just save a copy of your session without exporting it.
So import should now be fully functional. I renamed the Import option to "Add history from backup" as I hope that reflects enough about what it does to the user.
Now the question is if I should replace the already existing entries or just leave them and do nothing. Currently it updates them to what is in the JSON, but that could potentially make the history confusing if that page got visited later and then suddenly jumps "back in time" after the import.
@Cook-I-T Hi I'm really looking forward to this feature when will you do it? 🙃
@Cook-I-T Hi I'm really looking forward to this feature when will you do it? 🙃
Hey, sorry for my long absence, life's been too busy to work on this and now after all those months there are additionally merge conflicts to resolve which takes even more time (also I never had to deal with merge conflicts before so I have no clue what to do, yet). Perhaps I'll find some time, some time, but until then I'd say this PR is dead unless someone else can fix&finalize it :(
Best regards Cook I.T!
Sorry about the conflicts I just did some major refactoring.