mirror of
https://codeberg.org/tom79/Fedilab
synced 2025-02-02 12:27:17 +01:00
Fix notifications not removed from cache
This commit is contained in:
parent
b0eb52cf94
commit
b7ee38e37b
@ -409,6 +409,26 @@ public class StatusCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete all cached notification for an account
|
||||||
|
*
|
||||||
|
* @return long - db id
|
||||||
|
* @throws DBException exception with database
|
||||||
|
*/
|
||||||
|
public long deleteNotifications() throws DBException {
|
||||||
|
if (db == null) {
|
||||||
|
throw new DBException("db is null. Wrong initialization.");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return db.delete(Sqlite.TABLE_STATUS_CACHE,
|
||||||
|
Sqlite.COL_USER_ID + " = ? AND " + Sqlite.COL_INSTANCE + " =? AND " + Sqlite.COL_TYPE + "=?",
|
||||||
|
new String[]{MainActivity.currentUserID, MainActivity.currentInstance, Timeline.TimeLineEnum.NOTIFICATION.getValue()});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* delete all cache for an account
|
* delete all cache for an account
|
||||||
*
|
*
|
||||||
|
@ -420,6 +420,9 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
|||||||
*/
|
*/
|
||||||
public void addSharing(String url, String title, String description, String subject, String content, String saveFilePath) {
|
public void addSharing(String url, String title, String description, String subject, String content, String saveFilePath) {
|
||||||
|
|
||||||
|
if (description == null && content == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int position = statusList.size() - 1;
|
int position = statusList.size() - 1;
|
||||||
statusList.get(position).text = "";
|
statusList.get(position).text = "";
|
||||||
if (title != null && title.trim().length() > 0) {
|
if (title != null && title.trim().length() > 0) {
|
||||||
|
@ -231,6 +231,10 @@ public class NotificationsVM extends AndroidViewModel {
|
|||||||
MastodonNotificationsService mastodonNotificationsService = init(instance);
|
MastodonNotificationsService mastodonNotificationsService = init(instance);
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
Call<Void> voidCall = mastodonNotificationsService.clearAllNotifications(token);
|
Call<Void> voidCall = mastodonNotificationsService.clearAllNotifications(token);
|
||||||
|
try {
|
||||||
|
new StatusCache(getApplication().getApplicationContext()).deleteNotifications();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
if (voidCall != null) {
|
if (voidCall != null) {
|
||||||
try {
|
try {
|
||||||
voidCall.execute();
|
voidCall.execute();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user