From e21f40924fe7c34999f60ca011b860ad208e0131 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Fri, 26 Jul 2019 09:25:26 +0200 Subject: [PATCH 1/2] combined dagger bump Signed-off-by: tobiasKaminsky --- build.gradle | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index f39e78ddb3..d5ded64f1f 100644 --- a/build.gradle +++ b/build.gradle @@ -56,6 +56,7 @@ configurations { ext { jacocoVersion = "0.8.2" + daggerVersion = "2.24" androidLibraryVersion = "master-SNAPSHOT" travisBuild = System.getenv("TRAVIS") == "true" @@ -285,11 +286,11 @@ dependencies { spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.9.0' spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.6' - implementation 'com.google.dagger:dagger:2.23.2' - implementation 'com.google.dagger:dagger-android:2.23.2' - implementation 'com.google.dagger:dagger-android-support:2.23.2' - kapt 'com.google.dagger:dagger-compiler:2.23.2' - kapt 'com.google.dagger:dagger-android-processor:2.23.2' + implementation "com.google.dagger:dagger:$daggerVersion" + implementation "com.google.dagger:dagger-android:$daggerVersion" + implementation "com.google.dagger:dagger-android-support:$daggerVersion" + kapt "com.google.dagger:dagger-compiler:$daggerVersion" + kapt "com.google.dagger:dagger-android-processor:$daggerVersion" compileOnly "org.projectlombok:lombok:1.18.8" annotationProcessor "org.projectlombok:lombok:1.18.8" From 976e38e7def623f90549f716edd8bf2c73aa2338 Mon Sep 17 00:00:00 2001 From: Chris Narkiewicz Date: Fri, 26 Jul 2019 19:54:10 +0100 Subject: [PATCH 2/2] Migrate main app to new Dagger injector API Signed-off-by: Chris Narkiewicz --- .../java/com/owncloud/android/MainApp.java | 54 ++----------------- 1 file changed, 5 insertions(+), 49 deletions(-) diff --git a/src/main/java/com/owncloud/android/MainApp.java b/src/main/java/com/owncloud/android/MainApp.java index 2e7f118d27..592516144b 100644 --- a/src/main/java/com/owncloud/android/MainApp.java +++ b/src/main/java/com/owncloud/android/MainApp.java @@ -27,9 +27,6 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.app.NotificationChannel; import android.app.NotificationManager; -import android.app.Service; -import android.content.BroadcastReceiver; -import android.content.ContentProvider; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; @@ -91,15 +88,10 @@ import androidx.annotation.RequiresApi; import androidx.annotation.StringRes; import androidx.appcompat.app.AlertDialog; import androidx.core.util.Pair; -import androidx.fragment.app.Fragment; import androidx.multidex.MultiDexApplication; import dagger.android.AndroidInjector; import dagger.android.DispatchingAndroidInjector; -import dagger.android.HasActivityInjector; -import dagger.android.HasBroadcastReceiverInjector; -import dagger.android.HasContentProviderInjector; -import dagger.android.HasServiceInjector; -import dagger.android.support.HasSupportFragmentInjector; +import dagger.android.HasAndroidInjector; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import static com.owncloud.android.ui.activity.ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP; @@ -110,12 +102,7 @@ import static com.owncloud.android.ui.activity.ContactsPreferenceActivity.PREFER *

* Contains methods to build the "static" strings. These strings were before constants in different classes */ -public class MainApp extends MultiDexApplication implements - HasActivityInjector, - HasSupportFragmentInjector, - HasServiceInjector, - HasContentProviderInjector, - HasBroadcastReceiverInjector { +public class MainApp extends MultiDexApplication implements HasAndroidInjector { public static final OwnCloudVersion OUTDATED_SERVER_VERSION = OwnCloudVersion.nextcloud_13; public static final OwnCloudVersion MINIMUM_SUPPORTED_SERVER_VERSION = OwnCloudVersion.nextcloud_12; @@ -132,19 +119,7 @@ public class MainApp extends MultiDexApplication implements protected AppPreferences preferences; @Inject - protected DispatchingAndroidInjector dispatchingActivityInjector; - - @Inject - protected DispatchingAndroidInjector dispatchingFragmentInjector; - - @Inject - protected DispatchingAndroidInjector dispatchingServiceInjector; - - @Inject - protected DispatchingAndroidInjector dispatchingContentProviderInjector; - - @Inject - protected DispatchingAndroidInjector dispatchingBroadcastReceiverInjector; + protected DispatchingAndroidInjector dispatchingAndroidInjector; @Inject protected UserAccountManager accountManager; @@ -732,27 +707,8 @@ public class MainApp extends MultiDexApplication implements } @Override - public AndroidInjector activityInjector() { - return dispatchingActivityInjector; + public AndroidInjector androidInjector() { + return dispatchingAndroidInjector; } - @Override - public AndroidInjector supportFragmentInjector() { - return dispatchingFragmentInjector; - } - - @Override - public AndroidInjector serviceInjector() { - return dispatchingServiceInjector; - } - - @Override - public AndroidInjector contentProviderInjector() { - return dispatchingContentProviderInjector; - } - - @Override - public AndroidInjector broadcastReceiverInjector() { - return dispatchingBroadcastReceiverInjector; - } }