-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-generate Lemmy-API types. #657
Conversation
- Also added ApiState to represent 4 API states: - Empty, Loading, Fail, and Success - Still needs testing
@twizmwazin mmk tests are passing, apologies for CI issues again... woodpecker is supposed to do a release in a few days. If there's anything you want me to describe, lmk, cause I realize this one's massive. But it does need to get merged before any other ones do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I left a few comments here and there, mostly for my own curiosity.
defaultListingType = form.default_listing_type ?: account.defaultListingType, | ||
defaultSortType = form.default_sort_type ?: account.defaultSortType, | ||
defaultListingType = form.default_listing_type?.ordinal ?: account.defaultListingType, | ||
defaultSortType = form.default_sort_type ?.ordinal ?: account.defaultSortType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space before ?.ordinal
, odd that the formatter didn't catch it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's weird, I got it now.
Ok, I did some testing and found a crash here (mark an inbox message as read):
comment_view is null Edit: The crash is because the server is responding with Edit: #711 fixes this. |
Related: when I reply to inbox messages, I can't enter text, but I can submit empty replies. https://voyager.lemmy.ml/comment/151 I can reply to comments, so I can go to the link then reply there. It looks like doing this lets me mark as read. Edit: #715 fixes this. |
app/src/main/java/com/jerboa/ui/components/comment/edit/CommentEditViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/jerboa/ui/components/comment/reply/CommentReplyActivity.kt
Outdated
Show resolved
Hide resolved
The issue was caused by the activity checking for a completed request in the PostViewModel. However, since this activity was triggered by the inbox, that request was never made. The only data it needed was whether the user was a moderator, so I pass that information in with the deep link. In all cases we had enough information in the navigating activity to determine this, with the exception of the inbox, but we don't mark moderators in the inbox (at least lemmy-ui doesn't). This is a little bit of a hack, but it's a relatively clean hack.
This isn't perfect of course, and I'm sure we'll find more bugs that I introduced later on :(, but I'll get it merged as it needs to be here for |
Special thanks to @beatgammit for finding and fixing these bugs. |
No worries, glad to see this get merged. 😄 |
Okay this took weeks, but its ready to go. Changes:
./copy_generated_types_from_lemmy_js_client.sh
, wherelemmy-js-client
can be on any branch / API version you want to develop for.ApiState
, with 4 states: Empty, Loading, Success(data), and Failed(message). This makes handling Api states much more predictable, and catchable.Notes:
0.18.0
:0.18.0
sometime next week 🤞 , but you can test this version of jerboa using https://voyager.lemmy.ml .0.17
lemmy versions won't work. The user's default sort and listing types, as well as the API calls, actually use their enums now, and not strings. This is a breaking change that means users will not be able to log in with0.17.0
versions. I'll create arelease/v0.17
branch that people can cherry pick to, if they really need to test logins on old versions.SiteRes.Taglines
is no longer optional: if empty, it will always be an empty list, rather than non-existent. I've allowed this to fail softly in code.I had to deal with some pretty hairy merge conflicts with main, so I apologize if things got wiped out.