RedReader icon indicating copy to clipboard operation
RedReader copied to clipboard

Remember collapsed state of self-text

Open Cguy7777 opened this issue 2 years ago • 1 comments

This should be good to go, but I suggest double checking this one particularly; there's work in part of the codebase I'm less familiar with.

Closes #937.

Cguy7777 avatar Jul 15 '23 09:07 Cguy7777

Thank you for this @Cguy7777! Unfortunately there's a slight issue in that this changes the on-disk data format of the change data, which means the initial read fails when the app starts:

Initial read failed
java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:205)
at java.io.DataInputStream.readUTF(DataInputStream.java:611)
at java.io.DataInputStream.readUTF(DataInputStream.java:566)
at org.quantumbadger.redreader.reddit.prepared.RedditChangeDataManager.readAllUsers(RedditChangeDataManager.java:161)
at org.quantumbadger.redreader.io.RedditChangeDataIO.runInitialReadInThisThread(RedditChangeDataIO.java:216)
at org.quantumbadger.redreader.RedReader$onCreate$2.run(RedReader.kt:73)

(this is because Entry tries to read an extra boolean field when it doesn't exist)

I think the cleanest solution to this is to change RedditChangeDataIO.DB_VERSION to 2, and have RedditChangeDataIO pass the detected database version number into RedditChangeDataManager.readAllUsers(), which can in turn pass the version to the Entry constructor. Entry can then choose whether or not to read the field depending on the version. The if(DB_VERSION != version) check will also need to be changed or removed.

QuantumBadger avatar Sep 24 '23 12:09 QuantumBadger

Closing for now due to inactivity, but if this was fixed I'd be happy to merge.

QuantumBadger avatar Mar 24 '24 14:03 QuantumBadger