forked from github/wulkanowy-mirror
parent
2f24b25399
commit
2b60f555e9
@ -1,5 +1,3 @@
|
|||||||
exclude:
|
component_depth: 8
|
||||||
- /app/src/main/java/io/github/wulkanowy/data/db/dao/entities/.*
|
|
||||||
component_depth: 1
|
|
||||||
languages:
|
languages:
|
||||||
- java
|
- kotlin
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.github.wulkanowy
|
package io.github.wulkanowy
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.multidex.MultiDex
|
import androidx.multidex.MultiDex
|
||||||
import com.akaita.java.rxjava2debug.RxJava2Debug
|
import com.akaita.java.rxjava2debug.RxJava2Debug
|
||||||
import com.crashlytics.android.Crashlytics
|
import com.crashlytics.android.Crashlytics
|
||||||
@ -13,13 +14,18 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
|
|||||||
import eu.davidea.flexibleadapter.utils.Log
|
import eu.davidea.flexibleadapter.utils.Log
|
||||||
import io.fabric.sdk.android.Fabric
|
import io.fabric.sdk.android.Fabric
|
||||||
import io.github.wulkanowy.BuildConfig.DEBUG
|
import io.github.wulkanowy.BuildConfig.DEBUG
|
||||||
|
import io.github.wulkanowy.data.repositories.PreferencesRepository
|
||||||
import io.github.wulkanowy.di.DaggerAppComponent
|
import io.github.wulkanowy.di.DaggerAppComponent
|
||||||
import io.github.wulkanowy.utils.CrashlyticsTree
|
import io.github.wulkanowy.utils.CrashlyticsTree
|
||||||
import io.github.wulkanowy.utils.DebugLogTree
|
import io.github.wulkanowy.utils.DebugLogTree
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
class WulkanowyApp : DaggerApplication() {
|
class WulkanowyApp : DaggerApplication() {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var prefRepository: PreferencesRepository
|
||||||
|
|
||||||
override fun attachBaseContext(base: Context?) {
|
override fun attachBaseContext(base: Context?) {
|
||||||
super.attachBaseContext(base)
|
super.attachBaseContext(base)
|
||||||
MultiDex.install(this)
|
MultiDex.install(this)
|
||||||
@ -31,6 +37,7 @@ class WulkanowyApp : DaggerApplication() {
|
|||||||
initializeFabric()
|
initializeFabric()
|
||||||
if (DEBUG) enableDebugLog()
|
if (DEBUG) enableDebugLog()
|
||||||
RxJava2Debug.enableRxJava2AssemblyTracking(arrayOf(BuildConfig.APPLICATION_ID))
|
RxJava2Debug.enableRxJava2AssemblyTracking(arrayOf(BuildConfig.APPLICATION_ID))
|
||||||
|
AppCompatDelegate.setDefaultNightMode(prefRepository.currentTheme)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun enableDebugLog() {
|
private fun enableDebugLog() {
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package io.github.wulkanowy.ui.modules.splash
|
package io.github.wulkanowy.ui.modules.splash
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import io.github.wulkanowy.services.notification.GradeNotification
|
|
||||||
import io.github.wulkanowy.ui.base.BaseActivity
|
import io.github.wulkanowy.ui.base.BaseActivity
|
||||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
|
||||||
|
|
||||||
class SplashActivity : BaseActivity(), SplashView {
|
class SplashActivity : BaseActivity(), SplashView {
|
||||||
|
|
||||||
@ -28,10 +26,6 @@ class SplashActivity : BaseActivity(), SplashView {
|
|||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setCurrentThemeMode(mode: Int) {
|
|
||||||
AppCompatDelegate.setDefaultNightMode(mode)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
presenter.onDetachView()
|
presenter.onDetachView()
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package io.github.wulkanowy.ui.modules.splash
|
package io.github.wulkanowy.ui.modules.splash
|
||||||
|
|
||||||
import io.github.wulkanowy.data.ErrorHandler
|
import io.github.wulkanowy.data.ErrorHandler
|
||||||
import io.github.wulkanowy.data.repositories.PreferencesRepository
|
|
||||||
import io.github.wulkanowy.data.repositories.SessionRepository
|
import io.github.wulkanowy.data.repositories.SessionRepository
|
||||||
import io.github.wulkanowy.ui.base.BasePresenter
|
import io.github.wulkanowy.ui.base.BasePresenter
|
||||||
import io.github.wulkanowy.utils.logLogin
|
import io.github.wulkanowy.utils.logLogin
|
||||||
@ -9,14 +8,12 @@ import javax.inject.Inject
|
|||||||
|
|
||||||
class SplashPresenter @Inject constructor(
|
class SplashPresenter @Inject constructor(
|
||||||
private val sessionRepository: SessionRepository,
|
private val sessionRepository: SessionRepository,
|
||||||
private val preferencesRepository: PreferencesRepository,
|
|
||||||
errorHandler: ErrorHandler
|
errorHandler: ErrorHandler
|
||||||
) : BasePresenter<SplashView>(errorHandler) {
|
) : BasePresenter<SplashView>(errorHandler) {
|
||||||
|
|
||||||
override fun onAttachView(view: SplashView) {
|
override fun onAttachView(view: SplashView) {
|
||||||
super.onAttachView(view)
|
super.onAttachView(view)
|
||||||
view.run {
|
view.run {
|
||||||
setCurrentThemeMode(preferencesRepository.currentTheme)
|
|
||||||
if (sessionRepository.isSessionSaved) {
|
if (sessionRepository.isSessionSaved) {
|
||||||
logLogin("Open app")
|
logLogin("Open app")
|
||||||
openMainView()
|
openMainView()
|
||||||
|
@ -7,6 +7,4 @@ interface SplashView : BaseView {
|
|||||||
fun openLoginView()
|
fun openLoginView()
|
||||||
|
|
||||||
fun openMainView()
|
fun openMainView()
|
||||||
|
|
||||||
fun setCurrentThemeMode(mode: Int)
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package io.github.wulkanowy.ui.modules.splash
|
package io.github.wulkanowy.ui.modules.splash
|
||||||
|
|
||||||
import io.github.wulkanowy.data.ErrorHandler
|
import io.github.wulkanowy.data.ErrorHandler
|
||||||
import io.github.wulkanowy.data.repositories.PreferencesRepository
|
|
||||||
import io.github.wulkanowy.data.repositories.SessionRepository
|
import io.github.wulkanowy.data.repositories.SessionRepository
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -21,15 +20,12 @@ class SplashPresenterTest {
|
|||||||
@Mock
|
@Mock
|
||||||
lateinit var errorHandler: ErrorHandler
|
lateinit var errorHandler: ErrorHandler
|
||||||
|
|
||||||
@Mock
|
|
||||||
lateinit var preferencesRepository: PreferencesRepository
|
|
||||||
|
|
||||||
private lateinit var presenter: SplashPresenter
|
private lateinit var presenter: SplashPresenter
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun initPresenter() {
|
fun initPresenter() {
|
||||||
MockitoAnnotations.initMocks(this)
|
MockitoAnnotations.initMocks(this)
|
||||||
presenter = SplashPresenter(sessionRepository, preferencesRepository, errorHandler)
|
presenter = SplashPresenter(sessionRepository, errorHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user