mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-23 01:00:04 +02:00
Fix notifications in double and messages not removed from cache
This commit is contained in:
parent
6b2d3670d3
commit
eea7e83f85
4 changed files with 7 additions and 10 deletions
|
@ -1482,7 +1482,7 @@ public class Helper {
|
|||
message = message.substring(0, 499) + "…";
|
||||
}
|
||||
}*/
|
||||
notificationBuilder.setGroup(account.mastodon_account != null ? account.mastodon_account.acct : "" + "@" + account.instance)
|
||||
notificationBuilder.setGroup(account.mastodon_account != null ? account.mastodon_account.username + "@" + account.instance : "" + "@" + account.instance)
|
||||
.setContentIntent(pIntent)
|
||||
.setContentText(message);
|
||||
int ledColour = Color.BLUE;
|
||||
|
@ -1493,9 +1493,6 @@ public class Helper {
|
|||
prefColor = Integer.parseInt(sharedpreferences.getString(context.getString(R.string.SET_LED_COLOUR_VAL), String.valueOf(LED_COLOUR)));
|
||||
}
|
||||
switch (prefColor) {
|
||||
case 0: // BLUE
|
||||
ledColour = Color.BLUE;
|
||||
break;
|
||||
case 1: // CYAN
|
||||
ledColour = Color.CYAN;
|
||||
break;
|
||||
|
|
|
@ -65,8 +65,8 @@ public class NotificationsWorker extends Worker {
|
|||
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext(), CHANNEL_ID);
|
||||
notificationBuilder.setSmallIcon(R.drawable.ic_notification)
|
||||
.setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.drawable.ic_launcher_foreground))
|
||||
.setContentTitle(getApplicationContext().getString(R.string.scheduled_toots))
|
||||
.setContentText(getApplicationContext().getString(R.string.scheduled_toots))
|
||||
.setContentTitle(getApplicationContext().getString(R.string.notifications))
|
||||
.setContentText(getApplicationContext().getString(R.string.fetch_notifications))
|
||||
.setDefaults(NotificationCompat.DEFAULT_ALL)
|
||||
.setPriority(Notification.PRIORITY_DEFAULT);
|
||||
return Futures.immediateFuture(new ForegroundInfo(FETCH_NOTIFICATION_CHANNEL_ID, notificationBuilder.build()));
|
||||
|
@ -85,8 +85,8 @@ public class NotificationsWorker extends Worker {
|
|||
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext(), CHANNEL_ID);
|
||||
notificationBuilder.setSmallIcon(R.drawable.ic_notification)
|
||||
.setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.drawable.ic_launcher_foreground))
|
||||
.setContentTitle(getApplicationContext().getString(R.string.scheduled_toots))
|
||||
.setContentText(getApplicationContext().getString(R.string.scheduled_toots))
|
||||
.setContentTitle(getApplicationContext().getString(R.string.notifications))
|
||||
.setContentText(getApplicationContext().getString(R.string.fetch_notifications))
|
||||
.setDefaults(NotificationCompat.DEFAULT_ALL)
|
||||
.setPriority(Notification.PRIORITY_DEFAULT);
|
||||
return new ForegroundInfo(FETCH_NOTIFICATION_CHANNEL_ID, notificationBuilder.build());
|
||||
|
|
|
@ -325,12 +325,11 @@ public class StatusesVM extends AndroidViewModel {
|
|||
//The status must also be deleted in cache
|
||||
try {
|
||||
BaseAccount account = new app.fedilab.android.client.entities.app.Account(getApplication().getApplicationContext()).getAccountByToken(token);
|
||||
new StatusCache(getApplication().getApplicationContext()).deleteStatus(id, account.instance);
|
||||
new StatusCache(getApplication().getApplicationContext()).deleteStatus(account.instance, id);
|
||||
} catch (DBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
Status finalStatus = status;
|
||||
Runnable myRunnable = () -> statusMutableLiveData.setValue(finalStatus);
|
||||
|
|
|
@ -1474,4 +1474,5 @@
|
|||
<string name="cached_messages">Cached message</string>
|
||||
<string name="reply">Reply</string>
|
||||
<string name="display_options">Display options</string>
|
||||
<string name="fetch_notifications">Fetch notifications</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue