Fix code analysis errors
This commit is contained in:
parent
e4f42baaed
commit
8e9b14cecc
34 changed files with 71 additions and 79 deletions
|
|
@ -9,4 +9,4 @@ class HiltTestRunner : AndroidJUnitRunner() {
|
|||
|
||||
override fun newApplication(cl: ClassLoader?, name: String?, context: Context?): Application =
|
||||
super.newApplication(cl, HiltTestApplication::class.java.name, context)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,4 +30,4 @@ object HttpsConfigurationModule {
|
|||
handshakeCertificates.trustManager
|
||||
)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,4 @@ import android.app.Application
|
|||
import dagger.hilt.android.HiltAndroidApp
|
||||
|
||||
@HiltAndroidApp
|
||||
class TestShowcaseApplication : Application() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
}
|
||||
}
|
||||
class TestShowcaseApplication : Application()
|
||||
|
|
|
|||
|
|
@ -48,6 +48,5 @@ object AppModule {
|
|||
@Provides
|
||||
internal fun bindSessionExpirationListener(
|
||||
sessionExpirationListenerImpl: SessionExpirationListenerImpl
|
||||
) : SessionExpirationListener = sessionExpirationListenerImpl
|
||||
|
||||
}
|
||||
): SessionExpirationListener = sessionExpirationListenerImpl
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ object IntentCoordinator {
|
|||
|
||||
fun authActivitygetStartIntent(context: Context) =
|
||||
HiltAuthActivity.getStartIntent(context)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ inline fun <reified T : ViewModel> ViewModelStoreOwner.viewModels(): Lazy<T> =
|
|||
when (this) {
|
||||
is ComponentActivity -> androidxViewModel()
|
||||
else -> throw IllegalStateException("Only supports activity viewModel for now")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ class HiltAuthActivity : AuthActivity() {
|
|||
companion object {
|
||||
fun getStartIntent(context: Context): Intent = Intent(context, HiltAuthActivity::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ class HiltMainActivity : MainActivity() {
|
|||
companion object {
|
||||
fun getStartIntent(context: Context): Intent = Intent(context, HiltMainActivity::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ package org.fnives.test.showcase.ui.splash
|
|||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class HiltSplashActivity : SplashActivity()
|
||||
class HiltSplashActivity : SplashActivity()
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ object IntentCoordinator {
|
|||
|
||||
fun authActivitygetStartIntent(context: Context) =
|
||||
AuthActivity.getStartIntent(context)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@ import androidx.lifecycle.ViewModelStoreOwner
|
|||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
||||
inline fun <reified T : ViewModel> ViewModelStoreOwner.viewModels(): Lazy<T> =
|
||||
viewModel()
|
||||
viewModel()
|
||||
|
|
|
|||
|
|
@ -7,13 +7,20 @@ import org.fnives.test.showcase.model.session.Session
|
|||
import kotlin.properties.ReadWriteProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class SharedPreferencesManagerImpl constructor(private val sharedPreferences: SharedPreferences) : UserDataLocalStorage {
|
||||
class SharedPreferencesManagerImpl(
|
||||
private val sharedPreferences: SharedPreferences
|
||||
) : UserDataLocalStorage {
|
||||
|
||||
override var session: Session? by SessionDelegate(SESSION_KEY)
|
||||
|
||||
private class SessionDelegate(private val key: String) : ReadWriteProperty<SharedPreferencesManagerImpl, Session?> {
|
||||
private class SessionDelegate(private val key: String) :
|
||||
ReadWriteProperty<SharedPreferencesManagerImpl, Session?> {
|
||||
|
||||
override fun setValue(thisRef: SharedPreferencesManagerImpl, property: KProperty<*>, value: Session?) {
|
||||
override fun setValue(
|
||||
thisRef: SharedPreferencesManagerImpl,
|
||||
property: KProperty<*>,
|
||||
value: Session?
|
||||
) {
|
||||
if (value == null) {
|
||||
thisRef.sharedPreferences.edit().remove(key).apply()
|
||||
} else {
|
||||
|
|
@ -25,7 +32,10 @@ class SharedPreferencesManagerImpl constructor(private val sharedPreferences: Sh
|
|||
}
|
||||
}
|
||||
|
||||
override fun getValue(thisRef: SharedPreferencesManagerImpl, property: KProperty<*>): Session? {
|
||||
override fun getValue(
|
||||
thisRef: SharedPreferencesManagerImpl,
|
||||
property: KProperty<*>
|
||||
): Session? {
|
||||
val values = thisRef.sharedPreferences.getStringSet(key, null)?.toList()
|
||||
val accessToken = values?.firstOrNull { it.startsWith(ACCESS_TOKEN_KEY) }
|
||||
?.drop(ACCESS_TOKEN_KEY.length) ?: return null
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@ import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorag
|
|||
import org.fnives.test.showcase.model.content.ContentId
|
||||
import javax.inject.Inject
|
||||
|
||||
class FavouriteContentLocalStorageImpl @Inject constructor(private val favouriteDao: FavouriteDao) : FavouriteContentLocalStorage {
|
||||
class FavouriteContentLocalStorageImpl @Inject constructor(
|
||||
private val favouriteDao: FavouriteDao
|
||||
) : FavouriteContentLocalStorage {
|
||||
|
||||
override fun observeFavourites(): Flow<List<ContentId>> =
|
||||
favouriteDao.get().map { it.map(FavouriteEntity::contentId).map(::ContentId) }
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import android.os.Bundle
|
|||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import org.fnives.test.showcase.R
|
||||
import org.fnives.test.showcase.databinding.ActivityMainBinding
|
||||
import org.fnives.test.showcase.model.content.ContentId
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ internal class FavouriteContentLocalStorageImplTest {
|
|||
val hiltRule = HiltAndroidRule(this)
|
||||
|
||||
@Inject
|
||||
lateinit var sut : FavouriteContentLocalStorage
|
||||
lateinit var sut: FavouriteContentLocalStorage
|
||||
private lateinit var testDispatcher: TestCoroutineDispatcher
|
||||
|
||||
@Before
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
//package org.fnives.test.showcase.testutils.statesetup
|
||||
// package org.fnives.test.showcase.testutils.statesetup
|
||||
//
|
||||
//import kotlinx.coroutines.runBlocking
|
||||
//import org.fnives.test.showcase.core.login.IsUserLoggedInUseCase
|
||||
//import org.fnives.test.showcase.core.login.LoginUseCase
|
||||
//import org.fnives.test.showcase.core.login.LogoutUseCase
|
||||
//import org.fnives.test.showcase.model.auth.LoginCredentials
|
||||
//import org.fnives.test.showcase.network.mockserver.MockServerScenarioSetup
|
||||
//import org.fnives.test.showcase.network.mockserver.scenario.auth.AuthScenario
|
||||
//import org.koin.test.KoinTest
|
||||
//import org.koin.test.get
|
||||
// import kotlinx.coroutines.runBlocking
|
||||
// import org.fnives.test.showcase.core.login.IsUserLoggedInUseCase
|
||||
// import org.fnives.test.showcase.core.login.LoginUseCase
|
||||
// import org.fnives.test.showcase.core.login.LogoutUseCase
|
||||
// import org.fnives.test.showcase.model.auth.LoginCredentials
|
||||
// import org.fnives.test.showcase.network.mockserver.MockServerScenarioSetup
|
||||
// import org.fnives.test.showcase.network.mockserver.scenario.auth.AuthScenario
|
||||
// import org.koin.test.KoinTest
|
||||
// import org.koin.test.get
|
||||
//
|
||||
//object SetupLoggedInState : KoinTest {
|
||||
// object SetupLoggedInState : KoinTest {
|
||||
//
|
||||
// private val logoutUseCase get() = get<LogoutUseCase>()
|
||||
// private val loginUseCase get() = get<LoginUseCase>()
|
||||
|
|
@ -28,4 +28,4 @@
|
|||
// fun setupLogout() {
|
||||
// runBlocking { logoutUseCase.invoke() }
|
||||
// }
|
||||
//}
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import org.fnives.test.showcase.network.mockserver.scenario.auth.AuthScenario
|
|||
import javax.inject.Inject
|
||||
|
||||
class SetupLoggedInState @Inject constructor(
|
||||
private val logoutUseCase : LogoutUseCase,
|
||||
private val loginUseCase : LoginUseCase,
|
||||
private val logoutUseCase: LogoutUseCase,
|
||||
private val loginUseCase: LoginUseCase,
|
||||
private val isUserLoggedInUseCase: IsUserLoggedInUseCase
|
||||
) {
|
||||
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ object ActivityClassHolder {
|
|||
fun mainActivity() = HiltMainActivity::class
|
||||
|
||||
fun splashActivity() = HiltSplashActivity::class
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ object ActivityClassHolder {
|
|||
fun mainActivity() = MainActivity::class
|
||||
|
||||
fun splashActivity() = SplashActivity::class
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue