mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Merge branch 'develop' of https://codeberg.org/tom79/Fedilab into develop
This commit is contained in:
commit
a9f39ee1c6
1 changed files with 11 additions and 2 deletions
|
@ -176,6 +176,7 @@ public class NotificationsHelper {
|
||||||
int newPolls = 0;
|
int newPolls = 0;
|
||||||
int newStatus = 0;
|
int newStatus = 0;
|
||||||
String notificationUrl;
|
String notificationUrl;
|
||||||
|
String title = null;
|
||||||
String message = null;
|
String message = null;
|
||||||
String targeted_account = null;
|
String targeted_account = null;
|
||||||
Helper.NotifType notifType = Helper.NotifType.MENTION;
|
Helper.NotifType notifType = Helper.NotifType.MENTION;
|
||||||
|
@ -184,6 +185,7 @@ public class NotificationsHelper {
|
||||||
case "mention":
|
case "mention":
|
||||||
notifType = Helper.NotifType.MENTION;
|
notifType = Helper.NotifType.MENTION;
|
||||||
if (notif_mention) {
|
if (notif_mention) {
|
||||||
|
title = context.getString(R.string.channel_notif_mention);
|
||||||
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
||||||
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_mention));
|
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_mention));
|
||||||
else
|
else
|
||||||
|
@ -207,6 +209,7 @@ public class NotificationsHelper {
|
||||||
case "status":
|
case "status":
|
||||||
notifType = Helper.NotifType.STATUS;
|
notifType = Helper.NotifType.STATUS;
|
||||||
if (notif_status) {
|
if (notif_status) {
|
||||||
|
title = context.getString(R.string.channel_notif_status);
|
||||||
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
||||||
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_status));
|
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_status));
|
||||||
else
|
else
|
||||||
|
@ -230,6 +233,7 @@ public class NotificationsHelper {
|
||||||
case "reblog":
|
case "reblog":
|
||||||
notifType = Helper.NotifType.BOOST;
|
notifType = Helper.NotifType.BOOST;
|
||||||
if (notif_share) {
|
if (notif_share) {
|
||||||
|
title = context.getString(R.string.channel_notif_boost);
|
||||||
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
||||||
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_reblog));
|
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_reblog));
|
||||||
else
|
else
|
||||||
|
@ -240,6 +244,7 @@ public class NotificationsHelper {
|
||||||
case "favourite":
|
case "favourite":
|
||||||
notifType = Helper.NotifType.FAV;
|
notifType = Helper.NotifType.FAV;
|
||||||
if (notif_fav) {
|
if (notif_fav) {
|
||||||
|
title = context.getString(R.string.channel_notif_fav);
|
||||||
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
||||||
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_favourite));
|
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_favourite));
|
||||||
else
|
else
|
||||||
|
@ -250,6 +255,7 @@ public class NotificationsHelper {
|
||||||
case "follow_request":
|
case "follow_request":
|
||||||
notifType = Helper.NotifType.FOLLLOW;
|
notifType = Helper.NotifType.FOLLLOW;
|
||||||
if (notif_follow) {
|
if (notif_follow) {
|
||||||
|
title = context.getString(R.string.channel_notif_follow);
|
||||||
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
||||||
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_follow_request));
|
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_follow_request));
|
||||||
else
|
else
|
||||||
|
@ -261,6 +267,7 @@ public class NotificationsHelper {
|
||||||
case "follow":
|
case "follow":
|
||||||
notifType = Helper.NotifType.FOLLLOW;
|
notifType = Helper.NotifType.FOLLLOW;
|
||||||
if (notif_follow) {
|
if (notif_follow) {
|
||||||
|
title = context.getString(R.string.channel_notif_follow);
|
||||||
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
if (notification.account.display_name != null && notification.account.display_name.length() > 0)
|
||||||
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_follow));
|
message = String.format("%s %s", notification.account.display_name, context.getString(R.string.notif_follow));
|
||||||
else
|
else
|
||||||
|
@ -272,6 +279,7 @@ public class NotificationsHelper {
|
||||||
case "poll":
|
case "poll":
|
||||||
notifType = Helper.NotifType.POLL;
|
notifType = Helper.NotifType.POLL;
|
||||||
if (notif_poll) {
|
if (notif_poll) {
|
||||||
|
title = context.getString(R.string.channel_notif_poll);
|
||||||
if (notification.account.id != null && notification.account.id.equals(MainActivity.currentUserID))
|
if (notification.account.id != null && notification.account.id.equals(MainActivity.currentUserID))
|
||||||
message = context.getString(R.string.notif_poll_self);
|
message = context.getString(R.string.notif_poll_self);
|
||||||
else
|
else
|
||||||
|
@ -300,6 +308,7 @@ public class NotificationsHelper {
|
||||||
Helper.NotifType finalNotifType = notifType;
|
Helper.NotifType finalNotifType = notifType;
|
||||||
String finalMessage = message;
|
String finalMessage = message;
|
||||||
String finalMessage1 = message;
|
String finalMessage1 = message;
|
||||||
|
String finalTitle = title;
|
||||||
Runnable myRunnable = () -> Glide.with(context)
|
Runnable myRunnable = () -> Glide.with(context)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(finalNotificationUrl != null ? finalNotificationUrl : R.drawable.fedilab_logo_bubbles)
|
.load(finalNotificationUrl != null ? finalNotificationUrl : R.drawable.fedilab_logo_bubbles)
|
||||||
|
@ -313,7 +322,7 @@ public class NotificationsHelper {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
|
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
|
||||||
notify_user(context, account, intent, BitmapFactory.decodeResource(context.getResources(),
|
notify_user(context, account, intent, BitmapFactory.decodeResource(context.getResources(),
|
||||||
R.mipmap.ic_launcher), finalNotifType, context.getString(R.string.top_notification), finalMessage1);
|
R.mipmap.ic_launcher), finalNotifType, finalTitle, finalMessage1);
|
||||||
String lastNotif = prefs.getString(context.getString(R.string.LAST_NOTIFICATION_ID) + account.user_id + "@" + account.instance, null);
|
String lastNotif = prefs.getString(context.getString(R.string.LAST_NOTIFICATION_ID) + account.user_id + "@" + account.instance, null);
|
||||||
if (lastNotif == null || notifications.get(0).id.compareTo(lastNotif) > 0) {
|
if (lastNotif == null || notifications.get(0).id.compareTo(lastNotif) > 0) {
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
|
@ -326,7 +335,7 @@ public class NotificationsHelper {
|
||||||
.into(new CustomTarget<Bitmap>() {
|
.into(new CustomTarget<Bitmap>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
||||||
notify_user(context, account, intent, resource, finalNotifType, context.getString(R.string.top_notification), finalMessage);
|
notify_user(context, account, intent, resource, finalNotifType, finalTitle, finalMessage);
|
||||||
String lastNotif = prefs.getString(context.getString(R.string.LAST_NOTIFICATION_ID) + account.user_id + "@" + account.instance, null);
|
String lastNotif = prefs.getString(context.getString(R.string.LAST_NOTIFICATION_ID) + account.user_id + "@" + account.instance, null);
|
||||||
if (lastNotif == null || notifications.get(0).id.compareTo(lastNotif) > 0) {
|
if (lastNotif == null || notifications.get(0).id.compareTo(lastNotif) > 0) {
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
|
|
Loading…
Reference in a new issue