feat(Notification): add remove from followers action
This commit is contained in:
parent
25e654fbab
commit
1814e8dd2a
|
@ -21,6 +21,7 @@ import android.text.TextUtils;
|
|||
import android.util.Log;
|
||||
|
||||
import org.joinmastodon.android.api.MastodonAPIController;
|
||||
import org.joinmastodon.android.api.requests.accounts.RemoveFromFollowers;
|
||||
import org.joinmastodon.android.api.requests.accounts.SetAccountFollowed;
|
||||
import org.joinmastodon.android.api.requests.notifications.GetNotificationByID;
|
||||
import org.joinmastodon.android.api.requests.statuses.CreateStatus;
|
||||
|
@ -153,6 +154,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
|||
case UNBOOST -> new SetStatusReblogged(statusID, false, preferences.postingDefaultVisibility).exec(accountID);
|
||||
case REPLY -> handleReplyAction(context, accountID, intent, notification, notificationId, preferences);
|
||||
case FOLLOW_BACK -> new SetAccountFollowed(notification.account.id, true, true, false).exec(accountID);
|
||||
case REMOVE_FOLLOWER -> new RemoveFromFollowers(notification.account.id).exec(accountID);
|
||||
default -> Log.w(TAG, "onReceive: Failed to get NotificationAction");
|
||||
}
|
||||
}
|
||||
|
@ -283,6 +285,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
|||
}
|
||||
case FOLLOW -> {
|
||||
builder.addAction(buildNotificationAction(context, id, accountID, notification, context.getString(R.string.follow_back), NotificationAction.FOLLOW_BACK));
|
||||
builder.addAction(buildNotificationAction(context, id, accountID, notification, context.getString(R.string.mo_notification_action_remove_follower), NotificationAction.REMOVE_FOLLOWER));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.joinmastodon.android.model.Relationship;
|
|||
|
||||
public class RemoveFromFollowers extends MastodonAPIRequest<Relationship>{
|
||||
public RemoveFromFollowers(String id){
|
||||
super(HttpMethod.POST, "/follow_requests/"+id+"/reject", Relationship.class);
|
||||
super(HttpMethod.POST, "/accounts/"+id+"/remove_from_followers", Relationship.class);
|
||||
setRequestBody(new Object());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,5 +6,6 @@ public enum NotificationAction {
|
|||
UNBOOST,
|
||||
BOOKMARK,
|
||||
REPLY,
|
||||
FOLLOW_BACK
|
||||
FOLLOW_BACK,
|
||||
REMOVE_FOLLOWER
|
||||
}
|
||||
|
|
|
@ -139,4 +139,6 @@
|
|||
<string name="mo_error_display_text">Something went wrong while loading this post. If the problem persists, please report it on our Issues page along with the error details.</string>
|
||||
<string name="mo_error_display_copy_error_details">Copy details</string>
|
||||
<string name="mo_trending_link_read">Read</string>
|
||||
|
||||
<string name="mo_notification_action_remove_follower">Remove from Followers</string>
|
||||
</resources>
|
Loading…
Reference in New Issue