Skip to content

Commit

Permalink
Merge branch 'molly-7.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Jul 31, 2024
2 parents 45234d5 + 794f79a commit 9a49ca9
Show file tree
Hide file tree
Showing 1,789 changed files with 95,140 additions and 39,219 deletions.
15 changes: 13 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ root = true
indent_size = 2
ktlint_standard_trailing-comma-on-call-site = disable
ktlint_standard_trailing-comma-on-declaration-site = disable
ktlink_standard_spacing-between-declarations-with-annotations = disable
ktlint_standard_spacing-between-declarations-with-annotations = disable
ktlint_code_style = intellij_idea
ktlint_standard_class-naming = disabled
ktlint_standard_class-naming = disabled

# below rules disabled during ktlint version migration because they were preexisting but should be corrected and re-enabled ASAP
ktlint_function_naming_ignore_when_annotated_with = Composable
ktlint_standard_property-naming = disabled
ktlint_standard_enum-wrapping = disabled
ktlint_standard_multiline-if-else = disabled
ktlint_standard_backing-property-naming = disabled
ktlint_standard_statement-wrapping = disabled
internal:ktlint-suppression = disabled
ktlint_standard_unnecessary-parentheses-before-trailing-lambda = disabled
ktlint_standard_value-parameter-comment = disabled
8 changes: 8 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 21 additions & 18 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 = 1421
val canonicalVersionName = "7.8.1"
val mollyRevision = 2

val postFixSize = 100
val canonicalVersionCode = 1436
val canonicalVersionName = "7.11.4"
val mollyRevision = 1
val currentHotfixVersion = 1
val maxHotfixVersions = 100

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

Expand Down Expand Up @@ -85,6 +85,8 @@ android {
useLibrary("org.apache.http.legacy")
testBuildType = "instrumentation"

android.bundle.language.enableSplit = false

kotlinOptions {
jvmTarget = signalKotlinJvmTarget
}
Expand Down Expand Up @@ -142,15 +144,15 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = "1.4.4"
kotlinCompilerExtensionVersion = "1.5.4"
}

if (mollyRevision < 0 || mollyRevision >= postFixSize) {
throw GradleException("Molly revision $mollyRevision out of range")
if (mollyRevision < 0 || currentHotfixVersion < 0 || (mollyRevision + currentHotfixVersion) >= maxHotfixVersions) {
throw GradleException("Molly revision $mollyRevision or Hotfix version $currentHotfixVersion out of range")
}

defaultConfig {
versionCode = canonicalVersionCode * postFixSize + mollyRevision
versionCode = (canonicalVersionCode * maxHotfixVersions) + mollyRevision + currentHotfixVersion
versionName = if (ciEnabled) getCommitTag() else sourceVersionNameWithRevision

minSdk = signalMinSdkVersion
Expand Down Expand Up @@ -198,11 +200,12 @@ android {
buildConfigField("String", "SIGNAL_CAPTCHA_URL", "\"https://signalcaptchas.org/registration/generate.html\"")
buildConfigField("String", "RECAPTCHA_PROOF_URL", "\"https://signalcaptchas.org/challenge/generate.html\"")
buildConfigField("org.signal.libsignal.net.Network.Environment", "LIBSIGNAL_NET_ENV", "org.signal.libsignal.net.Network.Environment.PRODUCTION")
buildConfigField("int", "LIBSIGNAL_LOG_LEVEL", "org.signal.libsignal.protocol.logging.SignalProtocolLogger.INFO")

// MOLLY: Rely on the built-in variables FLAVOR and BUILD_TYPE instead of BUILD_*_TYPE
buildConfigField("String", "BADGE_STATIC_ROOT", "\"https://updates2.signal.org/static/badges/\"")
buildConfigField("String", "STRIPE_PUBLISHABLE_KEY", "\"pk_live_6cmGZopuTsV8novGgJJW9JpC00vLIgtQ1D\"")
buildConfigField("boolean", "TRACING_ENABLED", "false")
buildConfigField("boolean", "MESSAGE_BACKUP_RESTORE_ENABLED", "false")

ndk {
//noinspection ChromeOsAbiSupport
Expand All @@ -211,12 +214,6 @@ android {

resourceConfigurations += listOf()

bundle {
language {
enableSplit = false
}
}

testInstrumentationRunner = "org.thoughtcrime.securesms.testing.SignalTestRunner"
testInstrumentationRunnerArguments["clearPackageData"] = "true"
}
Expand Down Expand Up @@ -342,10 +339,10 @@ android {
buildConfigField("String", "SIGNAL_CAPTCHA_URL", "\"https://signalcaptchas.org/staging/registration/generate.html\"")
buildConfigField("String", "RECAPTCHA_PROOF_URL", "\"https://signalcaptchas.org/staging/challenge/generate.html\"")
buildConfigField("org.signal.libsignal.net.Network.Environment", "LIBSIGNAL_NET_ENV", "org.signal.libsignal.net.Network.Environment.STAGING")
buildConfigField("int", "LIBSIGNAL_LOG_LEVEL", "org.signal.libsignal.protocol.logging.SignalProtocolLogger.DEBUG")

buildConfigField("String", "BUILD_ENVIRONMENT_TYPE", "\"Staging\"")
buildConfigField("String", "STRIPE_PUBLISHABLE_KEY", "\"pk_test_sngOd8FnXNkpce9nPXawKrJD00kIDngZkD\"")
buildConfigField("boolean", "MESSAGE_BACKUP_RESTORE_ENABLED", "true")
}
}

Expand Down Expand Up @@ -406,6 +403,7 @@ dependencies {
implementation(project(":video"))
implementation(project(":device-transfer"))
implementation(project(":image-editor"))
implementation(project(":donations"))
implementation(project(":contacts"))
implementation(project(":qr"))
implementation(project(":sticky-header-grid"))
Expand Down Expand Up @@ -454,6 +452,7 @@ dependencies {
implementation(libs.androidx.profileinstaller)
implementation(libs.androidx.asynclayoutinflater)
implementation(libs.androidx.asynclayoutinflater.appcompat)
implementation(libs.androidx.emoji2)
implementation(libs.androidx.webkit)
"gmsImplementation"(libs.firebase.messaging) {
exclude(group = "com.google.firebase", module = "firebase-core")
Expand All @@ -462,6 +461,7 @@ dependencies {
}
"gmsImplementation"(libs.google.play.services.maps)
"gmsImplementation"(libs.google.play.services.auth)
"fossImplementation"(project(":libfakegms"))
implementation(libs.bundles.media3)
implementation(libs.conscrypt.android)
implementation(libs.signal.aesgcmprovider)
Expand All @@ -486,6 +486,7 @@ dependencies {
}
implementation(libs.stream)
implementation(libs.lottie)
implementation(libs.lottie.compose)
implementation(libs.signal.android.database.sqlcipher)
implementation(libs.androidx.sqlite)
implementation(libs.google.ez.vcard) {
Expand All @@ -496,6 +497,9 @@ dependencies {
implementation(libs.kotlinx.collections.immutable)
implementation(libs.accompanist.permissions)
implementation(libs.kotlin.stdlib.jdk8)
implementation(libs.kotlin.reflect)
"gmsImplementation"(libs.kotlinx.coroutines.play.services)
implementation(libs.jackson.module.kotlin)
implementation(libs.rxjava3.rxandroid)
implementation(libs.rxjava3.rxkotlin)
implementation(libs.rxdogtag)
Expand All @@ -506,7 +510,6 @@ dependencies {
implementation(libs.molly.glide.webp.decoder)
implementation(libs.gosimple.nbvcxz)
"fossImplementation"("org.osmdroid:osmdroid-android:6.1.16")
"fossImplementation"(project(":libfakegms"))

"spinnerImplementation"(project(":spinner"))

Expand Down
4 changes: 4 additions & 0 deletions app/proguard/proguard.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

-keep class androidx.window.** { *; }

-keepclassmembers class * extends androidx.constraintlayout.motion.widget.Key {
public <init>();
}

# AGP generated dont warns
-dontwarn com.android.org.conscrypt.SSLParametersImpl
-dontwarn org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.signal.core.util.logging.Log
import org.signal.libsignal.protocol.logging.SignalProtocolLoggerProvider
import org.thoughtcrime.securesms.crypto.MasterSecretUtil
import org.thoughtcrime.securesms.database.LogDatabase
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
import org.thoughtcrime.securesms.dependencies.AppDependencies
import org.thoughtcrime.securesms.dependencies.ApplicationDependencyProvider
import org.thoughtcrime.securesms.dependencies.InstrumentationApplicationDependencyProvider
import org.thoughtcrime.securesms.logging.CustomSignalProtocolLogger
Expand All @@ -26,8 +26,8 @@ class SignalInstrumentationApplicationContext : ApplicationContext() {

override fun initializeAppDependencies() {
val default = ApplicationDependencyProvider(this)
ApplicationDependencies.init(this, InstrumentationApplicationDependencyProvider(this, default))
ApplicationDependencies.getDeadlockDetector().start()
AppDependencies.init(this, InstrumentationApplicationDependencyProvider(this, default))
AppDependencies.deadlockDetector.start()
}

override fun initializeLogging(locked: Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.database.Cursor
import androidx.core.content.contentValuesOf
import net.zetetic.database.sqlcipher.SQLiteDatabase
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.signal.core.util.Hex
import org.signal.core.util.SqlUtil
Expand All @@ -24,27 +25,30 @@ import org.signal.core.util.toInt
import org.signal.core.util.withinTransaction
import org.signal.libsignal.zkgroup.profiles.ProfileKey
import org.thoughtcrime.securesms.backup.v2.database.clearAllDataForBackupRestore
import org.thoughtcrime.securesms.components.settings.app.subscription.InAppPaymentsRepository
import org.thoughtcrime.securesms.database.CallTable
import org.thoughtcrime.securesms.database.EmojiSearchTable
import org.thoughtcrime.securesms.database.MessageTable
import org.thoughtcrime.securesms.database.MessageTypes
import org.thoughtcrime.securesms.database.RecipientTable
import org.thoughtcrime.securesms.database.SignalDatabase
import org.thoughtcrime.securesms.database.model.InAppPaymentSubscriberRecord
import org.thoughtcrime.securesms.database.model.databaseprotos.BodyRangeList
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
import org.thoughtcrime.securesms.database.model.databaseprotos.InAppPaymentData
import org.thoughtcrime.securesms.dependencies.AppDependencies
import org.thoughtcrime.securesms.keyvalue.PhoneNumberPrivacyValues
import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.mms.QuoteModel
import org.thoughtcrime.securesms.profiles.ProfileName
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.recipients.RecipientId
import org.thoughtcrime.securesms.subscription.Subscriber
import org.thoughtcrime.securesms.testing.assertIs
import org.thoughtcrime.securesms.util.TextSecurePreferences
import org.whispersystems.signalservice.api.push.ServiceId.ACI
import org.whispersystems.signalservice.api.push.ServiceId.PNI
import org.whispersystems.signalservice.api.subscriptions.SubscriberId
import java.io.ByteArrayInputStream
import java.util.Currency
import java.util.UUID
import kotlin.random.Random

Expand Down Expand Up @@ -79,18 +83,20 @@ class BackupTest {

@Before
fun setup() {
SignalStore.account().setE164(SELF_E164)
SignalStore.account().setAci(SELF_ACI)
SignalStore.account().setPni(SELF_PNI)
SignalStore.account().generateAciIdentityKeyIfNecessary()
SignalStore.account().generatePniIdentityKeyIfNecessary()
SignalStore.account.setE164(SELF_E164)
SignalStore.account.setAci(SELF_ACI)
SignalStore.account.setPni(SELF_PNI)
SignalStore.account.generateAciIdentityKeyIfNecessary()
SignalStore.account.generatePniIdentityKeyIfNecessary()
}

@Ignore("Will likely be removed soon")
@Test
fun emptyDatabase() {
backupTest { }
}

@Ignore("Will likely be removed soon")
@Test
fun noteToSelf() {
backupTest {
Expand All @@ -102,6 +108,7 @@ class BackupTest {
}
}

@Ignore("Will likely be removed soon")
@Test
fun individualChat() {
backupTest {
Expand All @@ -118,6 +125,7 @@ class BackupTest {
}
}

@Ignore("Will likely be removed soon")
@Test
fun individualRecipients() {
backupTest {
Expand Down Expand Up @@ -149,6 +157,7 @@ class BackupTest {
}
}

@Ignore("Will likely be removed soon")
@Test
fun individualCallLogs() {
backupTest {
Expand Down Expand Up @@ -231,45 +240,45 @@ class BackupTest {
}
}

@Ignore("Will likely be removed soon")
@Test
fun accountData() {
val context = ApplicationDependencies.getApplication()
val context = AppDependencies.application

backupTest(validateKeyValue = true) {
val self = Recipient.self()

// TODO note-to-self archived
// TODO note-to-self unread

SignalStore.account().setAci(SELF_ACI)
SignalStore.account().setPni(SELF_PNI)
SignalStore.account().setE164(SELF_E164)
SignalStore.account().generateAciIdentityKeyIfNecessary()
SignalStore.account().generatePniIdentityKeyIfNecessary()
SignalStore.account.setAci(SELF_ACI)
SignalStore.account.setPni(SELF_PNI)
SignalStore.account.setE164(SELF_E164)
SignalStore.account.generateAciIdentityKeyIfNecessary()
SignalStore.account.generatePniIdentityKeyIfNecessary()

SignalDatabase.recipients.setProfileKey(self.id, ProfileKey(Random.nextBytes(32)))
SignalDatabase.recipients.setProfileName(self.id, ProfileName.fromParts("Peter", "Parker"))
SignalDatabase.recipients.setProfileAvatar(self.id, "https://example.com/")

SignalStore.donationsValues().markUserManuallyCancelled()
SignalStore.donationsValues().setSubscriber(Subscriber(SubscriberId.generate(), "USD"))
SignalStore.donationsValues().setDisplayBadgesOnProfile(false)
InAppPaymentsRepository.setSubscriber(InAppPaymentSubscriberRecord(SubscriberId.generate(), Currency.getInstance("USD"), InAppPaymentSubscriberRecord.Type.DONATION, false, InAppPaymentData.PaymentMethodType.UNKNOWN))
SignalStore.inAppPayments.setDisplayBadgesOnProfile(false)

SignalStore.phoneNumberPrivacy().phoneNumberDiscoverabilityMode = PhoneNumberPrivacyValues.PhoneNumberDiscoverabilityMode.NOT_DISCOVERABLE
SignalStore.phoneNumberPrivacy().phoneNumberSharingMode = PhoneNumberPrivacyValues.PhoneNumberSharingMode.NOBODY
SignalStore.phoneNumberPrivacy.phoneNumberDiscoverabilityMode = PhoneNumberPrivacyValues.PhoneNumberDiscoverabilityMode.NOT_DISCOVERABLE
SignalStore.phoneNumberPrivacy.phoneNumberSharingMode = PhoneNumberPrivacyValues.PhoneNumberSharingMode.NOBODY

SignalStore.settings().isLinkPreviewsEnabled = false
SignalStore.settings().isPreferSystemContactPhotos = true
SignalStore.settings().universalExpireTimer = 42
SignalStore.settings().setKeepMutedChatsArchived(true)
SignalStore.settings.isLinkPreviewsEnabled = false
SignalStore.settings.isPreferSystemContactPhotos = true
SignalStore.settings.universalExpireTimer = 42
SignalStore.settings.setKeepMutedChatsArchived(true)

SignalStore.storyValues().viewedReceiptsEnabled = false
SignalStore.storyValues().userHasViewedOnboardingStory = true
SignalStore.storyValues().isFeatureDisabled = false
SignalStore.storyValues().userHasBeenNotifiedAboutStories = true
SignalStore.storyValues().userHasSeenGroupStoryEducationSheet = true
SignalStore.story.viewedReceiptsEnabled = false
SignalStore.story.userHasViewedOnboardingStory = true
SignalStore.story.isFeatureDisabled = false
SignalStore.story.userHasBeenNotifiedAboutStories = true
SignalStore.story.userHasSeenGroupStoryEducationSheet = true

SignalStore.emojiValues().reactions = listOf("a", "b", "c")
SignalStore.emoji.reactions = listOf("a", "b", "c")

TextSecurePreferences.setTypingIndicatorsEnabled(context, false)
TextSecurePreferences.setReadReceiptsEnabled(context, false)
Expand Down
Loading

0 comments on commit 9a49ca9

Please sign in to comment.