Skip to content

Commit

Permalink
Merge tag 'v7.25.2' into molly-7.25
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Nov 27, 2024
2 parents e8ac436 + ed1348c commit ee09f3b
Show file tree
Hide file tree
Showing 365 changed files with 21,827 additions and 12,308 deletions.
8 changes: 3 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ apply {
from("fix-profm.gradle")
}

val canonicalVersionCode = 1484
val canonicalVersionName = "7.24.2"
val canonicalVersionCode = 1487
val canonicalVersionName = "7.25.2"
val currentHotfixVersion = 0
val maxHotfixVersions = 100
val mollyRevision = 2
val mollyRevision = 1

val sourceVersionNameWithRevision = "${canonicalVersionName}-${mollyRevision}"

Expand Down Expand Up @@ -83,7 +83,6 @@ android {
ndkVersion = signalNdkVersion

flavorDimensions += listOf("environment", "license", "distribution")
useLibrary("org.apache.http.legacy")
testBuildType = "instrumentation"

android.bundle.language.enableSplit = false
Expand Down Expand Up @@ -491,7 +490,6 @@ dependencies {
implementation(libs.molly.ringrtc)
implementation(libs.leolin.shortcutbadger)
implementation(libs.emilsjolander.stickylistheaders)
implementation(libs.apache.httpclient.android)
implementation(libs.glide.glide)
implementation(libs.roundedimageview)
implementation(libs.materialish.progress)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.thoughtcrime.securesms.testing.SignalActivityRule
import org.thoughtcrime.securesms.testing.assertIs
import org.thoughtcrime.securesms.util.MessageTableTestUtils
import org.whispersystems.signalservice.api.storage.SignalContactRecord
import org.whispersystems.signalservice.api.storage.toSignalContactRecord
import org.whispersystems.signalservice.internal.storage.protos.ContactRecord

@Suppress("ClassName")
Expand All @@ -34,10 +35,10 @@ class RecipientTableTest_applyStorageSyncContactUpdate {
MmsHelper.insert(recipient = other)
identities.setVerified(other.id, harness.othersKeys[0].publicKey, IdentityTable.VerifiedStatus.VERIFIED)

val oldRecord: SignalContactRecord = StorageSyncModels.localToRemoteRecord(SignalDatabase.recipients.getRecordForSync(harness.others[0])!!).contact.get()
val oldRecord: SignalContactRecord = StorageSyncModels.localToRemoteRecord(SignalDatabase.recipients.getRecordForSync(harness.others[0])!!).let { it.proto.contact!!.toSignalContactRecord(it.id) }

val newProto = oldRecord
.toProto()
.proto
.newBuilder()
.identityState(ContactRecord.IdentityState.DEFAULT)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.profiles.ProfileName
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.recipients.RecipientId
import org.thoughtcrime.securesms.registration.data.AccountRegistrationResult
import org.thoughtcrime.securesms.registration.data.LocalRegistrationMetadataUtil
import org.thoughtcrime.securesms.registration.data.RegistrationData
import org.thoughtcrime.securesms.registration.data.RegistrationRepository
Expand Down Expand Up @@ -101,7 +102,7 @@ class SignalActivityRule(private val othersCount: Int = 4, private val createGro
pniRegistrationId = RegistrationRepository.getPniRegistrationId(),
recoveryPassword = "asdfasdfasdfasdf"
)
val remoteResult = RegistrationRepository.AccountRegistrationResult(
val remoteResult = AccountRegistrationResult(
uuid = UUID.randomUUID().toString(),
pni = UUID.randomUUID().toString(),
storageCapable = false,
Expand Down
22 changes: 16 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
android:exported="false"/>

<activity android:name=".groups.ui.invitesandrequests.ManagePendingAndRequestingMembersActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize|uiMode"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:theme="@style/Theme.Signal.DayNight.NoActionBar"
android:exported="false"/>

Expand Down Expand Up @@ -819,13 +819,25 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:exported="false"/>

<activity android:name=".registrationv3.olddevice.TransferAccountActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:theme="@style/Theme.Signal.DayNight.NoActionBar"
android:exported="false"/>

<activity android:name=".registration.ui.RegistrationActivity"
android:launchMode="singleTask"
android:theme="@style/Theme.Signal.DayNight.NoActionBar"
android:windowSoftInputMode="stateHidden"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:exported="false"/>

<activity android:name=".registrationv3.ui.RegistrationActivity"
android:launchMode="singleTask"
android:theme="@style/Theme.Signal.DayNight.NoActionBar"
android:windowSoftInputMode="stateHidden|adjustResize"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:exported="false"/>

<activity android:name=".restore.RestoreActivity"
android:launchMode="singleTask"
android:theme="@style/Theme.Signal.DayNight.NoActionBar"
Expand Down Expand Up @@ -943,7 +955,7 @@
android:windowSoftInputMode="stateVisible|adjustResize"
android:exported="false"/>

<activity android:name=".registration.ui.restore.RemoteRestoreActivity"
<activity android:name=".registrationv3.ui.restore.RemoteRestoreActivity"
android:theme="@style/Signal.DayNight.NoActionBar"
android:exported="false"/>

Expand Down Expand Up @@ -1040,13 +1052,13 @@

<activity android:name=".megaphone.ClientDeprecatedActivity"
android:theme="@style/Theme.Signal.DayNight.NoActionBar"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize|uiMode"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:launchMode="singleTask"
android:exported="false"/>

<activity android:name=".ratelimit.RecaptchaProofActivity"
android:theme="@style/Theme.Signal.DayNight.NoActionBar"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize|uiMode"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:exported="false"/>

<activity android:name=".wallpaper.crop.WallpaperImageSelectionActivity"
Expand Down Expand Up @@ -1363,7 +1375,5 @@
</intent-filter>
</receiver>

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

</application>
</manifest>
17 changes: 11 additions & 6 deletions app/src/main/java/org/thoughtcrime/securesms/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.thoughtcrime.securesms.components.voice.VoiceNoteMediaController;
import org.thoughtcrime.securesms.components.voice.VoiceNoteMediaControllerOwner;
import org.thoughtcrime.securesms.conversationlist.RelinkDevicesReminderBottomSheetFragment;
import org.thoughtcrime.securesms.conversationlist.RestoreCompleteBottomSheetDialog;
import org.thoughtcrime.securesms.devicetransfer.olddevice.OldDeviceExitActivity;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.net.DeviceTransferBlockingInterceptor;
Expand Down Expand Up @@ -187,7 +188,16 @@ protected void onPreCreate() {
protected void onResume() {
super.onResume();
dynamicTheme.onResume(this);
if (SignalStore.misc().isOldDeviceTransferLocked()) {

if (SignalStore.misc().getShouldShowLinkedDevicesReminder()) {
SignalStore.misc().setShouldShowLinkedDevicesReminder(false);
RelinkDevicesReminderBottomSheetFragment.show(getSupportFragmentManager());
}

if (SignalStore.registration().isRestoringOnNewDevice()) {
SignalStore.registration().setRestoringOnNewDevice(false);
RestoreCompleteBottomSheetDialog.show(getSupportFragmentManager());
} else if (SignalStore.misc().isOldDeviceTransferLocked()) {
new MaterialAlertDialogBuilder(this)
.setTitle(R.string.OldDeviceTransferLockedDialog__complete_registration_on_your_new_device)
.setMessage(R.string.OldDeviceTransferLockedDialog__your_signal_account_has_been_transferred_to_your_new_device)
Expand All @@ -200,11 +210,6 @@ protected void onResume() {
.show();
}

if (SignalStore.misc().getShouldShowLinkedDevicesReminder()) {
SignalStore.misc().setShouldShowLinkedDevicesReminder(false);
RelinkDevicesReminderBottomSheetFragment.show(getSupportFragmentManager());
}

updateTabVisibility();

vitalsViewModel.checkSlowNotificationHeuristics();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private int getApplicationState(boolean locked) {
return STATE_UI_BLOCKING_UPGRADE;
} else if (!TextSecurePreferences.hasPromptedPushRegistration(this)) {
return STATE_WELCOME_PUSH_SCREEN;
} else if (SignalStore.storageService().needsAccountRestore()) {
} else if (SignalStore.storageService().getNeedsAccountRestore()) {
return STATE_ENTER_SIGNAL_PIN;
} else if (userCanTransferOrRestore()) {
return STATE_TRANSFER_OR_RESTORE;
Expand All @@ -151,11 +151,10 @@ private boolean userCanTransferOrRestore() {
}

private boolean userMustCreateSignalPin() {
return !SignalStore.registration().isRegistrationComplete() && !SignalStore.svr().hasPin() && !SignalStore.svr().lastPinCreateFailed() && !SignalStore.svr().hasOptedOut();
}

private boolean userHasSkippedOrForgottenPin() {
return !SignalStore.registration().isRegistrationComplete() && !SignalStore.svr().hasPin() && !SignalStore.svr().hasOptedOut() && SignalStore.svr().isPinForgottenOrSkipped();
return !SignalStore.registration().isRegistrationComplete() &&
!SignalStore.svr().hasOptedInWithAccess() &&
!SignalStore.svr().lastPinCreateFailed() &&
!SignalStore.svr().hasOptedOut();
}

private boolean userMustSetProfileName() {
Expand Down Expand Up @@ -195,7 +194,7 @@ private Intent getCreateSignalPinIntent() {
}

private Intent getTransferOrRestoreIntent() {
Intent intent = RestoreActivity.getIntentForTransferOrRestore(this);
Intent intent = RestoreActivity.getRestoreIntent(this);
return getRoutedIntent(intent, MainActivity.clearTop(this));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@

package org.thoughtcrime.securesms.backup.v2

import android.os.Environment
import android.os.StatFs
import androidx.annotation.WorkerThread
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import okio.ByteString.Companion.toByteString
import org.greenrobot.eventbus.EventBus
import org.signal.core.util.Base64
import org.signal.core.util.ByteSize
import org.signal.core.util.EventTimer
import org.signal.core.util.Stopwatch
import org.signal.core.util.bytes
import org.signal.core.util.concurrent.LimitedWorker
import org.signal.core.util.concurrent.SignalExecutors
import org.signal.core.util.forceForeignKeyConstraintsEnabled
Expand Down Expand Up @@ -126,9 +130,16 @@ object BackupRepository {
}
}

fun getFreeStorageSpace(): ByteSize {
val statFs = StatFs(Environment.getDataDirectory().absolutePath)
val free = (statFs.availableBlocksLong) * statFs.blockSizeLong

return free.bytes
}

@JvmStatic
fun skipMediaRestore() {
// TODO [backups] -- Clear the error as necessary
// TODO [backups] -- Clear the error as necessary, cancel anything remaining in the restore
}

/**
Expand Down Expand Up @@ -644,7 +655,7 @@ object BackupRepository {

else -> Log.w(TAG, "Unrecognized frame")
}
EventBus.getDefault().post(RestoreV2Event(RestoreV2Event.Type.PROGRESS_RESTORE, frameReader.getBytesRead(), totalLength))
EventBus.getDefault().post(RestoreV2Event(RestoreV2Event.Type.PROGRESS_RESTORE, frameReader.getBytesRead().bytes, totalLength.bytes))
}

if (chatItemInserter.flush()) {
Expand Down Expand Up @@ -1176,7 +1187,7 @@ object BackupRepository {
return if (SignalStore.backup.backupsInitialized) {
getArchiveServiceAccessPair().runOnStatusCodeError(resetInitializedStateErrorAction)
} else if (isPreRestoreDuringRegistration()) {
Log.w(TAG, "Requesting/using auth credentials in pre-restore state")
Log.w(TAG, "Requesting/using auth credentials in pre-restore state", Throwable())
getArchiveServiceAccessPair()
} else {
val messageBackupKey = SignalStore.backup.messageBackupKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@

package org.thoughtcrime.securesms.backup.v2

class RestoreV2Event(val type: Type, val count: Long, val estimatedTotalCount: Long) {
import org.signal.core.util.ByteSize

class RestoreV2Event(val type: Type, val count: ByteSize, val estimatedTotalCount: ByteSize) {
enum class Type {
PROGRESS_DOWNLOAD,
PROGRESS_RESTORE,
PROGRESS_MEDIA_RESTORE,
FINISHED
}

fun getProgress(): Float {
if (estimatedTotalCount == 0L) {
if (estimatedTotalCount.inWholeBytes == 0L) {
return 0f
}
return count.toFloat() / estimatedTotalCount.toFloat()
return count.inWholeBytes.toFloat() / estimatedTotalCount.inWholeBytes.toFloat()
}
}
Loading

0 comments on commit ee09f3b

Please sign in to comment.