2023-11-12 00:25:27 +01:00
|
|
|
package eu.kanade.tachiyomi.di
|
|
|
|
|
|
|
|
|
|
import android.app.Application
|
|
|
|
|
import eu.kanade.domain.base.BasePreferences
|
2025-09-04 07:40:32 +02:00
|
|
|
import eu.kanade.domain.connections.service.ConnectionsPreferences
|
2023-11-12 00:25:27 +01:00
|
|
|
import eu.kanade.domain.source.service.SourcePreferences
|
2024-03-16 16:53:20 +01:00
|
|
|
import eu.kanade.domain.sync.SyncPreferences
|
2023-11-12 00:25:27 +01:00
|
|
|
import eu.kanade.domain.track.service.TrackPreferences
|
|
|
|
|
import eu.kanade.domain.ui.UiPreferences
|
2024-10-12 02:46:28 +02:00
|
|
|
import eu.kanade.tachiyomi.core.security.PrivacyPreferences
|
2023-11-12 00:25:27 +01:00
|
|
|
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
|
|
|
|
import eu.kanade.tachiyomi.network.NetworkPreferences
|
|
|
|
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
2025-02-25 19:17:36 +01:00
|
|
|
import eu.kanade.tachiyomi.util.system.isDebugBuildType
|
2024-01-29 10:11:28 +01:00
|
|
|
import tachiyomi.core.common.preference.AndroidPreferenceStore
|
|
|
|
|
import tachiyomi.core.common.preference.PreferenceStore
|
|
|
|
|
import tachiyomi.core.common.storage.AndroidStorageFolderProvider
|
2023-11-12 00:25:27 +01:00
|
|
|
import tachiyomi.domain.backup.service.BackupPreferences
|
|
|
|
|
import tachiyomi.domain.download.service.DownloadPreferences
|
2026-01-28 07:07:43 +01:00
|
|
|
import tachiyomi.domain.history.service.HistoryPreferences
|
2023-11-12 00:25:27 +01:00
|
|
|
import tachiyomi.domain.library.service.LibraryPreferences
|
2023-10-26 19:43:42 +02:00
|
|
|
import tachiyomi.domain.storage.service.StoragePreferences
|
2026-01-17 11:43:40 +01:00
|
|
|
import tachiyomi.domain.updates.service.UpdatesPreferences
|
2023-11-12 00:25:27 +01:00
|
|
|
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(),
|
2025-02-25 19:17:36 +01:00
|
|
|
verboseLogging = isDebugBuildType,
|
2023-11-12 00:25:27 +01:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
addSingletonFactory {
|
|
|
|
|
SourcePreferences(get())
|
|
|
|
|
}
|
|
|
|
|
addSingletonFactory {
|
|
|
|
|
SecurityPreferences(get())
|
|
|
|
|
}
|
2024-10-12 02:46:28 +02:00
|
|
|
addSingletonFactory {
|
|
|
|
|
PrivacyPreferences(get())
|
|
|
|
|
}
|
2023-11-12 00:25:27 +01:00
|
|
|
addSingletonFactory {
|
|
|
|
|
LibraryPreferences(get())
|
|
|
|
|
}
|
2026-01-17 11:43:40 +01:00
|
|
|
addSingletonFactory {
|
|
|
|
|
UpdatesPreferences(get())
|
|
|
|
|
}
|
2026-01-28 07:07:43 +01:00
|
|
|
// KMK -->
|
|
|
|
|
addSingletonFactory {
|
|
|
|
|
HistoryPreferences(get())
|
|
|
|
|
}
|
|
|
|
|
// KMK <--
|
2023-11-12 00:25:27 +01:00
|
|
|
addSingletonFactory {
|
|
|
|
|
ReaderPreferences(get())
|
|
|
|
|
}
|
|
|
|
|
addSingletonFactory {
|
|
|
|
|
TrackPreferences(get())
|
|
|
|
|
}
|
|
|
|
|
addSingletonFactory {
|
2023-10-26 19:43:42 +02:00
|
|
|
DownloadPreferences(get())
|
2023-11-12 00:25:27 +01:00
|
|
|
}
|
|
|
|
|
addSingletonFactory {
|
2023-10-26 19:43:42 +02:00
|
|
|
BackupPreferences(get())
|
2023-11-12 00:25:27 +01:00
|
|
|
}
|
|
|
|
|
addSingletonFactory {
|
2023-10-26 19:43:42 +02:00
|
|
|
StoragePreferences(
|
|
|
|
|
folderProvider = get<AndroidStorageFolderProvider>(),
|
2023-11-12 00:25:27 +01:00
|
|
|
preferenceStore = get(),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
addSingletonFactory {
|
|
|
|
|
UiPreferences(get())
|
|
|
|
|
}
|
|
|
|
|
addSingletonFactory {
|
|
|
|
|
BasePreferences(app, get())
|
|
|
|
|
}
|
2025-09-04 07:40:32 +02:00
|
|
|
// AM (CONNECTIONS) -->
|
|
|
|
|
addSingletonFactory { ConnectionsPreferences(get()) }
|
|
|
|
|
// <-- AM (CONNECTIONS)
|
2024-03-16 16:53:20 +01:00
|
|
|
|
|
|
|
|
addSingletonFactory {
|
|
|
|
|
SyncPreferences(get())
|
|
|
|
|
}
|
2023-11-12 00:25:27 +01:00
|
|
|
}
|
|
|
|
|
}
|