flex3r/DankChat

No messages are shown when resuming app

itsnotoger opened this issue ยท 4 comments

As promised in #322 (comment)_
I have some further information.

This is indeed a separate issue from the one of missed messages due to disconnection.
After that got fixed, this improved maybe 20% of the issues I was having.

I still don't know what the issue is. I have a Samsung phone, where I put DankChat into "never sleeping apps". This was the only setting I could find at a glance to prevent battery saving optimizations and such.

The pattern remains:

  • If I kill the app and open it fresh, it always works
  • If the app was opened ~recently, it almost always works (recently being sometimes as short as ~10 minutes, but more often the issue doesn't happen after a longer time)
  • If I open the app after a day, it is guaranteed to not display any messages. It will open blank, show the message "logging in", and then no messages are shown.

The app is completely blank when resumed, no disconnection messages are shown. Maybe the messages are cleared due to some constraints (memory?), without ever disconnecting. Maybe the app is still somehow suspended, and the OS just doesn't give me a way to disable that.

I think I mentioned it in the other issue, but one way to solve it would be to hook onto the "logging in" lifecycle and test if the message log is empty and then force a loading of history.

flex3r commented

This sounds like an issue I experienced on an older Samsung Galaxy S10 as well. Essentially the system will kill the connection that DankChat uses without properly telling the app that it did. Samsung is very aggressive with it's battery restrictions, as mentioned here: https://dontkillmyapp.com/samsung For most of these restrictions there is no good way of disabling, unfortunately.

I already do a check in DankChat if the connection to Twitch is still there or if it needs to reconnect. If a reconnect is needed it would also load the history.
Unfortunately in this case, the system killed the connection but DankChat still thinks it is connected since it did not receive the appropiate "disconnect" event.

Your solution unfortunately is not as easy as you think it is and will be very hard and "hacky" to get right, especially since it is a restriction that is very likely only in place for Samsung devices.
At the time I don't have much time to work on the app either and I have to trade off working on new features and these kind of issues, so it might be a while until I can tackle this one.

Some questions that come to my mind:

  • I assume you can't write messages when this blank chat state happens?
  • Can you manually reconnect via the "three dots" menu (More -> Reconnect)?
  • How much of an issue is this really? If you say that most of the time it "doesn't happen after a longer time", is it really worth the effort to try and fix this via a "hacky" workaround?

Some questions that come to my mind:

  • I assume you can't write messages when this blank chat state happens?
  • Can you manually reconnect via the "three dots" menu (More -> Reconnect)?

Sorry for the confusion, but the state where it's blank is only briefly. After it shows the "logging in" message, that succeeds. Everything works as normal, I can write messages, I can see messages. It's just that no previous messages of any kind are shown (that includes history service and live-received messages, as well as system messages such as disconnects).

My phone is a Samsung S21 FE, for some additional context.

  • How much of an issue is this really? If you say that most of the time it "doesn't happen after a longer time", is it really worth the effort to try and fix this via a "hacky" workaround?

If we zoom out far, it is not much of an issue for me, mostly because I don't use the app that much. But the reason I don't use the app much, is partly because it takes so many actions just to check if there are new messages, which there might not even be any.
After the other fix to disconnects, I found myself using the app more often already, but that has subsided again, after realizing it hasn't improved that much. A quick glance at messages is ~5 swipes of effort. (Open, realize it's not working, open background apps, close the app, exit background apps, open the app.)
If I were to try hard, I would not even open the app, and instead close it from background apps without even checking if it's broken. That would save me 1 swipe. (I do that occasionally.)

How often does the issue occur: It's like 90% of the times I use the app, but that's due to me using the app mostly with large time pauses.

I usually end up waiting for the next time I pass by my desktop instead, checking messages there. This is not the same result though, as this leads me to interact less with Twitch chat in total.
If I did have a well-working phone app, I may also skip desktop usage entirely, since DankChat ends up always using high CPU for me (~17% total CPU).

So in summary, I would say the issue does break the experience for me, however, it's not as though I depend on it. I would use the app more if it's there, but if not, it's also okay. I would say it's reasonable to prioritize other issues first, given that nobody else has complained about it yet.

flex3r commented

That makes sense. If I have the time I will try to reproduce this on my Samsung device I still have laying around.
If I find a workaround that might work I will come back to this issue with something like a test version and it would be nice if you could give that version a try for some time ๐Ÿ‘Œ

That makes sense. If I have the time I will try to reproduce this on my Samsung device I still have laying around. If I find a workaround that might work I will come back to this issue with something like a test version and it would be nice if you could give that version a try for some time ๐Ÿ‘Œ

What about adding something like this to the app? We could request this from the device and then toggle to enable this for the app maybe
https://stackoverflow.com/questions/39256501/check-if-battery-optimization-is-enabled-or-not-for-an-app/54982071#54982071