Cleanup dagger setup (#2300)

* cleanup dagger setup

* fix tests

* fix ktlint

* cleanup FragmentBuildersModule
This commit is contained in:
Konrad Pozniak 2022-01-23 20:24:55 +01:00 committed by GitHub
commit e29567c9ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 44 additions and 159 deletions

View file

@ -16,19 +16,12 @@
package com.keylesspalace.tusky.service
import android.content.Context
import android.os.Build
import androidx.core.content.ContextCompat
import javax.inject.Inject
interface ServiceClient {
fun sendToot(tootToSend: TootToSend)
}
class ServiceClientImpl(private val context: Context) : ServiceClient {
override fun sendToot(tootToSend: TootToSend) {
class ServiceClient @Inject constructor(private val context: Context) {
fun sendToot(tootToSend: TootToSend) {
val intent = SendTootService.sendTootIntent(context, tootToSend)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(intent)
} else {
context.startService(intent)
}
ContextCompat.startForegroundService(context, intent)
}
}