diff --git a/app/src/main/java/com/quran/labs/androidquran/QuranApplication.kt b/app/src/main/java/com/quran/labs/androidquran/QuranApplication.kt index 4fea84f191..c3fb985be0 100644 --- a/app/src/main/java/com/quran/labs/androidquran/QuranApplication.kt +++ b/app/src/main/java/com/quran/labs/androidquran/QuranApplication.kt @@ -8,7 +8,6 @@ import androidx.work.WorkManager import com.quran.labs.androidquran.core.worker.QuranWorkerFactory import com.quran.labs.androidquran.di.component.application.ApplicationComponent import com.quran.labs.androidquran.di.component.application.DaggerApplicationComponent -import com.quran.labs.androidquran.di.module.application.ApplicationModule import com.quran.labs.androidquran.util.QuranSettings import com.quran.labs.androidquran.util.RecordingLogTree import com.quran.labs.androidquran.widget.BookmarksWidgetSubscriber @@ -42,9 +41,8 @@ open class QuranApplication : Application(), QuranApplicationComponentProvider { } open fun initializeInjector(): ApplicationComponent { - return DaggerApplicationComponent.builder() - .applicationModule(ApplicationModule(this)) - .build() + return DaggerApplicationComponent.factory() + .generate(this) } open fun initializeWorkManager() { diff --git a/app/src/main/java/com/quran/labs/androidquran/data/AyahInfoDatabaseProvider.kt b/app/src/main/java/com/quran/labs/androidquran/data/AyahInfoDatabaseProvider.kt index 3b269de87f..30aa919a83 100644 --- a/app/src/main/java/com/quran/labs/androidquran/data/AyahInfoDatabaseProvider.kt +++ b/app/src/main/java/com/quran/labs/androidquran/data/AyahInfoDatabaseProvider.kt @@ -3,11 +3,12 @@ package com.quran.labs.androidquran.data import android.content.Context import com.quran.data.di.ActivityScope import com.quran.labs.androidquran.util.QuranFileUtils +import com.quran.mobile.di.qualifier.ApplicationContext import javax.inject.Inject @ActivityScope class AyahInfoDatabaseProvider @Inject constructor( - private val context: Context, + @ApplicationContext private val context: Context, private val widthParameter: String, private val quranFileUtils: QuranFileUtils ) { diff --git a/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBAdapter.kt b/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBAdapter.kt index 38924fbd5f..7f02559cda 100644 --- a/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBAdapter.kt +++ b/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBAdapter.kt @@ -5,23 +5,20 @@ import android.content.Context import android.database.Cursor import android.database.sqlite.SQLiteDatabase import android.util.SparseArray - +import androidx.annotation.WorkerThread import com.quran.labs.androidquran.common.LocalTranslation import com.quran.labs.androidquran.dao.translation.TranslationItem import com.quran.labs.androidquran.database.TranslationsDBHelper.TranslationsTable import com.quran.labs.androidquran.util.QuranFileUtils - -import java.util.ArrayList -import java.util.Collections +import com.quran.mobile.di.qualifier.ApplicationContext import timber.log.Timber - -import androidx.annotation.WorkerThread +import java.util.Collections import javax.inject.Inject import javax.inject.Singleton @Singleton class TranslationsDBAdapter @Inject constructor( - private val context: Context, + @ApplicationContext private val context: Context, adapter: TranslationsDBHelper, private val quranFileUtils: QuranFileUtils ) { diff --git a/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBHelper.kt b/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBHelper.kt index 9f6fa816df..89dc574b4d 100644 --- a/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBHelper.kt +++ b/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBHelper.kt @@ -3,11 +3,12 @@ package com.quran.labs.androidquran.database import android.content.Context import android.database.sqlite.SQLiteDatabase import android.database.sqlite.SQLiteOpenHelper +import com.quran.mobile.di.qualifier.ApplicationContext import javax.inject.Inject import javax.inject.Singleton @Singleton -class TranslationsDBHelper @Inject constructor(context: Context) : +class TranslationsDBHelper @Inject constructor(@ApplicationContext context: Context) : SQLiteOpenHelper(context, DB_NAME, null, DB_VERSION) { companion object { diff --git a/app/src/main/java/com/quran/labs/androidquran/di/component/activity/PagerActivityComponent.kt b/app/src/main/java/com/quran/labs/androidquran/di/component/activity/PagerActivityComponent.kt index 819648b638..ae983f4bab 100644 --- a/app/src/main/java/com/quran/labs/androidquran/di/component/activity/PagerActivityComponent.kt +++ b/app/src/main/java/com/quran/labs/androidquran/di/component/activity/PagerActivityComponent.kt @@ -1,24 +1,28 @@ package com.quran.labs.androidquran.di.component.activity -import com.quran.data.di.QuranReadingScope +import android.content.Context import com.quran.data.di.ActivityScope +import com.quran.data.di.QuranReadingScope import com.quran.labs.androidquran.di.component.fragment.QuranPageComponent import com.quran.labs.androidquran.di.module.activity.PagerActivityModule import com.quran.labs.androidquran.ui.PagerActivity import com.quran.labs.androidquran.ui.fragment.AyahPlaybackFragment import com.quran.labs.androidquran.ui.fragment.AyahTranslationFragment import com.quran.labs.androidquran.ui.fragment.TagBookmarkFragment -import com.quran.page.common.toolbar.AyahToolBar +import com.quran.labs.androidquran.ui.helpers.AyahSelectedListener import com.quran.mobile.di.QuranReadingActivityComponent +import com.quran.mobile.di.qualifier.ActivityContext import com.quran.mobile.feature.qarilist.QariListWrapper +import com.quran.page.common.toolbar.AyahToolBar import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.BindsInstance import dagger.Subcomponent @ActivityScope @MergeSubcomponent(QuranReadingScope::class, modules = [PagerActivityModule::class]) interface PagerActivityComponent : QuranReadingActivityComponent { // subcomponents - fun quranPageComponentBuilder(): QuranPageComponent.Builder + fun quranPageComponentFactory(): QuranPageComponent.Factory fun inject(pagerActivity: PagerActivity) fun inject(ayahToolBar: AyahToolBar) @@ -29,9 +33,11 @@ interface PagerActivityComponent : QuranReadingActivityComponent { fun inject(qariListWrapper: QariListWrapper) - @Subcomponent.Builder - interface Builder { - fun withPagerActivityModule(pagerModule: PagerActivityModule): Builder - fun build(): PagerActivityComponent + @Subcomponent.Factory + interface Factory { + fun generate( + @BindsInstance @ActivityContext context: Context, + @BindsInstance ayahSelectedListener: AyahSelectedListener + ): PagerActivityComponent } } diff --git a/app/src/main/java/com/quran/labs/androidquran/di/component/activity/QuranActivityComponent.kt b/app/src/main/java/com/quran/labs/androidquran/di/component/activity/QuranActivityComponent.kt index f15c176504..d78ed394c7 100644 --- a/app/src/main/java/com/quran/labs/androidquran/di/component/activity/QuranActivityComponent.kt +++ b/app/src/main/java/com/quran/labs/androidquran/di/component/activity/QuranActivityComponent.kt @@ -8,8 +8,8 @@ import dagger.Subcomponent interface QuranActivityComponent { fun inject(quranActivity: QuranActivity) - @Subcomponent.Builder - interface Builder { - fun build(): QuranActivityComponent + @Subcomponent.Factory + interface Factory { + fun generate(): QuranActivityComponent } } diff --git a/app/src/main/java/com/quran/labs/androidquran/di/component/application/ApplicationComponent.kt b/app/src/main/java/com/quran/labs/androidquran/di/component/application/ApplicationComponent.kt index 24726377a5..ca4c740045 100644 --- a/app/src/main/java/com/quran/labs/androidquran/di/component/application/ApplicationComponent.kt +++ b/app/src/main/java/com/quran/labs/androidquran/di/component/application/ApplicationComponent.kt @@ -1,5 +1,6 @@ package com.quran.labs.androidquran.di.component.application +import android.content.Context import com.quran.analytics.provider.AnalyticsModule import com.quran.common.networking.NetworkModule import com.quran.data.di.AppScope @@ -33,7 +34,10 @@ import com.quran.labs.androidquran.widget.BookmarksWidget import com.quran.labs.androidquran.widget.BookmarksWidgetListProvider import com.quran.labs.androidquran.widget.ShowJumpFragmentActivity import com.quran.mobile.di.QuranApplicationComponent +import com.quran.mobile.di.qualifier.ApplicationContext import com.squareup.anvil.annotations.MergeComponent +import dagger.BindsInstance +import dagger.Component import javax.inject.Singleton @Singleton @@ -52,8 +56,8 @@ import javax.inject.Singleton ) interface ApplicationComponent: QuranApplicationComponent { // subcomponents - fun pagerActivityComponentBuilder(): PagerActivityComponent.Builder - fun quranActivityComponentBuilder(): QuranActivityComponent.Builder + fun pagerActivityComponentFactory(): PagerActivityComponent.Factory + fun quranActivityComponentFactory(): QuranActivityComponent.Factory // application fun inject(quranApplication: QuranApplication) @@ -89,4 +93,9 @@ interface ApplicationComponent: QuranApplicationComponent { // widgets fun inject(bookmarksWidgetListProvider: BookmarksWidgetListProvider) fun inject(bookmarksWidget: BookmarksWidget) + + @Component.Factory + interface Factory { + fun generate(@BindsInstance @ApplicationContext appContext: Context): ApplicationComponent + } } diff --git a/app/src/main/java/com/quran/labs/androidquran/di/component/fragment/QuranPageComponent.kt b/app/src/main/java/com/quran/labs/androidquran/di/component/fragment/QuranPageComponent.kt index 3332566703..e866e5c97a 100644 --- a/app/src/main/java/com/quran/labs/androidquran/di/component/fragment/QuranPageComponent.kt +++ b/app/src/main/java/com/quran/labs/androidquran/di/component/fragment/QuranPageComponent.kt @@ -2,24 +2,23 @@ package com.quran.labs.androidquran.di.component.fragment import com.quran.data.di.QuranPageScope import com.quran.data.di.QuranReadingPageScope -import com.quran.labs.androidquran.di.module.fragment.QuranPageModule import com.quran.labs.androidquran.ui.fragment.QuranPageFragment import com.quran.labs.androidquran.ui.fragment.TabletFragment import com.quran.labs.androidquran.ui.fragment.TranslationFragment import com.quran.mobile.di.QuranReadingPageComponent import com.squareup.anvil.annotations.MergeSubcomponent +import dagger.BindsInstance import dagger.Subcomponent @QuranPageScope -@MergeSubcomponent(QuranReadingPageScope::class, modules = [QuranPageModule::class]) +@MergeSubcomponent(QuranReadingPageScope::class) interface QuranPageComponent: QuranReadingPageComponent { fun inject(quranPageFragment: QuranPageFragment) fun inject(tabletFragment: TabletFragment) fun inject(translationFragment: TranslationFragment) - @Subcomponent.Builder - interface Builder { - fun withQuranPageModule(quranPageModule: QuranPageModule): Builder - fun build(): QuranPageComponent + @Subcomponent.Factory + interface Factory { + fun generate(@BindsInstance pages: IntArray): QuranPageComponent } } diff --git a/app/src/main/java/com/quran/labs/androidquran/di/module/activity/PagerActivityModule.kt b/app/src/main/java/com/quran/labs/androidquran/di/module/activity/PagerActivityModule.kt index a3bc1ec752..8f351532ca 100644 --- a/app/src/main/java/com/quran/labs/androidquran/di/module/activity/PagerActivityModule.kt +++ b/app/src/main/java/com/quran/labs/androidquran/di/module/activity/PagerActivityModule.kt @@ -1,40 +1,36 @@ package com.quran.labs.androidquran.di.module.activity +import android.content.Context import com.quran.data.core.QuranInfo import com.quran.data.core.QuranPageInfo import com.quran.data.di.ActivityScope import com.quran.labs.androidquran.data.QuranDisplayData -import com.quran.labs.androidquran.ui.PagerActivity -import com.quran.labs.androidquran.ui.helpers.AyahSelectedListener import com.quran.labs.androidquran.util.QuranPageInfoImpl import com.quran.labs.androidquran.util.QuranScreenInfo import com.quran.labs.androidquran.util.QuranUtils import com.quran.labs.androidquran.util.TranslationUtil import com.quran.mobile.di.AyahActionFragmentProvider +import com.quran.mobile.di.qualifier.ActivityContext import dagger.Module import dagger.Provides import dagger.multibindings.ElementsIntoSet @Module -class PagerActivityModule(private val pagerActivity: PagerActivity) { - - @Provides - fun provideAyahSelectedListener(): AyahSelectedListener { - return pagerActivity - } +object PagerActivityModule { @Provides fun provideQuranPageInfo( + @ActivityContext context: Context, quranInfo: QuranInfo, quranDisplayData: QuranDisplayData ): QuranPageInfo { - return QuranPageInfoImpl(pagerActivity, quranInfo, quranDisplayData) + return QuranPageInfoImpl(context, quranInfo, quranDisplayData) } @Provides @ActivityScope - fun provideImageWidth(screenInfo: QuranScreenInfo): String { - return if (QuranUtils.isDualPages(pagerActivity, screenInfo)) { + fun provideImageWidth(@ActivityContext context: Context, screenInfo: QuranScreenInfo): String { + return if (QuranUtils.isDualPages(context, screenInfo)) { screenInfo.tabletWidthParam } else { screenInfo.widthParam diff --git a/app/src/main/java/com/quran/labs/androidquran/di/module/application/ApplicationModule.kt b/app/src/main/java/com/quran/labs/androidquran/di/module/application/ApplicationModule.kt index 97f5c0b785..03feb4eaed 100644 --- a/app/src/main/java/com/quran/labs/androidquran/di/module/application/ApplicationModule.kt +++ b/app/src/main/java/com/quran/labs/androidquran/di/module/application/ApplicationModule.kt @@ -1,6 +1,5 @@ package com.quran.labs.androidquran.di.module.application -import android.app.Application import android.content.Context import android.graphics.Point import android.view.Display @@ -15,6 +14,7 @@ import com.quran.labs.androidquran.data.QuranFileConstants import com.quran.labs.androidquran.util.QuranFileUtils import com.quran.labs.androidquran.util.QuranSettings import com.quran.labs.androidquran.util.SettingsImpl +import com.quran.mobile.di.qualifier.ApplicationContext import com.quran.mobile.di.ExtraPreferencesProvider import com.quran.mobile.di.ExtraScreenProvider import dagger.Module @@ -28,15 +28,10 @@ import javax.inject.Named import javax.inject.Singleton @Module -class ApplicationModule(private val application: Application) { +object ApplicationModule { @Provides - fun provideApplicationContext(): Context { - return application - } - - @Provides - fun provideDisplay(appContext: Context): Display { + fun provideDisplay(@ApplicationContext appContext: Context): Display { val w = appContext.getSystemService(Context.WINDOW_SERVICE) as WindowManager return w.defaultDisplay } @@ -58,8 +53,8 @@ class ApplicationModule(private val application: Application) { @Provides @Singleton - fun provideQuranSettings(): QuranSettings { - return QuranSettings.getInstance(application) + fun provideQuranSettings(@ApplicationContext appContext: Context): QuranSettings { + return QuranSettings.getInstance(appContext) } @Provides @@ -94,8 +89,8 @@ class ApplicationModule(private val application: Application) { } @Provides - fun provideCacheDirectory(): File { - return application.cacheDir + fun provideCacheDirectory(@ApplicationContext appContext: Context): File { + return appContext.cacheDir } @Provides diff --git a/app/src/main/java/com/quran/labs/androidquran/di/module/fragment/QuranPageModule.kt b/app/src/main/java/com/quran/labs/androidquran/di/module/fragment/QuranPageModule.kt deleted file mode 100644 index 5a380bda66..0000000000 --- a/app/src/main/java/com/quran/labs/androidquran/di/module/fragment/QuranPageModule.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.quran.labs.androidquran.di.module.fragment - -import dagger.Module -import dagger.Provides - -@Module -class QuranPageModule(private vararg val pages: Int) { - - @Provides - fun providePages(): IntArray { - return pages - } -} diff --git a/app/src/main/java/com/quran/labs/androidquran/model/bookmark/BookmarkImportExportModel.java b/app/src/main/java/com/quran/labs/androidquran/model/bookmark/BookmarkImportExportModel.java index c1f491e4e7..9c898b5f2f 100644 --- a/app/src/main/java/com/quran/labs/androidquran/model/bookmark/BookmarkImportExportModel.java +++ b/app/src/main/java/com/quran/labs/androidquran/model/bookmark/BookmarkImportExportModel.java @@ -9,6 +9,7 @@ import com.quran.data.model.bookmark.BookmarkData; import com.quran.labs.androidquran.R; import com.quran.labs.androidquran.database.BookmarksDBAdapter; +import com.quran.mobile.di.qualifier.ApplicationContext; import java.io.File; import java.io.IOException; @@ -30,7 +31,7 @@ public class BookmarkImportExportModel { private final BookmarkModel bookmarkModel; @Inject - BookmarkImportExportModel(Context appContext, + BookmarkImportExportModel(@ApplicationContext Context appContext, BookmarkJsonModel model, BookmarkModel bookmarkModel) { this.appContext = appContext; this.jsonModel = model; diff --git a/app/src/main/java/com/quran/labs/androidquran/model/translation/ArabicDatabaseUtils.java b/app/src/main/java/com/quran/labs/androidquran/model/translation/ArabicDatabaseUtils.java index 54937c461a..dd9a408f97 100644 --- a/app/src/main/java/com/quran/labs/androidquran/model/translation/ArabicDatabaseUtils.java +++ b/app/src/main/java/com/quran/labs/androidquran/model/translation/ArabicDatabaseUtils.java @@ -3,15 +3,19 @@ import android.content.Context; import android.database.Cursor; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; + import com.quran.data.core.QuranInfo; import com.quran.data.model.QuranText; +import com.quran.data.model.SuraAyah; import com.quran.data.model.bookmark.Bookmark; import com.quran.labs.androidquran.data.QuranDataProvider; import com.quran.labs.androidquran.data.QuranFileConstants; -import com.quran.data.model.SuraAyah; import com.quran.labs.androidquran.database.DatabaseHandler; import com.quran.labs.androidquran.database.DatabaseUtils; import com.quran.labs.androidquran.util.QuranFileUtils; +import com.quran.mobile.di.qualifier.ApplicationContext; import java.util.ArrayList; import java.util.HashMap; @@ -21,8 +25,6 @@ import javax.inject.Inject; import javax.inject.Singleton; -import androidx.annotation.NonNull; -import androidx.annotation.VisibleForTesting; import io.reactivex.rxjava3.core.Single; import io.reactivex.rxjava3.schedulers.Schedulers; @@ -39,7 +41,7 @@ public class ArabicDatabaseUtils { private DatabaseHandler arabicDatabaseHandler; @Inject - ArabicDatabaseUtils(Context context, QuranInfo quranInfo, QuranFileUtils quranFileUtils) { + ArabicDatabaseUtils(@ApplicationContext Context context, QuranInfo quranInfo, QuranFileUtils quranFileUtils) { this.appContext = context; this.quranInfo = quranInfo; arabicDatabaseHandler = getArabicDatabaseHandler(); diff --git a/app/src/main/java/com/quran/labs/androidquran/model/translation/TranslationModel.kt b/app/src/main/java/com/quran/labs/androidquran/model/translation/TranslationModel.kt index 36f99e9757..12eb6cdca6 100644 --- a/app/src/main/java/com/quran/labs/androidquran/model/translation/TranslationModel.kt +++ b/app/src/main/java/com/quran/labs/androidquran/model/translation/TranslationModel.kt @@ -1,20 +1,21 @@ package com.quran.labs.androidquran.model.translation import android.content.Context +import com.quran.data.di.ActivityScope import com.quran.data.model.QuranText import com.quran.data.model.VerseRange import com.quran.data.pageinfo.mapper.AyahMapper import com.quran.labs.androidquran.data.QuranDataProvider import com.quran.labs.androidquran.database.DatabaseHandler import com.quran.labs.androidquran.database.DatabaseHandler.TextType -import com.quran.data.di.ActivityScope import com.quran.labs.androidquran.util.QuranFileUtils +import com.quran.mobile.di.qualifier.ApplicationContext import io.reactivex.rxjava3.core.Single import javax.inject.Inject @ActivityScope class TranslationModel @Inject internal constructor( - private val appContext: Context, + @ApplicationContext private val appContext: Context, private val quranFileUtils: QuranFileUtils, private val ayahMapper: AyahMapper ) { diff --git a/app/src/main/java/com/quran/labs/androidquran/presenter/QuranImportPresenter.java b/app/src/main/java/com/quran/labs/androidquran/presenter/QuranImportPresenter.java index 6ee2595f31..72cd13a8f9 100644 --- a/app/src/main/java/com/quran/labs/androidquran/presenter/QuranImportPresenter.java +++ b/app/src/main/java/com/quran/labs/androidquran/presenter/QuranImportPresenter.java @@ -6,16 +6,18 @@ import android.content.pm.PackageManager; import android.net.Uri; import android.os.ParcelFileDescriptor; + import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import androidx.core.app.ActivityCompat; -import com.quran.labs.androidquran.QuranImportActivity; import com.quran.data.model.bookmark.BookmarkData; +import com.quran.labs.androidquran.QuranImportActivity; import com.quran.labs.androidquran.model.bookmark.BookmarkImportExportModel; import com.quran.labs.androidquran.model.bookmark.BookmarkModel; import com.quran.labs.androidquran.service.util.PermissionUtil; import com.quran.labs.androidquran.util.QuranSettings; +import com.quran.mobile.di.qualifier.ApplicationContext; import java.io.FileDescriptor; import java.io.FileInputStream; @@ -24,9 +26,9 @@ import javax.inject.Inject; import javax.inject.Singleton; +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; import io.reactivex.rxjava3.core.Maybe; import io.reactivex.rxjava3.core.Observable; -import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; import io.reactivex.rxjava3.disposables.CompositeDisposable; import io.reactivex.rxjava3.observers.DisposableMaybeObserver; import io.reactivex.rxjava3.schedulers.Schedulers; @@ -48,7 +50,7 @@ public class QuranImportPresenter implements Presenter { private QuranImportActivity mCurrentActivity; @Inject - QuranImportPresenter(Context appContext, + QuranImportPresenter(@ApplicationContext Context appContext, BookmarkImportExportModel model, BookmarkModel bookmarkModel) { mAppContext = appContext; diff --git a/app/src/main/java/com/quran/labs/androidquran/presenter/bookmark/BookmarkPresenter.java b/app/src/main/java/com/quran/labs/androidquran/presenter/bookmark/BookmarkPresenter.java index 695f742398..847623b12f 100644 --- a/app/src/main/java/com/quran/labs/androidquran/presenter/bookmark/BookmarkPresenter.java +++ b/app/src/main/java/com/quran/labs/androidquran/presenter/bookmark/BookmarkPresenter.java @@ -13,7 +13,6 @@ import com.quran.data.model.bookmark.RecentPage; import com.quran.data.model.bookmark.Tag; import com.quran.labs.androidquran.dao.bookmark.BookmarkResult; -import com.quran.labs.androidquran.data.Constants; import com.quran.labs.androidquran.model.bookmark.BookmarkModel; import com.quran.labs.androidquran.model.translation.ArabicDatabaseUtils; import com.quran.labs.androidquran.presenter.Presenter; @@ -22,6 +21,7 @@ import com.quran.labs.androidquran.ui.helpers.QuranRowFactory; import com.quran.labs.androidquran.util.QuranSettings; import com.quran.labs.androidquran.util.QuranUtils; +import com.quran.mobile.di.qualifier.ApplicationContext; import java.util.ArrayList; import java.util.HashMap; @@ -64,7 +64,7 @@ public class BookmarkPresenter implements Presenter { @Inject - BookmarkPresenter(Context appContext, + BookmarkPresenter(@ApplicationContext Context appContext, BookmarkModel bookmarkModel, QuranSettings quranSettings, ArabicDatabaseUtils arabicDatabaseUtils, diff --git a/app/src/main/java/com/quran/labs/androidquran/presenter/data/QuranDataPresenter.kt b/app/src/main/java/com/quran/labs/androidquran/presenter/data/QuranDataPresenter.kt index d7010cba3d..3e4588807d 100644 --- a/app/src/main/java/com/quran/labs/androidquran/presenter/data/QuranDataPresenter.kt +++ b/app/src/main/java/com/quran/labs/androidquran/presenter/data/QuranDataPresenter.kt @@ -11,11 +11,11 @@ import androidx.work.OneTimeWorkRequestBuilder import androidx.work.PeriodicWorkRequestBuilder import androidx.work.WorkManager import androidx.work.workDataOf +import com.quran.common.upgrade.LocalDataUpgrade import com.quran.data.core.QuranInfo import com.quran.data.model.QuranDataStatus -import com.quran.data.source.PageProvider -import com.quran.common.upgrade.LocalDataUpgrade import com.quran.data.source.PageContentType +import com.quran.data.source.PageProvider import com.quran.labs.androidquran.QuranDataActivity import com.quran.labs.androidquran.data.Constants import com.quran.labs.androidquran.presenter.Presenter @@ -26,9 +26,10 @@ import com.quran.labs.androidquran.worker.AudioUpdateWorker import com.quran.labs.androidquran.worker.MissingPageDownloadWorker import com.quran.labs.androidquran.worker.PartialPageCheckingWorker import com.quran.labs.androidquran.worker.WorkerConstants +import com.quran.mobile.di.qualifier.ApplicationContext +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Single -import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.disposables.Disposable import io.reactivex.rxjava3.functions.Consumer import io.reactivex.rxjava3.schedulers.Schedulers @@ -38,12 +39,12 @@ import java.util.concurrent.TimeUnit.DAYS import javax.inject.Inject class QuranDataPresenter @Inject internal constructor( - val appContext: Context, - val quranInfo: QuranInfo, - val quranScreenInfo: QuranScreenInfo, - private val quranPageProvider: PageProvider, - val quranFileUtils: QuranFileUtils, - private val localDataUpgrade: LocalDataUpgrade + @ApplicationContext val appContext: Context, + val quranInfo: QuranInfo, + val quranScreenInfo: QuranScreenInfo, + private val quranPageProvider: PageProvider, + val quranFileUtils: QuranFileUtils, + private val localDataUpgrade: LocalDataUpgrade ) : Presenter { private var activity: QuranDataActivity? = null diff --git a/app/src/main/java/com/quran/labs/androidquran/presenter/translation/TranslationManagerPresenter.java b/app/src/main/java/com/quran/labs/androidquran/presenter/translation/TranslationManagerPresenter.java index b7b9778b11..74e16c69be 100644 --- a/app/src/main/java/com/quran/labs/androidquran/presenter/translation/TranslationManagerPresenter.java +++ b/app/src/main/java/com/quran/labs/androidquran/presenter/translation/TranslationManagerPresenter.java @@ -18,6 +18,7 @@ import com.quran.labs.androidquran.ui.TranslationManagerActivity; import com.quran.labs.androidquran.util.QuranFileUtils; import com.quran.labs.androidquran.util.QuranSettings; +import com.quran.mobile.di.qualifier.ApplicationContext; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; @@ -57,7 +58,7 @@ public class TranslationManagerPresenter implements Presenter