mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 12:38:33 +00:00
Clean up additional data when viewing view-once messages.
This commit is contained in:
@@ -862,12 +862,19 @@ class AttachmentTable(
|
||||
DATA_RANDOM to null,
|
||||
DATA_HASH_START to null,
|
||||
DATA_HASH_END to null,
|
||||
REMOTE_KEY to null,
|
||||
REMOTE_DIGEST to null,
|
||||
REMOTE_INCREMENTAL_DIGEST to null,
|
||||
REMOTE_INCREMENTAL_DIGEST_CHUNK_SIZE to 0,
|
||||
THUMBNAIL_FILE to null,
|
||||
THUMBNAIL_RANDOM to null,
|
||||
FILE_NAME to null,
|
||||
CAPTION to null,
|
||||
DATA_SIZE to 0,
|
||||
WIDTH to 0,
|
||||
HEIGHT to 0,
|
||||
TRANSFER_STATE to TRANSFER_PROGRESS_DONE,
|
||||
ARCHIVE_TRANSFER_STATE to ArchiveTransferState.NONE.value,
|
||||
BLUR_HASH to null,
|
||||
CONTENT_TYPE to MediaUtil.VIEW_ONCE
|
||||
)
|
||||
|
||||
@@ -137,6 +137,7 @@ import org.thoughtcrime.securesms.database.helpers.migration.V279_AddNotificatio
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V280_RemoveAttachmentIv
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V281_RemoveArchiveTransferFile
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V282_AddSnippetMessageIdColumnToThreadTable
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V283_ViewOnceRemoteDataCleanup
|
||||
import org.thoughtcrime.securesms.database.SQLiteDatabase as SignalSqliteDatabase
|
||||
|
||||
/**
|
||||
@@ -279,10 +280,11 @@ object SignalDatabaseMigrations {
|
||||
279 to V279_AddNotificationProfileForeignKey,
|
||||
280 to V280_RemoveAttachmentIv,
|
||||
281 to V281_RemoveArchiveTransferFile,
|
||||
282 to V282_AddSnippetMessageIdColumnToThreadTable
|
||||
282 to V282_AddSnippetMessageIdColumnToThreadTable,
|
||||
283 to V283_ViewOnceRemoteDataCleanup
|
||||
)
|
||||
|
||||
const val DATABASE_VERSION = 282
|
||||
const val DATABASE_VERSION = 283
|
||||
|
||||
@JvmStatic
|
||||
fun migrate(context: Application, db: SignalSqliteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2025 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.database.helpers.migration
|
||||
|
||||
import android.app.Application
|
||||
import org.thoughtcrime.securesms.database.SQLiteDatabase
|
||||
|
||||
/**
|
||||
* We were unnecessarily holding on to some attachment download data for viewed view-once messages that we don't need to hold onto.
|
||||
*/
|
||||
object V283_ViewOnceRemoteDataCleanup : SignalDatabaseMigration {
|
||||
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
db.execSQL(
|
||||
"""
|
||||
UPDATE
|
||||
attachment
|
||||
SET
|
||||
remote_key = NULL,
|
||||
remote_digest = NULL,
|
||||
remote_incremental_digest = NULL,
|
||||
remote_incremental_digest_chunk_size = 0,
|
||||
thumbnail_file = NULL,
|
||||
thumbnail_random = NULL,
|
||||
archive_transfer_state = 0
|
||||
WHERE
|
||||
data_file IS NULL AND
|
||||
content_type = 'application/x-signal-view-once'
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user