Timeline position reset when using notifications
Detailed description
I post this because it is (always) reproducible for me, but maybe it also fixes other problems like some of the triggers posted in https://github.com/tuskyapp/Tusky/issues/3960
Steps to reproduce the problem
- Scroll to some position in the home timeline
- Get a notification
- Tap that notification which switches to the notification view (and reloads that)
- Switch to the home timeline
This reloads (refreshes completely?) the home timeline and leaves you at a random looking location.
It does not happen when the system notification is not tapped (but i. e. you switch to notifications yourself and reload them).
When doing this multiple times the new location is every time another one. Would be quite funny if it weren't a bug.
Push notifications help with step 2.
Debug information
Current develop Android 14
That probably happens because MainActivity is restarted for each notification.
When?
It does not occur (restart) if you are staying inside Tusky (not tap the system notification).
When you click the notification, it opens a new instance of MainActivity. I think. That would explain that the timeline position is lost.
When you click the notification, it opens a new instance of MainActivity. I think. That would explain that the timeline position is lost.
That would explain a lot of problem then, I guess. "Losing position on a new instance of MainActivity." Which happens rather frequently I guess. But why would it start at "some random looking position" and not the top?
I think it starts at the top of the cached timeline, and then loads new stuff above. Depending on the circumstances that may look random. But I'm not sure.