Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Merge branch 'upstream' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
p1gp1g committed Nov 8, 2023
2 parents 51bcd91 + ec0e9a1 commit afadad0
Show file tree
Hide file tree
Showing 1,061 changed files with 27,222 additions and 15,200 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ Molly has unique features compared to Signal:
- **Custom backup scheduling** - Choose between a daily or weekly interval and the number of backups to retain
- **SOCKS proxy and Tor support** - Tunnel app network traffic via proxy and Orbot

For the [UnifiedPush](https://github.com/mollyim/mollyim-android-unifiedpush) version of Molly, the following features are additionally available:

- **UnifiedPush support**: Receive push notifications through the UnifiedPush protocol

Besides that, you will find all the features of Signal plus some minor tweaks and improvements. As with Signal, SMS is not supported.

## Free and Open-Source
Expand Down
74 changes: 25 additions & 49 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ wire {
}

protoPath {
srcDir "${project.rootDir}/libsignal/service/src/main/protowire"
srcDir "${project.rootDir}/libsignal-service/src/main/protowire"
}
}

Expand All @@ -44,9 +44,9 @@ ext {
MAPS_API_KEY = getEnv('CI_MAPS_API_KEY') ?: mapsApiKey
}

def canonicalVersionCode = 1341
def canonicalVersionName = "6.35.3"
def mollyRevision = 1
def canonicalVersionCode = 1353
def canonicalVersionName = "6.38.2"
def mollyRevision = 0

def postFixSize = 100

Expand All @@ -72,7 +72,7 @@ android {
buildToolsVersion = signalBuildToolsVersion
compileSdkVersion = signalCompileSdkVersion

flavorDimensions 'environment', 'license', 'distribution'
flavorDimensions = ['environment', 'license', 'distribution']
useLibrary 'org.apache.http.legacy'
testBuildType 'instrumentation'

Expand Down Expand Up @@ -175,12 +175,9 @@ android {
buildConfigField "int", "SIGNAL_CANONICAL_VERSION_CODE", "$canonicalVersionCode"
buildConfigField "String", "BACKUP_FILENAME", "\"" + BASE_APP_FILENAME.toLowerCase() + "\""
buildConfigField "boolean", "FORCE_INTERNAL_USER_FLAG", "$FORCE_INTERNAL_USER_FLAG"
buildConfigField "boolean", "USE_OSM", "false"

vectorDrawables.useSupportLibrary = true

manifestPlaceholders = [mapsApiKey:MAPS_API_KEY]

buildConfigField "long", "BUILD_TIMESTAMP", "${getBuildTimestamp()}L"
buildConfigField "String", "GIT_HASH", "\"${getCommitHashOrNull()}\""
// MOLLY: Ensure to add any new URL to the SignalServiceNetworkAccess.HOSTNAMES list
Expand All @@ -202,12 +199,6 @@ android {
buildConfigField "String", "SIGNAL_AGENT", "\"OWA\""
buildConfigField "String", "CDSI_MRENCLAVE", "\"0f6fd79cdfdaa5b2e6337f534d3baf999318b0c462a7ac1f41297a3e4b424a57\""
buildConfigField "String", "SVR2_MRENCLAVE", "\"6ee1042f9e20f880326686dd4ba50c25359f01e9f733eeba4382bca001d45094\""
buildConfigField "org.thoughtcrime.securesms.KbsEnclave", "KBS_ENCLAVE", "new org.thoughtcrime.securesms.KbsEnclave(\"e18376436159cda3ad7a45d9320e382e4a497f26b0dca34d8eab0bd0139483b5\", " +
"\"3a485adb56e2058ef7737764c738c4069dd62bc457637eafb6bbce1ce29ddb89\", " +
"\"45627094b2ea4a66f4cf0b182858a8dcf4b8479122c3820fe7fd0551a6d4cf5c\")"
buildConfigField "org.thoughtcrime.securesms.KbsEnclave[]", "KBS_FALLBACKS", "new org.thoughtcrime.securesms.KbsEnclave[] { new org.thoughtcrime.securesms.KbsEnclave(\"0cedba03535b41b67729ce9924185f831d7767928a1d1689acb689bc079c375f\", " +
"\"187d2739d22be65e74b65f0055e74d31310e4267e5fac2b1246cc8beba81af39\", " +
"\"ee19f1965b1eefa3dc4204eb70c04f397755f771b8c1909d080c04dad2a6a9ba\") }"
buildConfigField "String", "UNIDENTIFIED_SENDER_TRUST_ROOT", "\"BXu6QIKVz5MA8gstzfOgRQGqyLqOwNKHL6INkv3IHWMF\""
buildConfigField "String", "ZKGROUP_SERVER_PUBLIC_PARAMS", "\"AMhf5ywVwITZMsff/eCyudZx9JDmkkkbV6PInzG4p8x3VqVJSFiMvnvlEKWuRob/1eaIetR31IYeAbm0NdOuHH8Qi+Rexi1wLlpzIo1gstHWBfZzy1+qHRV5A4TqPp15YzBPm0WSggW6PbSn+F4lf57VCnHF7p8SvzAA2ZZJPYJURt8X7bbg+H3i+PEjH9DXItNEqs2sNcug37xZQDLm7X36nOoGPs54XsEGzPdEV+itQNGUFEjY6X9Uv+Acuks7NpyGvCoKxGwgKgE5XyJ+nNKlyHHOLb6N1NuHyBrZrgtY/JYJHRooo5CEqYKBqdFnmbTVGEkCvJKxLnjwKWf+fEPoWeQFj5ObDjcKMZf2Jm2Ae69x+ikU5gBXsRmoF94GXTLfN0/vLt98KDPnxwAQL9j5V1jGOY8jQl6MLxEs56cwXN0dqCnImzVH3TZT1cJ8SW1BRX6qIVxEzjsSGx3yxF3suAilPMqGRp4ffyopjMD1JXiKR2RwLKzizUe5e8XyGOy9fplzhw3jVzTRyUZTRSZKkMLWcQ/gv0E4aONNqs4P\""
buildConfigField "String", "GENERIC_SERVER_PUBLIC_PARAMS", "\"AByD873dTilmOSG0TjKrvpeaKEsUmIO8Vx9BeMmftwUs9v7ikPwM8P3OHyT0+X3EUMZrSe9VUp26Wai51Q9I8mdk0hX/yo7CeFGJyzoOqn8e/i4Ygbn5HoAyXJx5eXfIbqpc0bIxzju4H/HOQeOpt6h742qii5u/cbwOhFZCsMIbElZTaeU+BWMBQiZHIGHT5IE0qCordQKZ5iPZom0HeFa8Yq0ShuEyAl0WINBiY6xE3H/9WnvzXBbMuuk//eRxXgzO8ieCeK8FwQNxbfXqZm6Ro1cMhCOF3u7xoX83QhpN\""
Expand All @@ -216,15 +207,12 @@ android {
buildConfigField "String", "GIPHY_API_KEY", "\"3o6ZsYH6U6Eri53TXy\""
buildConfigField "String", "SIGNAL_CAPTCHA_URL", "\"https://signalcaptchas.org/registration/generate.html\""
buildConfigField "String", "RECAPTCHA_PROOF_URL", "\"https://signalcaptchas.org/challenge/generate.html\""

// MOLLY: Rely on the built-in variables FLAVOR and BUILD_TYPE instead
// buildConfigField "String", "BUILD_DISTRIBUTION_TYPE", "\"unset\""
// buildConfigField "String", "BUILD_ENVIRONMENT_TYPE", "\"unset\""
// buildConfigField "String", "BUILD_VARIANT_TYPE", "\"unset\""
// 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 "boolean", "TRACING_ENABLED", "false"

ndk {
//noinspection ChromeOsAbiSupport
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
}

Expand Down Expand Up @@ -302,27 +290,29 @@ android {
website {
dimension 'distribution'
isDefault true
buildConfigField "boolean", "ALLOW_INSTALL_SELF_UPDATES", "true"
buildConfigField "boolean", "MANAGES_MOLLY_UPDATES", "true"
}

store {
dimension 'distribution'
buildConfigField "boolean", "ALLOW_INSTALL_SELF_UPDATES", "false"
buildConfigField "boolean", "MANAGES_MOLLY_UPDATES", "false"
}

gms {
dimension 'license'
isDefault true
manifestPlaceholders = [mapsApiKey:MAPS_API_KEY]
buildConfigField "boolean", "USE_PLAY_SERVICES", "true"
buildConfigField "boolean", "USE_OSM", "false"
buildConfigField "String", "FDROID_UPDATE_URL", "\"https://molly.im/fdroid/repo\""
}

foss {
dimension 'license'
versionNameSuffix '-FOSS'
buildConfigField "boolean", "USE_PLAY_SERVICES", "false"
buildConfigField "String", "FDROID_UPDATE_URL", "\"https://molly.im/fdroid/foss/repo\""
buildConfigField "boolean", "USE_OSM", "true"
buildConfigField "String", "FDROID_UPDATE_URL", "\"https://molly.im/fdroid/foss/repo\""
}

prod {
Expand All @@ -348,12 +338,6 @@ android {
buildConfigField "String", "SIGNAL_KEY_BACKUP_URL", "\"https://api-staging.backup.signal.org\""
buildConfigField "String", "SIGNAL_SVR2_URL", "\"https://svr2.staging.signal.org\""
buildConfigField "String", "SVR2_MRENCLAVE", "\"a8a261420a6bb9b61aa25bf8a79e8bd20d7652531feb3381cbffd446d270be95\""
buildConfigField "org.thoughtcrime.securesms.KbsEnclave", "KBS_ENCLAVE", "new org.thoughtcrime.securesms.KbsEnclave(\"39963b736823d5780be96ab174869a9499d56d66497aa8f9b2244f777ebc366b\", " +
"\"ee1d0d972b7ea903615670de43ab1b6e7a825e811c70a29bb5fe0f819e0975fa\", " +
"\"45627094b2ea4a66f4cf0b182858a8dcf4b8479122c3820fe7fd0551a6d4cf5c\")"
buildConfigField "org.thoughtcrime.securesms.KbsEnclave[]", "KBS_FALLBACKS", "new org.thoughtcrime.securesms.KbsEnclave[] { new org.thoughtcrime.securesms.KbsEnclave(\"dd6f66d397d9e8cf6ec6db238e59a7be078dd50e9715427b9c89b409ffe53f99\", " +
"\"4200003414528c151e2dccafbc87aa6d3d66a5eb8f8c05979a6e97cb33cd493a\", " +
"\"ee19f1965b1eefa3dc4204eb70c04f397755f771b8c1909d080c04dad2a6a9ba\") }"
buildConfigField "String", "UNIDENTIFIED_SENDER_TRUST_ROOT", "\"BbqY1DzohE4NUZoVF+L18oUPrK3kILllLEJh2UnPSsEx\""
buildConfigField "String", "ZKGROUP_SERVER_PUBLIC_PARAMS", "\"ABSY21VckQcbSXVNCGRYJcfWHiAMZmpTtTELcDmxgdFbtp/bWsSxZdMKzfCp8rvIs8ocCU3B37fT3r4Mi5qAemeGeR2X+/YmOGR5ofui7tD5mDQfstAI9i+4WpMtIe8KC3wU5w3Inq3uNWVmoGtpKndsNfwJrCg0Hd9zmObhypUnSkfYn2ooMOOnBpfdanRtrvetZUayDMSC5iSRcXKpdlukrpzzsCIvEwjwQlJYVPOQPj4V0F4UXXBdHSLK05uoPBCQG8G9rYIGedYsClJXnbrgGYG3eMTG5hnx4X4ntARBgELuMWWUEEfSK0mjXg+/2lPmWcTZWR9nkqgQQP0tbzuiPm74H2wMO4u1Wafe+UwyIlIT9L7KLS19Aw8r4sPrXZSSsOZ6s7M1+rTJN0bI5CKY2PX29y5Ok3jSWufIKcgKOnWoP67d5b2du2ZVJjpjfibNIHbT/cegy/sBLoFwtHogVYUewANUAXIaMPyCLRArsKhfJ5wBtTminG/PAvuBdJ70Z/bXVPf8TVsR292zQ65xwvWTejROW6AZX6aqucUj\""
buildConfigField "String", "GENERIC_SERVER_PUBLIC_PARAMS", "\"AHILOIrFPXX9laLbalbA9+L1CXpSbM/bTJXZGZiuyK1JaI6dK5FHHWL6tWxmHKYAZTSYmElmJ5z2A5YcirjO/yfoemE03FItyaf8W1fE4p14hzb5qnrmfXUSiAIVrhaXVwIwSzH6RL/+EO8jFIjJ/YfExfJ8aBl48CKHgu1+A6kWynhttonvWWx6h7924mIzW0Czj2ROuh4LwQyZypex4GuOPW8sgIT21KNZaafgg+KbV7XM1x1tF3XA17B4uGUaDbDw2O+nR1+U5p6qHPzmJ7ggFjSN6Utu+35dS1sS0P9N\""
Expand All @@ -369,14 +353,14 @@ android {
disable 'LintError'
}

android.applicationVariants.all { variant ->
android.applicationVariants.configureEach { variant ->
def isStaging = variant.productFlavors*.name.contains("staging")
def hasSigningConfig = buildType.signingConfig || variant.signingConfig

variant.resValue 'string', 'app_name', BASE_APP_TITLE + (isStaging ? " Staging" : "")
variant.resValue "string", 'package_name', variant.applicationId

variant.outputs.all {
variant.outputs.configureEach {
def flavors = "-${variant.baseName}" - ~/-prod/ - ~/-(foss|gms)/ - ~/-website/ - ~/-release/
def unsigned = hasSigningConfig ? "" : "-unsigned"
outputFileName = "${BASE_APP_FILENAME}${flavors}${unsigned}-${versionName}.apk"
Expand All @@ -389,14 +373,6 @@ android {
setIgnore(true)
}
}

android.buildTypes.each {
if (it.name != 'release') {
sourceSets.findByName(it.name).java.srcDirs += "$projectDir/src/debug/java"
} else {
sourceSets.findByName(it.name).java.srcDirs += "$projectDir/src/release/java"
}
}
}

dependencies {
Expand Down Expand Up @@ -455,8 +431,6 @@ dependencies {
gmsImplementation libs.google.play.services.maps
gmsImplementation libs.google.play.services.auth

fossImplementation 'org.osmdroid:osmdroid-android:6.1.16'

implementation libs.bundles.media3

implementation libs.conscrypt.android
Expand All @@ -469,8 +443,6 @@ dependencies {
implementation project(':video')
implementation project(':device-transfer')
implementation project(':image-editor')
fossImplementation project(':libfakegms')
implementation project(":libnetcipher")
implementation project(':contacts')
implementation project(':qr')
implementation project(':sticky-header-grid')
Expand All @@ -481,12 +453,6 @@ dependencies {

implementation libs.mobilecoin

implementation(libs.molly.argon2) {
artifact {
type = "aar"
}
}

implementation libs.molly.ringrtc

implementation libs.leolin.shortcutbadger
Expand Down Expand Up @@ -520,10 +486,20 @@ dependencies {
implementation libs.kotlinx.collections.immutable
implementation libs.accompanist.permissions

implementation(libs.molly.argon2) {
artifact {
type = "aar"
}
}

implementation project(":libnetcipher")
implementation libs.gosimple.nbvcxz
implementation libs.molly.native.utils
implementation libs.molly.glide.webp.decoder

fossImplementation 'org.osmdroid:osmdroid-android:6.1.16'
fossImplementation project(':libfakegms')

spinnerImplementation project(":spinner")

canaryImplementation libs.square.leakcanary
Expand Down Expand Up @@ -597,7 +573,7 @@ static def getBuildTimestamp() {
}
}

tasks.withType(Test) {
tasks.withType(Test).configureEach {
testLogging {
events "failed"
exceptionFormat "full"
Expand Down
3 changes: 2 additions & 1 deletion app/proguard/proguard.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
-keep class org.signal.libsignal.protocol.** { *; }
-keep class org.thoughtcrime.securesms.** { *; }
-keep class im.molly.unifiedpush.** { *; }
-keep class org.signal.donations.json.** { *; }
-keepclassmembers class ** {
public void onEvent*(**);
}
Expand All @@ -18,4 +19,4 @@
-dontwarn org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
-dontwarn org.slf4j.impl.StaticLoggerBinder
-dontwarn sun.net.spi.nameservice.NameService
-dontwarn sun.net.spi.nameservice.NameServiceDescriptor
-dontwarn sun.net.spi.nameservice.NameServiceDescriptor
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class SignalInstrumentationApplicationContext : ApplicationContext() {
ApplicationDependencies.getDeadlockDetector().start()
}

override fun initializeLogging() {
Log.initialize({ true }, AndroidLogger(), PersistentLogger(this), inMemoryLogger)
override fun initializeLogging(locked: Boolean) {
Log.initialize({ true }, AndroidLogger, PersistentLogger(this), inMemoryLogger)

SignalProtocolLoggerProvider.setProvider(CustomSignalProtocolLogger())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,6 @@ class ChangeNumberViewModelTest {
lateinit var changeNumberRequest: ChangePhoneNumberRequest
lateinit var setPreKeysRequest: PreKeyState

MockProvider.mockGetRegistrationLockStringFlow()

InstrumentationApplicationDependencyProvider.addMockWebRequestHandlers(
Post("/v1/verification/session") { MockResponse().success(MockProvider.sessionMetadataJson.copy(verified = false)) },
Put("/v1/verification/session/${MockProvider.sessionMetadataJson.id}/code") { MockResponse().success(MockProvider.sessionMetadataJson) },
Expand Down Expand Up @@ -318,8 +316,6 @@ class ChangeNumberViewModelTest {
lateinit var changeNumberRequest: ChangePhoneNumberRequest
lateinit var setPreKeysRequest: PreKeyState

MockProvider.mockGetRegistrationLockStringFlow()

InstrumentationApplicationDependencyProvider.addMockWebRequestHandlers(
Post("/v1/verification/session") { MockResponse().success(MockProvider.sessionMetadataJson.copy(verified = false)) },
Put("/v1/verification/session/${MockProvider.sessionMetadataJson.id}/code") { MockResponse().success(MockProvider.sessionMetadataJson) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import org.junit.runner.RunWith
import org.signal.core.util.ThreadUtil
import org.thoughtcrime.securesms.attachments.PointerAttachment
import org.thoughtcrime.securesms.conversation.v2.ConversationActivity
import org.thoughtcrime.securesms.database.MessageType
import org.thoughtcrime.securesms.database.SignalDatabase
import org.thoughtcrime.securesms.mms.IncomingMediaMessage
import org.thoughtcrime.securesms.mms.IncomingMessage
import org.thoughtcrime.securesms.mms.OutgoingMessage
import org.thoughtcrime.securesms.profiles.ProfileName
import org.thoughtcrime.securesms.recipients.Recipient
Expand Down Expand Up @@ -64,7 +65,8 @@ class ConversationItemPreviewer {
attachment()
}

val message = IncomingMediaMessage(
val message = IncomingMessage(
type = MessageType.NORMAL,
from = other.id,
body = body,
sentTimeMillis = System.currentTimeMillis(),
Expand All @@ -73,7 +75,7 @@ class ConversationItemPreviewer {
attachments = PointerAttachment.forPointers(Optional.of(attachments))
)

SignalDatabase.messages.insertSecureDecryptedMessageInbox(message, SignalDatabase.threads.getOrCreateThreadIdFor(other)).get()
SignalDatabase.messages.insertMessageInbox(message, SignalDatabase.threads.getOrCreateThreadIdFor(other)).get()

ThreadUtil.sleep(1)
}
Expand All @@ -83,7 +85,8 @@ class ConversationItemPreviewer {
attachment()
}

val message = IncomingMediaMessage(
val message = IncomingMessage(
type = MessageType.NORMAL,
from = other.id,
body = body,
sentTimeMillis = System.currentTimeMillis(),
Expand All @@ -92,7 +95,7 @@ class ConversationItemPreviewer {
attachments = PointerAttachment.forPointers(Optional.of(attachments))
)

val insert = SignalDatabase.messages.insertSecureDecryptedMessageInbox(message, SignalDatabase.threads.getOrCreateThreadIdFor(other)).get()
val insert = SignalDatabase.messages.insertMessageInbox(message, SignalDatabase.threads.getOrCreateThreadIdFor(other)).get()

SignalDatabase.attachments.getAttachmentsForMessage(insert.messageId).forEachIndexed { index, attachment ->
// if (index != 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.thoughtcrime.securesms.database
import org.thoughtcrime.securesms.database.model.ParentStoryId
import org.thoughtcrime.securesms.database.model.StoryType
import org.thoughtcrime.securesms.database.model.databaseprotos.GiftBadge
import org.thoughtcrime.securesms.mms.IncomingMediaMessage
import org.thoughtcrime.securesms.mms.IncomingMessage
import org.thoughtcrime.securesms.mms.OutgoingMessage
import org.thoughtcrime.securesms.recipients.Recipient
import java.util.Optional
Expand Down Expand Up @@ -55,9 +55,9 @@ object MmsHelper {
}

fun insert(
message: IncomingMediaMessage,
message: IncomingMessage,
threadId: Long
): Optional<MessageTable.InsertResult> {
return SignalDatabase.messages.insertSecureDecryptedMessageInbox(message, threadId)
return SignalDatabase.messages.insertMessageInbox(message, threadId)
}
}
Loading

0 comments on commit afadad0

Please sign in to comment.