Skip to content

Commit

Permalink
Merge tag 'v7.16.4' into molly-7.16
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Sep 13, 2024
2 parents 05805dd + 07289b4 commit 1a57191
Show file tree
Hide file tree
Showing 144 changed files with 10,001 additions and 4,798 deletions.
6 changes: 4 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ apply {
from("fix-profm.gradle")
}

val canonicalVersionCode = 1451
val canonicalVersionName = "7.15.4"
val canonicalVersionCode = 1456
val canonicalVersionName = "7.16.4"
val currentHotfixVersion = 0
val maxHotfixVersions = 100
val mollyRevision = 1
Expand All @@ -45,6 +45,7 @@ val signalBuildToolsVersion: String by rootProject.extra
val signalCompileSdkVersion: String by rootProject.extra
val signalTargetSdkVersion: Int by rootProject.extra
val signalMinSdkVersion: Int by rootProject.extra
val signalNdkVersion: String by rootProject.extra
val signalJavaVersion: JavaVersion by rootProject.extra
val signalKotlinJvmTarget: String by rootProject.extra

Expand Down Expand Up @@ -79,6 +80,7 @@ android {

buildToolsVersion = signalBuildToolsVersion
compileSdkVersion = signalCompileSdkVersion
ndkVersion = signalNdkVersion

flavorDimensions += listOf("environment", "license", "distribution")
useLibrary("org.apache.http.legacy")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.signal.core.util.concurrent.SignalExecutors
import org.thoughtcrime.securesms.testing.SignalFlakyTest
import org.thoughtcrime.securesms.testing.SignalFlakyTestRule
import java.util.concurrent.CountDownLatch
import java.util.concurrent.atomic.AtomicBoolean
Expand Down Expand Up @@ -187,8 +186,8 @@ class SQLiteDatabaseTest {
assertTrue(hasRun2.get())
}

@SignalFlakyTest
@Test
// @SignalFlakyTest
// @Test
fun runPostSuccessfulTransaction_runsAfterMainTransactionInNestedTransaction() {
val hasRun1 = AtomicBoolean(false)
val hasRun2 = AtomicBoolean(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class EditMessageSyncProcessorTest {
.build()
).build()
).build()
SignalDatabase.recipients.setExpireMessages(toRecipient.id, content.dataMessage?.expireTimer ?: 0)
SignalDatabase.recipients.setExpireMessages(toRecipient.id, content.dataMessage?.expireTimer ?: 0, content.dataMessage?.expireTimerVersion ?: 1)
val syncTextMessage = TestMessage(
envelope = MessageContentFuzzer.envelope(originalTimestamp),
content = syncContent,
Expand Down Expand Up @@ -112,7 +112,7 @@ class EditMessageSyncProcessorTest {

testResult.runSync(listOf(syncTextMessage, syncEditMessage))

SignalDatabase.recipients.setExpireMessages(toRecipient.id, (content.dataMessage?.expireTimer ?: 0) / 1000)
SignalDatabase.recipients.setExpireMessages(toRecipient.id, (content.dataMessage?.expireTimer ?: 0) / 1000, content.dataMessage?.expireTimerVersion ?: 1)
val originalTextMessage = OutgoingMessage(
threadRecipient = toRecipient,
sentTimeMillis = originalTimestamp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class SignalActivityRule(private val othersCount: Int = 4, private val createGro
val recipientId = RecipientId.from(SignalServiceAddress(aci, "+15555551%03d".format(i)))
SignalDatabase.recipients.setProfileName(recipientId, ProfileName.fromParts("Buddy", "#$i"))
SignalDatabase.recipients.setProfileKeyIfAbsent(recipientId, ProfileKeyUtil.createNew())
SignalDatabase.recipients.setCapabilities(recipientId, SignalServiceProfile.Capabilities(true, false))
SignalDatabase.recipients.setCapabilities(recipientId, SignalServiceProfile.Capabilities(true, false, true))
SignalDatabase.recipients.setProfileSharing(recipientId, true)
SignalDatabase.recipients.markRegistered(recipientId, aci)
val otherIdentity = IdentityKeyUtil.generateIdentityKeyPair()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class ConversationElementGenerator {
0,
0,
0,
0,
false,
true,
null,
Expand Down
11,089 changes: 7,379 additions & 3,710 deletions app/src/main/baseline-prof.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ object AppCapabilities {
fun getCapabilities(storageCapable: Boolean): AccountAttributes.Capabilities {
return AccountAttributes.Capabilities(
storage = storageCapable,
deleteSync = true
deleteSync = true,
versionedExpirationTimer = true
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PendingGroupJoinRequestsBanner(override val enabled: Boolean, private val
DefaultBanner(
title = null,
body = pluralStringResource(
id = R.plurals.GroupsV1MigrationSuggestionsReminder_members_couldnt_be_added_to_the_new_group,
id = R.plurals.PendingGroupJoinRequestsReminder_d_pending_member_requests,
count = suggestionsSize,
suggestionsSize
),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import org.signal.core.util.logging.Log;
import org.signal.glide.transforms.SignalDownsampleStrategy;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.attachments.Attachment;
import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
import org.thoughtcrime.securesms.blurhash.BlurHash;
import org.thoughtcrime.securesms.components.transfercontrols.TransferControlView;
import org.thoughtcrime.securesms.database.AttachmentTable;
Expand Down Expand Up @@ -404,9 +406,22 @@ public ListenableFuture<Boolean> setImageResource(@NonNull RequestManager reques
return new SettableFuture<>(false);
}

Log.i(TAG, "loading part with id " + slide.asAttachment().getUri()
Attachment slideAttachment = slide.asAttachment();
String id;
if (slideAttachment instanceof DatabaseAttachment) {
id = ((DatabaseAttachment) slideAttachment).attachmentId.serialize();
} else {
final Uri uri = slideAttachment.getUri();
if (uri != null) {
id = slideAttachment.getUri().toString();
} else {
id = slideAttachment.getClass().getSimpleName();
}
}

Log.i(TAG, "loading part with id " + id
+ ", progress " + slide.getTransferState() + ", fast preflight id: " +
slide.asAttachment().fastPreflightId);
slideAttachment.fastPreflightId);

BlurHash previousBlurHash = this.slide != null ? this.slide.getPlaceholderBlur() : null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,19 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter

dividerPref()

sectionHeaderPref(DSLSettingsText.from("Media"))

switchPref(
title = DSLSettingsText.from("Enable HEVC Encoding for HD Videos"),
summary = DSLSettingsText.from("Videos sent in \"HD\" quality will be encoded in HEVC on compatible devices."),
isChecked = state.hevcEncoding,
onClick = {
viewModel.setHevcEncoding(!state.hevcEncoding)
}
)

dividerPref()

sectionHeaderPref(DSLSettingsText.from("Conversations and Shortcuts"))

clickPref(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ data class InternalSettingsState(
val disableStorageService: Boolean,
val canClearOnboardingState: Boolean,
val useConversationItemV2ForMedia: Boolean,
val hevcEncoding: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
refresh()
}

fun setHevcEncoding(enabled: Boolean) {
SignalStore.internal.hevcEncoding = enabled
refresh()
}

fun addSampleReleaseNote() {
repository.addSampleReleaseNote()
}
Expand Down Expand Up @@ -130,6 +135,7 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
disableStorageService = SignalStore.internal.storageServiceDisabled(),
canClearOnboardingState = SignalStore.story.hasDownloadedOnboardingStory && Stories.isFeatureEnabled(),
useConversationItemV2ForMedia = SignalStore.internal.useConversationItemV2Media(),
hevcEncoding = SignalStore.internal.hevcEncoding
)

fun onClearOnboardingState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.recipients.RecipientId
import org.thoughtcrime.securesms.sms.MessageSender
import org.thoughtcrime.securesms.storage.StorageSyncHelper
import org.thoughtcrime.securesms.util.ExpirationTimerUtil
import java.io.IOException

private val TAG: String = Log.tag(ExpireTimerSettingsRepository::class.java)
Expand All @@ -38,8 +39,8 @@ class ExpireTimerSettingsRepository(val context: Context) {
consumer.invoke(Result.failure(e))
}
} else {
SignalDatabase.recipients.setExpireMessages(recipientId, newExpirationTime)
val outgoingMessage = OutgoingMessage.expirationUpdateMessage(Recipient.resolved(recipientId), System.currentTimeMillis(), newExpirationTime * 1000L)
val expireTimerVersion = ExpirationTimerUtil.setExpirationTimer(recipientId, newExpirationTime)
val outgoingMessage = OutgoingMessage.expirationUpdateMessage(Recipient.resolved(recipientId), System.currentTimeMillis(), newExpirationTime * 1000L, expireTimerVersion)
MessageSender.send(context, outgoingMessage, getThreadId(recipientId), MessageSender.SendType.SIGNAL, null, null)
consumer.invoke(Result.success(newExpirationTime))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ class InAppPaymentCheckoutDelegate(
}

is DonationError.BadgeRedemptionError.DonationPending -> {
Log.d(TAG, "User launched an external application.", true)
errorHandlerCallback?.onUserLaunchedAnExternalApplication()
Log.d(TAG, "Long-running donation is still pending.", true)
errorHandlerCallback?.navigateToDonationPending(inAppPayment)
}

is DonationError.UserLaunchedExternalApplication -> {
Log.d(TAG, "Long-running donation is still pending.", true)
errorHandlerCallback?.navigateToDonationPending(inAppPayment)
Log.d(TAG, "User launched an external application.", true)
errorHandlerCallback?.onUserLaunchedAnExternalApplication()
}

else -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,9 @@ class InternalConversationSettingsFragment : DSLSettingsFragment(

return if (capabilities != null) {
TextUtils.concat(
colorize("DeleteSync", capabilities.deleteSync),
", ",
colorize("DeleteSync", capabilities.deleteSync)
colorize("VersionedExpirationTimer", capabilities.versionedExpirationTimer)
)
} else {
"Recipient not found!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ class TransferControlView @JvmOverloads constructor(context: Context, attrs: Att
val existingEvent = mutableMap[attachment]
if (existingEvent == null || updateEvent.completed > existingEvent.completed) {
mutableMap[attachment] = updateEvent
} else if (updateEvent.completed < 0) {
mutableMap.remove(attachment)
}
verboseLog("onEventAsync compression update")
return@updateState it.copy(compressionProgress = mutableMap.toMap())
Expand All @@ -538,6 +540,8 @@ class TransferControlView @JvmOverloads constructor(context: Context, attrs: Att
val existingEvent = mutableMap[attachment]
if (existingEvent == null || updateEvent.completed > existingEvent.completed) {
mutableMap[attachment] = updateEvent
} else if (updateEvent.completed < 0) {
mutableMap.remove(attachment)
}
verboseLog("onEventAsync network update")
return@updateState it.copy(networkProgress = mutableMap.toMap())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,24 @@ public void onCreate() {
public void onTaskRemoved(Intent rootIntent) {
super.onTaskRemoved(rootIntent);

mediaSession.getPlayer().stop();
mediaSession.getPlayer().clearMediaItems();
if (mediaSession != null) {
mediaSession.getPlayer().stop();
mediaSession.getPlayer().clearMediaItems();
}
}

@Override
public void onDestroy() {
player.removeListener(playerEventListener);
if (mediaSession != null) {
AppDependencies.getDatabaseObserver().unregisterObserver(attachmentDeletionObserver);
keyClearedReceiver.unregister();
player.release();

mediaSession.release();
mediaSession = null;

clearListener();
keyClearedReceiver.unregister();
}
super.onDestroy();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.thoughtcrime.securesms.components.webrtc

import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import kotlin.math.min

/**
Expand All @@ -13,15 +16,30 @@ class ToggleButtonOutputState {
throw IndexOutOfBoundsException("Index: $value, size: ${availableOutputs.size}")
}
field = value
currentDevice = getCurrentOutput()
}

/**
* Observable state of currently selected device.
*/
var currentDevice by mutableStateOf(getCurrentOutput())
private set

/**
* Observable state of available devices.
*/
var availableDevices by mutableStateOf(getOutputs())
private set

var isEarpieceAvailable: Boolean
get() = availableOutputs.contains(WebRtcAudioOutput.HANDSET)
set(value) {
if (value) {
availableOutputs.add(WebRtcAudioOutput.HANDSET)
availableDevices = getOutputs()
} else {
availableOutputs.remove(WebRtcAudioOutput.HANDSET)
availableDevices = getOutputs()
selectedDevice = min(selectedDevice, availableOutputs.size - 1)
}
}
Expand All @@ -31,8 +49,10 @@ class ToggleButtonOutputState {
set(value) {
if (value) {
availableOutputs.add(WebRtcAudioOutput.BLUETOOTH_HEADSET)
availableDevices = getOutputs()
} else {
availableOutputs.remove(WebRtcAudioOutput.BLUETOOTH_HEADSET)
availableDevices = getOutputs()
selectedDevice = min(selectedDevice, availableOutputs.size - 1)
}
}
Expand All @@ -41,8 +61,10 @@ class ToggleButtonOutputState {
set(value) {
if (value) {
availableOutputs.add(WebRtcAudioOutput.WIRED_HEADSET)
availableDevices = getOutputs()
} else {
availableOutputs.remove(WebRtcAudioOutput.WIRED_HEADSET)
availableDevices = getOutputs()
selectedDevice = min(selectedDevice, availableOutputs.size - 1)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class WebRtcAudioOutputToggleButton @JvmOverloads constructor(context: Context,
WebRtcAudioOutput.WIRED_HEADSET -> intArrayOf(R.attr.state_wired_headset_selected)
}

Log.i(TAG, "Switching to $currentOutput")
Log.d(TAG, "Switching button drawable to $currentOutput")

val drawableState = super.onCreateDrawableState(extraSpace + extra.size)
mergeDrawableStates(drawableState, extra)
Expand Down
Loading

0 comments on commit 1a57191

Please sign in to comment.