-
-
Notifications
You must be signed in to change notification settings - Fork 387
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
Add EventHub, add fav, reblog events, improve timelines #562
Conversation
I like your initative on this <3 We definitely need something like this and might as well do it with RxJava. Regarding your current code: when liking/boosting, Please use Kotlin Android Extensions instead of And can you merge master back in please? I would really like it if you continue to work on this! |
Thanks for review! 🙇 |
} else if (event instanceof ReblogEvent) { | ||
handleReblogEvent((ReblogEvent) event); | ||
} | ||
if (event instanceof BlockEvent) { |
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.
oops, missing else
here
Something is still wrong with boosted toots, needs more love, sigh |
Updating threads after reply is buggy too. |
I didn't find the bug with boosts bug I've fixed things with inserting new toots in threads and only in specific timelines. I'm not sure if we should insert "load more" in profiles because it doesn't seem to work there. Otherwise it should be good. I've spent half a day trying to make Robolectric work but I've stumbled upon couple of bugs so I give up. It doesn't worth trying to make it work until we refactor logic into separate entity. |
It crashed for me when the app did unload and then i tooted |
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 is awesome and works really well! Will continue testing.
When I post a status, it always shows a "load more" below the new status, but usually does not load anything when clicking there? It might be better to send a fetch timeline request instead of inserting the placeholder?
@@ -169,6 +170,8 @@ | |||
public MastodonApi mastodonApi; | |||
@Inject | |||
public AccountManager accountManager; | |||
@Inject |
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.
yes, more injecting 😎
@@ -91,6 +94,8 @@ | |||
public AccountManager accountManager; | |||
@Inject | |||
public DispatchingAndroidInjector<Fragment> dispatchingAndroidInjector; | |||
@Inject | |||
public AppStore appstore; |
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.
Is there a better name for this? It just reminds me so much of fdroid/google play 🙈
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.
It's a Redux/Flux terminology to name such a thing Store. Can rename to GlobalStore or something
About load more: the way we do it now will make timeline move on fetch result and it's very annoying to lose your postiion in timeline when you reply to someone. Do you have any idea how to fix this? |
I think in |
But we have to calculate what we inserted then because we may not have loaded anything? |
Anyway, @connyduck , if you insist we should actually refresh timeline on every post, I can try to make it work. It's kinda wasteful IMO but I see UX value in this. |
I do not think its wasteful, the UX improvement is huge. |
I've made some progress on it. |
I've stumbled upon some super weird bug, adding spinner as the last item crashes app with inconsistency exception. Will look at it tomorrow |
I've figured out the crash, it was a race condition because I used AsyncListDiffer incorrectly. |
Fix infinite loading. Remove spinner correctly. Don't refresh timeline without need.
I think that's it. It's a much bigger PR than I wanted but IMO it feels much better. |
Works like a charm and code is way cleaner - really awesome work One thing that personally bugs me with timelines is, when pulling down to refresh, it always jumps to the top instead of just scrolling down a little bit, enough to see that something new has loaded. The Twitter app does this really good. But we should probably handle this in a new pull request? |
Cool, thanks for the review |
ok you can merge this PR :) |
Okay, let's hope you tested it properly 😉 |
* Add AppStore, add fav, reblog events * Add events, add handling to Timeline * Add event handling to Notifications * Mostly finish events * Fix unsubscribing * Cleanup timeline * Fix newStatusEvent in thread, fix deleteEvent * Insert new toots only in specific timelines * Add missing else * Rename AppStore to EventHub * Fix tests * Use DiffUtils for timeline * Fix empty timeline bug. Improve loading placeholder * Fix AsyncListDiff, loading indicator, "load more" * Timeline fixes & improvements. Fix infinite loading. Remove spinner correctly. Don't refresh timeline without need.
This is an experiment on better handling of events like fav, boost, reply.
Basically we need something like EventBus but
So my solution is RxJava.
How is this better than broadcasts? Well, imagine we want to update a thread after posting a reply (#552). We would have to serialize/deserialize status somehow or make extra network request. But we can pass anything through RxJava so we don't have such a problem/overhead.
I didn't touch any other parts (like replacing all
Call
s withSingle
s or getting rid of broadcasts) just yet but that's what I would like to do in some point in the future if everyone agrees.I've also converted
TimelineFragment
to Kotlin because at one point it just became unreadable. Sorry about that.This is not complete in any sense (doesn't handle boosted things e.g.), just wanted to hear your opinion on fixing some things with RxJava.
(to make it clear: in
TimelineFragment
I just added a couple of methods on the bottom, not much else)