Начат LocalStorage, выкинут мусор из UiState
This commit is contained in:
@@ -6,8 +6,8 @@ import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import com.github.nullptroma.wallenc.presentation.WallencUi
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import timber.log.Timber
|
||||
|
||||
class Container<T>(val value: T)
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : ComponentActivity() {
|
||||
@@ -15,12 +15,13 @@ class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
|
||||
Timber.plant(Timber.DebugTree())
|
||||
// val sdk = YandexAuthSdk.create(YandexAuthOptions(applicationContext, true))
|
||||
// val launcher =
|
||||
// registerForActivityResult(sdk.contract) { result -> handleResult(result) }
|
||||
// val loginOptions = YandexAuthLoginOptions(LoginType.CHROME_TAB)
|
||||
val cont1 = Container(true)
|
||||
var cont2 = Container<Boolean>(true)
|
||||
|
||||
setContent {
|
||||
WallencUi()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.github.nullptroma.wallenc.app.di.modules.app
|
||||
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import javax.inject.Qualifier
|
||||
|
||||
@Qualifier
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class MainDispatcher
|
||||
|
||||
@Qualifier
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class IoDispatcher
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
class DispatchersModule {
|
||||
@MainDispatcher
|
||||
@Provides
|
||||
fun providesMainDispatcher(): CoroutineDispatcher = Dispatchers.Main
|
||||
|
||||
@IoDispatcher
|
||||
@Provides
|
||||
fun providesIoDispatcher(): CoroutineDispatcher = Dispatchers.IO
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.github.nullptroma.wallenc.app.di.modules.data
|
||||
|
||||
import android.content.Context
|
||||
import com.github.nullptroma.wallenc.app.di.modules.app.IoDispatcher
|
||||
import com.github.nullptroma.wallenc.data.vaults.local.LocalVault
|
||||
import com.github.nullptroma.wallenc.data.vaults.VaultsManager
|
||||
import com.github.nullptroma.wallenc.domain.models.IVaultsManager
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
class SingletonModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideLocalVault(@IoDispatcher ioDispatcher: CoroutineDispatcher,
|
||||
@ApplicationContext context: Context): LocalVault {
|
||||
return LocalVault(ioDispatcher, context)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideVaultsManager(localVault: LocalVault): IVaultsManager {
|
||||
return VaultsManager(localVault)
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.github.nullptroma.wallenc.app.di.modules.domain
|
||||
|
||||
import com.github.nullptroma.wallenc.domain.models.IMetaInfo
|
||||
import com.github.nullptroma.wallenc.domain.usecases.TestUseCase
|
||||
import com.github.nullptroma.wallenc.domain.models.IVaultsManager
|
||||
import com.github.nullptroma.wallenc.domain.usecases.GetAllRawStoragesUseCase
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
@@ -11,11 +11,9 @@ import javax.inject.Singleton
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
class UseCasesModule {
|
||||
var count = 0
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideTestUseCase(meta: IMetaInfo): TestUseCase {
|
||||
return TestUseCase(meta, count++)
|
||||
fun provideGetAllRawStoragesUseCase(vaultsManager: IVaultsManager): GetAllRawStoragesUseCase {
|
||||
return GetAllRawStoragesUseCase(vaultsManager)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user