mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-23 01:00:04 +02:00
This commit is contained in:
parent
2a7d04cfdc
commit
87a5b69ba0
1 changed files with 9 additions and 4 deletions
|
@ -74,9 +74,12 @@ public class NotificationsHelper {
|
||||||
if (accountDb == null) {
|
if (accountDb == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String last_notifid = prefs.getString(context.getString(R.string.LAST_NOTIFICATION_ID) + slug, null);
|
String last_notifid;
|
||||||
if (since_ids.containsKey(slug)) {
|
if (since_ids.containsKey(slug)) {
|
||||||
last_notifid = since_ids.get(slug);
|
last_notifid = since_ids.get(slug);
|
||||||
|
} else {
|
||||||
|
last_notifid = prefs.getString(context.getString(R.string.LAST_NOTIFICATION_ID) + slug, null);
|
||||||
|
since_ids.put(slug, last_notifid);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check which notifications the user wants to see
|
//Check which notifications the user wants to see
|
||||||
|
@ -321,13 +324,14 @@ 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(),
|
|
||||||
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();
|
||||||
|
since_ids.put(account.user_id + "@" + account.instance, lastNotif);
|
||||||
editor.putString(context.getString(R.string.LAST_NOTIFICATION_ID) + account.user_id + "@" + account.instance, notifications.get(0).id);
|
editor.putString(context.getString(R.string.LAST_NOTIFICATION_ID) + account.user_id + "@" + account.instance, notifications.get(0).id);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
|
notify_user(context, account, intent, BitmapFactory.decodeResource(context.getResources(),
|
||||||
|
R.mipmap.ic_launcher), finalNotifType, finalTitle, finalMessage1);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -335,12 +339,13 @@ 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, 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();
|
||||||
editor.putString(context.getString(R.string.LAST_NOTIFICATION_ID) + account.user_id + "@" + account.instance, notifications.get(0).id);
|
editor.putString(context.getString(R.string.LAST_NOTIFICATION_ID) + account.user_id + "@" + account.instance, notifications.get(0).id);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
|
since_ids.put(account.user_id + "@" + account.instance, lastNotif);
|
||||||
|
notify_user(context, account, intent, resource, finalNotifType, finalTitle, finalMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue