SimonHalvdansson / Harmonic-HN

Modern Android client for Hacker News
https://play.google.com/store/apps/details?id=com.simon.harmonichackernews
Apache License 2.0
620 stars 39 forks source link

App state is getting reset after it's been in the background for a while #129

Closed Angelore closed 11 months ago

Angelore commented 11 months ago

The issue: after the app has been in the background for a while, even if it was not killed by the system, going back to it takes you to the starting page. I have a tendency to read a part of the comment thread and then forget about it for a bit. So not only this resets the position in the comments, it sometimes makes finding the story itself hard (if you are using "Top last week" for example, and it's the next week by the time you return to it).

At first I attributed this to android being too aggressive with its battery saving measures, so I disabled them for harmonic, but alas.

I assume this can be solved with saving the current thread and position in the comments to local storage. Unfortunately, I have no experience with android development yet, so if you could point me in the right direction, I'd be grateful (and could take a swing at this).

Thank you for the app!

SimonHalvdansson commented 11 months ago

This issue is due to the app not using any sort of onSaveInstanceState logic, this was also mentioned in https://github.com/SimonHalvdansson/Harmonic-HN/issues/58 so I am closing the issue.

I myself am not too sure of how best to proceed with this. As is written in the other issue, a ViewModel setup would be ideal but might be some work.