diff --git a/app/build.gradle b/app/build.gradle index 3c2289324d..94ae63e38d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,6 +11,7 @@ plugins { id 'com.squareup.wire' id 'translations' id 'licenses' + id 'kotlin-kapt' } apply from: 'static-ips.gradle' @@ -449,6 +450,12 @@ android { } } +kapt { + arguments { + arg('eventBusIndex', 'org.thoughtcrime.securesms.SecuresmsEventBusIndex') + } +} + dependencies { implementation libs.androidx.fragment.ktx lintChecks project(':lintchecks') @@ -534,7 +541,8 @@ dependencies { implementation libs.glide.glide implementation libs.roundedimageview implementation libs.materialish.progress - implementation libs.greenrobot.eventbus + implementation libs.greenrobot.eventbus.core + kapt libs.greenrobot.eventbus.annotation implementation libs.google.zxing.android.integration implementation libs.google.zxing.core implementation libs.google.flexbox diff --git a/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java b/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java index 214fddc6fe..f2d6ffce3e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java +++ b/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java @@ -34,6 +34,7 @@ import org.signal.core.util.concurrent.SignalExecutors; import org.signal.core.util.logging.AndroidLogger; import org.signal.core.util.logging.Log; import org.signal.core.util.tracing.Tracer; +import org.signal.devicetransfer.TransferEventBusIndex; import org.signal.glide.SignalGlideCodecs; import org.signal.libsignal.protocol.logging.SignalProtocolLoggerProvider; import org.signal.ringrtc.CallManager; @@ -112,7 +113,7 @@ import rxdogtag2.RxDogTag; /** * Will be called once when the TextSecure process is created. - * + *

* We're using this as an insertion point to patch up the Android PRNG disaster, * to initialize the job manager, and to check for GCM registration freshness. * @@ -153,7 +154,13 @@ public class ApplicationContext extends MultiDexApplication implements AppForegr .addBlocking("security-provider", this::initializeSecurityProvider) .addBlocking("crash-handling", this::initializeCrashHandling) .addBlocking("rx-init", this::initializeRx) - .addBlocking("event-bus", () -> EventBus.builder().logNoSubscriberMessages(false).installDefaultEventBus()) + .addBlocking("event-bus", () -> EventBus + .builder() + .logNoSubscriberMessages(false) + .logSubscriberExceptions(BuildConfig.DEBUG) + .addIndex(new TransferEventBusIndex()) + .addIndex(new SecuresmsEventBusIndex()) + .installDefaultEventBus()) .addBlocking("app-dependencies", this::initializeAppDependencies) .addBlocking("first-launch", this::initializeFirstEverAppLaunch) .addBlocking("app-migrations", this::initializeApplicationMigrations) diff --git a/dependencies.gradle b/dependencies.gradle index 173a00f0fd..591c3828d4 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -20,6 +20,7 @@ dependencyResolutionManagement { version('android-gradle-plugin', '8.0.2') version('accompanist', '0.28.0') version('nanohttpd', '2.3.1') + version('eventbus', '3.3.1') // Android Plugins library('android-library', 'com.android.library', 'com.android.library.gradle.plugin').versionRef('android-gradle-plugin') @@ -120,7 +121,8 @@ dependencyResolutionManagement { library('signal-android-database-sqlcipher', 'org.signal:sqlcipher-android:4.5.4-S2') // Third Party - library('greenrobot-eventbus', 'org.greenrobot:eventbus:3.0.0') + library('greenrobot-eventbus-core', 'org.greenrobot', 'eventbus').versionRef('eventbus') + library('greenrobot-eventbus-annotation', 'org.greenrobot', 'eventbus-annotation-processor').versionRef('eventbus') library('jackson-core', 'com.fasterxml.jackson.core:jackson-databind:2.9.9.2') library('jackson-module-kotlin', 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.0') library('square-okhttp3', 'com.squareup.okhttp3:okhttp:3.12.13') diff --git a/device-transfer/lib/build.gradle b/device-transfer/lib/build.gradle index a797034260..a7abbf33d4 100644 --- a/device-transfer/lib/build.gradle +++ b/device-transfer/lib/build.gradle @@ -1,15 +1,23 @@ plugins { id 'signal-library' + id 'kotlin-kapt' } android { namespace 'org.signal.devicetransfer' } +kapt { + arguments { + arg('eventBusIndex', 'org.signal.devicetransfer.TransferEventBusIndex') + } +} + dependencies { implementation project(':core-util') implementation libs.libsignal.android - api libs.greenrobot.eventbus + api libs.greenrobot.eventbus.core + kapt libs.greenrobot.eventbus.annotation testImplementation (testLibs.robolectric.robolectric) { exclude group: 'com.google.protobuf', module: 'protobuf-java' diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 3420923ae4..9ed365cd4f 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -3730,6 +3730,11 @@ https://docs.gradle.org/current/userguide/dependency_verification.html + + + + + @@ -4419,9 +4424,28 @@ https://docs.gradle.org/current/userguide/dependency_verification.html - - - + + + + + + + + + + + + + + + + + + + + + +