1
0
mirror of https://github.com/tuskyapp/Tusky synced 2024-12-18 20:02:59 +01:00

Update Dagger & other deps (#1315)

* update dagger

* update remaining deps
This commit is contained in:
Konrad Pozniak 2019-06-09 19:48:04 +02:00 committed by GitHub
parent d8f7845be5
commit 05d939b68a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 77 additions and 114 deletions

View File

@ -86,7 +86,8 @@ project.tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
}
}
ext.daggerVersion = '2.22.1'
ext.daggerVersion = '2.23.1'
ext.retrofitVersion = '2.6.0'
// if libraries are changed here, they should also be changed in LicenseActivity
dependencies {
@ -102,9 +103,9 @@ dependencies {
implementation 'androidx.exifinterface:exifinterface:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.preference:preference:1.1.0-alpha04'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation 'com.squareup.okhttp3:okhttp:3.14.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.2'
implementation 'org.conscrypt:conscrypt-android:2.1.0'
@ -133,20 +134,19 @@ dependencies {
implementation "com.google.dagger:dagger-android:$daggerVersion"
implementation "com.google.dagger:dagger-android-support:$daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
testImplementation 'org.robolectric:robolectric:4.2.1'
testImplementation 'org.mockito:mockito-inline:2.27.0'
testImplementation 'org.robolectric:robolectric:4.3'
testImplementation 'org.mockito:mockito-inline:2.28.2'
testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation 'android.arch.persistence.room:testing:1.1.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
testImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
testImplementation 'androidx.test.ext:junit:1.1.1'
debugImplementation 'im.dino:dbinspector:3.4.1@aar'
implementation 'io.reactivex.rxjava2:rxjava:2.2.8'
implementation 'io.reactivex.rxjava2:rxjava:2.2.9'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.5.0'
implementation 'com.uber.autodispose:autodispose-android-archcomponents:1.3.0'
implementation 'com.uber.autodispose:autodispose:1.3.0'
implementation 'androidx.paging:paging-runtime-ktx:2.1.0'

View File

@ -33,7 +33,6 @@ import androidx.appcompat.app.AlertDialog
import androidx.core.app.ActivityOptionsCompat
import androidx.core.content.ContextCompat
import androidx.emoji.text.EmojiCompat
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.recyclerview.widget.LinearLayoutManager
@ -53,18 +52,17 @@ import com.keylesspalace.tusky.interfaces.ReselectableFragment
import com.keylesspalace.tusky.pager.AccountPagerAdapter
import com.keylesspalace.tusky.util.*
import com.keylesspalace.tusky.viewmodel.AccountViewModel
import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector
import dagger.android.support.HasSupportFragmentInjector
import dagger.android.HasAndroidInjector
import kotlinx.android.synthetic.main.activity_account.*
import kotlinx.android.synthetic.main.view_account_moved.*
import java.text.NumberFormat
import javax.inject.Inject
class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasSupportFragmentInjector, LinkListener {
class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInjector, LinkListener {
@Inject
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Fragment>
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Any>
@Inject
lateinit var viewModelFactory: ViewModelFactory
@ -711,9 +709,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasSupportF
} else null
}
override fun supportFragmentInjector(): AndroidInjector<Fragment> {
return dispatchingAndroidInjector
}
override fun androidInjector() = dispatchingAndroidInjector
companion object {

View File

@ -18,22 +18,17 @@ package com.keylesspalace.tusky
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.MenuItem
import com.keylesspalace.tusky.fragment.AccountListFragment
import dagger.android.DispatchingAndroidInjector
import dagger.android.HasAndroidInjector
import kotlinx.android.synthetic.main.toolbar_basic.*
import javax.inject.Inject
import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector
import dagger.android.support.HasSupportFragmentInjector
import kotlinx.android.synthetic.main.toolbar_basic.*
class AccountListActivity : BaseActivity(), HasSupportFragmentInjector {
class AccountListActivity : BaseActivity(), HasAndroidInjector {
@Inject
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Fragment>
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Any>
enum class Type {
FOLLOWS,
@ -83,9 +78,7 @@ class AccountListActivity : BaseActivity(), HasSupportFragmentInjector {
return super.onOptionsItemSelected(item)
}
override fun supportFragmentInjector(): AndroidInjector<Fragment>? {
return dispatchingAndroidInjector
}
override fun androidInjector() = dispatchingAndroidInjector
companion object {
private const val EXTRA_TYPE = "type"

View File

@ -16,14 +16,13 @@
package com.keylesspalace.tusky;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import com.keylesspalace.tusky.fragment.TimelineFragment;
@ -31,12 +30,12 @@ import javax.inject.Inject;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.support.HasSupportFragmentInjector;
import dagger.android.HasAndroidInjector;
public class FavouritesActivity extends BottomSheetActivity implements HasSupportFragmentInjector {
public class FavouritesActivity extends BottomSheetActivity implements HasAndroidInjector {
@Inject
public DispatchingAndroidInjector<Fragment> dispatchingAndroidInjector;
public DispatchingAndroidInjector<Object> dispatchingAndroidInjector;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -70,7 +69,7 @@ public class FavouritesActivity extends BottomSheetActivity implements HasSuppor
}
@Override
public AndroidInjector<Fragment> supportFragmentInjector() {
public AndroidInjector<Object> androidInjector() {
return dispatchingAndroidInjector;
}

View File

@ -27,7 +27,6 @@ import android.view.ViewGroup
import android.widget.*
import androidx.annotation.StringRes
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.*
import androidx.recyclerview.widget.ListAdapter
import at.connyduck.sparkbutton.helpers.Utils
@ -45,7 +44,7 @@ import com.mikepenz.iconics.IconicsDrawable
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from
import com.uber.autodispose.autoDisposable
import dagger.android.DispatchingAndroidInjector
import dagger.android.support.HasSupportFragmentInjector
import dagger.android.HasAndroidInjector
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.android.synthetic.main.activity_lists.*
import kotlinx.android.synthetic.main.toolbar_basic.*
@ -55,7 +54,7 @@ import javax.inject.Inject
* Created by charlag on 1/4/18.
*/
class ListsActivity : BaseActivity(), Injectable, HasSupportFragmentInjector {
class ListsActivity : BaseActivity(), Injectable, HasAndroidInjector {
companion object {
@JvmStatic
@ -68,7 +67,7 @@ class ListsActivity : BaseActivity(), Injectable, HasSupportFragmentInjector {
lateinit var viewModelFactory: ViewModelFactory
@Inject
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Fragment>
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Any>
private lateinit var viewModel: ListsViewModel
private val adapter = ListsAdapter()
@ -207,7 +206,7 @@ class ListsActivity : BaseActivity(), Injectable, HasSupportFragmentInjector {
}
}
override fun supportFragmentInjector() = dispatchingAndroidInjector
override fun androidInjector() = dispatchingAndroidInjector
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {

View File

@ -77,7 +77,7 @@ import javax.inject.Inject;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.support.HasSupportFragmentInjector;
import dagger.android.HasAndroidInjector;
import io.reactivex.android.schedulers.AndroidSchedulers;
import static com.keylesspalace.tusky.util.MediaUtilsKt.deleteStaleCachedMedia;
@ -85,7 +85,7 @@ import static com.uber.autodispose.AutoDispose.autoDisposable;
import static com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from;
public final class MainActivity extends BottomSheetActivity implements ActionButtonActivity,
HasSupportFragmentInjector {
HasAndroidInjector {
private static final String TAG = "MainActivity"; // logging tag
private static final long DRAWER_ITEM_ADD_ACCOUNT = -13;
@ -102,7 +102,7 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
public static final String STATUS_URL = "statusUrl";
@Inject
public DispatchingAndroidInjector<Fragment> fragmentInjector;
public DispatchingAndroidInjector<Object> androidInjector;
@Inject
public EventHub eventHub;
@Inject
@ -624,7 +624,7 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
}
@Override
public AndroidInjector<Fragment> supportFragmentInjector() {
return fragmentInjector;
public AndroidInjector<Object> androidInjector() {
return androidInjector;
}
}

View File

@ -3,18 +3,16 @@ package com.keylesspalace.tusky
import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.google.android.material.floatingactionbutton.FloatingActionButton
import androidx.fragment.app.Fragment
import android.view.MenuItem
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.keylesspalace.tusky.fragment.TimelineFragment
import com.keylesspalace.tusky.interfaces.ActionButtonActivity
import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector
import dagger.android.support.HasSupportFragmentInjector
import dagger.android.HasAndroidInjector
import kotlinx.android.synthetic.main.toolbar_basic.*
import javax.inject.Inject
class ModalTimelineActivity : BottomSheetActivity(), ActionButtonActivity, HasSupportFragmentInjector {
class ModalTimelineActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInjector {
companion object {
private const val ARG_KIND = "kind"
@ -32,7 +30,7 @@ class ModalTimelineActivity : BottomSheetActivity(), ActionButtonActivity, HasSu
}
@Inject
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Fragment>
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Any>
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -66,8 +64,6 @@ class ModalTimelineActivity : BottomSheetActivity(), ActionButtonActivity, HasSu
return false
}
override fun supportFragmentInjector(): AndroidInjector<Fragment> {
return dispatchingAndroidInjector
}
override fun androidInjector() = dispatchingAndroidInjector
}

View File

@ -28,21 +28,21 @@ import com.keylesspalace.tusky.appstore.PreferenceChangedEvent
import com.keylesspalace.tusky.fragment.preference.*
import com.keylesspalace.tusky.util.ThemeUtils
import com.keylesspalace.tusky.util.getNonNullString
import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector
import dagger.android.support.HasSupportFragmentInjector
import kotlinx.android.synthetic.main.toolbar_basic.*
import java.lang.IllegalArgumentException
import javax.inject.Inject
import androidx.appcompat.app.AppCompatDelegate
import dagger.android.HasAndroidInjector
class PreferencesActivity : BaseActivity(), SharedPreferences.OnSharedPreferenceChangeListener, HasSupportFragmentInjector {
class PreferencesActivity : BaseActivity(), SharedPreferences.OnSharedPreferenceChangeListener,
HasAndroidInjector {
@Inject
lateinit var eventHub: EventHub
@Inject
lateinit var fragmentInjector: DispatchingAndroidInjector<Fragment>
lateinit var androidInjector: DispatchingAndroidInjector<Any>
private var restartActivitiesOnExit: Boolean = false
@ -173,9 +173,7 @@ class PreferencesActivity : BaseActivity(), SharedPreferences.OnSharedPreference
}
}
override fun supportFragmentInjector(): AndroidInjector<Fragment> {
return fragmentInjector
}
override fun androidInjector() = androidInjector
companion object {

View File

@ -20,14 +20,14 @@ import android.app.SearchableInfo;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import androidx.fragment.app.FragmentTransaction;
import com.keylesspalace.tusky.fragment.SearchFragment;
@ -35,13 +35,13 @@ import javax.inject.Inject;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.support.HasSupportFragmentInjector;
import dagger.android.HasAndroidInjector;
public class SearchActivity extends BottomSheetActivity implements SearchView.OnQueryTextListener,
HasSupportFragmentInjector {
HasAndroidInjector {
@Inject
public DispatchingAndroidInjector<Fragment> fragmentInjector;
public DispatchingAndroidInjector<Object> androidInjector;
private String currentQuery;
@ -136,8 +136,8 @@ public class SearchActivity extends BottomSheetActivity implements SearchView.On
}
@Override
public AndroidInjector<Fragment> supportFragmentInjector() {
return fragmentInjector;
public AndroidInjector<Object> androidInjector() {
return androidInjector;
}
}

View File

@ -15,15 +15,13 @@
package com.keylesspalace.tusky;
import android.app.Activity;
import android.app.Application;
import android.app.Service;
import androidx.room.Room;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.res.Configuration;
import android.preference.PreferenceManager;
import androidx.emoji.text.EmojiCompat;
import androidx.room.Room;
import com.evernote.android.job.JobManager;
import com.keylesspalace.tusky.db.AccountManager;
@ -41,17 +39,12 @@ import javax.inject.Inject;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasActivityInjector;
import dagger.android.HasBroadcastReceiverInjector;
import dagger.android.HasServiceInjector;
import dagger.android.HasAndroidInjector;
public class TuskyApplication extends Application implements HasActivityInjector, HasServiceInjector, HasBroadcastReceiverInjector {
public class TuskyApplication extends Application implements HasAndroidInjector {
@Inject
DispatchingAndroidInjector<Activity> dispatchingAndroidInjector;
@Inject
DispatchingAndroidInjector<Service> dispatchingServiceInjector;
@Inject
DispatchingAndroidInjector<BroadcastReceiver> dispatchingBroadcastReceiverInjector;
DispatchingAndroidInjector<Object> androidInjector;
@Inject
NotificationPullJobCreator notificationPullJobCreator;
@ -142,18 +135,8 @@ public class TuskyApplication extends Application implements HasActivityInjector
}
@Override
public AndroidInjector<Activity> activityInjector() {
return dispatchingAndroidInjector;
}
@Override
public AndroidInjector<Service> serviceInjector() {
return dispatchingServiceInjector;
}
@Override
public AndroidInjector<BroadcastReceiver> broadcastReceiverInjector() {
return dispatchingBroadcastReceiverInjector;
public AndroidInjector<Object> androidInjector() {
return androidInjector;
}
public interface ServiceLocator {

View File

@ -18,14 +18,13 @@ package com.keylesspalace.tusky;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import com.keylesspalace.tusky.fragment.TimelineFragment;
@ -33,13 +32,14 @@ import javax.inject.Inject;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.support.HasSupportFragmentInjector;
import dagger.android.HasAndroidInjector;
public class ViewTagActivity extends BottomSheetActivity implements HasAndroidInjector {
public class ViewTagActivity extends BottomSheetActivity implements HasSupportFragmentInjector {
private static final String HASHTAG = "hashtag";
@Inject
public DispatchingAndroidInjector<Fragment> dispatchingAndroidInjector;
public DispatchingAndroidInjector<Object> dispatchingAndroidInjector;
public static Intent getIntent(Context context, String tag){
Intent intent = new Intent(context,ViewTagActivity.class);
@ -82,7 +82,7 @@ public class ViewTagActivity extends BottomSheetActivity implements HasSupportFr
}
@Override
public AndroidInjector<Fragment> supportFragmentInjector() {
public AndroidInjector<Object> androidInjector() {
return dispatchingAndroidInjector;
}

View File

@ -19,7 +19,6 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
@ -33,9 +32,9 @@ import javax.inject.Inject;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.support.HasSupportFragmentInjector;
import dagger.android.HasAndroidInjector;
public class ViewThreadActivity extends BottomSheetActivity implements HasSupportFragmentInjector {
public class ViewThreadActivity extends BottomSheetActivity implements HasAndroidInjector {
public static final int REVEAL_BUTTON_HIDDEN = 1;
public static final int REVEAL_BUTTON_REVEAL = 2;
@ -55,7 +54,7 @@ public class ViewThreadActivity extends BottomSheetActivity implements HasSuppor
private int revealButtonState = REVEAL_BUTTON_HIDDEN;
@Inject
public DispatchingAndroidInjector<Fragment> dispatchingAndroidInjector;
public DispatchingAndroidInjector<Object> dispatchingAndroidInjector;
private ViewThreadFragment fragment;
@ -128,7 +127,7 @@ public class ViewThreadActivity extends BottomSheetActivity implements HasSuppor
}
@Override
public AndroidInjector<Fragment> supportFragmentInjector() {
public AndroidInjector<Object> androidInjector() {
return dispatchingAndroidInjector;
}

View File

@ -24,8 +24,8 @@ import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import com.keylesspalace.tusky.TuskyApplication
import dagger.android.AndroidInjection
import dagger.android.HasAndroidInjector
import dagger.android.support.AndroidSupportInjection
import dagger.android.support.HasSupportFragmentInjector
/**
* Created by charlag on 3/24/18.
@ -63,7 +63,7 @@ object AppInjector {
}
private fun handleActivity(activity: Activity) {
if (activity is HasSupportFragmentInjector || activity is Injectable) {
if (activity is HasAndroidInjector || activity is Injectable) {
AndroidInjection.inject(activity)
}
if (activity is FragmentActivity) {