From a451c64a844efee98d53e242be92f4ab95da4f97 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 23 Nov 2022 20:43:15 +0100 Subject: [PATCH] move ProfileStore --- .../info/nightscout/androidaps/MainApp.kt | 6 +- .../activities/MyPreferenceFragment.kt | 2 +- .../activities/SingleFragmentActivity.kt | 2 +- .../nightscout/androidaps/di/AppModule.kt | 2 - .../configBuilder/ConfigBuilderPlugin.kt | 3 +- .../implementation/TranslatorImpl.kt | 4 +- .../implementation/UserEntryLoggerImpl.kt | 4 +- .../implementation/di/ImplementationModule.kt | 114 +++--------------- .../maintenance/PrefFileListProviderImpl.kt | 4 +- .../implementation/plugin}/PluginStore.kt | 7 +- .../implementation/profiling/ProfilerImpl.kt | 4 +- .../protection/PasswordCheckImpl.kt | 4 +- .../protection/ProtectionCheckImpl.kt | 4 +- .../pump/eopatch/ui/AlarmHelperActivity.kt | 2 +- .../pump/eopatch/ui/DialogHelperActivity.kt | 2 +- .../plugins/pump/eopatch/ui/EoBaseActivity.kt | 2 +- .../pump/eopatch/ui/dialogs/AlarmDialog.kt | 4 +- 17 files changed, 45 insertions(+), 125 deletions(-) rename {app/src/main/java/info/nightscout/androidaps/plugins/configBuilder => implementation/src/main/java/info/nightscout/implementation/plugin}/PluginStore.kt (97%) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.kt b/app/src/main/java/info/nightscout/androidaps/MainApp.kt index 68c17ce3b6..202c36e034 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.kt @@ -16,14 +16,13 @@ import androidx.work.WorkManager import dagger.android.AndroidInjector import dagger.android.DaggerApplication import info.nightscout.androidaps.di.DaggerAppComponent -import info.nightscout.interfaces.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.configBuilder.PluginStore import info.nightscout.androidaps.receivers.BTReceiver import info.nightscout.androidaps.receivers.ChargingStateReceiver import info.nightscout.androidaps.receivers.KeepAliveWorker import info.nightscout.androidaps.receivers.TimeDateOrTZChangeReceiver import info.nightscout.androidaps.services.AlarmSoundServiceHelper import info.nightscout.androidaps.utils.ProcessLifecycleListener +import info.nightscout.core.ui.locale.LocaleHelper import info.nightscout.core.utils.receivers.NetworkChangeReceiver import info.nightscout.core.versionChecker.VersionCheckerUtils import info.nightscout.database.entities.TherapyEvent @@ -32,10 +31,11 @@ import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction import info.nightscout.database.impl.transactions.VersionChangeTransaction import info.nightscout.implementation.db.CompatDBHelper +import info.nightscout.implementation.plugin.PluginStore import info.nightscout.interfaces.Config import info.nightscout.interfaces.ConfigBuilder import info.nightscout.interfaces.LocalAlertUtils -import info.nightscout.core.ui.locale.LocaleHelper +import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.plugins.general.overview.notifications.NotificationStore diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt index bccf6d878b..1c85f0a5ef 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -23,7 +23,6 @@ import info.nightscout.androidaps.danar.DanaRPlugin import info.nightscout.androidaps.danars.DanaRSPlugin import info.nightscout.androidaps.diaconn.DiaconnG8Plugin import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin -import info.nightscout.androidaps.plugins.configBuilder.PluginStore import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin import info.nightscout.androidaps.plugins.general.wear.WearPlugin import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin @@ -33,6 +32,7 @@ import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin import info.nightscout.automation.AutomationPlugin import info.nightscout.core.ui.dialogs.OKDialog +import info.nightscout.implementation.plugin.PluginStore import info.nightscout.interfaces.Config import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.profile.Profile diff --git a/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt index 3723e14b88..713a61f135 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt @@ -6,9 +6,9 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import info.nightscout.androidaps.R -import info.nightscout.androidaps.plugins.configBuilder.PluginStore import info.nightscout.core.activities.DaggerAppCompatActivityWithResult import info.nightscout.core.ui.locale.LocaleHelper +import info.nightscout.implementation.plugin.PluginStore import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.protection.ProtectionCheck import javax.inject.Inject diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt index 9a60b1a3ed..f9bb1b017b 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt @@ -10,7 +10,6 @@ import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.implementations.ActivityNamesImpl import info.nightscout.androidaps.implementations.ConfigImpl import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin -import info.nightscout.androidaps.plugins.configBuilder.PluginStore import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImpl import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin @@ -98,7 +97,6 @@ open class AppModule { @Binds fun bindContext(mainApp: MainApp): Context @Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector - @Binds fun bindActivePlugin(pluginStore: PluginStore): ActivePlugin @Binds fun bindConfigInterface(config: ConfigImpl): Config @Binds fun bindConfigBuilderInterface(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilder diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt index 55dadc5d02..7a22b12675 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.kt @@ -3,16 +3,17 @@ package info.nightscout.androidaps.plugins.configBuilder import androidx.fragment.app.FragmentActivity import dagger.android.HasAndroidInjector import info.nightscout.androidaps.R -import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.ValueWithUnit +import info.nightscout.implementation.plugin.PluginStore import info.nightscout.interfaces.ConfigBuilder import info.nightscout.interfaces.aps.APS import info.nightscout.interfaces.aps.Sensitivity import info.nightscout.interfaces.insulin.Insulin +import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginDescription diff --git a/implementation/src/main/java/info/nightscout/implementation/TranslatorImpl.kt b/implementation/src/main/java/info/nightscout/implementation/TranslatorImpl.kt index f8026b8b7a..1d98a5c24a 100644 --- a/implementation/src/main/java/info/nightscout/implementation/TranslatorImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/TranslatorImpl.kt @@ -1,5 +1,6 @@ package info.nightscout.implementation +import dagger.Reusable import info.nightscout.core.main.R import info.nightscout.database.entities.OfflineEvent import info.nightscout.database.entities.TemporaryTarget @@ -10,9 +11,8 @@ import info.nightscout.database.entities.ValueWithUnit import info.nightscout.interfaces.Translator import info.nightscout.shared.interfaces.ResourceHelper import javax.inject.Inject -import javax.inject.Singleton -@Singleton +@Reusable class TranslatorImpl @Inject internal constructor( private val rh: ResourceHelper ) : Translator { diff --git a/implementation/src/main/java/info/nightscout/implementation/UserEntryLoggerImpl.kt b/implementation/src/main/java/info/nightscout/implementation/UserEntryLoggerImpl.kt index 3b0990909f..97730d0da9 100644 --- a/implementation/src/main/java/info/nightscout/implementation/UserEntryLoggerImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/UserEntryLoggerImpl.kt @@ -1,5 +1,6 @@ package info.nightscout.implementation +import dagger.Reusable import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.UserEntry.Action @@ -16,10 +17,9 @@ import info.nightscout.shared.utils.DateUtil import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.kotlin.plusAssign import javax.inject.Inject -import javax.inject.Singleton @OpenForTesting -@Singleton +@Reusable class UserEntryLoggerImpl @Inject constructor( private val aapsLogger: AAPSLogger, private val repository: AppRepository, diff --git a/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt b/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt index 3db7c845ce..99768edd2c 100644 --- a/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt +++ b/implementation/src/main/java/info/nightscout/implementation/di/ImplementationModule.kt @@ -1,17 +1,8 @@ package info.nightscout.implementation.di -import android.content.Context import dagger.Binds -import dagger.Lazy import dagger.Module -import dagger.Provides -import dagger.Reusable -import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat import info.nightscout.core.graph.OverviewData -import info.nightscout.core.utils.CryptoUtil -import info.nightscout.core.utils.fabric.FabricPrivacy -import info.nightscout.core.versionChecker.VersionCheckerUtils -import info.nightscout.database.impl.AppRepository import info.nightscout.implementation.AndroidPermissionImpl import info.nightscout.implementation.BolusTimerImpl import info.nightscout.implementation.CarbTimerImpl @@ -26,6 +17,7 @@ import info.nightscout.implementation.androidNotification.NotificationHolderImpl import info.nightscout.implementation.logging.LoggerUtilsImpl import info.nightscout.implementation.maintenance.PrefFileListProviderImpl import info.nightscout.implementation.overview.OverviewDataImpl +import info.nightscout.implementation.plugin.PluginStore import info.nightscout.implementation.profiling.ProfilerImpl import info.nightscout.implementation.protection.PasswordCheckImpl import info.nightscout.implementation.protection.ProtectionCheckImpl @@ -42,7 +34,6 @@ import info.nightscout.implementation.stats.TirCalculatorImpl import info.nightscout.interfaces.AndroidPermission import info.nightscout.interfaces.BolusTimer import info.nightscout.interfaces.CarbTimer -import info.nightscout.interfaces.Config import info.nightscout.interfaces.LocalAlertUtils import info.nightscout.interfaces.NotificationHolder import info.nightscout.interfaces.Translator @@ -52,7 +43,6 @@ import info.nightscout.interfaces.logging.UserEntryLogger import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.profile.DefaultValueHelper -import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profiling.Profiler import info.nightscout.interfaces.protection.PasswordCheck import info.nightscout.interfaces.protection.ProtectionCheck @@ -64,17 +54,10 @@ import info.nightscout.interfaces.queue.CommandQueue import info.nightscout.interfaces.stats.DexcomTirCalculator import info.nightscout.interfaces.stats.TddCalculator import info.nightscout.interfaces.stats.TirCalculator -import info.nightscout.interfaces.storage.Storage import info.nightscout.interfaces.ui.IconsProvider import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.TrendCalculator -import info.nightscout.rx.AapsSchedulers -import info.nightscout.rx.bus.RxBus -import info.nightscout.rx.logging.AAPSLogger import info.nightscout.shared.interfaces.ResourceHelper -import info.nightscout.shared.sharedPreferences.SP -import info.nightscout.shared.utils.DateUtil -import javax.inject.Singleton @Module( includes = [ @@ -85,87 +68,24 @@ import javax.inject.Singleton @Suppress("unused") open class ImplementationModule { - @Provides - @Singleton - fun provideResources(context: Context, fabricPrivacy: FabricPrivacy): ResourceHelper = - ResourceHelperImpl(context, fabricPrivacy) - - @Provides - @Singleton - fun provideHardLimits(aapsLogger: AAPSLogger, rxBus: RxBus, sp: SP, rh: ResourceHelper, context: Context, repository: AppRepository): HardLimits = - HardLimitsImpl(aapsLogger, rxBus, sp, rh, context, repository) - - @Provides - @Singleton - fun provideWarnColors(rh: ResourceHelper): WarnColors = WarnColorsImpl(rh) - - @Provides - @Reusable - fun provideProfiler(aapsLogger: AAPSLogger): Profiler = ProfilerImpl(aapsLogger) - - @Provides - @Singleton - fun provideLoggerUtils(prefFileListProvider: PrefFileListProvider): LoggerUtils = LoggerUtilsImpl(prefFileListProvider) - - @Provides - @Reusable - fun providePasswordCheck(sp: SP, cryptoUtil: CryptoUtil): PasswordCheck = PasswordCheckImpl(sp, cryptoUtil) - - @Provides - @Reusable - fun provideProtectionCheck(sp: SP, passwordCheck: PasswordCheck, dateUtil: DateUtil): ProtectionCheck = ProtectionCheckImpl(sp, passwordCheck, dateUtil) - - @Provides - @Reusable - fun provideDefaultValueHelper(sp: SP, profileFunction: ProfileFunction): DefaultValueHelper = DefaultValueHelperImpl(sp, profileFunction) - - @Provides - @Reusable - fun provideTranslator(rh: ResourceHelper): Translator = TranslatorImpl(rh) - - @Provides - @Singleton - fun provideTemporaryBasalStorage(aapsLogger: AAPSLogger): TemporaryBasalStorage = TemporaryBasalStorageImpl(aapsLogger) - - @Provides - @Singleton - fun provideDetailedBolusInfoStorage(aapsLogger: AAPSLogger): DetailedBolusInfoStorage = DetailedBolusInfoStorageImpl(aapsLogger) - - @Provides - @Reusable - fun provideUserEntryLogger( - aapsLogger: AAPSLogger, - repository: AppRepository, - aapsSchedulers: AapsSchedulers, - dateUtil: DateUtil - ): UserEntryLogger = UserEntryLoggerImpl(aapsLogger, repository, aapsSchedulers, dateUtil) - - @Provides - @Singleton - fun provideOverviewData( - aapsLogger: AAPSLogger, - rh: ResourceHelper, - dateUtil: DateUtil, - sp: SP, - activePlugin: ActivePlugin, - defaultValueHelper: DefaultValueHelper, - profileFunction: ProfileFunction, - repository: AppRepository - ): OverviewData = OverviewDataImpl(aapsLogger, rh, dateUtil, sp, activePlugin, defaultValueHelper, profileFunction, repository) - - @Provides - @Reusable - fun providePrefFileListProvider( - rh: ResourceHelper, - config: Lazy, - encryptedPrefsFormat: EncryptedPrefsFormat, - storage: Storage, - versionCheckerUtils: VersionCheckerUtils, - context: Context - ): PrefFileListProvider = PrefFileListProviderImpl(rh, config, encryptedPrefsFormat, storage, versionCheckerUtils, context) - @Module interface Bindings { + @Binds fun bindActivePlugin(pluginStore: PluginStore): ActivePlugin + @Binds fun bindPrefFileListProvider(prefFileListProviderImpl: PrefFileListProviderImpl): PrefFileListProvider + @Binds fun bindOverviewData(overviewData: OverviewDataImpl): OverviewData + @Binds fun bindUserEntryLogger(userEntryLoggerImpl: UserEntryLoggerImpl): UserEntryLogger + @Binds fun bindDetailedBolusInfoStorage(detailedBolusInfoStorageImpl: DetailedBolusInfoStorageImpl): DetailedBolusInfoStorage + @Binds fun bindTemporaryBasalStorage(temporaryBasalStorageImpl: TemporaryBasalStorageImpl): TemporaryBasalStorage + @Binds fun bindTranslator(translatorImpl: TranslatorImpl): Translator + @Binds fun bindDefaultValueHelper(defaultValueHelperImpl: DefaultValueHelperImpl): DefaultValueHelper + @Binds fun bindProtectionCheck(protectionCheckImpl: ProtectionCheckImpl): ProtectionCheck + @Binds fun bindPasswordCheck(passwordCheckImpl: PasswordCheckImpl): PasswordCheck + @Binds fun bindLoggerUtils(loggerUtilsImpl: LoggerUtilsImpl): LoggerUtils + @Binds fun bindProfiler(profilerImpl: ProfilerImpl): Profiler + @Binds fun bindWarnColors(warnColorsImpl: WarnColorsImpl): WarnColors + @Binds fun bindHardLimits(hardLimitsImpl: HardLimitsImpl): HardLimits + @Binds fun bindResourceHelper(resourceHelperImpl: ResourceHelperImpl): ResourceHelper + @Binds fun bindTrendCalculatorInterface(trendCalculator: TrendCalculatorImpl): TrendCalculator @Binds fun bindTddCalculatorInterface(tddCalculator: TddCalculatorImpl): TddCalculator @Binds fun bindTirCalculatorInterface(tirCalculator: TirCalculatorImpl): TirCalculator diff --git a/implementation/src/main/java/info/nightscout/implementation/maintenance/PrefFileListProviderImpl.kt b/implementation/src/main/java/info/nightscout/implementation/maintenance/PrefFileListProviderImpl.kt index 56fc9ca8e4..97d3d0292b 100644 --- a/implementation/src/main/java/info/nightscout/implementation/maintenance/PrefFileListProviderImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/maintenance/PrefFileListProviderImpl.kt @@ -3,6 +3,7 @@ package info.nightscout.implementation.maintenance import android.content.Context import android.os.Environment import dagger.Lazy +import dagger.Reusable import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat import info.nightscout.core.main.R @@ -24,12 +25,11 @@ import org.joda.time.LocalDateTime import org.joda.time.format.DateTimeFormat import java.io.File import javax.inject.Inject -import javax.inject.Singleton import kotlin.math.abs @Suppress("SpellCheckingInspection") @OpenForTesting -@Singleton +@Reusable class PrefFileListProviderImpl @Inject constructor( private val rh: ResourceHelper, private val config: Lazy, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt b/implementation/src/main/java/info/nightscout/implementation/plugin/PluginStore.kt similarity index 97% rename from app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt rename to implementation/src/main/java/info/nightscout/implementation/plugin/PluginStore.kt index 522bd766fc..21eaeac57d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt +++ b/implementation/src/main/java/info/nightscout/implementation/plugin/PluginStore.kt @@ -1,6 +1,7 @@ -package info.nightscout.androidaps.plugins.configBuilder +package info.nightscout.implementation.plugin import info.nightscout.interfaces.Config +import info.nightscout.interfaces.ConfigBuilder import info.nightscout.interfaces.Overview import info.nightscout.interfaces.aps.APS import info.nightscout.interfaces.aps.Sensitivity @@ -57,7 +58,7 @@ class PluginStore @Inject constructor( override fun getSpecificPluginsListByInterface(interfaceClass: Class<*>): ArrayList { val newList = ArrayList() for (p in plugins) { - if (p.javaClass != ConfigBuilderPlugin::class.java && interfaceClass.isAssignableFrom(p.javaClass)) newList.add(p) + if (!interfaceClass.isAssignableFrom(ConfigBuilder::class.java) && interfaceClass.isAssignableFrom(p.javaClass)) newList.add(p) } return newList } @@ -204,4 +205,4 @@ class PluginStore @Inject constructor( override fun getPluginsList(): ArrayList = ArrayList(plugins) -} +} \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/profiling/ProfilerImpl.kt b/implementation/src/main/java/info/nightscout/implementation/profiling/ProfilerImpl.kt index 8879542221..a3e092607a 100644 --- a/implementation/src/main/java/info/nightscout/implementation/profiling/ProfilerImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/profiling/ProfilerImpl.kt @@ -1,14 +1,14 @@ package info.nightscout.implementation.profiling +import dagger.Reusable import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.interfaces.profiling.Profiler import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.LTag import javax.inject.Inject -import javax.inject.Singleton @OpenForTesting -@Singleton +@Reusable class ProfilerImpl @Inject constructor(val aapsLogger: AAPSLogger) : Profiler { override fun log(lTag: LTag, function: String, start: Long) { diff --git a/implementation/src/main/java/info/nightscout/implementation/protection/PasswordCheckImpl.kt b/implementation/src/main/java/info/nightscout/implementation/protection/PasswordCheckImpl.kt index 6b45e31b06..76a902ba55 100644 --- a/implementation/src/main/java/info/nightscout/implementation/protection/PasswordCheckImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/protection/PasswordCheckImpl.kt @@ -12,15 +12,15 @@ import android.widget.EditText import android.widget.TextView import androidx.annotation.StringRes import com.google.android.material.dialog.MaterialAlertDialogBuilder +import dagger.Reusable import info.nightscout.core.main.R import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.core.utils.CryptoUtil import info.nightscout.interfaces.protection.PasswordCheck import info.nightscout.shared.sharedPreferences.SP import javax.inject.Inject -import javax.inject.Singleton -@Singleton +@Reusable class PasswordCheckImpl @Inject constructor( private val sp: SP, private val cryptoUtil: CryptoUtil diff --git a/implementation/src/main/java/info/nightscout/implementation/protection/ProtectionCheckImpl.kt b/implementation/src/main/java/info/nightscout/implementation/protection/ProtectionCheckImpl.kt index b4fc1aa9c4..0e6206846a 100644 --- a/implementation/src/main/java/info/nightscout/implementation/protection/ProtectionCheckImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/protection/ProtectionCheckImpl.kt @@ -1,6 +1,7 @@ package info.nightscout.implementation.protection import androidx.fragment.app.FragmentActivity +import dagger.Reusable import info.nightscout.core.main.R import info.nightscout.interfaces.protection.PasswordCheck import info.nightscout.interfaces.protection.ProtectionCheck @@ -8,9 +9,8 @@ import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.utils.DateUtil import java.util.concurrent.TimeUnit import javax.inject.Inject -import javax.inject.Singleton -@Singleton +@Reusable class ProtectionCheckImpl @Inject constructor( private val sp: SP, private val passwordCheck: PasswordCheck, diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/AlarmHelperActivity.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/AlarmHelperActivity.kt index 90ecdf5151..fb45db03bd 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/AlarmHelperActivity.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/AlarmHelperActivity.kt @@ -7,8 +7,8 @@ import info.nightscout.androidaps.plugins.pump.eopatch.event.EventDialog import info.nightscout.androidaps.plugins.pump.eopatch.event.EventProgressDialog import info.nightscout.androidaps.plugins.pump.eopatch.ui.dialogs.AlarmDialog import info.nightscout.androidaps.plugins.pump.eopatch.ui.dialogs.ProgressDialogHelper +import info.nightscout.core.ui.R import info.nightscout.core.ui.activities.DialogAppCompatActivity -import info.nightscout.core.main.R import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.shared.sharedPreferences.SP diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/DialogHelperActivity.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/DialogHelperActivity.kt index 7a57c27f78..59e86714e2 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/DialogHelperActivity.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/DialogHelperActivity.kt @@ -2,8 +2,8 @@ package info.nightscout.androidaps.plugins.pump.eopatch.ui import android.os.Bundle import info.nightscout.androidaps.plugins.pump.eopatch.ui.dialogs.ActivationNotCompleteDialog +import info.nightscout.core.ui.R import info.nightscout.core.ui.activities.DialogAppCompatActivity -import info.nightscout.core.main.R class DialogHelperActivity : DialogAppCompatActivity() { @Override diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/EoBaseActivity.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/EoBaseActivity.kt index f784bebe53..d5226f2297 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/EoBaseActivity.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/EoBaseActivity.kt @@ -9,7 +9,7 @@ import androidx.databinding.ViewDataBinding import androidx.lifecycle.ViewModelProvider import info.nightscout.androidaps.plugins.pump.eopatch.dagger.EopatchPluginQualifier import info.nightscout.core.activities.NoSplashAppCompatActivity -import info.nightscout.core.main.R +import info.nightscout.core.ui.R import info.nightscout.rx.AapsSchedulers import io.reactivex.rxjava3.disposables.CompositeDisposable import javax.inject.Inject diff --git a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/dialogs/AlarmDialog.kt b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/dialogs/AlarmDialog.kt index d5b824b01a..61c0f764c8 100644 --- a/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/dialogs/AlarmDialog.kt +++ b/pump/eopatch/src/main/java/info/nightscout/androidaps/plugins/pump/eopatch/ui/dialogs/AlarmDialog.kt @@ -10,7 +10,6 @@ import android.view.ViewGroup import android.view.Window import android.view.WindowManager import dagger.android.support.DaggerDialogFragment -import info.nightscout.core.main.R import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmCode import info.nightscout.androidaps.plugins.pump.eopatch.alarm.AlarmProcess import info.nightscout.androidaps.plugins.pump.eopatch.alarm.IAlarmProcess @@ -19,10 +18,11 @@ import info.nightscout.androidaps.plugins.pump.eopatch.ble.IPatchManager import info.nightscout.androidaps.plugins.pump.eopatch.databinding.DialogAlarmBinding import info.nightscout.androidaps.plugins.pump.eopatch.ui.AlarmHelperActivity import info.nightscout.androidaps.services.AlarmSoundServiceHelper -import info.nightscout.shared.utils.T +import info.nightscout.core.ui.R import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.AAPSLogger +import info.nightscout.shared.utils.T import io.reactivex.rxjava3.disposables.Disposable import javax.inject.Inject