Merge branch 'dev' into on

This commit is contained in:
andrew 2023-10-16 10:11:39 +10:30
commit c2088efe43
5 changed files with 23 additions and 6 deletions

View File

@ -31,8 +31,8 @@ configurations.all {
exclude module: "commons-logging" exclude module: "commons-logging"
} }
def canonicalVersionCode = 356 def canonicalVersionCode = 358
def canonicalVersionName = "1.17.2" def canonicalVersionName = "1.17.3"
def postFixSize = 10 def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1, def abiPostFix = ['armeabi-v7a' : 1,

View File

@ -9,13 +9,14 @@ import android.os.Bundle;
import androidx.annotation.IdRes; import androidx.annotation.IdRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import org.session.libsession.utilities.TextSecurePreferences;
import org.session.libsignal.utilities.Log; import org.session.libsignal.utilities.Log;
import org.thoughtcrime.securesms.home.HomeActivity; import org.thoughtcrime.securesms.home.HomeActivity;
import org.thoughtcrime.securesms.onboarding.LandingActivity; import org.thoughtcrime.securesms.onboarding.LandingActivity;
import org.thoughtcrime.securesms.service.KeyCachingService; import org.thoughtcrime.securesms.service.KeyCachingService;
import org.session.libsession.utilities.TextSecurePreferences;
import java.util.Locale; import java.util.Locale;
@ -168,7 +169,13 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
}; };
IntentFilter filter = new IntentFilter(KeyCachingService.CLEAR_KEY_EVENT); IntentFilter filter = new IntentFilter(KeyCachingService.CLEAR_KEY_EVENT);
registerReceiver(clearKeyReceiver, filter, KeyCachingService.KEY_PERMISSION, null); ContextCompat.registerReceiver(
this,
clearKeyReceiver, filter,
KeyCachingService.KEY_PERMISSION,
null,
ContextCompat.RECEIVER_NOT_EXPORTED
);
} }
private void removeClearKeyReceiver(Context context) { private void removeClearKeyReceiver(Context context) {

View File

@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.database
import android.content.ContentValues import android.content.ContentValues
import android.content.Context import android.content.Context
import android.database.Cursor import android.database.Cursor
import org.session.libsession.messaging.jobs.AttachmentDownloadJob
import org.session.libsession.messaging.jobs.AttachmentUploadJob import org.session.libsession.messaging.jobs.AttachmentUploadJob
import org.session.libsession.messaging.jobs.BackgroundGroupAddJob import org.session.libsession.messaging.jobs.BackgroundGroupAddJob
import org.session.libsession.messaging.jobs.GroupAvatarDownloadJob import org.session.libsession.messaging.jobs.GroupAvatarDownloadJob
@ -26,6 +27,9 @@ class SessionJobDatabase(context: Context, helper: SQLCipherOpenHelper) : Databa
const val serializedData = "serialized_data" const val serializedData = "serialized_data"
@JvmStatic val createSessionJobTableCommand @JvmStatic val createSessionJobTableCommand
= "CREATE TABLE $sessionJobTable ($jobID INTEGER PRIMARY KEY, $jobType STRING, $failureCount INTEGER DEFAULT 0, $serializedData TEXT);" = "CREATE TABLE $sessionJobTable ($jobID INTEGER PRIMARY KEY, $jobType STRING, $failureCount INTEGER DEFAULT 0, $serializedData TEXT);"
const val dropAttachmentDownloadJobs =
"DELETE FROM $sessionJobTable WHERE $jobType = '${AttachmentDownloadJob.KEY}';"
} }
fun persistJob(job: Job) { fun persistJob(job: Job) {

View File

@ -90,8 +90,10 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
private static final int lokiV42 = 63; private static final int lokiV42 = 63;
private static final int lokiV43 = 64; private static final int lokiV43 = 64;
private static final int lokiV44 = 65;
// Loki - onUpgrade(...) must be updated to use Loki version numbers if Signal makes any database changes // Loki - onUpgrade(...) must be updated to use Loki version numbers if Signal makes any database changes
private static final int DATABASE_VERSION = lokiV43; private static final int DATABASE_VERSION = lokiV44;
private static final int MIN_DATABASE_VERSION = lokiV7; private static final int MIN_DATABASE_VERSION = lokiV7;
private static final String CIPHER3_DATABASE_NAME = "signal.db"; private static final String CIPHER3_DATABASE_NAME = "signal.db";
public static final String DATABASE_NAME = "signal_v4.db"; public static final String DATABASE_NAME = "signal_v4.db";
@ -604,6 +606,10 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
db.execSQL(RecipientDatabase.getAddBlocksCommunityMessageRequests()); db.execSQL(RecipientDatabase.getAddBlocksCommunityMessageRequests());
} }
if (oldVersion < lokiV44) {
db.execSQL(SessionJobDatabase.dropAttachmentDownloadJobs);
}
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} finally { } finally {
db.endTransaction(); db.endTransaction();

View File

@ -35,7 +35,7 @@ class AttachmentDownloadJob(val attachmentID: Long, val databaseMessageID: Long)
override val maxFailureCount: Int = 2 override val maxFailureCount: Int = 2
companion object { companion object {
val KEY: String = "AttachmentDownloadJob" const val KEY: String = "AttachmentDownloadJob"
// Keys used for database storage // Keys used for database storage
private val ATTACHMENT_ID_KEY = "attachment_id" private val ATTACHMENT_ID_KEY = "attachment_id"