Support follow requests
This commit is contained in:
parent
13e8a7eecb
commit
3074f725e2
|
@ -127,6 +127,12 @@ public class Notification implements Parcelable {
|
|||
else
|
||||
typeString = String.format("@%s %s", notification.getAccount().getUsername(), context.getString(R.string.notif_follow));
|
||||
break;
|
||||
case "follow_request":
|
||||
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
|
||||
typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true), context.getString(R.string.notif_follow_request));
|
||||
else
|
||||
typeString = String.format("@%s %s", notification.getAccount().getUsername(), context.getString(R.string.notif_follow_request));
|
||||
break;
|
||||
}
|
||||
SpannableString displayNameSpan = new SpannableString(typeString);
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
|
|
|
@ -307,6 +307,16 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
|||
holder.main_container_trans.setVisibility(View.VISIBLE);
|
||||
holder.status_more.setVisibility(View.GONE);
|
||||
break;
|
||||
case "follow_request":
|
||||
holder.status_action_container.setVisibility(View.GONE);
|
||||
holder.status_date.setVisibility(View.GONE);
|
||||
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
|
||||
typeString = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true), context.getString(R.string.notif_follow_request));
|
||||
else
|
||||
typeString = String.format("@%s %s", notification.getAccount().getUsername(), context.getString(R.string.notif_follow_request));
|
||||
imgH = ContextCompat.getDrawable(context, R.drawable.ic_follow_notif_header);
|
||||
holder.main_container_trans.setVisibility(View.GONE);
|
||||
break;
|
||||
case "follow":
|
||||
holder.status_action_container.setVisibility(View.GONE);
|
||||
holder.status_date.setVisibility(View.GONE);
|
||||
|
|
|
@ -224,6 +224,20 @@ public class NotificationsSyncJob extends Job {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case "follow_request":
|
||||
notifType = Helper.NotifType.FOLLLOW;
|
||||
if (notif_follow) {
|
||||
newFollows++;
|
||||
if (notificationUrl == null) {
|
||||
notificationUrl = notification.getAccount().getAvatar();
|
||||
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
|
||||
title = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true), getContext().getString(R.string.notif_follow_request));
|
||||
else
|
||||
title = String.format("@%s %s", notification.getAccount().getAcct(), getContext().getString(R.string.notif_follow_request));
|
||||
targeted_account = notification.getAccount().getId();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "follow":
|
||||
notifType = Helper.NotifType.FOLLLOW;
|
||||
if (notif_follow) {
|
||||
|
|
|
@ -369,6 +369,18 @@ public class LiveNotificationDelayedService extends Service {
|
|||
canSendBroadCast = false;
|
||||
}
|
||||
break;
|
||||
case "follow_request":
|
||||
notifType = Helper.NotifType.FOLLLOW;
|
||||
if (notif_follow) {
|
||||
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
|
||||
message = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true), getString(R.string.notif_follow_request));
|
||||
else
|
||||
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_follow_request));
|
||||
targeted_account = notification.getAccount().getId();
|
||||
} else {
|
||||
canSendBroadCast = false;
|
||||
}
|
||||
break;
|
||||
case "follow":
|
||||
notifType = Helper.NotifType.FOLLLOW;
|
||||
if (notif_follow) {
|
||||
|
|
|
@ -414,6 +414,18 @@ public class LiveNotificationService extends Service implements NetworkStateRece
|
|||
canSendBroadCast = false;
|
||||
}
|
||||
break;
|
||||
case "follow_request":
|
||||
notifType = Helper.NotifType.FOLLLOW;
|
||||
if (notif_follow) {
|
||||
if (notification.getAccount().getDisplay_name() != null && notification.getAccount().getDisplay_name().length() > 0)
|
||||
message = String.format("%s %s", Helper.shortnameToUnicode(notification.getAccount().getDisplay_name(), true), getString(R.string.notif_follow_request));
|
||||
else
|
||||
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_follow_request));
|
||||
targeted_account = notification.getAccount().getId();
|
||||
} else {
|
||||
canSendBroadCast = false;
|
||||
}
|
||||
break;
|
||||
case "follow":
|
||||
notifType = Helper.NotifType.FOLLLOW;
|
||||
if (notif_follow) {
|
||||
|
|
|
@ -236,6 +236,7 @@
|
|||
<string name="notif_reblog">boosted your status</string>
|
||||
<string name="notif_favourite">favourited your status</string>
|
||||
<string name="notif_follow">followed you</string>
|
||||
<string name="notif_follow_request">asked to follow you</string>
|
||||
<plurals name="other_notifications">
|
||||
<item quantity="one">and another notification</item>
|
||||
<item quantity="other">and %d other notifications</item>
|
||||
|
|
Loading…
Reference in New Issue