Another post-merge build fix

main
Alibek Omarov 4 years ago
parent 928fdd8d02
commit 8982f7af28
  1. 2
      app/src/main/java/com/keylesspalace/tusky/appstore/Events.kt
  2. 2
      app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt
  3. 6
      app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java
  4. 4
      app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java
  5. 6
      app/src/main/java/com/keylesspalace/tusky/fragment/TimelineFragment.java
  6. 4
      app/src/main/java/com/keylesspalace/tusky/network/MastodonApi.kt
  7. 19
      app/src/main/java/com/keylesspalace/tusky/network/TimelineCases.kt

@ -9,7 +9,7 @@ import com.keylesspalace.tusky.entity.Status
data class FavoriteEvent(val statusId: String, val favourite: Boolean) : Dispatchable data class FavoriteEvent(val statusId: String, val favourite: Boolean) : Dispatchable
data class ReblogEvent(val statusId: String, val reblog: Boolean) : Dispatchable data class ReblogEvent(val statusId: String, val reblog: Boolean) : Dispatchable
data class BookmarkEvent(val statusId: String, val bookmark: Boolean) : Dispatchable data class BookmarkEvent(val statusId: String, val bookmark: Boolean) : Dispatchable
data class MuteStatusEvent(val statusId: String, val mute: Boolean) : Dispatchable data class MuteConversationEvent(val statusId: String, val mute: Boolean) : Dispatchable
data class EmojiReactEvent(val newStatus: Status) : Dispatchable data class EmojiReactEvent(val newStatus: Status) : Dispatchable
data class UnfollowEvent(val accountId: String) : Dispatchable data class UnfollowEvent(val accountId: String) : Dispatchable
data class BlockEvent(val accountId: String) : Dispatchable data class BlockEvent(val accountId: String) : Dispatchable

@ -199,7 +199,7 @@ class SearchViewModel @Inject constructor(
} }
fun muteConversation(status: Status, isMute: Boolean) { fun muteConversation(status: Status, isMute: Boolean) {
timelineCases.muteStatus(status, isMute) timelineCases.muteConversation(status, isMute)
} }
fun pinAccount(status: Status, isPin: Boolean) { fun pinAccount(status: Status, isPin: Boolean) {

@ -335,7 +335,7 @@ public class NotificationsFragment extends SFragment implements
event.getReblog()); event.getReblog());
} }
private void handleMuteStatusEvent(MuteStatusEvent event) { private void handleMuteStatusEvent(MuteConversationEvent event) {
Pair<Integer, Notification> posAndNotification = findReplyPosition(event.getStatusId()); Pair<Integer, Notification> posAndNotification = findReplyPosition(event.getStatusId());
if (posAndNotification == null) if (posAndNotification == null)
return; return;
@ -438,8 +438,8 @@ public class NotificationsFragment extends SFragment implements
handleBookmarkEvent((BookmarkEvent) event); handleBookmarkEvent((BookmarkEvent) event);
} else if (event instanceof ReblogEvent) { } else if (event instanceof ReblogEvent) {
handleReblogEvent((ReblogEvent) event); handleReblogEvent((ReblogEvent) event);
} else if (event instanceof MuteStatusEvent) { } else if (event instanceof MuteConversationEvent) {
handleMuteStatusEvent((MuteStatusEvent) event); handleMuteStatusEvent((MuteConversationEvent) event);
} else if (event instanceof BlockEvent) { } else if (event instanceof BlockEvent) {
removeAllByAccountId(((BlockEvent) event).getAccountId()); removeAllByAccountId(((BlockEvent) event).getAccountId());
} else if (event instanceof MuteEvent) { } else if (event instanceof MuteEvent) {

@ -349,11 +349,11 @@ public abstract class SFragment extends BaseFragment implements Injectable {
return true; return true;
} }
case R.id.status_mute_conversation: { case R.id.status_mute_conversation: {
timelineCases.muteStatus(status, true); timelineCases.muteConversation(status, true);
return true; return true;
} }
case R.id.status_unmute_conversation: { case R.id.status_unmute_conversation: {
timelineCases.muteStatus(status, false); timelineCases.muteConversation(status, false);
return true; return true;
} }
case R.id.status_unreblog_private: { case R.id.status_unreblog_private: {

@ -527,9 +527,9 @@ public class TimelineFragment extends SFragment implements
String id = ((BlockEvent) event).getAccountId(); String id = ((BlockEvent) event).getAccountId();
removeAllByAccountId(id); removeAllByAccountId(id);
} }
} else if (event instanceof MuteStatusEvent) { } else if (event instanceof MuteConversationEvent) {
if (kind != Kind.USER && kind != Kind.USER_WITH_REPLIES && kind != Kind.USER_PINNED) { if (kind != Kind.USER && kind != Kind.USER_WITH_REPLIES && kind != Kind.USER_PINNED) {
handleMuteStatusEvent((MuteStatusEvent)event); handleMuteStatusEvent((MuteConversationEvent)event);
} }
} else if (event instanceof MuteEvent) { } else if (event instanceof MuteEvent) {
if (kind != Kind.USER && kind != Kind.USER_WITH_REPLIES && kind != Kind.USER_PINNED) { if (kind != Kind.USER && kind != Kind.USER_WITH_REPLIES && kind != Kind.USER_PINNED) {
@ -1428,7 +1428,7 @@ public class TimelineFragment extends SFragment implements
onRefresh(); onRefresh();
} }
private void handleMuteStatusEvent(MuteStatusEvent event) { private void handleMuteStatusEvent(MuteConversationEvent event) {
int pos = findStatusOrReblogPositionById(event.getStatusId()); int pos = findStatusOrReblogPositionById(event.getStatusId());
if (pos < 0) if (pos < 0)

@ -212,12 +212,12 @@ interface MastodonApi {
): Single<Status> ): Single<Status>
@POST("api/v1/statuses/{id}/mute") @POST("api/v1/statuses/{id}/mute")
fun muteStatus( fun muteConversation(
@Path("id") statusId: String @Path("id") statusId: String
): Single<Status> ): Single<Status>
@POST("api/v1/statuses/{id}/unmute") @POST("api/v1/statuses/{id}/unmute")
fun unmuteStatus( fun unmuteConversation(
@Path("id") statusId: String @Path("id") statusId: String
): Single<Status> ): Single<Status>

@ -15,7 +15,6 @@
package com.keylesspalace.tusky.network package com.keylesspalace.tusky.network
import android.util.Log
import com.keylesspalace.tusky.appstore.* import com.keylesspalace.tusky.appstore.*
import com.keylesspalace.tusky.entity.DeletedStatus import com.keylesspalace.tusky.entity.DeletedStatus
import com.keylesspalace.tusky.entity.Poll import com.keylesspalace.tusky.entity.Poll
@ -34,7 +33,7 @@ interface TimelineCases {
fun reblog(status: Status, reblog: Boolean): Single<Status> fun reblog(status: Status, reblog: Boolean): Single<Status>
fun favourite(status: Status, favourite: Boolean): Single<Status> fun favourite(status: Status, favourite: Boolean): Single<Status>
fun bookmark(status: Status, bookmark: Boolean): Single<Status> fun bookmark(status: Status, bookmark: Boolean): Single<Status>
fun muteStatus(status: Status, mute: Boolean) fun muteConversation(status: Status, mute: Boolean)
fun mute(id: String, notifications: Boolean) fun mute(id: String, notifications: Boolean)
fun block(id: String) fun block(id: String)
fun delete(id: String): Single<DeletedStatus> fun delete(id: String): Single<DeletedStatus>
@ -93,23 +92,25 @@ class TimelineCasesImpl(
} }
} }
override fun muteConversation(status: Status, mute: Boolean): Single<Status> { override fun muteConversation(status: Status, mute: Boolean) {
val id = status.actionableId val id = status.actionableId
if (mute) {
val call = if (mute) {
mastodonApi.muteConversation(id) mastodonApi.muteConversation(id)
} else { } else {
mastodonApi.unmuteConversation(id) mastodonApi.unmuteConversation(id)
} }
return call.doAfterSuccess { .subscribe({
eventHub.dispatch(MuteConversationEvent(status.id, mute)) eventHub.dispatch(MuteConversationEvent(id, mute))
} }, { t ->
Log.w("Failed to mute status", t)
})
.addTo(cancelDisposable)
} }
override fun mute(id: String, notifications: Boolean) { override fun mute(id: String, notifications: Boolean) {
mastodonApi.muteAccount(id, notifications) mastodonApi.muteAccount(id, notifications)
.subscribe({ .subscribe({
eventHub.dispatch(MuteEvent(id)) eventHub.dispatch(MuteEvent(id, true))
}, { t -> }, { t ->
Log.w("Failed to mute account", t) Log.w("Failed to mute account", t)
}) })

Loading…
Cancel
Save