Fix build after logical conflict (#4036)

Ugh, I didn't notice that #3480 was affected by the notification
fragment rollback
This commit is contained in:
Levi Bard 2023-09-26 20:04:06 +02:00 committed by GitHub
parent 54e92b2156
commit 2dceecb591
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 18 deletions

View File

@ -61,12 +61,9 @@ import com.keylesspalace.tusky.R;
import com.keylesspalace.tusky.adapter.NotificationsAdapter; import com.keylesspalace.tusky.adapter.NotificationsAdapter;
import com.keylesspalace.tusky.adapter.StatusBaseViewHolder; import com.keylesspalace.tusky.adapter.StatusBaseViewHolder;
import com.keylesspalace.tusky.appstore.BlockEvent; import com.keylesspalace.tusky.appstore.BlockEvent;
import com.keylesspalace.tusky.appstore.BookmarkEvent;
import com.keylesspalace.tusky.appstore.EventHub; import com.keylesspalace.tusky.appstore.EventHub;
import com.keylesspalace.tusky.appstore.FavoriteEvent;
import com.keylesspalace.tusky.appstore.PinEvent;
import com.keylesspalace.tusky.appstore.PreferenceChangedEvent; import com.keylesspalace.tusky.appstore.PreferenceChangedEvent;
import com.keylesspalace.tusky.appstore.ReblogEvent; import com.keylesspalace.tusky.appstore.StatusChangedEvent;
import com.keylesspalace.tusky.components.notifications.NotificationHelper; import com.keylesspalace.tusky.components.notifications.NotificationHelper;
import com.keylesspalace.tusky.databinding.FragmentTimelineNotificationsBinding; import com.keylesspalace.tusky.databinding.FragmentTimelineNotificationsBinding;
import com.keylesspalace.tusky.db.AccountEntity; import com.keylesspalace.tusky.db.AccountEntity;
@ -389,14 +386,9 @@ public class NotificationsFragment extends SFragment implements
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY))) .to(autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)))
.subscribe(event -> { .subscribe(event -> {
if (event instanceof FavoriteEvent) { if (event instanceof StatusChangedEvent) {
setFavouriteForStatus(((FavoriteEvent) event).getStatusId(), ((FavoriteEvent) event).getFavourite()); Status updatedStatus = ((StatusChangedEvent) event).getStatus();
} else if (event instanceof BookmarkEvent) { updateStatus(updatedStatus.getActionableId(), s -> updatedStatus);
setBookmarkForStatus(((BookmarkEvent) event).getStatusId(), ((BookmarkEvent) event).getBookmark());
} else if (event instanceof ReblogEvent) {
setReblogForStatus(((ReblogEvent) event).getStatusId(), ((ReblogEvent) event).getReblog());
} else if (event instanceof PinEvent) {
setPinForStatus(((PinEvent) event).getStatusId(), ((PinEvent) event).getPinned());
} else if (event instanceof BlockEvent) { } else if (event instanceof BlockEvent) {
removeAllByAccountId(((BlockEvent) event).getAccountId()); removeAllByAccountId(((BlockEvent) event).getAccountId());
} else if (event instanceof PreferenceChangedEvent) { } else if (event instanceof PreferenceChangedEvent) {

View File

@ -91,8 +91,8 @@ class TimelineCases @Inject constructor(
} else { } else {
mastodonApi.unreblogStatusOld(statusId) mastodonApi.unreblogStatusOld(statusId)
} }
return call.doAfterSuccess { return call.doAfterSuccess { status ->
eventHub.dispatchOld(ReblogEvent(statusId, reblog)) eventHub.dispatchOld(StatusChangedEvent(status))
} }
} }
@ -102,8 +102,8 @@ class TimelineCases @Inject constructor(
} else { } else {
mastodonApi.unfavouriteStatusOld(statusId) mastodonApi.unfavouriteStatusOld(statusId)
} }
return call.doAfterSuccess { return call.doAfterSuccess { status ->
eventHub.dispatchOld(FavoriteEvent(statusId, favourite)) eventHub.dispatchOld(StatusChangedEvent(status))
} }
} }
@ -113,8 +113,8 @@ class TimelineCases @Inject constructor(
} else { } else {
mastodonApi.unbookmarkStatusOld(statusId) mastodonApi.unbookmarkStatusOld(statusId)
} }
return call.doAfterSuccess { return call.doAfterSuccess { status ->
eventHub.dispatchOld(BookmarkEvent(statusId, bookmark)) eventHub.dispatchOld(StatusChangedEvent(status))
} }
} }