That fuck shit the fascists are using
1package org.tm.archive.migrations;
2
3import androidx.annotation.NonNull;
4import androidx.annotation.Nullable;
5
6import org.signal.core.util.logging.Log;
7import org.tm.archive.database.SignalDatabase;
8import org.tm.archive.jobmanager.Job;
9
10/**
11 * Check for abandoned attachments and delete them.
12 */
13public class AttachmentCleanupMigrationJob extends MigrationJob {
14
15 private static final String TAG = Log.tag(AttachmentCleanupMigrationJob.class);
16
17 public static final String KEY = "AttachmentCleanupMigrationJob";
18
19 AttachmentCleanupMigrationJob() {
20 this(new Parameters.Builder().build());
21 }
22
23 private AttachmentCleanupMigrationJob(@NonNull Parameters parameters) {
24 super(parameters);
25 }
26
27 @Override
28 public boolean isUiBlocking() {
29 return false;
30 }
31
32 @Override
33 public @NonNull String getFactoryKey() {
34 return KEY;
35 }
36
37 @Override
38 public void performMigration() {
39 int deletes = SignalDatabase.attachments().deleteAbandonedAttachmentFiles();
40 Log.i(TAG, "Deleted " + deletes + " abandoned attachments.");
41 }
42
43 @Override
44 boolean shouldRetry(@NonNull Exception e) {
45 return false;
46 }
47
48 public static class Factory implements Job.Factory<AttachmentCleanupMigrationJob> {
49 @Override
50 public @NonNull AttachmentCleanupMigrationJob create(@NonNull Parameters parameters, @Nullable byte[] serializedData) {
51 return new AttachmentCleanupMigrationJob(parameters);
52 }
53 }
54}