mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Always include english translations for emoji search.
Updates the `emoji_search` table by including English emoji labels alongside existing localized labels, enabling users to search for emojis in both their preferred language and English.
This commit is contained in:
committed by
Greyson Parrelli
parent
23b7ea90a1
commit
f0df1b99e5
@@ -188,11 +188,12 @@ public class ApplicationMigrations {
|
||||
static final int RESET_ARCHIVE_TIER = 144;
|
||||
static final int ARCHIVE_BACKUP_ID = 145;
|
||||
static final int QUOTE_THUMBNAIL_BACKFILL = 146;
|
||||
static final int EMOJI_ENGLISH_SEARCH = 147;
|
||||
}
|
||||
|
||||
public static final int CURRENT_VERSION = 146;
|
||||
public static final int CURRENT_VERSION = 147;
|
||||
|
||||
/**
|
||||
/**
|
||||
* This *must* be called after the {@link JobManager} has been instantiated, but *before* the call
|
||||
* to {@link JobManager#beginJobLoop()}. Otherwise, other non-migration jobs may have started
|
||||
* executing before we add the migration jobs.
|
||||
@@ -505,7 +506,7 @@ public class ApplicationMigrations {
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.CHANGE_NUMBER_CAPABILITY_4) {
|
||||
jobs.put(Version.CHANGE_NUMBER_CAPABILITY_4,new AttributesMigrationJob());
|
||||
jobs.put(Version.CHANGE_NUMBER_CAPABILITY_4, new AttributesMigrationJob());
|
||||
}
|
||||
|
||||
// if (lastSeenVersion < Version.KBS_MIGRATION) {
|
||||
@@ -686,11 +687,11 @@ public class ApplicationMigrations {
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.SELF_REGISTERTED_STATE) {
|
||||
jobs.put(Version.SELF_REGISTERTED_STATE, new SelfRegisteredStateMigrationJob());
|
||||
jobs.put(Version.SELF_REGISTERTED_STATE, new SelfRegisteredStateMigrationJob());
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.SVR2_ENCLAVE_UPDATE) {
|
||||
jobs.put(Version.SVR2_ENCLAVE_UPDATE, new Svr2MirrorMigrationJob());
|
||||
jobs.put(Version.SVR2_ENCLAVE_UPDATE, new Svr2MirrorMigrationJob());
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.STORAGE_LOCAL_UNKNOWNS_FIX) {
|
||||
@@ -754,7 +755,7 @@ public class ApplicationMigrations {
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.SVR2_ENCLAVE_UPDATE_2) {
|
||||
jobs.put(Version.SVR2_ENCLAVE_UPDATE_2, new Svr2MirrorMigrationJob());
|
||||
jobs.put(Version.SVR2_ENCLAVE_UPDATE_2, new Svr2MirrorMigrationJob());
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.WALLPAPER_MIGRATION_CLEANUP) {
|
||||
@@ -816,7 +817,7 @@ public class ApplicationMigrations {
|
||||
if (lastSeenVersion < Version.AVATAR_COLOR_MIGRATION_JOB) {
|
||||
jobs.put(Version.AVATAR_COLOR_MIGRATION_JOB, new AvatarColorStorageServiceMigrationJob());
|
||||
}
|
||||
|
||||
|
||||
if (lastSeenVersion < Version.DUPLICATE_E164_FIX_2) {
|
||||
jobs.put(Version.DUPLICATE_E164_FIX_2, new DuplicateE164MigrationJob());
|
||||
}
|
||||
@@ -869,6 +870,10 @@ public class ApplicationMigrations {
|
||||
jobs.put(Version.QUOTE_THUMBNAIL_BACKFILL, new QuoteThumbnailBackfillMigrationJob());
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.EMOJI_ENGLISH_SEARCH) {
|
||||
jobs.put(Version.EMOJI_ENGLISH_SEARCH, new EmojiSearchEnglishLabelsMigrationJob());
|
||||
}
|
||||
|
||||
return jobs;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2025 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.migrations
|
||||
|
||||
import org.thoughtcrime.securesms.jobmanager.Job
|
||||
import org.thoughtcrime.securesms.jobs.EmojiSearchIndexDownloadJob
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
|
||||
/**
|
||||
* Schedules job to download both the localized and English emoji search indices, ensuring that emoji search data is available in the user's preferred
|
||||
* language as well as English.
|
||||
*/
|
||||
internal class EmojiSearchEnglishLabelsMigrationJob(parameters: Parameters = Parameters.Builder().build()) : MigrationJob(parameters) {
|
||||
companion object {
|
||||
const val KEY = "EmojiSearchEnglishLabelsMigrationJob"
|
||||
}
|
||||
|
||||
override fun getFactoryKey(): String = KEY
|
||||
override fun isUiBlocking(): Boolean = false
|
||||
|
||||
override fun performMigration() {
|
||||
if (EmojiSearchIndexDownloadJob.LANGUAGE_CODE_ENGLISH != SignalStore.emoji.searchLanguage) {
|
||||
SignalStore.emoji.clearSearchIndexMetadata()
|
||||
EmojiSearchIndexDownloadJob.scheduleImmediately()
|
||||
}
|
||||
}
|
||||
|
||||
override fun shouldRetry(e: Exception): Boolean = false
|
||||
|
||||
class Factory : Job.Factory<EmojiSearchEnglishLabelsMigrationJob> {
|
||||
override fun create(parameters: Parameters, serializedData: ByteArray?): EmojiSearchEnglishLabelsMigrationJob {
|
||||
return EmojiSearchEnglishLabelsMigrationJob(parameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user