Merge branch 'dev' into variable-rate-polling

pull/552/head
Niels Andriesse 3 years ago
commit 2a756375a8

@ -143,7 +143,7 @@ dependencies {
testImplementation 'org.robolectric:shadows-multidex:4.2'
}
def canonicalVersionCode = 169
def canonicalVersionCode = 170
def canonicalVersionName = "1.10.7"
def postFixSize = 10

@ -56,9 +56,10 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
private static final int lokiV22 = 43;
private static final int lokiV23 = 44;
private static final int lokiV24 = 45;
private static final int lokiV25 = 46;
// Loki - onUpgrade(...) must be updated to use Loki version numbers if Signal makes any database changes
private static final int DATABASE_VERSION = lokiV24;
private static final int DATABASE_VERSION = lokiV25;
private static final String DATABASE_NAME = "signal.db";
private final Context context;
@ -291,6 +292,12 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
db.execSQL(LokiAPIDatabase.getCreateSwarmTableCommand());
}
if (oldVersion < lokiV25) {
String jobTable = SessionJobDatabase.sessionJobTable;
db.execSQL("DROP TABLE " + jobTable);
db.execSQL(SessionJobDatabase.getCreateSessionJobTableCommand());
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();

@ -14,7 +14,7 @@ import org.thoughtcrime.securesms.loki.utilities.*
class SessionJobDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper) {
companion object {
private const val sessionJobTable = "session_job_database"
const val sessionJobTable = "session_job_database"
const val jobID = "job_id"
const val jobType = "job_type"
const val failureCount = "failure_count"

@ -28,7 +28,7 @@ dependencies {
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.annimon:stream:1.1.8'
implementation 'com.makeramen:roundedimageview:2.1.0'
implementation 'com.esotericsoftware:kryo:4.0.1'
implementation 'com.esotericsoftware:kryo:5.1.1'
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
implementation "org.whispersystems:curve25519-java:$curve25519Version"

@ -158,7 +158,7 @@ class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val mess
.putString(THREAD_ID_KEY, threadID)
.putByteArray(MESSAGE_KEY, serializedMessage)
.putString(MESSAGE_SEND_JOB_ID_KEY, messageSendJobID)
.build();
.build()
}
override fun getFactoryKey(): String {
@ -172,7 +172,7 @@ class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val mess
val kryo = Kryo()
kryo.isRegistrationRequired = false
val input = Input(serializedMessage)
val message: Message = kryo.readObject(input, Message::class.java)
val message = kryo.readObject(input, Message::class.java)
input.close()
return AttachmentUploadJob(
data.getLong(ATTACHMENT_ID_KEY),

@ -88,17 +88,16 @@ class MessageSendJob(val message: Message, val destination: Destination) : Job {
override fun serialize(): Data {
val kryo = Kryo()
kryo.isRegistrationRequired = false
val output = Output(ByteArray(4096), MAX_BUFFER_SIZE)
// Message
kryo.writeClassAndObject(output, message)
output.close()
val serializedMessage = output.toBytes()
output.clear()
val messageOutput = Output(ByteArray(4096), MAX_BUFFER_SIZE)
kryo.writeClassAndObject(messageOutput, message)
messageOutput.close()
val serializedMessage = messageOutput.toBytes()
// Destination
kryo.writeClassAndObject(output, destination)
output.close()
val serializedDestination = output.toBytes()
output.clear()
val destinationOutput = Output(ByteArray(4096), MAX_BUFFER_SIZE)
kryo.writeClassAndObject(destinationOutput, destination)
destinationOutput.close()
val serializedDestination = destinationOutput.toBytes()
// Serialize
return Data.Builder()
.putByteArray(MESSAGE_KEY, serializedMessage)
@ -116,6 +115,7 @@ class MessageSendJob(val message: Message, val destination: Destination) : Job {
val serializedMessage = data.getByteArray(MESSAGE_KEY)
val serializedDestination = data.getByteArray(DESTINATION_KEY)
val kryo = Kryo()
kryo.isRegistrationRequired = false
// Message
val messageInput = Input(serializedMessage)
val message: Message

@ -67,7 +67,9 @@ class NotifyPNServerJob(val message: SnodeMessage) : Job {
val output = Output(serializedMessage)
kryo.writeObject(output, message)
output.close()
return Data.Builder().putByteArray(MESSAGE_KEY, serializedMessage).build();
return Data.Builder()
.putByteArray(MESSAGE_KEY, serializedMessage)
.build();
}
override fun getFactoryKey(): String {
@ -81,7 +83,7 @@ class NotifyPNServerJob(val message: SnodeMessage) : Job {
val kryo = Kryo()
kryo.isRegistrationRequired = false
val input = Input(serializedMessage)
val message: SnodeMessage = kryo.readObject(input, SnodeMessage::class.java)
val message = kryo.readObject(input, SnodeMessage::class.java)
input.close()
return NotifyPNServerJob(message)
}

Loading…
Cancel
Save