Add basic moderation actions, fix long-press miss bug #442
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #386 and #194
Forgive me, I've not tested this at all, I'm not a mobile developer so I don't have the dev environment set up for it. (I'm willing to help test if you're able to send me an Android .apk though!)
I've been using Frosty for quite a while now, and I love it. But I've really been missing the lack of moderation actions when I use it. I figured I'd take a shot at implementing it.
I have zero Dart experience, so I heavily used Github Copilot to write the necessary changes.
I've reviewed the Twitch Helix API docs to make sure the API usage makes sense.
I assume users would need to log out and back in to get the new scopes to actually be able to get the moderation actions. I think
getModeratedChannels()
should probably return an empty list (to safely just hide the moderation actions if the scope isn't given) instead of throwing an error, but an error message should probably still be logged. I don't know the best way to handle that, so I'll leave that up to you.While I was at it, a minor bug that's been annoying me is long-pressing on a message (which I do typically to reply to someone), it would often miss if someone else types at the same time, and the long-press menu chooses the user that's under the tap after scrolling. So to fix this, we can use
GestureDetector
to pause scrolling while long pressing (and unpause at end of longpress/cancel if was autoscrolling before starting the longpress). This changes from an InkWell to a GestureDetector with an InkWell child which might have side effects (again, entirely untested!) so that needs to be tested. The child InkWell should retain the ripple effect behaviour as before. 🤞