DomainModule.kt 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. package eu.kanade.domain
  2. import eu.kanade.data.category.CategoryRepositoryImpl
  3. import eu.kanade.data.chapter.ChapterRepositoryImpl
  4. import eu.kanade.data.history.HistoryRepositoryImpl
  5. import eu.kanade.data.manga.MangaRepositoryImpl
  6. import eu.kanade.data.source.SourceDataRepositoryImpl
  7. import eu.kanade.data.source.SourceRepositoryImpl
  8. import eu.kanade.data.track.TrackRepositoryImpl
  9. import eu.kanade.data.updates.UpdatesRepositoryImpl
  10. import eu.kanade.domain.category.interactor.CreateCategoryWithName
  11. import eu.kanade.domain.category.interactor.DeleteCategory
  12. import eu.kanade.domain.category.interactor.GetCategories
  13. import eu.kanade.domain.category.interactor.RenameCategory
  14. import eu.kanade.domain.category.interactor.ReorderCategory
  15. import eu.kanade.domain.category.interactor.ResetCategoryFlags
  16. import eu.kanade.domain.category.interactor.SetDisplayModeForCategory
  17. import eu.kanade.domain.category.interactor.SetMangaCategories
  18. import eu.kanade.domain.category.interactor.SetSortModeForCategory
  19. import eu.kanade.domain.category.interactor.UpdateCategory
  20. import eu.kanade.domain.category.repository.CategoryRepository
  21. import eu.kanade.domain.chapter.interactor.GetChapter
  22. import eu.kanade.domain.chapter.interactor.GetChapterByMangaId
  23. import eu.kanade.domain.chapter.interactor.SetMangaDefaultChapterFlags
  24. import eu.kanade.domain.chapter.interactor.SetReadStatus
  25. import eu.kanade.domain.chapter.interactor.ShouldUpdateDbChapter
  26. import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource
  27. import eu.kanade.domain.chapter.interactor.SyncChaptersWithTrackServiceTwoWay
  28. import eu.kanade.domain.chapter.interactor.UpdateChapter
  29. import eu.kanade.domain.chapter.repository.ChapterRepository
  30. import eu.kanade.domain.download.interactor.DeleteDownload
  31. import eu.kanade.domain.extension.interactor.GetExtensionLanguages
  32. import eu.kanade.domain.extension.interactor.GetExtensionSources
  33. import eu.kanade.domain.extension.interactor.GetExtensionsByType
  34. import eu.kanade.domain.history.interactor.GetHistory
  35. import eu.kanade.domain.history.interactor.GetNextChapters
  36. import eu.kanade.domain.history.interactor.RemoveHistory
  37. import eu.kanade.domain.history.interactor.UpsertHistory
  38. import eu.kanade.domain.history.repository.HistoryRepository
  39. import eu.kanade.domain.manga.interactor.GetDuplicateLibraryManga
  40. import eu.kanade.domain.manga.interactor.GetFavorites
  41. import eu.kanade.domain.manga.interactor.GetLibraryManga
  42. import eu.kanade.domain.manga.interactor.GetManga
  43. import eu.kanade.domain.manga.interactor.GetMangaWithChapters
  44. import eu.kanade.domain.manga.interactor.NetworkToLocalManga
  45. import eu.kanade.domain.manga.interactor.ResetViewerFlags
  46. import eu.kanade.domain.manga.interactor.SetMangaChapterFlags
  47. import eu.kanade.domain.manga.interactor.SetMangaViewerFlags
  48. import eu.kanade.domain.manga.interactor.UpdateManga
  49. import eu.kanade.domain.manga.repository.MangaRepository
  50. import eu.kanade.domain.source.interactor.GetEnabledSources
  51. import eu.kanade.domain.source.interactor.GetLanguagesWithSources
  52. import eu.kanade.domain.source.interactor.GetRemoteManga
  53. import eu.kanade.domain.source.interactor.GetSourcesWithFavoriteCount
  54. import eu.kanade.domain.source.interactor.GetSourcesWithNonLibraryManga
  55. import eu.kanade.domain.source.interactor.SetMigrateSorting
  56. import eu.kanade.domain.source.interactor.ToggleLanguage
  57. import eu.kanade.domain.source.interactor.ToggleSource
  58. import eu.kanade.domain.source.interactor.ToggleSourcePin
  59. import eu.kanade.domain.source.repository.SourceDataRepository
  60. import eu.kanade.domain.source.repository.SourceRepository
  61. import eu.kanade.domain.track.interactor.DeleteTrack
  62. import eu.kanade.domain.track.interactor.GetTracks
  63. import eu.kanade.domain.track.interactor.GetTracksPerManga
  64. import eu.kanade.domain.track.interactor.InsertTrack
  65. import eu.kanade.domain.track.repository.TrackRepository
  66. import eu.kanade.domain.updates.interactor.GetUpdates
  67. import eu.kanade.domain.updates.repository.UpdatesRepository
  68. import uy.kohesive.injekt.api.InjektModule
  69. import uy.kohesive.injekt.api.InjektRegistrar
  70. import uy.kohesive.injekt.api.addFactory
  71. import uy.kohesive.injekt.api.addSingletonFactory
  72. import uy.kohesive.injekt.api.get
  73. class DomainModule : InjektModule {
  74. override fun InjektRegistrar.registerInjectables() {
  75. addSingletonFactory<CategoryRepository> { CategoryRepositoryImpl(get()) }
  76. addFactory { GetCategories(get()) }
  77. addFactory { ResetCategoryFlags(get(), get()) }
  78. addFactory { SetDisplayModeForCategory(get(), get()) }
  79. addFactory { SetSortModeForCategory(get(), get()) }
  80. addFactory { CreateCategoryWithName(get(), get()) }
  81. addFactory { RenameCategory(get()) }
  82. addFactory { ReorderCategory(get()) }
  83. addFactory { UpdateCategory(get()) }
  84. addFactory { DeleteCategory(get()) }
  85. addSingletonFactory<MangaRepository> { MangaRepositoryImpl(get()) }
  86. addFactory { GetDuplicateLibraryManga(get()) }
  87. addFactory { GetFavorites(get()) }
  88. addFactory { GetLibraryManga(get()) }
  89. addFactory { GetMangaWithChapters(get(), get()) }
  90. addFactory { GetManga(get()) }
  91. addFactory { GetNextChapters(get(), get(), get()) }
  92. addFactory { ResetViewerFlags(get()) }
  93. addFactory { SetMangaChapterFlags(get()) }
  94. addFactory { SetMangaDefaultChapterFlags(get(), get(), get()) }
  95. addFactory { SetMangaViewerFlags(get()) }
  96. addFactory { NetworkToLocalManga(get()) }
  97. addFactory { UpdateManga(get()) }
  98. addFactory { SetMangaCategories(get()) }
  99. addSingletonFactory<TrackRepository> { TrackRepositoryImpl(get()) }
  100. addFactory { DeleteTrack(get()) }
  101. addFactory { GetTracksPerManga(get()) }
  102. addFactory { GetTracks(get()) }
  103. addFactory { InsertTrack(get()) }
  104. addSingletonFactory<ChapterRepository> { ChapterRepositoryImpl(get()) }
  105. addFactory { GetChapter(get()) }
  106. addFactory { GetChapterByMangaId(get()) }
  107. addFactory { UpdateChapter(get()) }
  108. addFactory { SetReadStatus(get(), get(), get(), get()) }
  109. addFactory { ShouldUpdateDbChapter() }
  110. addFactory { SyncChaptersWithSource(get(), get(), get(), get()) }
  111. addFactory { SyncChaptersWithTrackServiceTwoWay(get(), get()) }
  112. addSingletonFactory<HistoryRepository> { HistoryRepositoryImpl(get()) }
  113. addFactory { GetHistory(get()) }
  114. addFactory { UpsertHistory(get()) }
  115. addFactory { RemoveHistory(get()) }
  116. addFactory { DeleteDownload(get(), get()) }
  117. addFactory { GetExtensionsByType(get(), get()) }
  118. addFactory { GetExtensionSources(get()) }
  119. addFactory { GetExtensionLanguages(get(), get()) }
  120. addSingletonFactory<UpdatesRepository> { UpdatesRepositoryImpl(get()) }
  121. addFactory { GetUpdates(get(), get()) }
  122. addSingletonFactory<SourceRepository> { SourceRepositoryImpl(get(), get()) }
  123. addSingletonFactory<SourceDataRepository> { SourceDataRepositoryImpl(get()) }
  124. addFactory { GetEnabledSources(get(), get()) }
  125. addFactory { GetLanguagesWithSources(get(), get()) }
  126. addFactory { GetRemoteManga(get()) }
  127. addFactory { GetSourcesWithFavoriteCount(get(), get()) }
  128. addFactory { GetSourcesWithNonLibraryManga(get()) }
  129. addFactory { SetMigrateSorting(get()) }
  130. addFactory { ToggleLanguage(get()) }
  131. addFactory { ToggleSource(get()) }
  132. addFactory { ToggleSourcePin(get()) }
  133. }
  134. }