93 lines
3.1 KiB
Kotlin
93 lines
3.1 KiB
Kotlin
package eu.kanade.tachiyomi.di
|
|
|
|
import android.app.Application
|
|
import eu.kanade.domain.base.BasePreferences
|
|
import eu.kanade.domain.connections.service.ConnectionsPreferences
|
|
import eu.kanade.domain.source.service.SourcePreferences
|
|
import eu.kanade.domain.sync.SyncPreferences
|
|
import eu.kanade.domain.track.service.TrackPreferences
|
|
import eu.kanade.domain.ui.UiPreferences
|
|
import eu.kanade.tachiyomi.core.security.PrivacyPreferences
|
|
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
|
import eu.kanade.tachiyomi.network.NetworkPreferences
|
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
|
import eu.kanade.tachiyomi.util.system.isDebugBuildType
|
|
import tachiyomi.core.common.preference.AndroidPreferenceStore
|
|
import tachiyomi.core.common.preference.PreferenceStore
|
|
import tachiyomi.core.common.storage.AndroidStorageFolderProvider
|
|
import tachiyomi.domain.backup.service.BackupPreferences
|
|
import tachiyomi.domain.download.service.DownloadPreferences
|
|
import tachiyomi.domain.history.service.HistoryPreferences
|
|
import tachiyomi.domain.library.service.LibraryPreferences
|
|
import tachiyomi.domain.storage.service.StoragePreferences
|
|
import tachiyomi.domain.updates.service.UpdatesPreferences
|
|
import uy.kohesive.injekt.api.InjektModule
|
|
import uy.kohesive.injekt.api.InjektRegistrar
|
|
import uy.kohesive.injekt.api.addSingletonFactory
|
|
import uy.kohesive.injekt.api.get
|
|
|
|
class PreferenceModule(val app: Application) : InjektModule {
|
|
|
|
override fun InjektRegistrar.registerInjectables() {
|
|
addSingletonFactory<PreferenceStore> {
|
|
AndroidPreferenceStore(app)
|
|
}
|
|
addSingletonFactory {
|
|
NetworkPreferences(
|
|
preferenceStore = get(),
|
|
verboseLogging = isDebugBuildType,
|
|
)
|
|
}
|
|
addSingletonFactory {
|
|
SourcePreferences(get())
|
|
}
|
|
addSingletonFactory {
|
|
SecurityPreferences(get())
|
|
}
|
|
addSingletonFactory {
|
|
PrivacyPreferences(get())
|
|
}
|
|
addSingletonFactory {
|
|
LibraryPreferences(get())
|
|
}
|
|
addSingletonFactory {
|
|
UpdatesPreferences(get())
|
|
}
|
|
// KMK -->
|
|
addSingletonFactory {
|
|
HistoryPreferences(get())
|
|
}
|
|
// KMK <--
|
|
addSingletonFactory {
|
|
ReaderPreferences(get())
|
|
}
|
|
addSingletonFactory {
|
|
TrackPreferences(get())
|
|
}
|
|
addSingletonFactory {
|
|
DownloadPreferences(get())
|
|
}
|
|
addSingletonFactory {
|
|
BackupPreferences(get())
|
|
}
|
|
addSingletonFactory {
|
|
StoragePreferences(
|
|
folderProvider = get<AndroidStorageFolderProvider>(),
|
|
preferenceStore = get(),
|
|
)
|
|
}
|
|
addSingletonFactory {
|
|
UiPreferences(get())
|
|
}
|
|
addSingletonFactory {
|
|
BasePreferences(app, get())
|
|
}
|
|
// AM (CONNECTIONS) -->
|
|
addSingletonFactory { ConnectionsPreferences(get()) }
|
|
// <-- AM (CONNECTIONS)
|
|
|
|
addSingletonFactory {
|
|
SyncPreferences(get())
|
|
}
|
|
}
|
|
}
|