improve local status updates (#3480)
The idea here is: Everytime we get hold of a new version of a post, we update everything about that post everywhere. This makes the distincion between different event types unnecessary, as everythng is just a `StatusChangedEvent`. The main benefit is that posts should be up-to-date more often, which is important considering there is now editing and #3413
This commit is contained in:
parent
2f39f87cc7
commit
54e92b2156
12 changed files with 145 additions and 198 deletions
|
|
@ -21,14 +21,11 @@ import at.connyduck.calladapter.networkresult.fold
|
|||
import at.connyduck.calladapter.networkresult.onFailure
|
||||
import at.connyduck.calladapter.networkresult.onSuccess
|
||||
import com.keylesspalace.tusky.appstore.BlockEvent
|
||||
import com.keylesspalace.tusky.appstore.BookmarkEvent
|
||||
import com.keylesspalace.tusky.appstore.EventHub
|
||||
import com.keylesspalace.tusky.appstore.FavoriteEvent
|
||||
import com.keylesspalace.tusky.appstore.MuteConversationEvent
|
||||
import com.keylesspalace.tusky.appstore.MuteEvent
|
||||
import com.keylesspalace.tusky.appstore.PinEvent
|
||||
import com.keylesspalace.tusky.appstore.PollVoteEvent
|
||||
import com.keylesspalace.tusky.appstore.ReblogEvent
|
||||
import com.keylesspalace.tusky.appstore.StatusChangedEvent
|
||||
import com.keylesspalace.tusky.appstore.StatusDeletedEvent
|
||||
import com.keylesspalace.tusky.entity.DeletedStatus
|
||||
import com.keylesspalace.tusky.entity.Poll
|
||||
|
|
@ -53,8 +50,8 @@ class TimelineCases @Inject constructor(
|
|||
mastodonApi.reblogStatus(statusId)
|
||||
} else {
|
||||
mastodonApi.unreblogStatus(statusId)
|
||||
}.onSuccess {
|
||||
eventHub.dispatch(ReblogEvent(statusId, reblog))
|
||||
}.onSuccess { status ->
|
||||
eventHub.dispatch(StatusChangedEvent(status))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -63,8 +60,8 @@ class TimelineCases @Inject constructor(
|
|||
mastodonApi.favouriteStatus(statusId)
|
||||
} else {
|
||||
mastodonApi.unfavouriteStatus(statusId)
|
||||
}.onSuccess {
|
||||
eventHub.dispatch(FavoriteEvent(statusId, favourite))
|
||||
}.onSuccess { status ->
|
||||
eventHub.dispatch(StatusChangedEvent(status))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -73,8 +70,8 @@ class TimelineCases @Inject constructor(
|
|||
mastodonApi.bookmarkStatus(statusId)
|
||||
} else {
|
||||
mastodonApi.unbookmarkStatus(statusId)
|
||||
}.onSuccess {
|
||||
eventHub.dispatch(BookmarkEvent(statusId, bookmark))
|
||||
}.onSuccess { status ->
|
||||
eventHub.dispatch(StatusChangedEvent(status))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +159,7 @@ class TimelineCases @Inject constructor(
|
|||
} else {
|
||||
mastodonApi.unpinStatus(statusId)
|
||||
}.fold({ status ->
|
||||
eventHub.dispatch(PinEvent(statusId, pin))
|
||||
eventHub.dispatch(StatusChangedEvent(status))
|
||||
NetworkResult.success(status)
|
||||
}, { e ->
|
||||
Log.w(TAG, "Failed to change pin state", e)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue