Update ktlint and gradle plugin.

This commit is contained in:
Cody Henthorne
2023-06-23 13:09:24 -04:00
committed by Nicholas
parent 65255121de
commit c17d62aeab
69 changed files with 447 additions and 176 deletions

View File

@@ -23,6 +23,6 @@ data class GiftFlowState(
RECIPIENT_VERIFICATION,
TOKEN_REQUEST,
PAYMENT_PIPELINE,
FAILURE;
FAILURE
}
}

View File

@@ -1188,7 +1188,8 @@ class ConversationFragment :
}
private fun updateLinkPreviewState() {
if (/* TODO [cfv2] -- viewModel.isPushAvailable && */ !attachmentManager.isAttachmentPresent && context != null) {
// TODO [cfv2] include viewModel.isPushAvailable && in check
if (!attachmentManager.isAttachmentPresent && context != null) {
linkPreviewViewModel.onEnabled()
linkPreviewViewModel.onTextChanged(composeText.textTrimmed.toString(), composeText.selectionStart, composeText.selectionEnd)
} else {
@@ -2185,7 +2186,7 @@ class ConversationFragment :
}
val conversationItem: ConversationItem = itemView
val isAttachmentKeyboardOpen = false /* TODO [cfv2] -- isAttachmentKeyboardOpen */
val isAttachmentKeyboardOpen = false // TODO [cfv2] -- isAttachmentKeyboardOpen
handleReaction(
item.conversationMessage,
ReactionsToolbarListener(item.conversationMessage),

View File

@@ -6,5 +6,5 @@ package org.thoughtcrime.securesms.conversationlist
*/
enum class ConversationFilterLatch {
SET,
RESET;
RESET
}

View File

@@ -40,5 +40,5 @@ enum class FilterPullState {
/**
* The filter is being removed and the animation is running
*/
CLOSING;
CLOSING
}

View File

@@ -1428,7 +1428,7 @@ class GroupTable(context: Context?, databaseHelper: SignalDatabase?) : DatabaseT
}
enum class MemberSet(val includeSelf: Boolean, val includePending: Boolean) {
FULL_MEMBERS_INCLUDING_SELF(true, false), FULL_MEMBERS_EXCLUDING_SELF(false, false), FULL_MEMBERS_AND_PENDING_INCLUDING_SELF(true, true), FULL_MEMBERS_AND_PENDING_EXCLUDING_SELF(false, true);
FULL_MEMBERS_INCLUDING_SELF(true, false), FULL_MEMBERS_EXCLUDING_SELF(false, false), FULL_MEMBERS_AND_PENDING_INCLUDING_SELF(true, true), FULL_MEMBERS_AND_PENDING_EXCLUDING_SELF(false, true)
}
/**

View File

@@ -4929,7 +4929,7 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
protected enum class ReceiptType(val columnName: String, val groupStatus: Int) {
READ(READ_RECEIPT_COUNT, GroupReceiptTable.STATUS_READ),
DELIVERY(DELIVERY_RECEIPT_COUNT, GroupReceiptTable.STATUS_DELIVERED),
VIEWED(VIEWED_RECEIPT_COUNT, GroupReceiptTable.STATUS_VIEWED);
VIEWED(VIEWED_RECEIPT_COUNT, GroupReceiptTable.STATUS_VIEWED)
}
data class SyncMessageId(

View File

@@ -16,6 +16,7 @@ import java.util.concurrent.atomic.AtomicReference
/**
* The default error handler wipes the file. This one instead prints some diagnostics and then crashes so the original corrupt file isn't lost.
*/
@Suppress("ClassName")
class SqlCipherErrorHandler(private val databaseName: String) : DatabaseErrorHandler {
override fun onCorruption(db: SQLiteDatabase, message: String) {

View File

@@ -7,6 +7,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
* Adding an urgent flag to message envelopes to help with notifications. Need to track flag in
* MSL table so can be resent with the correct urgency.
*/
@Suppress("ClassName")
object V150_UrgentMslFlagMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("ALTER TABLE msl_payload ADD COLUMN urgent INTEGER NOT NULL DEFAULT 1")

View File

@@ -13,6 +13,7 @@ import org.thoughtcrime.securesms.util.Base64
/**
* Performs a check and ensures that MyStory exists at the correct distribution list id and correct distribution id.
*/
@Suppress("ClassName")
object V151_MyStoryMigration : SignalDatabaseMigration {
private val TAG = Log.tag(V151_MyStoryMigration::class.java)

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Marks story recipients with a new group type constant.
*/
@Suppress("ClassName")
object V152_StoryGroupTypesMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL(

View File

@@ -13,6 +13,7 @@ import org.thoughtcrime.securesms.util.Base64
/**
* Performs a check and ensures that MyStory exists at the correct distribution list id and correct distribution id.
*/
@Suppress("ClassName")
object V153_MyStoryMigration : SignalDatabaseMigration {
private val TAG = Log.tag(V153_MyStoryMigration::class.java)

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Introduces the tables and fields required to keep track of whether we need to send a PNI signature message and if the ones we've sent out have been received.
*/
@Suppress("ClassName")
object V154_PniSignaturesMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Adds necessary book-keeping columns to SMS and MMS tables for SMS export.
*/
@Suppress("ClassName")
object V155_SmsExporterMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("ALTER TABLE mms ADD COLUMN export_state BLOB DEFAULT NULL")

View File

@@ -9,6 +9,7 @@ import java.util.concurrent.TimeUnit
* Adds an 'unregistered timestamp' on a recipient to keep track of when they became unregistered.
* Also updates all currently-unregistered users to have an unregistered time of "now".
*/
@Suppress("ClassName")
object V156_RecipientUnregisteredTimestampMigration : SignalDatabaseMigration {
const val UNREGISTERED = 2

View File

@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.database.helpers.migration
import android.app.Application
import net.zetetic.database.sqlcipher.SQLiteDatabase
@Suppress("ClassName")
object V157_RecipeintHiddenMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("ALTER TABLE recipient ADD COLUMN hidden INTEGER DEFAULT 0")

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Track last time we did a forced sanity check for this group with the server.
*/
@Suppress("ClassName")
object V158_GroupsLastForceUpdateTimestampMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("ALTER TABLE groups ADD COLUMN last_force_update_timestamp INTEGER DEFAULT 0")

View File

@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.database.helpers.migration
import android.app.Application
import net.zetetic.database.sqlcipher.SQLiteDatabase
@Suppress("ClassName")
object V159_ThreadUnreadSelfMentionCount : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("ALTER TABLE thread ADD COLUMN unread_self_mention_count INTEGER DEFAULT 0")

View File

@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.database.helpers.migration
import android.app.Application
import net.zetetic.database.sqlcipher.SQLiteDatabase
@Suppress("ClassName")
object V160_SmsMmsExportedIndexMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("CREATE INDEX IF NOT EXISTS sms_exported_index ON sms (exported)")

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Adds an index to the story sends table to help with a new common query.
*/
@Suppress("ClassName")
object V161_StorySendMessageIdIndex : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("CREATE INDEX IF NOT EXISTS story_sends_message_id_distribution_id_index ON story_sends (message_id, distribution_id)")

View File

@@ -10,6 +10,7 @@ import org.thoughtcrime.securesms.database.helpers.SignalDatabaseMigrations
* A bad cherry-pick for a database change requires us to attempt to alter the table again
* to fix it.
*/
@Suppress("ClassName")
object V162_ThreadUnreadSelfMentionCountFixup : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {

View File

@@ -7,6 +7,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Add columns needed to track remote megaphone specific snooze rates.
*/
@Suppress("ClassName")
object V163_RemoteMegaphoneSnoozeSupportMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
if (columnMissing(db, "primary_action_data")) {

View File

@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.database.helpers.migration
import android.app.Application
import net.zetetic.database.sqlcipher.SQLiteDatabase
@Suppress("ClassName")
object V164_ThreadDatabaseReadIndexMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("CREATE INDEX IF NOT EXISTS thread_read ON thread (read);")

View File

@@ -14,6 +14,7 @@ import org.signal.core.util.update
* This one's a doozy. We want to add additional foreign key constraints between the thread, recipient, and message tables. This will let us know for sure
* that there aren't threads with invalid recipients, or messages with invalid threads, or multiple threads for the same recipient.
*/
@Suppress("ClassName")
object V166_ThreadAndMessageForeignKeys : SignalDatabaseMigration {
private val TAG = Log.tag(V166_ThreadAndMessageForeignKeys::class.java)

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Forgot to recreate the triggers for the reactions table in [V166_ThreadAndMessageForeignKeys]. So we gotta fix stuff up and do it here.
*/
@Suppress("ClassName")
object V167_RecreateReactionTriggers : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL(

View File

@@ -7,6 +7,7 @@ import org.signal.core.util.Stopwatch
import org.signal.core.util.logging.Log
import org.thoughtcrime.securesms.keyvalue.SignalStore
@Suppress("ClassName")
object V168_SingleMessageTableMigration : SignalDatabaseMigration {
private val TAG = Log.tag(V168_SingleMessageTableMigration::class.java)

View File

@@ -7,6 +7,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
* We want to add a new `rank` column to the emoji_search table, and we no longer use it as an FTS
* table, so we can get rid of that too.
*/
@Suppress("ClassName")
object V169_EmojiSearchIndexRank : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL(

View File

@@ -13,6 +13,7 @@ import org.signal.core.util.update
* When we ran [V166_ThreadAndMessageForeignKeys], we forgot to update the actual table definition in [ThreadTable].
* We could make this conditional, but I'd rather run it on everyone just so it's more predictable.
*/
@Suppress("ClassName")
object V171_ThreadForeignKeyFix : SignalDatabaseMigration {
private val TAG = Log.tag(V171_ThreadForeignKeyFix::class.java)

View File

@@ -7,6 +7,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
* In order to support scheduled sending, we need to add another column to keep track of when to send the message. We also use this
* column to hide future scheduled messages from views.
*/
@Suppress("ClassName")
object V173_ScheduledMessagesMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("ALTER TABLE mms ADD COLUMN scheduled_date INTEGER DEFAULT -1")

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Expand quote index to included scheduled date so they can be excluded.
*/
@Suppress("ClassName")
object V176_AddScheduledDateToQuoteIndex : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("DROP INDEX IF EXISTS mms_quote_id_quote_author_index")

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* This adds a column to the Recipients table to store a spam reporting token.
*/
@Suppress("ClassName")
object V178_ReportingTokenColumnMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("ALTER TABLE recipient ADD COLUMN reporting_token BLOB DEFAULT NULL")

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* This cleans up some MSL entries that we left behind during a bad past migration.
*/
@Suppress("ClassName")
object V179_CleanupDanglingMessageSendLogMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("DELETE FROM msl_message WHERE payload_id NOT IN (SELECT _id FROM msl_payload)")

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Adds support for storing the systemNickname from storage service.
*/
@Suppress("ClassName")
object V180_RecipientNicknameMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("ALTER TABLE recipient ADD COLUMN system_nickname TEXT DEFAULT NULL")

View File

@@ -9,6 +9,7 @@ import org.signal.core.util.logging.Log
* We saw evidence (via failed backup restores) that some people have recipients in their thread table that do not exist in the recipient table.
* This is likely the result of a bad past migration, since a foreign key is in place. Cleaning it up now.
*/
@Suppress("ClassName")
object V181_ThreadTableForeignKeyCleanup : SignalDatabaseMigration {
val TAG = Log.tag(V181_ThreadTableForeignKeyCleanup::class.java)

View File

@@ -16,6 +16,7 @@ import org.thoughtcrime.securesms.database.RecipientTable
* Removes the 'NOT NULL' condition on message_id and peer, as with ad-hoc calling in place, these
* can now be null.
*/
@Suppress("ClassName")
object V182_CallTableMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL(

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Adds the CallLinkTable and modifies the CallTable to include an FK into it.
*/
@Suppress("ClassName")
object V183_CallLinkTableMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("CREATE TABLE call_link (_id INTEGER PRIMARY KEY)")

View File

@@ -6,6 +6,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* [V183_CallLinkTableMigration] accidentally setup a unique constraint incorrectly and missed an index. This fixes it.
*/
@Suppress("ClassName")
object V184_CallLinkReplaceIndexMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL(

View File

@@ -30,6 +30,7 @@ import org.whispersystems.signalservice.api.push.ACI
* Changes needed for edit message. New foreign keys require recreating the table.
*
*/
@Suppress("ClassName")
object V185_MessageRecipientsAndEditMessageMigration : SignalDatabaseMigration {
private val TAG = Log.tag(V185_MessageRecipientsAndEditMessageMigration::class.java)

View File

@@ -19,6 +19,7 @@ import org.signal.core.util.requireNonNullString
*
* While I was at it, I looked at other columns that would need indices as well.
*/
@Suppress("ClassName")
object V186_ForeignKeyIndicesMigration : SignalDatabaseMigration {
private val TAG = Log.tag(V186_ForeignKeyIndicesMigration::class.java)

View File

@@ -8,6 +8,7 @@ import org.signal.core.util.logging.Log
/**
* I found some other tables that didn't have the proper indexes setup to correspond with their foreign keys.
*/
@Suppress("ClassName")
object V187_MoreForeignKeyIndexesMigration : SignalDatabaseMigration {
private val TAG = Log.tag(V187_MoreForeignKeyIndexesMigration::class.java)

View File

@@ -34,6 +34,7 @@ import org.whispersystems.signalservice.api.push.ACI
* the concept of a self. To do that, we're going to create a placeholder for self with a special ID (-2), and then
* we're going to replace that ID with the true self after it's been created.
*/
@Suppress("ClassName")
object V188_FixMessageRecipientsAndEditMessageMigration : SignalDatabaseMigration {
private val TAG = Log.tag(V188_FixMessageRecipientsAndEditMessageMigration::class.java)

View File

@@ -12,6 +12,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
* Fleshes out the call link table and rebuilds the call event table.
* At this point, there should be no records in the call link database.
*/
@Suppress("ClassName")
object V189_CreateCallLinkTableColumnsAndRebuildFKReference : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL(

View File

@@ -7,6 +7,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
* This migration used to do what [V191_UniqueMessageMigrationV2] does. However, due to bugs, the migration was abandoned.
* We now re-do the migration in V191.
*/
@Suppress("ClassName")
object V190_UniqueMessageMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) = Unit
}

View File

@@ -15,6 +15,7 @@ import org.signal.core.util.requireLong
*
* This migration safely removes those dupes, and then adds the desired unique constraint.
*/
@Suppress("ClassName")
object V191_UniqueMessageMigrationV2 : SignalDatabaseMigration {
private val TAG = Log.tag(V191_UniqueMessageMigrationV2::class.java)

View File

@@ -13,6 +13,7 @@ import org.signal.core.util.logging.Log
/**
* Allow ROOT_KEY in CallLinkTable to be null.
*/
@Suppress("ClassName")
object V192_CallLinkTableNullableRootKeys : SignalDatabaseMigration {
private val TAG = Log.tag(V192_CallLinkTableNullableRootKeys::class.java)

View File

@@ -11,6 +11,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Due to a bug, this has been replaced by [V196_BackCallLinksWithRecipientV2]
*/
@Suppress("ClassName")
object V193_BackCallLinksWithRecipient : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) = Unit

View File

@@ -11,6 +11,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Introduces [org.thoughtcrime.securesms.database.KyberPreKeyTable].
*/
@Suppress("ClassName")
object V194_KyberPreKeyMigration : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL(

View File

@@ -17,6 +17,7 @@ import org.signal.core.util.requireLong
* Back CallLinks with a Recipient to ease integration and ensure we can support
* different features which would require that relation in the future.
*/
@Suppress("ClassName")
object V195_GroupMemberForeignKeyMigration : SignalDatabaseMigration {
private val TAG = Log.tag(V195_GroupMemberForeignKeyMigration::class.java)

View File

@@ -13,6 +13,7 @@ import org.signal.core.util.logging.Log
/**
* Cleans up the call events table and restricts peer to non-null.
*/
@Suppress("ClassName")
object V196_BackCallLinksWithRecipientV2 : SignalDatabaseMigration {
private val TAG = Log.tag(V196_BackCallLinksWithRecipientV2::class.java)

View File

@@ -11,6 +11,7 @@ import net.zetetic.database.sqlcipher.SQLiteDatabase
/**
* Because getting the color is a simple modulo operation, there is no need to store it in the database.
*/
@Suppress("ClassName")
object V197_DropAvatarColorFromCallLinks : SignalDatabaseMigration {
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
db.execSQL("ALTER TABLE call_link DROP COLUMN avatar_color")

View File

@@ -7,5 +7,5 @@ import org.thoughtcrime.securesms.R
enum class TextAlignment(val gravity: Int, @DrawableRes val icon: Int) {
START(Gravity.START or Gravity.CENTER_VERTICAL, R.drawable.ic_text_start),
CENTER(Gravity.CENTER, R.drawable.ic_text_center),
END(Gravity.END or Gravity.CENTER_VERTICAL, R.drawable.ic_text_end);
END(Gravity.END or Gravity.CENTER_VERTICAL, R.drawable.ic_text_end)
}

View File

@@ -17,5 +17,5 @@ enum class TextColorStyle(@DrawableRes val icon: Int) {
/**
* textColor background with white foreground.
*/
INVERT(R.drawable.ic_text_effect);
INVERT(R.drawable.ic_text_effect)
}

View File

@@ -205,7 +205,7 @@ class VerifyAccountRepository(private val context: Application) {
enum class Mode(val isSmsRetrieverSupported: Boolean) {
SMS_WITH_LISTENER(true),
SMS_WITHOUT_LISTENER(false),
PHONE_CALL(false);
PHONE_CALL(false)
}
private class PushTokenChallengeSubscriber {