Merge branch 'fix-crash-android5'
This commit is contained in:
commit
ba61387909
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
package com.keylesspalace.tusky.di
|
package com.keylesspalace.tusky.di
|
||||||
|
|
||||||
import com.keylesspalace.tusky.service.AccountChooserService
|
|
||||||
import com.keylesspalace.tusky.service.SendTootService
|
import com.keylesspalace.tusky.service.SendTootService
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
|
@ -24,6 +23,4 @@ import dagger.android.ContributesAndroidInjector
|
||||||
abstract class ServicesModule {
|
abstract class ServicesModule {
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
abstract fun contributesSendTootService(): SendTootService
|
abstract fun contributesSendTootService(): SendTootService
|
||||||
@ContributesAndroidInjector
|
|
||||||
abstract fun contributesAccountChooserService(): AccountChooserService
|
|
||||||
}
|
}
|
|
@ -24,21 +24,22 @@ import android.service.chooser.ChooserTarget
|
||||||
import android.service.chooser.ChooserTargetService
|
import android.service.chooser.ChooserTargetService
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import com.keylesspalace.tusky.R
|
import com.keylesspalace.tusky.R
|
||||||
|
import com.keylesspalace.tusky.TuskyApplication
|
||||||
import com.keylesspalace.tusky.db.AccountManager
|
import com.keylesspalace.tusky.db.AccountManager
|
||||||
import com.keylesspalace.tusky.di.Injectable
|
import com.keylesspalace.tusky.di.Injectable
|
||||||
import com.keylesspalace.tusky.util.NotificationHelper
|
import com.keylesspalace.tusky.util.NotificationHelper
|
||||||
import com.squareup.picasso.Picasso
|
import com.squareup.picasso.Picasso
|
||||||
import dagger.android.AndroidInjection
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
@TargetApi(23)
|
@TargetApi(23)
|
||||||
class AccountChooserService : ChooserTargetService(), Injectable {
|
class AccountChooserService : ChooserTargetService(), Injectable {
|
||||||
@Inject
|
|
||||||
|
// cannot inject here, it crashes on APIs < 23
|
||||||
lateinit var accountManager: AccountManager
|
lateinit var accountManager: AccountManager
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
AndroidInjection.inject(this)
|
accountManager = (application as TuskyApplication).serviceLocator.get(AccountManager::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onGetChooserTargets(targetActivityName: ComponentName?, intentFilter: IntentFilter?): MutableList<ChooserTarget> {
|
override fun onGetChooserTargets(targetActivityName: ComponentName?, intentFilter: IntentFilter?): MutableList<ChooserTarget> {
|
||||||
|
|
Loading…
Reference in New Issue