diff --git a/app/src/androidTest/java/info/nightscout/androidaps/EspressoHelper.kt b/app/src/androidTest/kotlin/info/nightscout/androidaps/EspressoHelper.kt similarity index 100% rename from app/src/androidTest/java/info/nightscout/androidaps/EspressoHelper.kt rename to app/src/androidTest/kotlin/info/nightscout/androidaps/EspressoHelper.kt diff --git a/app/src/androidTest/java/info/nightscout/androidaps/RealPumpTest.kt b/app/src/androidTest/kotlin/info/nightscout/androidaps/RealPumpTest.kt similarity index 100% rename from app/src/androidTest/java/info/nightscout/androidaps/RealPumpTest.kt rename to app/src/androidTest/kotlin/info/nightscout/androidaps/RealPumpTest.kt diff --git a/app/src/androidTest/java/info/nightscout/androidaps/SetupWizardActivityTest.kt b/app/src/androidTest/kotlin/info/nightscout/androidaps/SetupWizardActivityTest.kt similarity index 100% rename from app/src/androidTest/java/info/nightscout/androidaps/SetupWizardActivityTest.kt rename to app/src/androidTest/kotlin/info/nightscout/androidaps/SetupWizardActivityTest.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d83cb773ab..ae87ca840c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,7 +3,9 @@ xmlns:tools="http://schemas.android.com/tools"> - + @@ -32,9 +34,9 @@ @@ -67,16 +69,16 @@ + android:theme="@style/AppTheme" /> @@ -100,7 +102,7 @@ @@ -114,7 +116,7 @@ diff --git a/app/src/main/java/info/nightscout/androidaps/di/FragmentsModule.kt b/app/src/main/java/info/nightscout/androidaps/di/FragmentsModule.kt deleted file mode 100644 index 23abffb71e..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/di/FragmentsModule.kt +++ /dev/null @@ -1,13 +0,0 @@ -package info.nightscout.androidaps.di - -import dagger.Module -import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.activities.MyPreferenceFragment - -@Module -@Suppress("unused") -abstract class FragmentsModule { - - @ContributesAndroidInjector abstract fun contributesPreferencesFragment(): MyPreferenceFragment - -} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/kotlin/app/aaps/MainActivity.kt similarity index 99% rename from app/src/main/java/info/nightscout/androidaps/MainActivity.kt rename to app/src/main/kotlin/app/aaps/MainActivity.kt index 2483786057..15e99b10a6 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/kotlin/app/aaps/MainActivity.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps +package app.aaps import android.content.Context import android.content.Intent @@ -29,6 +29,8 @@ import androidx.core.view.GravityCompat import androidx.core.view.MenuCompat import androidx.core.view.MenuProvider import androidx.viewpager2.widget.ViewPager2 +import app.aaps.activities.HistoryBrowseActivity +import app.aaps.activities.PreferencesActivity import app.aaps.configuration.activities.DaggerAppCompatActivityWithResult import app.aaps.configuration.activities.SingleFragmentActivity import app.aaps.configuration.setupwizard.SetupWizardActivity @@ -37,8 +39,8 @@ import com.google.android.material.tabs.TabLayoutMediator import com.google.firebase.crashlytics.FirebaseCrashlytics import com.joanzapata.iconify.Iconify import com.joanzapata.iconify.fonts.FontAwesomeModule -import info.nightscout.androidaps.activities.HistoryBrowseActivity -import info.nightscout.androidaps.activities.PreferencesActivity +import info.nightscout.androidaps.BuildConfig +import info.nightscout.androidaps.R import info.nightscout.androidaps.databinding.ActivityMainBinding import info.nightscout.core.ui.UIRunnable import info.nightscout.core.ui.dialogs.OKDialog diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.kt b/app/src/main/kotlin/app/aaps/MainApp.kt similarity index 97% rename from app/src/main/java/info/nightscout/androidaps/MainApp.kt rename to app/src/main/kotlin/app/aaps/MainApp.kt index c5bc8b4d8e..76e24a0b1a 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.kt +++ b/app/src/main/kotlin/app/aaps/MainApp.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps +package app.aaps import android.bluetooth.BluetoothDevice import android.content.Intent @@ -13,13 +13,15 @@ import androidx.work.Data import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.PeriodicWorkRequest import androidx.work.WorkManager +import app.aaps.di.DaggerAppComponent +import app.aaps.receivers.BTReceiver +import app.aaps.receivers.ChargingStateReceiver +import app.aaps.receivers.KeepAliveWorker +import app.aaps.receivers.TimeDateOrTZChangeReceiver import dagger.android.AndroidInjector import dagger.android.DaggerApplication -import info.nightscout.androidaps.di.DaggerAppComponent -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.BuildConfig +import info.nightscout.androidaps.R import info.nightscout.core.ui.locale.LocaleHelper import info.nightscout.database.entities.TherapyEvent import info.nightscout.database.entities.UserEntry diff --git a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt b/app/src/main/kotlin/app/aaps/activities/HistoryBrowseActivity.kt similarity index 99% rename from app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt rename to app/src/main/kotlin/app/aaps/activities/HistoryBrowseActivity.kt index 3859e79af0..371b02a9c4 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt +++ b/app/src/main/kotlin/app/aaps/activities/HistoryBrowseActivity.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.activities +package app.aaps.activities import android.annotation.SuppressLint import android.content.Context diff --git a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowserData.kt b/app/src/main/kotlin/app/aaps/activities/HistoryBrowserData.kt similarity index 98% rename from app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowserData.kt rename to app/src/main/kotlin/app/aaps/activities/HistoryBrowserData.kt index 509a1d5a24..ababb434a2 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowserData.kt +++ b/app/src/main/kotlin/app/aaps/activities/HistoryBrowserData.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.activities +package app.aaps.activities import dagger.android.HasAndroidInjector import info.nightscout.core.graph.OverviewData diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/kotlin/app/aaps/activities/MyPreferenceFragment.kt similarity index 99% rename from app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt rename to app/src/main/kotlin/app/aaps/activities/MyPreferenceFragment.kt index a6e54e3a2b..2a0c46215e 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/kotlin/app/aaps/activities/MyPreferenceFragment.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.activities +package app.aaps.activities import android.annotation.SuppressLint import android.content.Context diff --git a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt b/app/src/main/kotlin/app/aaps/activities/PreferencesActivity.kt similarity index 98% rename from app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt rename to app/src/main/kotlin/app/aaps/activities/PreferencesActivity.kt index 14fa442f16..2115ee0f80 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.kt +++ b/app/src/main/kotlin/app/aaps/activities/PreferencesActivity.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.activities +package app.aaps.activities import android.os.Bundle import android.view.Menu diff --git a/app/src/main/java/info/nightscout/androidaps/di/ActivitiesModule.kt b/app/src/main/kotlin/app/aaps/di/ActivitiesModule.kt similarity index 59% rename from app/src/main/java/info/nightscout/androidaps/di/ActivitiesModule.kt rename to app/src/main/kotlin/app/aaps/di/ActivitiesModule.kt index 0146159325..800d396aec 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/ActivitiesModule.kt +++ b/app/src/main/kotlin/app/aaps/di/ActivitiesModule.kt @@ -1,10 +1,11 @@ -package info.nightscout.androidaps.di +package app.aaps.di +import app.aaps.MainActivity +import app.aaps.activities.HistoryBrowseActivity +import app.aaps.activities.MyPreferenceFragment +import app.aaps.activities.PreferencesActivity import dagger.Module import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.MainActivity -import info.nightscout.androidaps.activities.HistoryBrowseActivity -import info.nightscout.androidaps.activities.PreferencesActivity @Module @Suppress("unused") @@ -13,5 +14,5 @@ abstract class ActivitiesModule { @ContributesAndroidInjector abstract fun contributesHistoryBrowseActivity(): HistoryBrowseActivity @ContributesAndroidInjector abstract fun contributesMainActivity(): MainActivity @ContributesAndroidInjector abstract fun contributesPreferencesActivity(): PreferencesActivity - + @ContributesAndroidInjector abstract fun contributesPreferencesFragment(): MyPreferenceFragment } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt b/app/src/main/kotlin/app/aaps/di/AppComponent.kt similarity index 96% rename from app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt rename to app/src/main/kotlin/app/aaps/di/AppComponent.kt index 4ccb61df9d..99f5c47718 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt +++ b/app/src/main/kotlin/app/aaps/di/AppComponent.kt @@ -1,12 +1,12 @@ -package info.nightscout.androidaps.di +package app.aaps.di +import app.aaps.MainApp import app.aaps.configuration.di.ConfigurationModule import app.aaps.shared.impl.di.SharedImplModule import dagger.BindsInstance import dagger.Component import dagger.android.AndroidInjectionModule import dagger.android.AndroidInjector -import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.danar.di.DanaRModule import info.nightscout.androidaps.insight.di.InsightDatabaseModule import info.nightscout.androidaps.insight.di.InsightModule @@ -47,7 +47,6 @@ import javax.inject.Singleton AppModule::class, PluginsListModule::class, ActivitiesModule::class, - FragmentsModule::class, ReceiversModule::class, // Gradle modules diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt b/app/src/main/kotlin/app/aaps/di/AppModule.kt similarity index 86% rename from app/src/main/java/info/nightscout/androidaps/di/AppModule.kt rename to app/src/main/kotlin/app/aaps/di/AppModule.kt index 62490d265a..6e1c200eb4 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt +++ b/app/src/main/kotlin/app/aaps/di/AppModule.kt @@ -1,16 +1,16 @@ -package info.nightscout.androidaps.di +package app.aaps.di import android.content.Context +import app.aaps.MainApp +import app.aaps.implementations.ConfigImpl +import app.aaps.implementations.InstantiatorImpl +import app.aaps.implementations.UiInteractionImpl +import app.aaps.workflow.CalculationWorkflowImpl import dagger.Binds import dagger.Lazy import dagger.Module import dagger.Provides import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.MainApp -import info.nightscout.androidaps.implementations.ConfigImpl -import info.nightscout.androidaps.implementations.InstantiatorImpl -import info.nightscout.androidaps.implementations.UiInteractionImpl -import info.nightscout.androidaps.workflow.CalculationWorkflowImpl import info.nightscout.core.workflow.CalculationWorkflow import info.nightscout.interfaces.Config import info.nightscout.interfaces.plugin.PluginBase diff --git a/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt b/app/src/main/kotlin/app/aaps/di/PluginsListModule.kt similarity index 99% rename from app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt rename to app/src/main/kotlin/app/aaps/di/PluginsListModule.kt index a3b940c78c..04bcbd58a2 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/PluginsListModule.kt +++ b/app/src/main/kotlin/app/aaps/di/PluginsListModule.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.di +package app.aaps.di import app.aaps.configuration.configBuilder.ConfigBuilderPlugin import app.aaps.configuration.maintenance.MaintenancePlugin diff --git a/app/src/main/java/info/nightscout/androidaps/di/ReceiversModule.kt b/app/src/main/kotlin/app/aaps/di/ReceiversModule.kt similarity index 62% rename from app/src/main/java/info/nightscout/androidaps/di/ReceiversModule.kt rename to app/src/main/kotlin/app/aaps/di/ReceiversModule.kt index 1186f5fe8c..c7f2d80e3f 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/ReceiversModule.kt +++ b/app/src/main/kotlin/app/aaps/di/ReceiversModule.kt @@ -1,14 +1,14 @@ -package info.nightscout.androidaps.di +package app.aaps.di +import app.aaps.receivers.AutoStartReceiver +import app.aaps.receivers.BTReceiver +import app.aaps.receivers.ChargingStateReceiver +import app.aaps.receivers.DataReceiver +import app.aaps.receivers.KeepAliveWorker +import app.aaps.receivers.SmsReceiver +import app.aaps.receivers.TimeDateOrTZChangeReceiver import dagger.Module import dagger.android.ContributesAndroidInjector -import info.nightscout.androidaps.receivers.AutoStartReceiver -import info.nightscout.androidaps.receivers.BTReceiver -import info.nightscout.androidaps.receivers.ChargingStateReceiver -import info.nightscout.androidaps.receivers.DataReceiver -import info.nightscout.androidaps.receivers.KeepAliveWorker -import info.nightscout.androidaps.receivers.SmsReceiver -import info.nightscout.androidaps.receivers.TimeDateOrTZChangeReceiver @Module @Suppress("unused") diff --git a/app/src/main/java/info/nightscout/androidaps/implementations/ConfigImpl.kt b/app/src/main/kotlin/app/aaps/implementations/ConfigImpl.kt similarity index 98% rename from app/src/main/java/info/nightscout/androidaps/implementations/ConfigImpl.kt rename to app/src/main/kotlin/app/aaps/implementations/ConfigImpl.kt index ce696f96f6..885214e5b9 100644 --- a/app/src/main/java/info/nightscout/androidaps/implementations/ConfigImpl.kt +++ b/app/src/main/kotlin/app/aaps/implementations/ConfigImpl.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.implementations +package app.aaps.implementations import android.os.Build import info.nightscout.androidaps.BuildConfig diff --git a/app/src/main/java/info/nightscout/androidaps/implementations/InstantiatorImpl.kt b/app/src/main/kotlin/app/aaps/implementations/InstantiatorImpl.kt similarity index 95% rename from app/src/main/java/info/nightscout/androidaps/implementations/InstantiatorImpl.kt rename to app/src/main/kotlin/app/aaps/implementations/InstantiatorImpl.kt index eaab048da7..ee37851dc0 100644 --- a/app/src/main/java/info/nightscout/androidaps/implementations/InstantiatorImpl.kt +++ b/app/src/main/kotlin/app/aaps/implementations/InstantiatorImpl.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.implementations +package app.aaps.implementations import dagger.Reusable import dagger.android.HasAndroidInjector diff --git a/app/src/main/java/info/nightscout/androidaps/implementations/UiInteractionImpl.kt b/app/src/main/kotlin/app/aaps/implementations/UiInteractionImpl.kt similarity index 96% rename from app/src/main/java/info/nightscout/androidaps/implementations/UiInteractionImpl.kt rename to app/src/main/kotlin/app/aaps/implementations/UiInteractionImpl.kt index dddf6362ec..3d456c2ae9 100644 --- a/app/src/main/java/info/nightscout/androidaps/implementations/UiInteractionImpl.kt +++ b/app/src/main/kotlin/app/aaps/implementations/UiInteractionImpl.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.implementations +package app.aaps.implementations import android.content.Context import android.content.Intent @@ -6,13 +6,13 @@ import android.os.Bundle import androidx.annotation.RawRes import androidx.annotation.StringRes import androidx.fragment.app.FragmentManager +import app.aaps.MainActivity +import app.aaps.activities.HistoryBrowseActivity +import app.aaps.activities.MyPreferenceFragment +import app.aaps.activities.PreferencesActivity import app.aaps.configuration.activities.SingleFragmentActivity import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.MainActivity import info.nightscout.androidaps.R -import info.nightscout.androidaps.activities.HistoryBrowseActivity -import info.nightscout.androidaps.activities.MyPreferenceFragment -import info.nightscout.androidaps.activities.PreferencesActivity import info.nightscout.core.events.EventNewNotification import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.interfaces.notifications.Notification diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.kt b/app/src/main/kotlin/app/aaps/receivers/AutoStartReceiver.kt similarity index 92% rename from app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.kt rename to app/src/main/kotlin/app/aaps/receivers/AutoStartReceiver.kt index 7a1bd9c6fa..24c45e74d4 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/AutoStartReceiver.kt +++ b/app/src/main/kotlin/app/aaps/receivers/AutoStartReceiver.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.receivers +package app.aaps.receivers import android.content.Context import android.content.Intent diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/BTReceiver.kt b/app/src/main/kotlin/app/aaps/receivers/BTReceiver.kt similarity index 95% rename from app/src/main/java/info/nightscout/androidaps/receivers/BTReceiver.kt rename to app/src/main/kotlin/app/aaps/receivers/BTReceiver.kt index 3f43740fb5..4b0c20e089 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/BTReceiver.kt +++ b/app/src/main/kotlin/app/aaps/receivers/BTReceiver.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.receivers +package app.aaps.receivers import android.bluetooth.BluetoothDevice import android.content.Context @@ -20,6 +20,7 @@ class BTReceiver : DaggerBroadcastReceiver() { when (intent.action) { BluetoothDevice.ACTION_ACL_CONNECTED -> rxBus.send(EventBTChange(EventBTChange.Change.CONNECT, deviceName = device.name, deviceAddress = device.address)) + BluetoothDevice.ACTION_ACL_DISCONNECTED -> rxBus.send(EventBTChange(EventBTChange.Change.DISCONNECT, deviceName = device.name, deviceAddress = device.address)) } diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/ChargingStateReceiver.kt b/app/src/main/kotlin/app/aaps/receivers/ChargingStateReceiver.kt similarity index 95% rename from app/src/main/java/info/nightscout/androidaps/receivers/ChargingStateReceiver.kt rename to app/src/main/kotlin/app/aaps/receivers/ChargingStateReceiver.kt index 5923978509..1512b74b9a 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/ChargingStateReceiver.kt +++ b/app/src/main/kotlin/app/aaps/receivers/ChargingStateReceiver.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.receivers +package app.aaps.receivers import android.content.Context import android.content.Intent @@ -13,6 +13,7 @@ import info.nightscout.rx.logging.LTag import javax.inject.Inject class ChargingStateReceiver : DaggerBroadcastReceiver() { + @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var rxBus: RxBus @Inject lateinit var receiverStatusStore: ReceiverStatusStore @@ -22,7 +23,8 @@ class ChargingStateReceiver : DaggerBroadcastReceiver() { rxBus.send(grabChargingState(context)) aapsLogger.debug( LTag.CORE, receiverStatusStore.lastChargingEvent?.toString() - ?: "Unknown charging state") + ?: "Unknown charging state" + ) } private fun grabChargingState(context: Context): EventChargingState { diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.kt b/app/src/main/kotlin/app/aaps/receivers/DataReceiver.kt similarity index 98% rename from app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.kt rename to app/src/main/kotlin/app/aaps/receivers/DataReceiver.kt index d642569246..b5645e1b3d 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/DataReceiver.kt +++ b/app/src/main/kotlin/app/aaps/receivers/DataReceiver.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.receivers +package app.aaps.receivers import android.content.Context import android.content.Intent @@ -39,11 +39,13 @@ open class DataReceiver : DaggerBroadcastReceiver() { Intents.ACTION_NEW_BG_ESTIMATE -> OneTimeWorkRequest.Builder(XdripSourcePlugin.XdripSourceWorker::class.java) .setInputData(dataWorkerStorage.storeInputData(bundle, intent.action)).build() + Intents.POCTECH_BG -> OneTimeWorkRequest.Builder(PoctechPlugin.PoctechWorker::class.java) .setInputData(Data.Builder().also { it.copyString("data", bundle) }.build()).build() + Intents.GLIMP_BG -> OneTimeWorkRequest.Builder(GlimpPlugin.GlimpWorker::class.java) .setInputData(Data.Builder().also { @@ -51,6 +53,7 @@ open class DataReceiver : DaggerBroadcastReceiver() { it.copyString("myTrend", bundle) it.copyLong("myTimestamp", bundle) }.build()).build() + Intents.TOMATO_BG -> @Suppress("SpellCheckingInspection") OneTimeWorkRequest.Builder(TomatoPlugin.TomatoWorker::class.java) @@ -58,15 +61,18 @@ open class DataReceiver : DaggerBroadcastReceiver() { it.copyDouble("com.fanqies.tomatofn.Extras.BgEstimate", bundle) it.copyLong("com.fanqies.tomatofn.Extras.Time", bundle) }.build()).build() + Intents.NS_EMULATOR -> OneTimeWorkRequest.Builder(MM640gPlugin.MM640gWorker::class.java) .setInputData(Data.Builder().also { it.copyString("collection", bundle) it.copyString("data", bundle) }.build()).build() + Telephony.Sms.Intents.SMS_RECEIVED_ACTION -> OneTimeWorkRequest.Builder(SmsCommunicatorPlugin.SmsCommunicatorWorker::class.java) .setInputData(dataWorkerStorage.storeInputData(bundle, intent.action)).build() + Intents.EVERSENSE_BG -> OneTimeWorkRequest.Builder(EversensePlugin.EversenseWorker::class.java) .setInputData(dataWorkerStorage.storeInputData(bundle, intent.action)).build() @@ -78,6 +84,7 @@ open class DataReceiver : DaggerBroadcastReceiver() { Intents.AIDEX_NEW_BG_ESTIMATE -> OneTimeWorkRequest.Builder(AidexPlugin.AidexWorker::class.java) .setInputData(dataWorkerStorage.storeInputData(bundle, intent.action)).build() + else -> null }?.let { request -> dataWorkerStorage.enqueue(request) } } diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt b/app/src/main/kotlin/app/aaps/receivers/KeepAliveWorker.kt similarity index 99% rename from app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt rename to app/src/main/kotlin/app/aaps/receivers/KeepAliveWorker.kt index 2a3b2eff17..d27510edfa 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt +++ b/app/src/main/kotlin/app/aaps/receivers/KeepAliveWorker.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.receivers +package app.aaps.receivers import android.content.Context import androidx.work.Data diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/SmsReceiver.kt b/app/src/main/kotlin/app/aaps/receivers/SmsReceiver.kt similarity index 85% rename from app/src/main/java/info/nightscout/androidaps/receivers/SmsReceiver.kt rename to app/src/main/kotlin/app/aaps/receivers/SmsReceiver.kt index ed5b1201cf..8becd9b65d 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/SmsReceiver.kt +++ b/app/src/main/kotlin/app/aaps/receivers/SmsReceiver.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.receivers +package app.aaps.receivers /** * Forward received SMS intents. This is a separate class, because unlike local broadcasts handled by DataReceiver, diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/TimeDateOrTZChangeReceiver.kt b/app/src/main/kotlin/app/aaps/receivers/TimeDateOrTZChangeReceiver.kt similarity index 98% rename from app/src/main/java/info/nightscout/androidaps/receivers/TimeDateOrTZChangeReceiver.kt rename to app/src/main/kotlin/app/aaps/receivers/TimeDateOrTZChangeReceiver.kt index 7bd237dba2..aeb888a30a 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/TimeDateOrTZChangeReceiver.kt +++ b/app/src/main/kotlin/app/aaps/receivers/TimeDateOrTZChangeReceiver.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.receivers +package app.aaps.receivers import android.content.Context import android.content.Intent @@ -15,6 +15,7 @@ import java.util.TimeZone import javax.inject.Inject class TimeDateOrTZChangeReceiver : DaggerBroadcastReceiver() { + @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var activePlugin: ActivePlugin val gson: Gson = Gson() diff --git a/app/src/main/java/info/nightscout/androidaps/utils/SPBackupAgent.kt b/app/src/main/kotlin/app/aaps/utils/SPBackupAgent.kt similarity index 91% rename from app/src/main/java/info/nightscout/androidaps/utils/SPBackupAgent.kt rename to app/src/main/kotlin/app/aaps/utils/SPBackupAgent.kt index e93a757beb..a44546e97f 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/SPBackupAgent.kt +++ b/app/src/main/kotlin/app/aaps/utils/SPBackupAgent.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.utils +package app.aaps.utils import android.app.backup.BackupAgentHelper import android.app.backup.SharedPreferencesBackupHelper diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/CalculationWorkflowImpl.kt b/app/src/main/kotlin/app/aaps/workflow/CalculationWorkflowImpl.kt similarity index 99% rename from app/src/main/java/info/nightscout/androidaps/workflow/CalculationWorkflowImpl.kt rename to app/src/main/kotlin/app/aaps/workflow/CalculationWorkflowImpl.kt index ccca089833..5355224359 100644 --- a/app/src/main/java/info/nightscout/androidaps/workflow/CalculationWorkflowImpl.kt +++ b/app/src/main/kotlin/app/aaps/workflow/CalculationWorkflowImpl.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.workflow +package app.aaps.workflow import android.content.Context import android.os.SystemClock diff --git a/app/src/main/res/layout/activity_historybrowse.xml b/app/src/main/res/layout/activity_historybrowse.xml index 26673e7b76..bf6cf44724 100644 --- a/app/src/main/res/layout/activity_historybrowse.xml +++ b/app/src/main/res/layout/activity_historybrowse.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context="info.nightscout.androidaps.activities.HistoryBrowseActivity"> + tools:context="info.nightscout.androidaps.app.aaps.activities.HistoryBrowseActivity"> + tools:context="app.aaps.MainActivity"> - + - - + + diff --git a/app/src/test/java/info/nightscout/plugins/configBuilder/ConfigBuilderPluginTest.kt b/app/src/test/java/info/nightscout/plugins/configBuilder/ConfigBuilderPluginTest.kt deleted file mode 100644 index 78f2a03ac1..0000000000 --- a/app/src/test/java/info/nightscout/plugins/configBuilder/ConfigBuilderPluginTest.kt +++ /dev/null @@ -1,41 +0,0 @@ -package info.nightscout.plugins.configBuilder - -import app.aaps.configuration.configBuilder.ConfigBuilderPlugin -import app.aaps.shared.tests.TestBase -import dagger.android.AndroidInjector -import dagger.android.HasAndroidInjector -import info.nightscout.interfaces.logging.UserEntryLogger -import info.nightscout.interfaces.plugin.ActivePlugin -import info.nightscout.interfaces.protection.ProtectionCheck -import info.nightscout.interfaces.pump.PumpSync -import info.nightscout.interfaces.ui.UiInteraction -import info.nightscout.shared.interfaces.ResourceHelper -import info.nightscout.shared.sharedPreferences.SP -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.mockito.Mock - -class ConfigBuilderPluginTest : TestBase() { - - @Mock lateinit var sp: SP - @Mock lateinit var rh: ResourceHelper - @Mock lateinit var activePlugin: ActivePlugin - @Mock lateinit var uel: UserEntryLogger - @Mock lateinit var pumpSync: PumpSync - @Mock lateinit var protectionCheck: ProtectionCheck - @Mock lateinit var uiInteraction: UiInteraction - - private lateinit var configBuilderPlugin: ConfigBuilderPlugin - - private val injector = HasAndroidInjector { AndroidInjector { } } - - @Test - fun dummy() { - - } - - @BeforeEach - fun prepareMock() { - configBuilderPlugin = ConfigBuilderPlugin(injector, aapsLogger, rh, sp, rxBus, activePlugin, uel, pumpSync, protectionCheck, uiInteraction) - } -} \ No newline at end of file diff --git a/implementation/build.gradle b/implementation/build.gradle index 90855cb812..224a629b69 100644 --- a/implementation/build.gradle +++ b/implementation/build.gradle @@ -24,6 +24,8 @@ dependencies { implementation project(':core:utils') testImplementation project(':shared:tests') + testImplementation project(':plugins:aps') + testImplementation project(':pump:virtual') // Protection api 'androidx.biometric:biometric:1.1.0' diff --git a/app/src/test/java/info/nightscout/pump/PumpEnactResultTest.kt b/implementation/src/test/java/info/nightscout/interfaces/pump/PumpEnactResultTest.kt similarity index 98% rename from app/src/test/java/info/nightscout/pump/PumpEnactResultTest.kt rename to implementation/src/test/java/info/nightscout/interfaces/pump/PumpEnactResultTest.kt index 460ea6a8f4..fd0bdf5184 100644 --- a/app/src/test/java/info/nightscout/pump/PumpEnactResultTest.kt +++ b/implementation/src/test/java/info/nightscout/interfaces/pump/PumpEnactResultTest.kt @@ -1,11 +1,10 @@ -package info.nightscout.pump +package info.nightscout.interfaces.pump import app.aaps.shared.tests.TestBaseWithProfile import com.google.common.truth.Truth.assertThat import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.core.pump.toHtml -import info.nightscout.interfaces.pump.PumpEnactResult import info.nightscout.plugins.aps.loop.extensions.json import info.nightscout.pump.virtual.extensions.toText import org.json.JSONObject diff --git a/plugins/aps/build.gradle b/plugins/aps/build.gradle index aa894b97f4..0d17072266 100644 --- a/plugins/aps/build.gradle +++ b/plugins/aps/build.gradle @@ -24,6 +24,7 @@ dependencies { implementation project(':core:ui') implementation project(':core:validators') + testImplementation project(':pump:virtual') testImplementation project(':shared:tests') api "androidx.appcompat:appcompat:$appcompat_version" diff --git a/plugins/aps/src/test/java/info/nightscout/plugins/aps/loop/APSResultTest.kt b/plugins/aps/src/test/java/info/nightscout/plugins/aps/loop/APSResultTest.kt deleted file mode 100644 index 74dab48212..0000000000 --- a/plugins/aps/src/test/java/info/nightscout/plugins/aps/loop/APSResultTest.kt +++ /dev/null @@ -1,338 +0,0 @@ -package info.nightscout.plugins.aps.loop - -import app.aaps.shared.tests.TestBaseWithProfile -import com.google.common.truth.Truth.assertThat -import dagger.android.AndroidInjector -import dagger.android.HasAndroidInjector -import info.nightscout.core.constraints.ConstraintObject -import info.nightscout.core.utils.JsonHelper.safeGetDouble -import info.nightscout.database.entities.TemporaryBasal -import info.nightscout.interfaces.aps.APSResult -import info.nightscout.interfaces.constraints.Constraint -import info.nightscout.interfaces.constraints.ConstraintsChecker -import info.nightscout.interfaces.pump.defs.PumpType -import info.nightscout.plugins.aps.APSResultObject -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.mockito.ArgumentMatchers -import org.mockito.Mock -import org.mockito.Mockito.`when` - -class APSResultTest : TestBaseWithProfile() { - - @Mock lateinit var constraintsChecker: ConstraintsChecker - - private val injector = HasAndroidInjector { AndroidInjector { } } - - private lateinit var closedLoopEnabled: Constraint - - private fun APSResult.percent(percent: Int): APSResult { - this.percent = percent - return this - } - - private fun APSResult.rate(rate: Double): APSResult { - this.rate = rate - return this - } - - private fun APSResult.duration(duration: Int): APSResult { - this.duration = duration - return this - } - - private fun APSResult.usePercent(usePercent: Boolean): APSResult { - this.usePercent = usePercent - return this - } - - private fun APSResult.tempBasalRequested(tempBasalRequested: Boolean): APSResult { - this.isTempBasalRequested = tempBasalRequested - return this - } - - @Test - fun changeRequestedTest() { - - val apsResult = APSResultObject { AndroidInjector { } } - .also { - it.aapsLogger = aapsLogger - it.constraintChecker = constraintsChecker - it.sp = sp - it.activePlugin = activePlugin - it.iobCobCalculator = iobCobCalculator - it.profileFunction = profileFunction - it.rh = rh - } - - // BASAL RATE IN TEST PROFILE IS 1U/h - - // **** PERCENT pump **** - testPumpPlugin.pumpDescription.fillFor(PumpType.CELLNOVO) // % based - apsResult.usePercent(true) - - // closed loop mode return original request - closedLoopEnabled.set(true) - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(null) - apsResult.tempBasalRequested(false) - assertThat(apsResult.isChangeRequested).isFalse() - apsResult.tempBasalRequested(true).percent(200).duration(30) - assertThat(apsResult.isChangeRequested).isTrue() - - // open loop - closedLoopEnabled.set(false) - // no change requested - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(null) - apsResult.tempBasalRequested(false) - assertThat(apsResult.isChangeRequested).isFalse() - - // request 100% when no temp is running - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(null) - apsResult.tempBasalRequested(true).percent(100).duration(30) - assertThat(apsResult.isChangeRequested).isFalse() - - // request equal temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 70.0, - duration = 30, - isAbsolute = false, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).percent(70).duration(30) - assertThat(apsResult.isChangeRequested).isFalse() - - // request zero temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 10.0, - duration = 30, - isAbsolute = false, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).percent(0).duration(30) - assertThat(apsResult.isChangeRequested).isTrue() - - // request high temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 190.0, - duration = 30, - isAbsolute = false, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).percent(200).duration(30) - assertThat(apsResult.isChangeRequested).isTrue() - - // request slightly different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 70.0, - duration = 30, - isAbsolute = false, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).percent(80).duration(30) - assertThat(apsResult.isChangeRequested).isFalse() - - // request different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 70.0, - duration = 30, - isAbsolute = false, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).percent(120).duration(30) - assertThat(apsResult.isChangeRequested).isTrue() - - // it should work with absolute temps too - // request different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 1.0, - duration = 30, - isAbsolute = true, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).percent(100).duration(30) - assertThat(apsResult.isChangeRequested).isFalse() - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 2.0, - duration = 30, - isAbsolute = true, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).percent(50).duration(30) - assertThat(apsResult.isChangeRequested).isTrue() - - // **** ABSOLUTE pump **** - testPumpPlugin.pumpDescription.fillFor(PumpType.MEDTRONIC_515_715) // U/h based - apsResult.usePercent(false) - - // open loop - closedLoopEnabled.set(false) - // request 100% when no temp is running - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn(null) - apsResult.tempBasalRequested(true).rate(1.0).duration(30) - assertThat(apsResult.isChangeRequested).isFalse() - - // request equal temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 2.0, - duration = 30, - isAbsolute = true, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).rate(2.0).duration(30) - assertThat(apsResult.isChangeRequested).isFalse() - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 200.0, - duration = 30, - isAbsolute = false, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).rate(2.0).duration(30) - assertThat(apsResult.isChangeRequested).isFalse() - - // request zero temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 0.1, - duration = 30, - isAbsolute = true, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).rate(0.0).duration(30) - assertThat(apsResult.isChangeRequested).isTrue() - - // request high temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 34.9, - duration = 30, - isAbsolute = true, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).rate(35.0).duration(30) - assertThat(apsResult.isChangeRequested).isTrue() - - // request slightly different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 1.1, - duration = 30, - isAbsolute = true, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).rate(1.2).duration(30) - assertThat(apsResult.isChangeRequested).isFalse() - - // request different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 1.1, - duration = 30, - isAbsolute = true, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).rate(1.5).duration(30) - assertThat(apsResult.isChangeRequested).isTrue() - - // it should work with percent temps too - // request different temp - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 110.0, - duration = 30, - isAbsolute = false, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).rate(1.1).duration(30) - assertThat(apsResult.isChangeRequested).isFalse() - `when`(iobCobCalculator.getTempBasalIncludingConvertedExtended(ArgumentMatchers.anyLong())).thenReturn( - TemporaryBasal( - timestamp = 0, - rate = 200.0, - duration = 30, - isAbsolute = false, - type = TemporaryBasal.Type.NORMAL - ) - ) - apsResult.tempBasalRequested(true).rate(0.5).duration(30) - assertThat(apsResult.isChangeRequested).isTrue() - } - - @Test fun cloneTest() { - val apsResult = APSResultObject(injector) - .also { - it.aapsLogger = aapsLogger - it.constraintChecker = constraintsChecker - it.sp = sp - it.activePlugin = activePlugin - it.iobCobCalculator = iobCobCalculator - it.profileFunction = profileFunction - it.rh = rh - } - apsResult.rate(10.0) - val apsResult2 = apsResult.newAndClone(injector) - assertThat(apsResult2.rate).isEqualTo(apsResult.rate) - } - - @Test fun jsonTest() { - closedLoopEnabled.set(true) - val apsResult = APSResultObject(injector) - .also { - it.aapsLogger = aapsLogger - it.constraintChecker = constraintsChecker - it.sp = sp - it.activePlugin = activePlugin - it.iobCobCalculator = iobCobCalculator - it.profileFunction = profileFunction - it.rh = rh - } - apsResult.rate(20.0).tempBasalRequested(true) - assertThat(safeGetDouble(apsResult.json(), "rate")).isEqualTo(20.0) - apsResult.rate(20.0).tempBasalRequested(false) - assertThat(apsResult.json()?.has("rate")).isFalse() - } - - @BeforeEach - fun prepare() { - closedLoopEnabled = ConstraintObject(false, aapsLogger) - `when`(constraintsChecker.isClosedLoopAllowed()).thenReturn(closedLoopEnabled) - `when`(sp.getDouble(ArgumentMatchers.anyInt(), ArgumentMatchers.anyDouble())).thenReturn(30.0) - `when`(profileFunction.getProfile()).thenReturn(validProfile) - } -} diff --git a/app/src/test/java/info/nightscout/plugins/aps/loop/LoopPluginTest.kt b/plugins/aps/src/test/java/info/nightscout/plugins/aps/loop/LoopPluginTest.kt similarity index 100% rename from app/src/test/java/info/nightscout/plugins/aps/loop/LoopPluginTest.kt rename to plugins/aps/src/test/java/info/nightscout/plugins/aps/loop/LoopPluginTest.kt diff --git a/app/src/test/java/info/nightscout/plugins/general/maintenance/MaintenancePluginTest.kt b/plugins/configuration/src/test/kotlin/app/aaps/configuration/maintenance/MaintenancePluginTest.kt similarity index 94% rename from app/src/test/java/info/nightscout/plugins/general/maintenance/MaintenancePluginTest.kt rename to plugins/configuration/src/test/kotlin/app/aaps/configuration/maintenance/MaintenancePluginTest.kt index ce89308e23..e6c268757a 100644 --- a/app/src/test/java/info/nightscout/plugins/general/maintenance/MaintenancePluginTest.kt +++ b/plugins/configuration/src/test/kotlin/app/aaps/configuration/maintenance/MaintenancePluginTest.kt @@ -1,7 +1,6 @@ -package info.nightscout.plugins.general.maintenance +package app.aaps.configuration.maintenance import android.content.Context -import app.aaps.configuration.maintenance.MaintenancePlugin import app.aaps.shared.tests.TestBase import com.google.common.truth.Truth.assertThat import dagger.android.HasAndroidInjector diff --git a/app/src/test/res/logger/AndroidAPS.2018-01-01_01-01-00.1.zip b/plugins/configuration/src/test/res/logger/AndroidAPS.2018-01-01_01-01-00.1.zip similarity index 100% rename from app/src/test/res/logger/AndroidAPS.2018-01-01_01-01-00.1.zip rename to plugins/configuration/src/test/res/logger/AndroidAPS.2018-01-01_01-01-00.1.zip diff --git a/app/src/test/res/logger/AndroidAPS.2018-01-02_01-01-00.1.zip b/plugins/configuration/src/test/res/logger/AndroidAPS.2018-01-02_01-01-00.1.zip similarity index 100% rename from app/src/test/res/logger/AndroidAPS.2018-01-02_01-01-00.1.zip rename to plugins/configuration/src/test/res/logger/AndroidAPS.2018-01-02_01-01-00.1.zip diff --git a/app/src/test/res/logger/AndroidAPS.2018-01-03_01-01-00.1.zip b/plugins/configuration/src/test/res/logger/AndroidAPS.2018-01-03_01-01-00.1.zip similarity index 100% rename from app/src/test/res/logger/AndroidAPS.2018-01-03_01-01-00.1.zip rename to plugins/configuration/src/test/res/logger/AndroidAPS.2018-01-03_01-01-00.1.zip diff --git a/app/src/test/res/logger/AndroidAPS.log b/plugins/configuration/src/test/res/logger/AndroidAPS.log similarity index 100% rename from app/src/test/res/logger/AndroidAPS.log rename to plugins/configuration/src/test/res/logger/AndroidAPS.log diff --git a/plugins/constraints/build.gradle b/plugins/constraints/build.gradle index c141235dcb..507e031f48 100644 --- a/plugins/constraints/build.gradle +++ b/plugins/constraints/build.gradle @@ -23,6 +23,16 @@ dependencies { implementation project(':core:validators') implementation project(':database:entities') + testImplementation project(':database:impl') + testImplementation project(':implementation') + testImplementation project(':insight') + testImplementation project(':plugins:aps') + testImplementation project(':plugins:source') + testImplementation project(':pump:combo') + testImplementation project(':pump:dana') + testImplementation project(':pump:danar') + testImplementation project(':pump:danars') + testImplementation project(':pump:virtual') testImplementation project(':shared:tests') // Phone checker diff --git a/app/src/test/java/info/nightscout/plugins/constraints/ConstraintsCheckerTest.kt b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/ConstraintsCheckerImplTest.kt similarity index 98% rename from app/src/test/java/info/nightscout/plugins/constraints/ConstraintsCheckerTest.kt rename to plugins/constraints/src/test/java/info/nightscout/plugins/constraints/ConstraintsCheckerImplTest.kt index 29d30e839d..b27c5e8d82 100644 --- a/app/src/test/java/info/nightscout/plugins/constraints/ConstraintsCheckerTest.kt +++ b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/ConstraintsCheckerImplTest.kt @@ -5,7 +5,6 @@ import com.google.common.truth.Truth.assertThat import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector import info.nightscout.androidaps.danar.DanaRPlugin -import info.nightscout.androidaps.implementations.ConfigImpl import info.nightscout.androidaps.insight.database.InsightDatabase import info.nightscout.androidaps.insight.database.InsightDatabaseDao import info.nightscout.androidaps.insight.database.InsightDbHelper @@ -17,7 +16,6 @@ import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck import info.nightscout.interfaces.constraints.Constraint import info.nightscout.interfaces.constraints.Objectives import info.nightscout.interfaces.constraints.PluginConstraints -import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.profile.Instantiator @@ -52,7 +50,7 @@ import org.mockito.Mockito.`when` /** * Created by mike on 18.03.2018. */ -class ConstraintsCheckerTest : TestBaseWithProfile() { +class ConstraintsCheckerImplTest : TestBaseWithProfile() { @Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin @Mock lateinit var commandQueue: CommandQueue @@ -60,7 +58,6 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { @Mock lateinit var temporaryBasalStorage: TemporaryBasalStorage @Mock lateinit var glimpPlugin: GlimpPlugin @Mock lateinit var profiler: Profiler - @Mock lateinit var fileListProvider: PrefFileListProvider @Mock lateinit var repository: AppRepository @Mock lateinit var pumpSync: PumpSync @Mock lateinit var insightDatabaseDao: InsightDatabaseDao @@ -215,7 +212,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() { safetyPlugin = SafetyPlugin( injector, aapsLogger, rh, sp, constraintChecker, activePlugin, hardLimits, - ConfigImpl(fileListProvider), iobCobCalculator, dateUtil, uiInteraction, decimalFormatter + config, iobCobCalculator, dateUtil, uiInteraction, decimalFormatter ) val constraintsPluginsList = ArrayList() constraintsPluginsList.add(safetyPlugin) diff --git a/app/src/test/java/info/nightscout/plugins/safety/SafetyPluginTest.kt b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/safety/SafetyPluginTest.kt similarity index 99% rename from app/src/test/java/info/nightscout/plugins/safety/SafetyPluginTest.kt rename to plugins/constraints/src/test/java/info/nightscout/plugins/constraints/safety/SafetyPluginTest.kt index 1cf0e57513..8ed36396aa 100644 --- a/app/src/test/java/info/nightscout/plugins/safety/SafetyPluginTest.kt +++ b/plugins/constraints/src/test/java/info/nightscout/plugins/constraints/safety/SafetyPluginTest.kt @@ -1,4 +1,4 @@ -package info.nightscout.plugins.safety +package info.nightscout.plugins.constraints.safety import app.aaps.shared.tests.TestBaseWithProfile import com.google.common.truth.Truth.assertThat @@ -19,7 +19,6 @@ import info.nightscout.interfaces.ui.UiInteraction import info.nightscout.interfaces.utils.HardLimits import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin -import info.nightscout.plugins.constraints.safety.SafetyPlugin import info.nightscout.pump.virtual.VirtualPumpPlugin import info.nightscout.source.GlimpPlugin import org.junit.jupiter.api.BeforeEach diff --git a/plugins/sensitivity/build.gradle b/plugins/sensitivity/build.gradle index 451ec3783e..143418c947 100644 --- a/plugins/sensitivity/build.gradle +++ b/plugins/sensitivity/build.gradle @@ -22,4 +22,6 @@ dependencies { implementation project(':core:utils') implementation project(':core:ui') implementation project(':core:validators') + + testImplementation project(':shared:tests') } \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/plugins/sensitivity/AbstractSensitivityPluginTest.kt b/plugins/sensitivity/src/test/java/info/nightscout/sensitivity/AbstractSensitivityPluginTest.kt similarity index 95% rename from app/src/test/java/info/nightscout/plugins/sensitivity/AbstractSensitivityPluginTest.kt rename to plugins/sensitivity/src/test/java/info/nightscout/sensitivity/AbstractSensitivityPluginTest.kt index 2e1dafc996..1ea0214d93 100644 --- a/app/src/test/java/info/nightscout/plugins/sensitivity/AbstractSensitivityPluginTest.kt +++ b/plugins/sensitivity/src/test/java/info/nightscout/sensitivity/AbstractSensitivityPluginTest.kt @@ -1,4 +1,4 @@ -package info.nightscout.plugins.sensitivity +package info.nightscout.sensitivity import app.aaps.shared.tests.TestBase import com.google.common.truth.Truth.assertThat @@ -9,7 +9,6 @@ import info.nightscout.interfaces.aps.AutosensResult import info.nightscout.interfaces.aps.Sensitivity import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.rx.logging.AAPSLogger -import info.nightscout.sensitivity.AbstractSensitivityPlugin import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.json.JSONObject