mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-01-03 14:40:07 +02:00
Fix notifications not removed from cache
This commit is contained in:
parent
b0eb52cf94
commit
b7ee38e37b
3 changed files with 27 additions and 0 deletions
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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) {
|
||||
|
||||
if (description == null && content == null) {
|
||||
return;
|
||||
}
|
||||
int position = statusList.size() - 1;
|
||||
statusList.get(position).text = "";
|
||||
if (title != null && title.trim().length() > 0) {
|
||||
|
|
|
@ -231,6 +231,10 @@ public class NotificationsVM extends AndroidViewModel {
|
|||
MastodonNotificationsService mastodonNotificationsService = init(instance);
|
||||
new Thread(() -> {
|
||||
Call<Void> voidCall = mastodonNotificationsService.clearAllNotifications(token);
|
||||
try {
|
||||
new StatusCache(getApplication().getApplicationContext()).deleteNotifications();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
if (voidCall != null) {
|
||||
try {
|
||||
voidCall.execute();
|
||||
|
|
Loading…
Reference in a new issue