Schedule a migration to fetch the latest search index.

This commit is contained in:
Greyson Parrelli
2022-08-03 12:07:20 -04:00
parent 907abf72d3
commit 120dda6e68
2 changed files with 9 additions and 2 deletions

View File

@@ -104,9 +104,10 @@ public class ApplicationMigrations {
static final int EMOJI_VERSION_7 = 60; static final int EMOJI_VERSION_7 = 60;
static final int MY_STORY_PRIVACY_MODE = 61; static final int MY_STORY_PRIVACY_MODE = 61;
static final int REFRESH_EXPIRING_CREDENTIAL = 62; static final int REFRESH_EXPIRING_CREDENTIAL = 62;
static final int EMOJI_SEARCH_INDEX_10 = 63;
} }
public static final int CURRENT_VERSION = 62; public static final int CURRENT_VERSION = 63;
/** /**
* This *must* be called after the {@link JobManager} has been instantiated, but *before* the call * This *must* be called after the {@link JobManager} has been instantiated, but *before* the call
@@ -456,6 +457,10 @@ public class ApplicationMigrations {
jobs.put(Version.REFRESH_EXPIRING_CREDENTIAL, new AttributesMigrationJob()); jobs.put(Version.REFRESH_EXPIRING_CREDENTIAL, new AttributesMigrationJob());
} }
if (lastSeenVersion < Version.EMOJI_SEARCH_INDEX_10) {
jobs.put(Version.EMOJI_SEARCH_INDEX_10, new EmojiDownloadMigrationJob());
}
return jobs; return jobs;
} }

View File

@@ -6,9 +6,10 @@ import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.jobmanager.Data; import org.thoughtcrime.securesms.jobmanager.Data;
import org.thoughtcrime.securesms.jobmanager.Job; import org.thoughtcrime.securesms.jobmanager.Job;
import org.thoughtcrime.securesms.jobs.DownloadLatestEmojiDataJob; import org.thoughtcrime.securesms.jobs.DownloadLatestEmojiDataJob;
import org.thoughtcrime.securesms.jobs.EmojiSearchIndexDownloadJob;
/** /**
* Schedules a emoji download job to get the latest version. * Schedules jobs to get the latest emoji and search index.
*/ */
public final class EmojiDownloadMigrationJob extends MigrationJob { public final class EmojiDownloadMigrationJob extends MigrationJob {
@@ -35,6 +36,7 @@ public final class EmojiDownloadMigrationJob extends MigrationJob {
@Override @Override
public void performMigration() { public void performMigration() {
ApplicationDependencies.getJobManager().add(new DownloadLatestEmojiDataJob(false)); ApplicationDependencies.getJobManager().add(new DownloadLatestEmojiDataJob(false));
EmojiSearchIndexDownloadJob.scheduleImmediately();
} }
@Override @Override