mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 02:10:44 +01:00
Fix group call flickering missed.
This commit is contained in:
committed by
Greyson Parrelli
parent
3c10966a36
commit
d424a60345
@@ -44,7 +44,7 @@ public class JobManager implements ConstraintObserver.Notifier {
|
||||
|
||||
private static final String TAG = Log.tag(JobManager.class);
|
||||
|
||||
public static final int CURRENT_VERSION = 11;
|
||||
public static final int CURRENT_VERSION = 12;
|
||||
|
||||
private final Application application;
|
||||
private final Configuration configuration;
|
||||
|
||||
@@ -50,6 +50,18 @@ public class JsonJobData {
|
||||
}
|
||||
}
|
||||
|
||||
public static @Nullable JsonJobData deserializeOrNull(@Nullable byte[] data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return JsonUtils.fromJson(data, JsonJobData.class);
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private JsonJobData(@JsonProperty("strings") @NonNull Map<String, String> strings,
|
||||
@JsonProperty("stringArrays") @NonNull Map<String, String[]> stringArrays,
|
||||
@JsonProperty("integers") @NonNull Map<String, Integer> integers,
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2024 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.jobmanager.migrations
|
||||
|
||||
import org.thoughtcrime.securesms.jobmanager.JobMigration
|
||||
import org.thoughtcrime.securesms.jobmanager.JsonJobData
|
||||
import org.thoughtcrime.securesms.jobs.protos.GroupCallPeekJobData
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
|
||||
/**
|
||||
* Migrate jobs with just the recipient id to utilize the new data proto.
|
||||
*/
|
||||
class GroupCallPeekJobDataMigration : JobMigration(12) {
|
||||
|
||||
companion object {
|
||||
private const val KEY_GROUP_RECIPIENT_ID: String = "group_recipient_id"
|
||||
private val GROUP_PEEK_JOB_KEYS = arrayOf("GroupCallPeekJob", "GroupCallPeekWorkerJob")
|
||||
}
|
||||
|
||||
override fun migrate(jobData: JobData): JobData {
|
||||
if (jobData.factoryKey !in GROUP_PEEK_JOB_KEYS) {
|
||||
return jobData
|
||||
}
|
||||
|
||||
val data = jobData.data ?: return jobData
|
||||
val jsonData = JsonJobData.deserializeOrNull(data) ?: return jobData
|
||||
val recipientId = jsonData.getStringOrDefault(KEY_GROUP_RECIPIENT_ID, null) ?: return jobData
|
||||
|
||||
val jobProto = GroupCallPeekJobData(
|
||||
groupRecipientId = recipientId.toLong(),
|
||||
senderRecipientId = RecipientId.UNKNOWN.toLong(),
|
||||
serverTimestamp = 0L
|
||||
)
|
||||
|
||||
return jobData.withData(jobProto.encode())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user