diff --git a/app/build.gradle b/app/build.gradle
index 7fb11a0e7d..49cdffb837 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -191,6 +191,8 @@ dependencies {
implementation project(':ui')
implementation project(':plugins')
implementation project(':implementation')
+ implementation project(':database:entities')
+ implementation project(':database:entities')
implementation project(':database:impl')
implementation project(':pump:combo')
implementation project(':pump:dana')
diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
index a6ab0792d6..7d74e8e14d 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
@@ -35,8 +35,6 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.activities.ProfileHelperActivity
import info.nightscout.androidaps.activities.SingleFragmentActivity
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.databinding.ActivityMainBinding
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.ActivePlugin
@@ -53,6 +51,8 @@ import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.tabs.TabPageAdapter
import info.nightscout.androidaps.utils.ui.UIRunnable
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.interfaces.AndroidPermission
import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.Config
diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.kt b/app/src/main/java/info/nightscout/androidaps/MainApp.kt
index f5ff42cd2d..758a5fedc8 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainApp.kt
+++ b/app/src/main/java/info/nightscout/androidaps/MainApp.kt
@@ -15,16 +15,12 @@ import androidx.work.PeriodicWorkRequest
import androidx.work.WorkManager
import dagger.android.AndroidInjector
import dagger.android.DaggerApplication
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
-import info.nightscout.androidaps.database.transactions.VersionChangeTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
+import info.nightscout.database.impl.transactions.VersionChangeTransaction
import info.nightscout.androidaps.db.CompatDBHelper
import info.nightscout.androidaps.di.DaggerAppComponent
import info.nightscout.androidaps.di.StaticInjector
-import info.nightscout.interfaces.ConfigBuilder
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils
@@ -35,9 +31,13 @@ import info.nightscout.androidaps.receivers.NetworkChangeReceiver
import info.nightscout.androidaps.receivers.TimeDateOrTZChangeReceiver
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
import info.nightscout.androidaps.utils.ProcessLifecycleListener
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry
import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.ConfigBuilder
import info.nightscout.interfaces.LocalAlertUtils
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.locale.LocaleHelper
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.plugins.general.overview.notifications.NotificationStore
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowserData.kt b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowserData.kt
index cc2410960c..f1adf86de2 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowserData.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowserData.kt
@@ -1,7 +1,7 @@
package info.nightscout.androidaps.activities
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.general.overview.OverviewData
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt
index 2069def3d6..a666b777c7 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt
@@ -11,8 +11,7 @@ import com.google.common.collect.Lists
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.data.PureProfile
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.databinding.ActivityProfilehelperBinding
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.interfaces.ActivePlugin
@@ -21,6 +20,7 @@ import info.nightscout.androidaps.interfaces.stats.TddCalculator
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.EffectiveProfileSwitch
import info.nightscout.plugins.profile.ProfilePlugin
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.events.EventLocalProfileChanged
diff --git a/app/src/main/java/info/nightscout/androidaps/db/CompatDBHelper.kt b/app/src/main/java/info/nightscout/androidaps/db/CompatDBHelper.kt
index 6240ad62de..ae715ad866 100644
--- a/app/src/main/java/info/nightscout/androidaps/db/CompatDBHelper.kt
+++ b/app/src/main/java/info/nightscout/androidaps/db/CompatDBHelper.kt
@@ -1,21 +1,21 @@
package info.nightscout.androidaps.db
import android.content.Context
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.entities.Food
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.entities.ProfileSwitch
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.events.EventNewHistoryData
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.Food
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TherapyEvent
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventExtendedBolusChange
import info.nightscout.rx.events.EventFoodDatabaseChanged
diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt b/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt
index e6789a9b8c..0d598198f5 100644
--- a/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt
+++ b/app/src/main/java/info/nightscout/androidaps/di/AppComponent.kt
@@ -4,13 +4,13 @@ import dagger.BindsInstance
import dagger.Component
import dagger.android.AndroidInjectionModule
import dagger.android.AndroidInjector
+import info.nightcout.shared.impl.di.SharedImplModule
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.combo.di.ComboModule
import info.nightscout.androidaps.dana.di.DanaHistoryModule
import info.nightscout.androidaps.dana.di.DanaModule
import info.nightscout.androidaps.danar.di.DanaRModule
import info.nightscout.androidaps.danars.di.DanaRSModule
-import info.nightscout.androidaps.database.DatabaseModule
import info.nightscout.androidaps.diaconn.di.DiaconnG8Module
import info.nightscout.androidaps.insight.di.InsightDatabaseModule
import info.nightscout.androidaps.insight.di.InsightModule
@@ -22,10 +22,10 @@ import info.nightscout.androidaps.plugins.pump.medtronic.di.MedtronicModule
import info.nightscout.androidaps.plugins.pump.omnipod.dash.di.OmnipodDashModule
import info.nightscout.androidaps.plugins.pump.omnipod.eros.di.OmnipodErosModule
import info.nightscout.automation.di.AutomationModule
+import info.nightscout.database.impl.DatabaseModule
import info.nightscout.implementation.di.ImplementationModule
import info.nightscout.plugins.di.PluginsModule
import info.nightscout.rx.di.RxModule
-import info.nightcout.shared.impl.di.SharedImplModule
import info.nightscout.shared.di.SharedModule
import info.nightscout.ui.di.UiModule
import javax.inject.Singleton
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 51e139b8e1..bf2d90a912 100644
--- a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt
+++ b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt
@@ -7,7 +7,7 @@ import dagger.Module
import dagger.Provides
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.MainApp
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.implementations.ActivityNamesImpl
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
index 45d260c25c..45e2d14775 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt
@@ -7,26 +7,26 @@ import android.view.View
import android.view.ViewGroup
import com.google.common.base.Joiner
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.databinding.DialogExtendedbolusBinding
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.ActivityNames
import info.nightscout.androidaps.interfaces.CommandQueue
-import info.nightscout.interfaces.Constraint
import info.nightscout.androidaps.interfaces.Constraints
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.interfaces.queue.Callback
-import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.ActivityNames
+import info.nightscout.interfaces.Constraint
+import info.nightscout.interfaces.queue.Callback
+import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.SafeParse
+import info.nightscout.shared.interfaces.ResourceHelper
import java.text.DecimalFormat
import java.util.LinkedList
import javax.inject.Inject
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
index 9896c9612b..08bec3cf63 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt
@@ -8,30 +8,30 @@ import android.view.ViewGroup
import com.google.common.base.Joiner
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.DetailedBolusInfo
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
import info.nightscout.androidaps.databinding.DialogFillBinding
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.ActivityNames
import info.nightscout.androidaps.interfaces.CommandQueue
-import info.nightscout.interfaces.Constraint
import info.nightscout.androidaps.interfaces.Constraints
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.interfaces.queue.Callback
import info.nightscout.androidaps.utils.DecimalFormatter
-import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.ActivityNames
+import info.nightscout.interfaces.Constraint
+import info.nightscout.interfaces.queue.Callback
+import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.SafeParse
+import info.nightscout.shared.interfaces.ResourceHelper
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import java.util.LinkedList
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
index a16c9cf0ef..85ce90fa01 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt
@@ -10,39 +10,39 @@ import android.view.ViewGroup
import com.google.common.base.Joiner
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.DetailedBolusInfo
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
import info.nightscout.androidaps.databinding.DialogInsulinBinding
import info.nightscout.androidaps.extensions.formatColor
-import info.nightscout.shared.extensions.toVisibility
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.ActivityNames
-import info.nightscout.interfaces.BolusTimer
import info.nightscout.androidaps.interfaces.CommandQueue
-import info.nightscout.interfaces.Config
-import info.nightscout.interfaces.Constraint
import info.nightscout.androidaps.interfaces.Constraints
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.interfaces.queue.Callback
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.DefaultValueHelper
-import info.nightscout.interfaces.utils.HtmlHelper
-import info.nightscout.shared.utils.T
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.extensions.toSignedString
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.ActivityNames
+import info.nightscout.interfaces.BolusTimer
+import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.Constraint
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.queue.Callback
+import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.SafeParse
+import info.nightscout.shared.extensions.toVisibility
+import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.shared.utils.T
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import java.text.DecimalFormat
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
index ec9e2a8aab..5ce44dc903 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
@@ -12,13 +12,9 @@ import android.view.WindowManager
import androidx.fragment.app.FragmentManager
import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.CancelCurrentOfflineEventIfAnyTransaction
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentOfflineEventTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CancelCurrentOfflineEventIfAnyTransaction
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentOfflineEventTransaction
import info.nightscout.androidaps.databinding.DialogLoopBinding
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.ActivePlugin
@@ -33,6 +29,10 @@ import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.ActivityNames
import info.nightscout.interfaces.ConfigBuilder
import info.nightscout.interfaces.Constraint
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
index 379d769d54..cda87b566e 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt
@@ -9,33 +9,33 @@ import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import com.google.common.base.Joiner
-import info.nightscout.interfaces.Constants
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
import info.nightscout.androidaps.databinding.DialogProfileswitchBinding
-import info.nightscout.shared.extensions.toVisibility
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.Config
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.HardLimits
-import info.nightscout.interfaces.utils.HtmlHelper
-import info.nightscout.shared.utils.T
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.extensions.toVisibility
+import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.shared.utils.T
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import java.text.DecimalFormat
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
index 30babfb9fa..4cc9372866 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt
@@ -7,29 +7,29 @@ import android.view.View
import android.view.ViewGroup
import com.google.common.base.Joiner
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.databinding.DialogTempbasalBinding
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.ActivityNames
import info.nightscout.androidaps.interfaces.CommandQueue
-import info.nightscout.interfaces.Constraint
import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.interfaces.pump.PumpDescription
import info.nightscout.androidaps.interfaces.PumpSync
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.interfaces.queue.Callback
-import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.ActivityNames
+import info.nightscout.interfaces.Constraint
+import info.nightscout.interfaces.pump.PumpDescription
+import info.nightscout.interfaces.queue.Callback
+import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.SafeParse
+import info.nightscout.shared.interfaces.ResourceHelper
import java.text.DecimalFormat
import java.util.LinkedList
import javax.inject.Inject
@@ -137,13 +137,13 @@ class TempBasalDialog : DialogFragmentWithDate() {
}
if (isPercentPump) {
uel.log(Action.TEMP_BASAL, Sources.TempBasalDialog,
- ValueWithUnit.Percent(percent),
- ValueWithUnit.Minute(durationInMinutes))
+ ValueWithUnit.Percent(percent),
+ ValueWithUnit.Minute(durationInMinutes))
commandQueue.tempBasalPercent(percent, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.NORMAL, callback)
} else {
uel.log(Action.TEMP_BASAL, Sources.TempBasalDialog,
- ValueWithUnit.Insulin(absolute),
- ValueWithUnit.Minute(durationInMinutes))
+ ValueWithUnit.Insulin(absolute),
+ ValueWithUnit.Minute(durationInMinutes))
commandQueue.tempBasalAbsolute(absolute, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.NORMAL, callback)
}
})
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
index cf5a27bff2..244625183b 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt
@@ -8,31 +8,30 @@ import android.view.ViewGroup
import android.widget.ArrayAdapter
import com.google.common.base.Joiner
import com.google.common.collect.Lists
-import info.nightscout.interfaces.Constants
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
+import info.nightscout.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
import info.nightscout.androidaps.databinding.DialogTemptargetBinding
import info.nightscout.androidaps.interfaces.Constraints
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.DefaultValueHelper
-import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.logging.LTag
-
+import info.nightscout.shared.interfaces.ResourceHelper
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import java.text.DecimalFormat
@@ -184,10 +183,14 @@ class TempTargetDialog : DialogFragmentWithDate() {
OKDialog.showConfirmation(activity, rh.gs(R.string.careportal_temporarytarget), HtmlHelper.fromHtml(Joiner.on("
").join(actions)), {
val units = profileFunction.getUnits()
when(reason) {
- rh.gs(R.string.eatingsoon) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
- rh.gs(R.string.activity) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.ACTIVITY), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
- rh.gs(R.string.hypo) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.HYPOGLYCEMIA), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
- rh.gs(R.string.manual) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.CUSTOM), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
+ rh.gs(R.string.eatingsoon) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(
+ TemporaryTarget.Reason.EATING_SOON), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
+ rh.gs(R.string.activity) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(
+ TemporaryTarget.Reason.ACTIVITY), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
+ rh.gs(R.string.hypo) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(
+ TemporaryTarget.Reason.HYPOGLYCEMIA), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
+ rh.gs(R.string.manual) -> uel.log(Action.TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged }, ValueWithUnit.TherapyEventTTReason(
+ TemporaryTarget.Reason.CUSTOM), ValueWithUnit.fromGlucoseUnit(target, units.asText), ValueWithUnit.Minute(duration))
rh.gs(R.string.stoptemptarget) -> uel.log(Action.CANCEL_TT, Sources.TTDialog, ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged })
}
if (target == 0.0 || duration == 0) {
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
index 3dce3b467d..5d899aaa02 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt
@@ -10,29 +10,29 @@ import android.view.ViewGroup
import com.google.common.base.Joiner
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.DetailedBolusInfo
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.databinding.DialogTreatmentBinding
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.ActivityNames
import info.nightscout.androidaps.interfaces.CommandQueue
-import info.nightscout.interfaces.Config
-import info.nightscout.interfaces.Constraint
import info.nightscout.androidaps.interfaces.Constraints
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.interfaces.queue.Callback
import info.nightscout.androidaps.utils.DecimalFormatter
-import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.ActivityNames
+import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.Constraint
+import info.nightscout.interfaces.queue.Callback
+import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.SafeParse
+import info.nightscout.shared.interfaces.ResourceHelper
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import java.text.DecimalFormat
@@ -156,10 +156,10 @@ class TreatmentDialog : DialogFragmentWithDate() {
detailedBolusInfo.context = context
if (recordOnlyChecked) {
uel.log(action, Sources.TreatmentDialog, if (insulinAfterConstraints != 0.0) rh.gs(R.string.record) else "",
- ValueWithUnit.Timestamp(detailedBolusInfo.timestamp).takeIf { eventTimeChanged },
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.record)).takeIf { insulinAfterConstraints != 0.0 },
- ValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 },
- ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
+ ValueWithUnit.Timestamp(detailedBolusInfo.timestamp).takeIf { eventTimeChanged },
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.record)).takeIf { insulinAfterConstraints != 0.0 },
+ ValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 },
+ ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
if (detailedBolusInfo.insulin > 0)
disposable += repository.runTransactionForResult(detailedBolusInfo.insertBolusTransaction())
.subscribe(
@@ -175,8 +175,8 @@ class TreatmentDialog : DialogFragmentWithDate() {
} else {
if (detailedBolusInfo.insulin > 0) {
uel.log(action, Sources.TreatmentDialog,
- ValueWithUnit.Insulin(insulinAfterConstraints),
- ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
+ ValueWithUnit.Insulin(insulinAfterConstraints),
+ ValueWithUnit.Gram(carbsAfterConstraints).takeIf { carbsAfterConstraints != 0 })
commandQueue.bolus(detailedBolusInfo, object : Callback() {
override fun run() {
if (!result.success) {
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
index 4bdbc87c4a..f0af37c084 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt
@@ -20,8 +20,8 @@ import dagger.android.HasAndroidInjector
import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.databinding.DialogWizardBinding
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.extensions.valueToUnits
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt
index 2b7a5ebc0c..f5d71a1f49 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.kt
@@ -18,14 +18,10 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentOfflineEventTransaction
-import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentOfflineEventTransaction
+import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.convertedToPercent
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
@@ -48,6 +44,10 @@ import info.nightscout.androidaps.receivers.ReceiverStatusStore
import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.androidaps.utils.extensions.buildDeviceStatus
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.ActivityNames
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt
index 66ba2dc1ce..26e2f972d2 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.kt
@@ -4,8 +4,8 @@ import android.content.Context
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.extensions.target
import info.nightscout.androidaps.interfaces.APS
import info.nightscout.androidaps.interfaces.ActivePlugin
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt
index 18c28bbf39..fd1c4c8e0f 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt
@@ -6,8 +6,8 @@ import androidx.preference.SwitchPreference
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.extensions.target
import info.nightscout.androidaps.interfaces.APS
import info.nightscout.androidaps.interfaces.ActivePlugin
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt
index 87acf2fde3..e9d5687b6a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt
@@ -4,7 +4,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.IobTotal
import info.nightscout.interfaces.data.MealData
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.getPassedDurationToTimeInMinutes
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt
index 3883b1ad57..995ecdffca 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt
@@ -4,7 +4,7 @@ import android.content.Context
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.interfaces.BuildHelper
import info.nightscout.androidaps.interfaces.Constraints
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 494903f745..923f18cfa2 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,10 @@ package info.nightscout.androidaps.plugins.configBuilder
import androidx.fragment.app.FragmentActivity
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.interfaces.APS
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.BgSource
-import info.nightscout.interfaces.ConfigBuilder
import info.nightscout.androidaps.interfaces.Insulin
-import info.nightscout.interfaces.NsClient
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.ProfileSource
import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.interfaces.PumpSync
@@ -20,6 +14,12 @@ import info.nightscout.androidaps.interfaces.Sensitivity
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.ConfigBuilder
+import info.nightscout.interfaces.NsClient
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.rx.bus.RxBus
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImpl.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImpl.kt
index edcaae518e..67790fcef0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImpl.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImpl.kt
@@ -1,10 +1,9 @@
package info.nightscout.androidaps.plugins.configBuilder
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.ProfileSwitch
-import info.nightscout.androidaps.database.transactions.InsertOrUpdateProfileSwitch
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
+import info.nightscout.database.impl.transactions.InsertOrUpdateProfileSwitch
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Profile
@@ -14,6 +13,7 @@ import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.androidaps.utils.extensions.fromConstant
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.main.R
+import info.nightscout.database.entities.ProfileSwitch
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.GlucoseUnit
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
index 4ecba0e9f4..0be07d510c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesFragment.kt
@@ -17,9 +17,6 @@ import androidx.recyclerview.widget.LinearSmoothScroller
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.databinding.ObjectivesFragmentBinding
import info.nightscout.androidaps.databinding.ObjectivesItemBinding
import info.nightscout.androidaps.dialogs.NtpProgressDialog
@@ -32,6 +29,9 @@ import info.nightscout.androidaps.setupwizard.events.EventSWUpdate
import info.nightscout.androidaps.utils.SntpClient
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.kt
index 8adfac1242..45c6a41f79 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.kt
@@ -2,8 +2,8 @@ package info.nightscout.androidaps.plugins.constraints.objectives.objectives
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.Loop
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
index 587dce9633..445925b8aa 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
@@ -12,10 +12,8 @@ import androidx.core.content.ContextCompat
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.HistoryBrowseActivity
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.databinding.ActionsFragmentBinding
import info.nightscout.androidaps.dialogs.ExtendedBolusDialog
import info.nightscout.androidaps.dialogs.FillDialog
@@ -37,6 +35,8 @@ import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.ui.SingleClickButton
import info.nightscout.androidaps.utils.ui.UIRunnable
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.interfaces.ActivityNames
import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.Config
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt
index aa32565319..5b3203fa67 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt
@@ -24,42 +24,42 @@ import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.DaggerAppCompatActivityWithResult
import info.nightscout.androidaps.activities.PreferencesActivity
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8PumpLogReset
-import info.nightscout.interfaces.AndroidPermission
-import info.nightscout.interfaces.BuildHelper
-import info.nightscout.interfaces.Config
-import info.nightscout.interfaces.ImportExportPrefs
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat
-import info.nightscout.interfaces.data.maintenance.PrefFileNotFoundError
-import info.nightscout.interfaces.data.maintenance.PrefIOError
-import info.nightscout.interfaces.data.maintenance.PrefMetadata
-import info.nightscout.interfaces.data.maintenance.Prefs
-import info.nightscout.interfaces.data.maintenance.PrefsFormat
-import info.nightscout.interfaces.data.maintenance.PrefsMetadataKey
-import info.nightscout.interfaces.data.maintenance.PrefsStatus
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.interfaces.utils.MidnightTime
-import info.nightscout.shared.utils.T
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.alertDialogs.PrefImportSummaryDialog
import info.nightscout.androidaps.utils.alertDialogs.TwoMessagesAlertDialog
import info.nightscout.androidaps.utils.alertDialogs.WarningDialog
import info.nightscout.androidaps.utils.protection.PasswordCheck
-import info.nightscout.interfaces.storage.Storage
import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.interfaces.AndroidPermission
+import info.nightscout.interfaces.BuildHelper
+import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.ImportExportPrefs
+import info.nightscout.interfaces.data.maintenance.PrefFileNotFoundError
+import info.nightscout.interfaces.data.maintenance.PrefIOError
+import info.nightscout.interfaces.data.maintenance.PrefMetadata
+import info.nightscout.interfaces.data.maintenance.Prefs
import info.nightscout.interfaces.data.maintenance.PrefsFile
+import info.nightscout.interfaces.data.maintenance.PrefsFormat
+import info.nightscout.interfaces.data.maintenance.PrefsMetadataKey
+import info.nightscout.interfaces.data.maintenance.PrefsStatus
+import info.nightscout.interfaces.storage.Storage
+import info.nightscout.interfaces.utils.MidnightTime
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAppExit
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import java.io.File
import java.io.FileNotFoundException
import java.io.IOException
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt
index 5f63e54276..ce64fb49e3 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt
@@ -10,9 +10,7 @@ import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.SingleFragmentActivity
import info.nightscout.androidaps.dana.database.DanaHistoryDatabase
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.databinding.MaintenanceFragmentBinding
import info.nightscout.androidaps.diaconn.database.DiaconnHistoryDatabase
import info.nightscout.androidaps.events.EventPreferenceChange
@@ -29,6 +27,8 @@ import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.PREFERENCES
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.interfaces.ImportExportPrefs
import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.AapsSchedulers
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
index 1f5ea937df..9edba3b27b 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
@@ -29,10 +29,7 @@ import dagger.android.HasAndroidInjector
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.databinding.OverviewFragmentBinding
import info.nightscout.androidaps.dialogs.InsulinDialog
import info.nightscout.androidaps.dialogs.LoopDialog
@@ -78,6 +75,9 @@ import info.nightscout.androidaps.utils.ui.UIRunnable
import info.nightscout.androidaps.utils.wizard.QuickWizard
import info.nightscout.automation.AutomationPlugin
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.interfaces.end
import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt
index 1f05372d6e..7d41714441 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt
@@ -3,19 +3,19 @@ package info.nightscout.androidaps.plugins.general.overview
import android.widget.TextView
import androidx.annotation.StringRes
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.plugins.sync.nsclient.extensions.age
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.Config
-import info.nightscout.interfaces.pump.PumpType
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.WarnColors
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.pump.PumpType
+import info.nightscout.plugins.sync.nsclient.extensions.age
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt
index f879060531..965ddc4426 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataHandlerMobile.kt
@@ -5,18 +5,10 @@ import android.content.Context
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.DetailedBolusInfo
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.TotalDailyDose
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.interfaces.end
-import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
+import info.nightscout.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
import info.nightscout.androidaps.dialogs.InsulinDialog
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.toStringShort
@@ -44,6 +36,14 @@ import info.nightscout.androidaps.utils.wizard.BolusWizard
import info.nightscout.androidaps.utils.wizard.QuickWizard
import info.nightscout.androidaps.utils.wizard.QuickWizardEntry
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TotalDailyDose
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.database.entities.interfaces.end
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.Constraint
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataLayerListenerServiceMobile.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataLayerListenerServiceMobile.kt
index 0af169d2e4..b8331cea44 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataLayerListenerServiceMobile.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataLayerListenerServiceMobile.kt
@@ -16,7 +16,7 @@ import com.google.android.gms.wearable.Wearable
import com.google.android.gms.wearable.WearableListenerService
import dagger.android.AndroidInjection
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.Loop
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt
index 867f81ad66..36175e3412 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt
@@ -5,12 +5,8 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.data.IobTotal
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.events.EventNewHistoryData
@@ -27,6 +23,10 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.workflow.CalculationWorkflow
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.interfaces.end
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt
index e8e3f5144e..0da991feee 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt
@@ -7,8 +7,8 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.extensions.target
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt
index 8f2868beaf..7c463efc71 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt
@@ -7,7 +7,7 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.ProfileFunction
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.kt
index ebad2db295..66614fc3a3 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityAAPSPlugin.kt
@@ -3,24 +3,24 @@ package info.nightscout.androidaps.plugins.sensitivity
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.interfaces.Sensitivity.SensitivityType
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult
-import info.nightscout.plugins.sync.nsclient.extensions.isTherapyEventEvent5minBack
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.extensions.isPSEvent5minBack
+import info.nightscout.database.entities.TherapyEvent
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
+import info.nightscout.plugins.sync.nsclient.extensions.isTherapyEventEvent5minBack
import info.nightscout.plugins.utils.Percentile
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
import org.json.JSONException
import org.json.JSONObject
import java.util.Arrays
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.kt
index 2c0164e4e8..bba17187b8 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityOref1Plugin.kt
@@ -3,25 +3,25 @@ package info.nightscout.androidaps.plugins.sensitivity
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.interfaces.Sensitivity.SensitivityType
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult
-import info.nightscout.plugins.sync.nsclient.extensions.isTherapyEventEvent5minBack
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.extensions.isPSEvent5minBack
+import info.nightscout.database.entities.TherapyEvent
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.interfaces.aps.SMBDefaults
+import info.nightscout.plugins.sync.nsclient.extensions.isTherapyEventEvent5minBack
import info.nightscout.plugins.utils.Percentile
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
import org.json.JSONException
import org.json.JSONObject
import java.util.Arrays
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt
index 7e5b9b2bf2..377c0ac213 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/SensitivityWeightedAveragePlugin.kt
@@ -4,23 +4,23 @@ import androidx.collection.LongSparseArray
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.interfaces.Sensitivity.SensitivityType
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult
-import info.nightscout.plugins.sync.nsclient.extensions.isTherapyEventEvent5minBack
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.extensions.isPSEvent5minBack
+import info.nightscout.database.entities.TherapyEvent
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
+import info.nightscout.plugins.sync.nsclient.extensions.isTherapyEventEvent5minBack
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
import org.json.JSONException
import org.json.JSONObject
import javax.inject.Inject
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt
index 0d16097b67..c2952c2453 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt
@@ -6,16 +6,16 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
import info.nightscout.androidaps.interfaces.BgSource
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.receivers.DataWorkerStorage
import info.nightscout.androidaps.receivers.Intents
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.plugins.source.BGSourceFragment
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt
index fcc9ba66a7..78d2cf94ef 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/DexcomPlugin.kt
@@ -9,23 +9,23 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
-import info.nightscout.androidaps.database.transactions.InvalidateGlucoseValueTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.transactions.InvalidateGlucoseValueTransaction
import info.nightscout.androidaps.extensions.fromConstant
import info.nightscout.androidaps.interfaces.BgSource
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.source.activities.RequestDexcomPermissionActivity
import info.nightscout.androidaps.receivers.DataWorkerStorage
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.plugins.source.BGSourceFragment
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt
index 48bf1c7e09..abf984eadd 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/EversensePlugin.kt
@@ -6,15 +6,15 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
-import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
import info.nightscout.androidaps.interfaces.BgSource
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.receivers.DataWorkerStorage
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.plugins.source.BGSourceFragment
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt
index a7563fd1b4..659ff06446 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlimpPlugin.kt
@@ -7,12 +7,12 @@ import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
import info.nightscout.androidaps.interfaces.BgSource
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.XDripBroadcast
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.plugins.source.BGSourceFragment
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt
index 41f78e2dc7..4f91486fac 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt
@@ -6,16 +6,16 @@ import android.os.Handler
import android.os.HandlerThread
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
import info.nightscout.androidaps.interfaces.BgSource
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/IntelligoPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/IntelligoPlugin.kt
index 74cd9c4d9a..7b30df2780 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/IntelligoPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/IntelligoPlugin.kt
@@ -8,16 +8,16 @@ import android.os.HandlerThread
import android.util.Log
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
import info.nightscout.androidaps.interfaces.BgSource
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt
index 08b9a9cafc..f4f29ba3c7 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/MM640gPlugin.kt
@@ -6,13 +6,13 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
import info.nightscout.androidaps.interfaces.BgSource
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.receivers.DataWorkerStorage
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.plugins.source.BGSourceFragment
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt
index 474ac21e5c..00ffd09c3f 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/PoctechPlugin.kt
@@ -6,13 +6,13 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
import info.nightscout.androidaps.interfaces.BgSource
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.XDripBroadcast
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.interfaces.utils.JsonHelper.safeGetString
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt
index 462fed8b35..c293e1e3c7 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/RandomBgPlugin.kt
@@ -5,14 +5,14 @@ import android.os.HandlerThread
import android.os.SystemClock
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
import info.nightscout.androidaps.interfaces.BgSource
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.utils.extensions.isRunningTest
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.BuildHelper
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt
index d49f2f9c95..4c6afa72b9 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/TomatoPlugin.kt
@@ -6,12 +6,12 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
import info.nightscout.androidaps.interfaces.BgSource
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.XDripBroadcast
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.plugins.source.BGSourceFragment
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt
index 787ab8bec8..ba89e19878 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/XdripPlugin.kt
@@ -6,13 +6,13 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
import info.nightscout.androidaps.interfaces.BgSource
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.receivers.DataWorkerStorage
import info.nightscout.androidaps.receivers.Intents
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.plugins.source.BGSourceFragment
diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt
index 9aab525609..0e79e2697c 100644
--- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveWorker.kt
@@ -15,7 +15,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.IobCobCalculator
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
index 27c4e76709..f0c350bc21 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt
@@ -6,47 +6,47 @@ import com.google.common.base.Joiner
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.DetailedBolusInfo
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InsertOrUpdateBolusCalculatorResultTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertOrUpdateBolusCalculatorResultTransaction
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.extensions.highValueToUnitsToString
import info.nightscout.androidaps.extensions.lowValueToUnitsToString
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.ActivityNames
-import info.nightscout.interfaces.BolusTimer
-import info.nightscout.interfaces.CarbTimer
import info.nightscout.androidaps.interfaces.CommandQueue
-import info.nightscout.interfaces.Config
-import info.nightscout.interfaces.Constraint
import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.Loop
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.interfaces.pump.PumpDescription
import info.nightscout.androidaps.interfaces.PumpSync
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
+import info.nightscout.androidaps.utils.alertDialogs.OKDialog
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.ActivityNames
+import info.nightscout.interfaces.BolusTimer
+import info.nightscout.interfaces.CarbTimer
+import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.Constraint
+import info.nightscout.interfaces.PluginBase
+import info.nightscout.interfaces.pump.PumpDescription
import info.nightscout.interfaces.queue.Callback
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.interfaces.utils.Round
-import info.nightscout.shared.utils.T
-import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventRefreshOverview
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import java.util.LinkedList
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizardEntry.kt b/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizardEntry.kt
index d0ef9fb08c..47b1b0cd60 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizardEntry.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/wizard/QuickWizardEntry.kt
@@ -2,21 +2,21 @@ package info.nightscout.androidaps.utils.wizard
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.extensions.valueToUnits
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.Loop
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
-import info.nightscout.shared.utils.DateUtil
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.utils.JsonHelper.safeGetInt
import info.nightscout.interfaces.utils.JsonHelper.safeGetString
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
import org.json.JSONException
import org.json.JSONObject
import java.util.UUID
diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/LoadBgDataWorker.kt b/app/src/main/java/info/nightscout/androidaps/workflow/LoadBgDataWorker.kt
index 213b808af0..6f8d816454 100644
--- a/app/src/main/java/info/nightscout/androidaps/workflow/LoadBgDataWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/workflow/LoadBgDataWorker.kt
@@ -5,7 +5,7 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.receivers.DataWorkerStorage
import info.nightscout.shared.utils.DateUtil
diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBgDataWorker.kt b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBgDataWorker.kt
index 4754c975d3..4a9e1146dc 100644
--- a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBgDataWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBgDataWorker.kt
@@ -5,7 +5,7 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.Profile
diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareIobAutosensGraphDataWorker.kt b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareIobAutosensGraphDataWorker.kt
index 5db55ebc88..0ee562bcce 100644
--- a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareIobAutosensGraphDataWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareIobAutosensGraphDataWorker.kt
@@ -11,8 +11,8 @@ import com.jjoe64.graphview.series.LineGraphSeries
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.IobTotal
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.shared.interfaces.ResourceHelper
diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/PreparePredictionsWorker.kt b/app/src/main/java/info/nightscout/androidaps/workflow/PreparePredictionsWorker.kt
index 812323f3fe..9b61629a65 100644
--- a/app/src/main/java/info/nightscout/androidaps/workflow/PreparePredictionsWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/workflow/PreparePredictionsWorker.kt
@@ -5,7 +5,7 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.general.overview.OverviewData
diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTemporaryTargetDataWorker.kt b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTemporaryTargetDataWorker.kt
index dd2fca9b9b..eada8b4423 100644
--- a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTemporaryTargetDataWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTemporaryTargetDataWorker.kt
@@ -8,8 +8,8 @@ import com.jjoe64.graphview.series.DataPoint
import com.jjoe64.graphview.series.LineGraphSeries
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.extensions.target
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.interfaces.Profile
diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTreatmentsDataWorker.kt b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTreatmentsDataWorker.kt
index fb4d069430..ed3829557a 100644
--- a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTreatmentsDataWorker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareTreatmentsDataWorker.kt
@@ -5,14 +5,10 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.general.overview.OverviewData
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.BolusDataPoint
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.CarbsDataPoint
@@ -24,10 +20,14 @@ import info.nightscout.androidaps.plugins.general.overview.graphExtensions.Thera
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress
import info.nightscout.androidaps.receivers.DataWorkerStorage
import info.nightscout.androidaps.utils.DefaultValueHelper
-import info.nightscout.interfaces.utils.Round
-import info.nightscout.shared.utils.T
import info.nightscout.androidaps.utils.Translator
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.utils.Round
import info.nightscout.rx.bus.RxBus
+import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.shared.utils.T
import javax.inject.Inject
class PrepareTreatmentsDataWorker(
diff --git a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
index 693e5b0a30..6e2012ecd1 100644
--- a/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
+++ b/app/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
@@ -4,14 +4,14 @@ import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.embedments.InsulinConfiguration
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ProfileStore
import info.nightscout.androidaps.utils.extensions.pureProfileFromJson
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.embedments.InsulinConfiguration
import info.nightscout.interfaces.Config
import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.interfaces.ResourceHelper
diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt
index 534c4c313c..0aa5358c57 100644
--- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt
+++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt
@@ -8,7 +8,7 @@ import info.nightscout.androidaps.dana.DanaPump
import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.danars.DanaRSPlugin
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.insight.database.InsightDatabaseDao
import info.nightscout.androidaps.insight.database.InsightDbHelper
import info.nightscout.androidaps.logging.UserEntryLogger
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt
index f478c59f20..6e43a490ca 100644
--- a/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt
+++ b/app/src/test/java/info/nightscout/androidaps/plugins/aps/loop/LoopPluginTest.kt
@@ -6,7 +6,7 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.TestBase
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.Constraints
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt
index bcbaa1a06b..a4d6fd6682 100644
--- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt
+++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt
@@ -4,7 +4,7 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.TestBaseWithProfile
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.interfaces.Constraint
import info.nightscout.androidaps.interfaces.Constraints
diff --git a/automation/build.gradle b/automation/build.gradle
index b19cd3347b..773f670e36 100644
--- a/automation/build.gradle
+++ b/automation/build.gradle
@@ -20,6 +20,7 @@ dependencies {
implementation project(':graphview')
implementation project(':core:core-main')
implementation project(':core:fabric')
+ implementation project(':database:entities')
implementation project(':database:impl')
implementation project(':app-wear-shared:rx')
implementation project(':app-wear-shared:shared')
diff --git a/automation/src/main/java/info/nightscout/automation/AutomationFragment.kt b/automation/src/main/java/info/nightscout/automation/AutomationFragment.kt
index 29239c18e2..c1c606a002 100644
--- a/automation/src/main/java/info/nightscout/automation/AutomationFragment.kt
+++ b/automation/src/main/java/info/nightscout/automation/AutomationFragment.kt
@@ -23,8 +23,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.HasAndroidInjector
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
@@ -35,6 +33,8 @@ import info.nightscout.automation.events.EventAutomationDataChanged
import info.nightscout.automation.events.EventAutomationUpdateGui
import info.nightscout.automation.triggers.TriggerConnector
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.interfaces.dragHelpers.ItemTouchHelperAdapter
import info.nightscout.interfaces.dragHelpers.OnStartDragListener
import info.nightscout.interfaces.dragHelpers.SimpleItemTouchHelperCallback
diff --git a/automation/src/main/java/info/nightscout/automation/actions/ActionCarePortalEvent.kt b/automation/src/main/java/info/nightscout/automation/actions/ActionCarePortalEvent.kt
index 4a143b4f78..d9448b3dc5 100644
--- a/automation/src/main/java/info/nightscout/automation/actions/ActionCarePortalEvent.kt
+++ b/automation/src/main/java/info/nightscout/automation/actions/ActionCarePortalEvent.kt
@@ -3,28 +3,27 @@ package info.nightscout.automation.actions
import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
import info.nightscout.androidaps.extensions.fromConstant
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
-import info.nightscout.interfaces.queue.Callback
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.interfaces.utils.JsonHelper
-import info.nightscout.shared.utils.T
import info.nightscout.automation.R
import info.nightscout.automation.elements.InputCarePortalMenu
import info.nightscout.automation.elements.InputDuration
import info.nightscout.automation.elements.InputString
import info.nightscout.automation.elements.LabelWithElement
import info.nightscout.automation.elements.LayoutBuilder
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.queue.Callback
+import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.rx.logging.LTag
-
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import org.json.JSONObject
diff --git a/automation/src/main/java/info/nightscout/automation/actions/ActionLoopDisable.kt b/automation/src/main/java/info/nightscout/automation/actions/ActionLoopDisable.kt
index e8b4121028..79a48efc99 100644
--- a/automation/src/main/java/info/nightscout/automation/actions/ActionLoopDisable.kt
+++ b/automation/src/main/java/info/nightscout/automation/actions/ActionLoopDisable.kt
@@ -3,16 +3,16 @@ package info.nightscout.automation.actions
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.interfaces.CommandQueue
-import info.nightscout.interfaces.ConfigBuilder
import info.nightscout.androidaps.interfaces.Loop
+import info.nightscout.androidaps.logging.UserEntryLogger
+import info.nightscout.automation.R
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.interfaces.ConfigBuilder
import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginType
-import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.interfaces.queue.Callback
-import info.nightscout.automation.R
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventRefreshOverview
import javax.inject.Inject
diff --git a/automation/src/main/java/info/nightscout/automation/actions/ActionLoopEnable.kt b/automation/src/main/java/info/nightscout/automation/actions/ActionLoopEnable.kt
index fb691a50fa..1a6e5bf0e7 100644
--- a/automation/src/main/java/info/nightscout/automation/actions/ActionLoopEnable.kt
+++ b/automation/src/main/java/info/nightscout/automation/actions/ActionLoopEnable.kt
@@ -3,15 +3,15 @@ package info.nightscout.automation.actions
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.interfaces.ConfigBuilder
import info.nightscout.androidaps.interfaces.Loop
+import info.nightscout.androidaps.logging.UserEntryLogger
+import info.nightscout.automation.R
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.interfaces.ConfigBuilder
import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginType
-import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.interfaces.queue.Callback
-import info.nightscout.automation.R
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventRefreshOverview
import javax.inject.Inject
diff --git a/automation/src/main/java/info/nightscout/automation/actions/ActionLoopResume.kt b/automation/src/main/java/info/nightscout/automation/actions/ActionLoopResume.kt
index 4a98b8105c..5e28a525f4 100644
--- a/automation/src/main/java/info/nightscout/automation/actions/ActionLoopResume.kt
+++ b/automation/src/main/java/info/nightscout/automation/actions/ActionLoopResume.kt
@@ -3,19 +3,19 @@ package info.nightscout.automation.actions
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.transactions.CancelCurrentOfflineEventIfAnyTransaction
-import info.nightscout.interfaces.ConfigBuilder
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CancelCurrentOfflineEventIfAnyTransaction
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.interfaces.queue.Callback
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.automation.R
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.interfaces.ConfigBuilder
+import info.nightscout.interfaces.queue.Callback
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventRefreshOverview
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.utils.DateUtil
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject
diff --git a/automation/src/main/java/info/nightscout/automation/actions/ActionLoopSuspend.kt b/automation/src/main/java/info/nightscout/automation/actions/ActionLoopSuspend.kt
index d7f6d46e48..3aed698e76 100644
--- a/automation/src/main/java/info/nightscout/automation/actions/ActionLoopSuspend.kt
+++ b/automation/src/main/java/info/nightscout/automation/actions/ActionLoopSuspend.kt
@@ -4,17 +4,17 @@ import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.interfaces.queue.Callback
-import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.automation.R
import info.nightscout.automation.elements.InputDuration
import info.nightscout.automation.elements.LabelWithElement
import info.nightscout.automation.elements.LayoutBuilder
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.queue.Callback
+import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventRefreshOverview
import org.json.JSONObject
diff --git a/automation/src/main/java/info/nightscout/automation/actions/ActionNotification.kt b/automation/src/main/java/info/nightscout/automation/actions/ActionNotification.kt
index d240cc4670..3b08d91c72 100644
--- a/automation/src/main/java/info/nightscout/automation/actions/ActionNotification.kt
+++ b/automation/src/main/java/info/nightscout/automation/actions/ActionNotification.kt
@@ -4,8 +4,8 @@ import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.interfaces.notifications.NotificationUserMessage
import info.nightscout.interfaces.queue.Callback
diff --git a/automation/src/main/java/info/nightscout/automation/actions/ActionProfileSwitch.kt b/automation/src/main/java/info/nightscout/automation/actions/ActionProfileSwitch.kt
index d556930ad1..9162401897 100644
--- a/automation/src/main/java/info/nightscout/automation/actions/ActionProfileSwitch.kt
+++ b/automation/src/main/java/info/nightscout/automation/actions/ActionProfileSwitch.kt
@@ -4,21 +4,20 @@ import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.interfaces.queue.Callback
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.automation.R
import info.nightscout.automation.elements.InputProfileName
import info.nightscout.automation.elements.LabelWithElement
import info.nightscout.automation.elements.LayoutBuilder
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.queue.Callback
+import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.rx.logging.LTag
-
+import info.nightscout.shared.utils.DateUtil
import org.json.JSONObject
import javax.inject.Inject
diff --git a/automation/src/main/java/info/nightscout/automation/actions/ActionProfileSwitchPercent.kt b/automation/src/main/java/info/nightscout/automation/actions/ActionProfileSwitchPercent.kt
index 935e4de072..32ebcde01c 100644
--- a/automation/src/main/java/info/nightscout/automation/actions/ActionProfileSwitchPercent.kt
+++ b/automation/src/main/java/info/nightscout/automation/actions/ActionProfileSwitchPercent.kt
@@ -4,13 +4,8 @@ import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.interfaces.queue.Callback
-import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.automation.R
import info.nightscout.automation.elements.Comparator
import info.nightscout.automation.elements.InputDuration
@@ -18,8 +13,12 @@ import info.nightscout.automation.elements.InputPercent
import info.nightscout.automation.elements.LabelWithElement
import info.nightscout.automation.elements.LayoutBuilder
import info.nightscout.automation.triggers.TriggerProfilePercent
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.queue.Callback
+import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.rx.logging.LTag
-
import org.json.JSONObject
import javax.inject.Inject
diff --git a/automation/src/main/java/info/nightscout/automation/actions/ActionStartTempTarget.kt b/automation/src/main/java/info/nightscout/automation/actions/ActionStartTempTarget.kt
index 012941df62..a391b07170 100644
--- a/automation/src/main/java/info/nightscout/automation/actions/ActionStartTempTarget.kt
+++ b/automation/src/main/java/info/nightscout/automation/actions/ActionStartTempTarget.kt
@@ -3,24 +3,14 @@ package info.nightscout.automation.actions
import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
-import info.nightscout.interfaces.Constants
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
import info.nightscout.androidaps.extensions.friendlyDescription
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.interfaces.queue.Callback
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.interfaces.utils.JsonHelper
-import info.nightscout.interfaces.utils.JsonHelper.safeGetDouble
import info.nightscout.automation.R
import info.nightscout.automation.elements.ComparatorExists
import info.nightscout.automation.elements.InputDuration
@@ -28,8 +18,17 @@ import info.nightscout.automation.elements.InputTempTarget
import info.nightscout.automation.elements.LabelWithElement
import info.nightscout.automation.elements.LayoutBuilder
import info.nightscout.automation.triggers.TriggerTempTarget
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.queue.Callback
+import info.nightscout.interfaces.utils.JsonHelper
+import info.nightscout.interfaces.utils.JsonHelper.safeGetDouble
import info.nightscout.rx.logging.LTag
-
+import info.nightscout.shared.utils.DateUtil
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import org.json.JSONObject
diff --git a/automation/src/main/java/info/nightscout/automation/actions/ActionStopTempTarget.kt b/automation/src/main/java/info/nightscout/automation/actions/ActionStopTempTarget.kt
index 48a6637cc3..c2f8ef349a 100644
--- a/automation/src/main/java/info/nightscout/automation/actions/ActionStopTempTarget.kt
+++ b/automation/src/main/java/info/nightscout/automation/actions/ActionStopTempTarget.kt
@@ -2,16 +2,15 @@ package info.nightscout.automation.actions
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.interfaces.queue.Callback
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.automation.R
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.interfaces.queue.Callback
import info.nightscout.rx.logging.LTag
-
+import info.nightscout.shared.utils.DateUtil
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject
diff --git a/automation/src/main/java/info/nightscout/automation/elements/InputCarePortalMenu.kt b/automation/src/main/java/info/nightscout/automation/elements/InputCarePortalMenu.kt
index 488e8e4b34..cffb628db0 100644
--- a/automation/src/main/java/info/nightscout/automation/elements/InputCarePortalMenu.kt
+++ b/automation/src/main/java/info/nightscout/automation/elements/InputCarePortalMenu.kt
@@ -8,9 +8,9 @@ import android.widget.LinearLayout
import android.widget.Spinner
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.automation.R
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.shared.interfaces.ResourceHelper
class InputCarePortalMenu(private val rh: ResourceHelper) : Element() {
diff --git a/automation/src/main/java/info/nightscout/automation/triggers/Trigger.kt b/automation/src/main/java/info/nightscout/automation/triggers/Trigger.kt
index 37c1f23d67..d8a963b6db 100644
--- a/automation/src/main/java/info/nightscout/automation/triggers/Trigger.kt
+++ b/automation/src/main/java/info/nightscout/automation/triggers/Trigger.kt
@@ -9,7 +9,7 @@ import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.google.common.base.Optional
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.ProfileFunction
diff --git a/automation/src/main/java/info/nightscout/automation/triggers/TriggerBolusAgo.kt b/automation/src/main/java/info/nightscout/automation/triggers/TriggerBolusAgo.kt
index e7a5aa3439..a9c2f57870 100644
--- a/automation/src/main/java/info/nightscout/automation/triggers/TriggerBolusAgo.kt
+++ b/automation/src/main/java/info/nightscout/automation/triggers/TriggerBolusAgo.kt
@@ -3,18 +3,17 @@ package info.nightscout.automation.triggers
import android.widget.LinearLayout
import com.google.common.base.Optional
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.interfaces.utils.JsonHelper
-import info.nightscout.interfaces.utils.JsonHelper.safeGetString
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.automation.R
import info.nightscout.automation.elements.Comparator
import info.nightscout.automation.elements.InputDuration
import info.nightscout.automation.elements.LabelWithElement
import info.nightscout.automation.elements.LayoutBuilder
import info.nightscout.automation.elements.StaticLabel
+import info.nightscout.database.entities.Bolus
+import info.nightscout.interfaces.utils.JsonHelper
+import info.nightscout.interfaces.utils.JsonHelper.safeGetString
import info.nightscout.rx.logging.LTag
-
import org.json.JSONObject
class TriggerBolusAgo(injector: HasAndroidInjector) : Trigger(injector) {
diff --git a/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTarget.kt b/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTarget.kt
index fe401a4eee..8d0884a9fc 100644
--- a/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTarget.kt
+++ b/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTarget.kt
@@ -3,7 +3,7 @@ package info.nightscout.automation.triggers
import android.widget.LinearLayout
import com.google.common.base.Optional
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.ValueWrapper
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.automation.R
import info.nightscout.automation.elements.ComparatorExists
diff --git a/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTargetValue.kt b/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTargetValue.kt
index cf8ec87ac6..de161f96ab 100644
--- a/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTargetValue.kt
+++ b/automation/src/main/java/info/nightscout/automation/triggers/TriggerTempTargetValue.kt
@@ -4,7 +4,7 @@ import android.widget.LinearLayout
import com.google.common.base.Optional
import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.Constants
-import info.nightscout.androidaps.database.ValueWrapper
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.interfaces.utils.JsonHelper
diff --git a/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
index d954e24b51..19b9e62b99 100644
--- a/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
+++ b/automation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
@@ -3,7 +3,7 @@ package info.nightscout.androidaps
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
diff --git a/automation/src/test/java/info/nightscout/automation/actions/ActionCarePortalEventTest.kt b/automation/src/test/java/info/nightscout/automation/actions/ActionCarePortalEventTest.kt
index 61bebe6282..4491760ba6 100644
--- a/automation/src/test/java/info/nightscout/automation/actions/ActionCarePortalEventTest.kt
+++ b/automation/src/test/java/info/nightscout/automation/actions/ActionCarePortalEventTest.kt
@@ -1,7 +1,7 @@
package info.nightscout.automation.actions
-import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
-import info.nightscout.androidaps.database.transactions.Transaction
+import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
+import info.nightscout.database.impl.transactions.Transaction
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.queue.Callback
import info.nightscout.automation.elements.InputCarePortalMenu
diff --git a/automation/src/test/java/info/nightscout/automation/actions/ActionLoopResumeTest.kt b/automation/src/test/java/info/nightscout/automation/actions/ActionLoopResumeTest.kt
index da7e057b1a..dc953fbbed 100644
--- a/automation/src/test/java/info/nightscout/automation/actions/ActionLoopResumeTest.kt
+++ b/automation/src/test/java/info/nightscout/automation/actions/ActionLoopResumeTest.kt
@@ -1,10 +1,10 @@
package info.nightscout.automation.actions
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.transactions.CancelCurrentOfflineEventIfAnyTransaction
-import info.nightscout.androidaps.database.transactions.Transaction
-import info.nightscout.interfaces.queue.Callback
+import info.nightscout.database.impl.transactions.CancelCurrentOfflineEventIfAnyTransaction
+import info.nightscout.database.impl.transactions.Transaction
import info.nightscout.automation.R
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.interfaces.queue.Callback
import io.reactivex.rxjava3.core.Single
import org.junit.Assert
import org.junit.Before
diff --git a/automation/src/test/java/info/nightscout/automation/actions/ActionNotificationTest.kt b/automation/src/test/java/info/nightscout/automation/actions/ActionNotificationTest.kt
index 9b5084943b..2c0ab3b5dc 100644
--- a/automation/src/test/java/info/nightscout/automation/actions/ActionNotificationTest.kt
+++ b/automation/src/test/java/info/nightscout/automation/actions/ActionNotificationTest.kt
@@ -4,9 +4,9 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
-import info.nightscout.androidaps.database.transactions.Transaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
+import info.nightscout.database.impl.transactions.Transaction
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.interfaces.queue.Callback
import info.nightscout.automation.R
diff --git a/automation/src/test/java/info/nightscout/automation/actions/ActionStartTempTargetTest.kt b/automation/src/test/java/info/nightscout/automation/actions/ActionStartTempTargetTest.kt
index 9959e3f08d..dc5f7f78cd 100644
--- a/automation/src/test/java/info/nightscout/automation/actions/ActionStartTempTargetTest.kt
+++ b/automation/src/test/java/info/nightscout/automation/actions/ActionStartTempTargetTest.kt
@@ -1,13 +1,13 @@
package info.nightscout.automation.actions
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
-import info.nightscout.androidaps.database.transactions.Transaction
-import info.nightscout.interfaces.GlucoseUnit
-import info.nightscout.interfaces.queue.Callback
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
+import info.nightscout.database.impl.transactions.Transaction
import info.nightscout.automation.R
import info.nightscout.automation.elements.InputDuration
import info.nightscout.automation.elements.InputTempTarget
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.queue.Callback
import io.reactivex.rxjava3.core.Single
import org.junit.Assert
import org.junit.Before
diff --git a/automation/src/test/java/info/nightscout/automation/actions/ActionStopTempTargetTest.kt b/automation/src/test/java/info/nightscout/automation/actions/ActionStopTempTargetTest.kt
index 8d2d889766..f56ea7ae3f 100644
--- a/automation/src/test/java/info/nightscout/automation/actions/ActionStopTempTargetTest.kt
+++ b/automation/src/test/java/info/nightscout/automation/actions/ActionStopTempTargetTest.kt
@@ -1,10 +1,10 @@
package info.nightscout.automation.actions
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
-import info.nightscout.androidaps.database.transactions.Transaction
-import info.nightscout.interfaces.queue.Callback
+import info.nightscout.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
+import info.nightscout.database.impl.transactions.Transaction
import info.nightscout.automation.R
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.interfaces.queue.Callback
import io.reactivex.rxjava3.core.Single
import org.junit.Assert
import org.junit.Before
diff --git a/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt b/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt
index 771befbe00..c77e943724 100644
--- a/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt
+++ b/automation/src/test/java/info/nightscout/automation/actions/ActionsTestBase.kt
@@ -5,22 +5,22 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.TestPumpPlugin
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.entities.OfflineEvent
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
+import info.nightscout.androidaps.interfaces.Loop
+import info.nightscout.androidaps.interfaces.Profile
+import info.nightscout.androidaps.interfaces.ProfileSource
+import info.nightscout.androidaps.logging.UserEntryLogger
+import info.nightscout.automation.triggers.Trigger
+import info.nightscout.database.entities.OfflineEvent
import info.nightscout.interfaces.ConfigBuilder
import info.nightscout.interfaces.Constraint
import info.nightscout.interfaces.GlucoseUnit
-import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
-import info.nightscout.androidaps.interfaces.Profile
-import info.nightscout.androidaps.interfaces.ProfileSource
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.interfaces.SmsCommunicator
-import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.automation.triggers.Trigger
import info.nightscout.rx.logging.AAPSLogger
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import org.junit.Before
import org.mockito.Mock
diff --git a/automation/src/test/java/info/nightscout/automation/triggers/TriggerBgTest.kt b/automation/src/test/java/info/nightscout/automation/triggers/TriggerBgTest.kt
index da9cf0d5b2..c761573b75 100644
--- a/automation/src/test/java/info/nightscout/automation/triggers/TriggerBgTest.kt
+++ b/automation/src/test/java/info/nightscout/automation/triggers/TriggerBgTest.kt
@@ -1,9 +1,9 @@
package info.nightscout.automation.triggers
import com.google.common.base.Optional
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.automation.elements.Comparator
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.interfaces.GlucoseUnit
import org.json.JSONObject
import org.junit.Assert
import org.junit.Before
diff --git a/automation/src/test/java/info/nightscout/automation/triggers/TriggerBolusAgoTest.kt b/automation/src/test/java/info/nightscout/automation/triggers/TriggerBolusAgoTest.kt
index 30eff00a5a..78e69b7322 100644
--- a/automation/src/test/java/info/nightscout/automation/triggers/TriggerBolusAgoTest.kt
+++ b/automation/src/test/java/info/nightscout/automation/triggers/TriggerBolusAgoTest.kt
@@ -1,9 +1,9 @@
package info.nightscout.automation.triggers
import com.google.common.base.Optional
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.automation.elements.Comparator
+import info.nightscout.database.entities.Bolus
import io.reactivex.rxjava3.core.Single
import org.json.JSONException
import org.json.JSONObject
diff --git a/automation/src/test/java/info/nightscout/automation/triggers/TriggerDeltaTest.kt b/automation/src/test/java/info/nightscout/automation/triggers/TriggerDeltaTest.kt
index 13ad7c396b..50007685a7 100644
--- a/automation/src/test/java/info/nightscout/automation/triggers/TriggerDeltaTest.kt
+++ b/automation/src/test/java/info/nightscout/automation/triggers/TriggerDeltaTest.kt
@@ -1,11 +1,11 @@
package info.nightscout.automation.triggers
import com.google.common.base.Optional
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.automation.R
import info.nightscout.automation.elements.Comparator
import info.nightscout.automation.elements.InputDelta.DeltaType
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.interfaces.GlucoseUnit
import org.json.JSONObject
import org.junit.Assert
import org.junit.Before
diff --git a/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetValueTest.kt b/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetValueTest.kt
index bbff8ede27..393e231a47 100644
--- a/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetValueTest.kt
+++ b/automation/src/test/java/info/nightscout/automation/triggers/TriggerTempTargetValueTest.kt
@@ -1,11 +1,11 @@
package info.nightscout.automation.triggers
import com.google.common.base.Optional
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.automation.R
import info.nightscout.automation.elements.Comparator
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.interfaces.GlucoseUnit
import io.reactivex.rxjava3.core.Single
import org.json.JSONObject
import org.junit.Assert
diff --git a/core/core-main/build.gradle b/core/core-main/build.gradle
index 45cb57f011..5b2afde88d 100644
--- a/core/core-main/build.gradle
+++ b/core/core-main/build.gradle
@@ -17,6 +17,7 @@ dependencies {
implementation project(':graphview')
implementation project(':app-wear-shared:rx')
implementation project(':app-wear-shared:shared')
+ implementation project(':database:entities')
implementation project(':database:impl')
implementation project(':interfaces')
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt b/core/core-main/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt
index 8fd8fcfaab..74c62f0fb3 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/data/DetailedBolusInfo.kt
@@ -2,12 +2,12 @@ package info.nightscout.androidaps.data
import android.content.Context
import com.google.gson.Gson
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.transactions.InsertOrUpdateBolusTransaction
-import info.nightscout.androidaps.database.transactions.InsertOrUpdateCarbsTransaction
+import info.nightscout.database.impl.transactions.InsertOrUpdateBolusTransaction
+import info.nightscout.database.impl.transactions.InsertOrUpdateCarbsTransaction
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.TherapyEvent
import info.nightscout.interfaces.pump.PumpType
class DetailedBolusInfo {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/data/InMemoryGlucoseValue.kt b/core/core-main/src/main/java/info/nightscout/androidaps/data/InMemoryGlucoseValue.kt
index 00a89d48db..040a191bf6 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/data/InMemoryGlucoseValue.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/data/InMemoryGlucoseValue.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.data
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
class InMemoryGlucoseValue constructor(var timestamp: Long = 0L, var value: Double = 0.0, var interpolated: Boolean = false) {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/data/LocalInsulin.kt b/core/core-main/src/main/java/info/nightscout/androidaps/data/LocalInsulin.kt
index 92c1b2e607..df103f7fdd 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/data/LocalInsulin.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/data/LocalInsulin.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.data
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
import info.nightscout.interfaces.data.Iob
import kotlin.math.exp
import kotlin.math.pow
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt b/core/core-main/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt
index 2ffeeaaebf..feb2c409e8 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/data/ProfileSealed.kt
@@ -1,32 +1,32 @@
package info.nightscout.androidaps.data
-import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.data.Block
-import info.nightscout.androidaps.database.data.TargetBlock
-import info.nightscout.androidaps.database.embedments.InsulinConfiguration
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
-import info.nightscout.androidaps.database.entities.ProfileSwitch
import info.nightscout.androidaps.extensions.blockValueBySeconds
import info.nightscout.androidaps.extensions.highTargetBlockValueBySeconds
import info.nightscout.androidaps.extensions.lowTargetBlockValueBySeconds
import info.nightscout.androidaps.extensions.shiftBlock
import info.nightscout.androidaps.extensions.shiftTargetBlock
import info.nightscout.androidaps.extensions.targetBlockValueBySeconds
-import info.nightscout.interfaces.Config
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.Profile.Companion.secondsFromMidnight
import info.nightscout.androidaps.interfaces.Profile.Companion.toMgdl
import info.nightscout.androidaps.interfaces.Profile.ProfileValue
import info.nightscout.androidaps.interfaces.Pump
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
-import info.nightscout.interfaces.notifications.Notification
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.HardLimits
-import info.nightscout.shared.utils.T
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.data.Block
+import info.nightscout.database.entities.data.TargetBlock
+import info.nightscout.database.entities.embedments.InsulinConfiguration
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.notifications.Notification
import info.nightscout.rx.bus.RxBus
+import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import org.json.JSONArray
import org.json.JSONObject
import java.text.DecimalFormat
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/data/PureProfile.kt b/core/core-main/src/main/java/info/nightscout/androidaps/data/PureProfile.kt
index cad67c56e7..112640e877 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/data/PureProfile.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/data/PureProfile.kt
@@ -1,10 +1,10 @@
package info.nightscout.androidaps.data
-import info.nightscout.androidaps.database.data.Block
-import info.nightscout.androidaps.database.data.TargetBlock
+import info.nightscout.database.entities.data.Block
+import info.nightscout.database.entities.data.TargetBlock
import info.nightscout.interfaces.GlucoseUnit
import org.json.JSONObject
-import java.util.*
+import java.util.TimeZone
class PureProfile(
var jsonObject: JSONObject, // source json data (must correspond to the rest of the profile)
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt b/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt
index f78e1986b1..1ae58f23c0 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt
@@ -9,14 +9,14 @@ import android.view.Window
import android.view.WindowManager
import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.activities.DialogAppCompatActivity
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
import info.nightscout.core.main.R
import info.nightscout.core.main.databinding.DialogBolusprogressBinding
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventOverviewBolusProgress
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt b/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt
index 2faf1346d7..23e5067f88 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt
@@ -12,14 +12,14 @@ import android.view.Window
import android.view.WindowManager
import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.activities.DialogAppCompatActivity
-import info.nightscout.core.main.R
-import info.nightscout.core.main.databinding.DialogErrorBinding
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
-import info.nightscout.shared.utils.T
+import info.nightscout.core.main.R
+import info.nightscout.core.main.databinding.DialogErrorBinding
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.rx.logging.AAPSLogger
+import info.nightscout.shared.utils.T
import javax.inject.Inject
class ErrorDialog : DaggerDialogFragment() {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt b/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt
index 83500f2793..b4f4ea79b1 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt
@@ -12,8 +12,8 @@ import dagger.android.support.DaggerDialogFragment
import info.nightscout.core.main.R
import info.nightscout.core.main.databinding.DialogProfileviewerBinding
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.shared.extensions.toVisibility
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Profile
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/events/EventEffectiveProfileSwitchChanged.kt b/core/core-main/src/main/java/info/nightscout/androidaps/events/EventEffectiveProfileSwitchChanged.kt
index e81bba9c71..f162cfd51c 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/events/EventEffectiveProfileSwitchChanged.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/events/EventEffectiveProfileSwitchChanged.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.events
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.EffectiveProfileSwitch
import info.nightscout.rx.events.Event
class EventEffectiveProfileSwitchChanged(effectiveProfileSwitch: EffectiveProfileSwitch?) : Event() {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/events/EventNewBG.kt b/core/core-main/src/main/java/info/nightscout/androidaps/events/EventNewBG.kt
index ae23b56a05..8760bde63f 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/events/EventNewBG.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/events/EventNewBG.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.events
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.rx.events.EventLoop
class EventNewBG(val glucoseValue: GlucoseValue?) : EventLoop()
\ No newline at end of file
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/events/EventNewHistoryData.kt b/core/core-main/src/main/java/info/nightscout/androidaps/events/EventNewHistoryData.kt
index cf13925bb6..317b04d049 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/events/EventNewHistoryData.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/events/EventNewHistoryData.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.events
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.rx.events.Event
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BlockExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BlockExtension.kt
index 013b1536eb..0a8be6f26a 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BlockExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BlockExtension.kt
@@ -1,7 +1,7 @@
package info.nightscout.androidaps.extensions
-import info.nightscout.androidaps.database.data.Block
-import info.nightscout.androidaps.database.data.TargetBlock
+import info.nightscout.database.entities.data.Block
+import info.nightscout.database.entities.data.TargetBlock
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import org.json.JSONArray
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt
index 001952e053..3703192377 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt
@@ -2,17 +2,16 @@ package info.nightscout.androidaps.extensions
import com.google.gson.Gson
import com.google.gson.JsonSyntaxException
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
-import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.utils.DateUtil
+import info.nightscout.database.entities.BolusCalculatorResult
import info.nightscout.interfaces.utils.JsonHelper
+import info.nightscout.shared.utils.DateUtil
import org.json.JSONObject
fun BolusCalculatorResult.toJson(isAdd: Boolean, dateUtil: DateUtil, profileFunction: ProfileFunction): JSONObject =
JSONObject()
- .put("eventType", TherapyEvent.Type.BOLUS_WIZARD.text)
+ .put("eventType", info.nightscout.database.entities.TherapyEvent.Type.BOLUS_WIZARD.text)
.put("created_at", dateUtil.toISOString(timestamp))
.put("isValid", isValid)
.put("bolusCalculatorResult", Gson().toJson(this))
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt
index 34162b2368..af0a005fad 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/BolusExtension.kt
@@ -1,15 +1,10 @@
package info.nightscout.androidaps.extensions
-import info.nightscout.interfaces.data.Iob
import info.nightscout.androidaps.data.LocalInsulin
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Insulin
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.interfaces.utils.JsonHelper
-import org.json.JSONObject
+import info.nightscout.database.entities.Bolus
+import info.nightscout.interfaces.data.Iob
fun Bolus.iobCalc(activePlugin: ActivePlugin, time: Long, dia: Double): Iob {
if (!isValid || type == Bolus.Type.PRIMING ) return Iob()
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt
index 619ae5c390..5651f1e0a8 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ExtendedBolusExtension.kt
@@ -1,15 +1,15 @@
package info.nightscout.androidaps.extensions
import info.nightscout.androidaps.data.IobTotal
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.interfaces.end
import info.nightscout.androidaps.interfaces.Insulin
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.interfaces.end
+import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import kotlin.math.ceil
import kotlin.math.max
@@ -43,7 +43,7 @@ fun ExtendedBolus.toTemporaryBasal(profile: Profile): TemporaryBasal =
isAbsolute = true,
isValid = isValid,
interfaceIDs_backing = interfaceIDs_backing,
- type = TemporaryBasal.Type.FAKE_EXTENDED
+ type = info.nightscout.database.entities.TemporaryBasal.Type.FAKE_EXTENDED
)
fun ExtendedBolus.iobCalc(time: Long, profile: Profile, insulinInterface: Insulin): IobTotal {
@@ -62,7 +62,7 @@ fun ExtendedBolus.iobCalc(time: Long, profile: Profile, insulinInterface: Insuli
val tempBolusPart = Bolus(
timestamp = calcDate,
amount = tempBolusSize,
- type = Bolus.Type.NORMAL
+ type = info.nightscout.database.entities.Bolus.Type.NORMAL
)
val aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, dia)
result.iob += aIOB.iobContrib
@@ -110,7 +110,7 @@ fun ExtendedBolus.iobCalc(
val tempBolusPart = Bolus(
timestamp = calcDate,
amount = tempBolusSize,
- type = Bolus.Type.NORMAL
+ type = info.nightscout.database.entities.Bolus.Type.NORMAL
)
val aIOB = insulinInterface.iobCalcForTreatment(tempBolusPart, time, dia)
result.iob += aIOB.iobContrib
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/FoodExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/FoodExtension.kt
index c77c73a607..f48f8b1bc3 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/FoodExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/FoodExtension.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.extensions
-import info.nightscout.androidaps.database.entities.Food
+import info.nightscout.database.entities.Food
import info.nightscout.interfaces.utils.JsonHelper
import org.json.JSONObject
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt
index 808ae79d6f..97f62fa922 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/GlucoseValueExtension.kt
@@ -1,10 +1,10 @@
package info.nightscout.androidaps.extensions
+import info.nightscout.androidaps.utils.DecimalFormatter
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.Constants
-import info.nightscout.androidaps.database.entities.GlucoseValue
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.shared.utils.DateUtil
-import info.nightscout.androidaps.utils.DecimalFormatter
import org.json.JSONObject
fun GlucoseValue.valueToUnits(units: GlucoseUnit): Double =
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt
index 8c41a81e4f..e4b873ac12 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/ProfileSwitchExtension.kt
@@ -1,15 +1,15 @@
package info.nightscout.androidaps.utils.extensions
-import info.nightscout.interfaces.Constants
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.data.PureProfile
-import info.nightscout.androidaps.database.entities.ProfileSwitch
import info.nightscout.androidaps.extensions.blockFromJsonArray
import info.nightscout.androidaps.extensions.targetBlockFromJsonArray
-import info.nightscout.interfaces.GlucoseUnit
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.utils.JsonHelper
+import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import org.json.JSONObject
import java.util.TimeZone
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/PumpTypeExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/PumpTypeExtension.kt
index d6b4c13d3b..0514020c57 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/PumpTypeExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/PumpTypeExtension.kt
@@ -1,7 +1,7 @@
package info.nightscout.androidaps.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.interfaces.pump.PumpType
fun PumpType.Companion.fromDbSource(s: UserEntry.Sources): PumpType.Source =
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt
index 7553aa59f8..1e546136db 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryBasalExtension.kt
@@ -1,15 +1,15 @@
package info.nightscout.androidaps.extensions
import info.nightscout.androidaps.data.IobTotal
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.interfaces.end
import info.nightscout.androidaps.interfaces.Insulin
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter.to0Decimal
import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.interfaces.end
+import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import kotlin.math.ceil
import kotlin.math.max
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt
index 763505043a..0ff7e6cdd8 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TemporaryTargetExtension.kt
@@ -1,13 +1,13 @@
package info.nightscout.androidaps.extensions
-import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
+import info.nightscout.androidaps.utils.DecimalFormatter
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.utils.DateUtil
-import info.nightscout.androidaps.utils.DecimalFormatter
-import info.nightscout.interfaces.Constants
import java.util.concurrent.TimeUnit
fun TemporaryTarget.isInProgress(dateUtil: DateUtil): Boolean =
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TherapyEventExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TherapyEventExtension.kt
index 66330481a8..9ea429cc47 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TherapyEventExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TherapyEventExtension.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.extensions
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.TherapyEvent
import info.nightscout.interfaces.GlucoseUnit
fun TherapyEvent.isOlderThan(hours: Double): Boolean {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TotalDailyDoseExtension.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TotalDailyDoseExtension.kt
index 417daeaefb..f4b8301ad1 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TotalDailyDoseExtension.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TotalDailyDoseExtension.kt
@@ -6,9 +6,9 @@ import android.view.Gravity
import android.widget.TableRow
import android.widget.TextView
import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.TotalDailyDose
-import info.nightscout.shared.utils.DateUtil
+import info.nightscout.database.entities.TotalDailyDose
import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.shared.utils.DateUtil
val TotalDailyDose.total
get() = if (totalAmount > 0) totalAmount else basalAmount + bolusAmount
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TrendArrowIcon.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TrendArrowIcon.kt
index 1331e7c4c5..5b852690f8 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TrendArrowIcon.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/TrendArrowIcon.kt
@@ -1,7 +1,7 @@
package info.nightscout.androidaps.extensions
import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
fun GlucoseValue.TrendArrow.directionToIcon(): Int {
return when {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/UserEntryExt.kt b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/UserEntryExt.kt
index f766b727f0..3c52968d4f 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/extensions/UserEntryExt.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/extensions/UserEntryExt.kt
@@ -1,7 +1,7 @@
package info.nightscout.androidaps.extensions
import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.UserEntry.*
+import info.nightscout.database.entities.UserEntry.ColorGroup
fun ColorGroup.colorId(): Int {
return when (this) {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/BgSource.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/BgSource.kt
index 91e4638353..9a8eab4ba5 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/BgSource.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/BgSource.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.interfaces
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
interface BgSource {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/DataSyncSelector.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/DataSyncSelector.kt
index bf215d0229..01018c833a 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/DataSyncSelector.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/DataSyncSelector.kt
@@ -1,7 +1,18 @@
package info.nightscout.androidaps.interfaces
-import info.nightscout.androidaps.database.entities.DeviceStatus
-import info.nightscout.androidaps.database.entities.*
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.DeviceStatus
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.Food
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TherapyEvent
import org.json.JSONObject
interface DataSyncSelector {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Insulin.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Insulin.kt
index 0fcd641363..d5f59886e2 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Insulin.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Insulin.kt
@@ -1,9 +1,9 @@
package info.nightscout.androidaps.interfaces
-import info.nightscout.interfaces.data.Iob
-import info.nightscout.androidaps.database.embedments.InsulinConfiguration
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.embedments.InsulinConfiguration
import info.nightscout.interfaces.ConfigExportImport
+import info.nightscout.interfaces.data.Iob
interface Insulin : ConfigExportImport {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt
index 9578f50cd0..df24dd5f67 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/IobCobCalculator.kt
@@ -1,14 +1,14 @@
package info.nightscout.androidaps.interfaces
import info.nightscout.androidaps.data.IobTotal
-import info.nightscout.interfaces.data.MealData
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.entities.TemporaryBasal
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.BasalData
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.interfaces.data.MealData
import org.json.JSONArray
interface IobCobCalculator {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt
index 3523c8a16b..47ca978fc3 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/Loop.kt
@@ -1,9 +1,9 @@
package info.nightscout.androidaps.interfaces
-import info.nightscout.interfaces.data.PumpEnactResult
-import info.nightscout.androidaps.database.entities.OfflineEvent
import info.nightscout.androidaps.plugins.aps.loop.APSResult
+import info.nightscout.database.entities.OfflineEvent
import info.nightscout.interfaces.Constraint
+import info.nightscout.interfaces.data.PumpEnactResult
interface Loop {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ProfileFunction.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ProfileFunction.kt
index e0d3dd46e2..fe1109cf19 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ProfileFunction.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/ProfileFunction.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.interfaces
-import info.nightscout.androidaps.database.entities.ProfileSwitch
+import info.nightscout.database.entities.ProfileSwitch
import info.nightscout.interfaces.GlucoseUnit
interface ProfileFunction {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt
index a137bb5ec8..3dde921289 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/PumpSync.kt
@@ -1,7 +1,7 @@
package info.nightscout.androidaps.interfaces
import info.nightscout.androidaps.data.DetailedBolusInfo
-import info.nightscout.androidaps.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryBasal
import info.nightscout.interfaces.pump.PumpType
/**
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/TrendCalculator.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/TrendCalculator.kt
index 0235f355a3..41834b2937 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/TrendCalculator.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/TrendCalculator.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.interfaces
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
/**
* Convert BG direction value to trend arrow or calculate it if not provided
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/XDripBroadcast.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/XDripBroadcast.kt
index 2cd6782c8b..009a062754 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/XDripBroadcast.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/XDripBroadcast.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.interfaces
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
import org.json.JSONArray
import org.json.JSONObject
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/stats/TddCalculator.kt b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/stats/TddCalculator.kt
index f8da1e0c74..dbe37c5233 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/stats/TddCalculator.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/interfaces/stats/TddCalculator.kt
@@ -3,7 +3,7 @@ package info.nightscout.androidaps.interfaces.stats
import android.content.Context
import android.util.LongSparseArray
import android.widget.TableLayout
-import info.nightscout.androidaps.database.entities.TotalDailyDose
+import info.nightscout.database.entities.TotalDailyDose
interface TddCalculator {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt b/core/core-main/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt
index 36f87e20ae..1d34a47ac7 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/logging/UserEntryLogger.kt
@@ -1,16 +1,16 @@
package info.nightscout.androidaps.logging
import info.nightscout.androidaps.annotations.OpenForTesting
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.UserEntryTransaction
-import info.nightscout.shared.utils.DateUtil
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.UserEntryTransaction
import info.nightscout.androidaps.utils.userEntry.UserEntryMapper
import info.nightscout.androidaps.utils.userEntry.ValueWithUnitMapper
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.logging.AAPSLogger
+import info.nightscout.shared.utils.DateUtil
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt
index 5820ea7c86..f1c9096f8b 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/aps/loop/APSResult.kt
@@ -2,25 +2,24 @@ package info.nightscout.androidaps.plugins.aps.loop
import android.text.Spanned
import dagger.android.HasAndroidInjector
-import info.nightscout.core.main.R
import info.nightscout.androidaps.data.IobTotal
-import info.nightscout.androidaps.database.entities.GlucoseValue
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.convertedToPercent
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.Constraint
import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.interfaces.pump.PumpDescription
-import info.nightscout.shared.interfaces.ResourceHelper
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.interfaces.Constraint
+import info.nightscout.interfaces.pump.PumpDescription
import info.nightscout.interfaces.utils.HtmlHelper.fromHtml
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
-
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
import org.json.JSONException
import org.json.JSONObject
import javax.inject.Inject
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt
index 894d572117..dd4c076fc1 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt
@@ -7,12 +7,9 @@ import androidx.annotation.DrawableRes
import com.jjoe64.graphview.series.BarGraphSeries
import com.jjoe64.graphview.series.DataPoint
import com.jjoe64.graphview.series.LineGraphSeries
-import info.nightscout.core.main.R
import info.nightscout.androidaps.data.IobTotal
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.TemporaryTarget
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.extensions.convertedToPercent
import info.nightscout.androidaps.extensions.isInProgress
import info.nightscout.androidaps.extensions.toStringFull
@@ -30,6 +27,9 @@ import info.nightscout.androidaps.plugins.general.overview.graphExtensions.Scale
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData
import info.nightscout.androidaps.utils.DefaultValueHelper
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.TemporaryTarget
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/BolusDataPoint.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/BolusDataPoint.kt
index e457c921f7..00f5ae946d 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/BolusDataPoint.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/BolusDataPoint.kt
@@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.general.overview.graphExtensions
import android.content.Context
-import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.Bolus
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.DefaultValueHelper
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.Bolus
+import info.nightscout.shared.interfaces.ResourceHelper
class BolusDataPoint(
val data: Bolus,
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/CarbsDataPoint.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/CarbsDataPoint.kt
index 9290e87b5e..c2a25ab4dc 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/CarbsDataPoint.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/CarbsDataPoint.kt
@@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.general.overview.graphExtensions
import android.content.Context
import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.Carbs
+import info.nightscout.database.entities.Carbs
import info.nightscout.shared.interfaces.ResourceHelper
class CarbsDataPoint(
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/EffectiveProfileSwitchDataPoint.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/EffectiveProfileSwitchDataPoint.kt
index 05f3dcbe89..0e465db304 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/EffectiveProfileSwitchDataPoint.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/EffectiveProfileSwitchDataPoint.kt
@@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.general.overview.graphExtensions
import android.content.Context
import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.EffectiveProfileSwitch
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.utils.T
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/ExtendedBolusDataPoint.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/ExtendedBolusDataPoint.kt
index 00ad4ce522..6a950bb0cc 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/ExtendedBolusDataPoint.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/ExtendedBolusDataPoint.kt
@@ -1,9 +1,9 @@
package info.nightscout.androidaps.plugins.general.overview.graphExtensions
import android.content.Context
-import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.ExtendedBolus
import info.nightscout.androidaps.extensions.toStringTotal
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.ExtendedBolus
import info.nightscout.shared.interfaces.ResourceHelper
class ExtendedBolusDataPoint(
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/GlucoseValueDataPoint.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/GlucoseValueDataPoint.kt
index 433183be52..a5cef52fcd 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/GlucoseValueDataPoint.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/GlucoseValueDataPoint.kt
@@ -1,14 +1,14 @@
package info.nightscout.androidaps.plugins.general.overview.graphExtensions
import android.content.Context
-import info.nightscout.interfaces.Constants
-import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.DefaultValueHelper
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.shared.interfaces.ResourceHelper
class GlucoseValueDataPoint(
val data: GlucoseValue,
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt
index 44a9af4aa9..916cf8c9fb 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/TherapyEventDataPoint.kt
@@ -1,13 +1,13 @@
package info.nightscout.androidaps.plugins.general.overview.graphExtensions
import android.content.Context
-import info.nightscout.interfaces.Constants
-import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.Translator
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.interfaces.Constants
+import info.nightscout.shared.interfaces.ResourceHelper
class TherapyEventDataPoint(
val data: TherapyEvent,
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt
index 56158ecff8..cf78d672d6 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStore.kt
@@ -4,15 +4,15 @@ import androidx.collection.LongSparseArray
import androidx.collection.size
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.data.InMemoryGlucoseValue
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventBucketedDataCreated
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.shared.utils.T
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import kotlin.math.abs
import kotlin.math.roundToLong
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.kt
index d24d58611e..4416a32f03 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/data/AutosensData.kt
@@ -2,20 +2,20 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator.data
import android.content.Context
import dagger.android.HasAndroidInjector
-import info.nightscout.interfaces.Constants
-import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.Carbs
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
-import info.nightscout.interfaces.aps.SMBDefaults
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.PointsWithLabelGraphSeries
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.Scale
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensResult
-import info.nightscout.shared.utils.DateUtil
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.Carbs
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.aps.SMBDefaults
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
import java.util.Locale
import javax.inject.Inject
import kotlin.math.min
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt b/core/core-main/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt
index 652d04c773..7e78cf60d0 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt
@@ -3,7 +3,7 @@ package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector
import info.nightscout.core.main.R
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.interfaces.queue.Callback
import info.nightscout.rx.logging.AAPSLogger
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt
index 42f95d4e2c..de39a4ef78 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt
@@ -3,8 +3,8 @@ package info.nightscout.androidaps.utils
import android.content.Context
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/Translator.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/Translator.kt
index 86eadfbda1..0a8ee44dde 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/Translator.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/Translator.kt
@@ -1,12 +1,12 @@
package info.nightscout.androidaps.utils
import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.shared.interfaces.ResourceHelper
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/WarnColors.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/WarnColors.kt
index 5567bf256c..5788becbb7 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/WarnColors.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/WarnColors.kt
@@ -1,9 +1,9 @@
package info.nightscout.androidaps.utils
import android.widget.TextView
-import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.extensions.isOlderThan
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.TherapyEvent
import info.nightscout.shared.interfaces.ResourceHelper
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiser.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerializer.kt
similarity index 55%
rename from core/core-main/src/main/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiser.kt
rename to core/core-main/src/main/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerializer.kt
index 42db084ddc..f2167eb2a3 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiser.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerializer.kt
@@ -1,8 +1,11 @@
package info.nightscout.androidaps.utils.serialisation
-import info.nightscout.androidaps.database.entities.ValueWithUnit
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.database.impl.serialisation.SealedClassHelper
-object ValueWithUnitSerialiser {
+object ValueWithUnitSerializer {
fun toSealedClassJson(list: List): String = list.map(::ValueWithUnitWrapper)
.let(SealedClassHelper.gson::toJson)
@@ -11,4 +14,6 @@ object ValueWithUnitSerialiser {
.fromJson>(string).map { it.wrapped }
private class ValueWithUnitWrapper(val wrapped: ValueWithUnit)
-}
\ No newline at end of file
+}
+
+inline fun Gson.fromJson(json: String): T = fromJson(json, object : TypeToken() {}.type)
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryMapper.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryMapper.kt
index da402ac9ee..5833281465 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryMapper.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryMapper.kt
@@ -1,6 +1,6 @@
package info.nightscout.androidaps.utils.userEntry
-import info.nightscout.androidaps.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry
class UserEntryMapper {
enum class Action (val db: UserEntry.Action) {
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt
index cc6cc86028..b2f5da37e4 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt
@@ -2,21 +2,21 @@ package info.nightscout.androidaps.utils.userEntry
import android.text.Spanned
import dagger.Reusable
-import info.nightscout.interfaces.Constants
-import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.ColorGroup
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter
-import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.androidaps.utils.Translator
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.ColorGroup
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.shared.utils.DateUtil
import javax.inject.Inject
@Reusable
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/ValueWithUnitMapper.kt b/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/ValueWithUnitMapper.kt
index 53834d3166..73f7b57b6b 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/ValueWithUnitMapper.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/utils/userEntry/ValueWithUnitMapper.kt
@@ -1,9 +1,9 @@
package info.nightscout.androidaps.utils.userEntry
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.Constants
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.ValueWithUnit
sealed class ValueWithUnitMapper { //I use a sealed class because of StringResource that contains a listOf as second parameter
diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
index d59c1efa9d..201d744fbf 100644
--- a/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
+++ b/core/core-main/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
@@ -4,7 +4,7 @@ import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/data/DetailedBolusInfoTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/data/DetailedBolusInfoTest.kt
index 2e37734b64..8a47986297 100644
--- a/core/core-main/src/test/java/info/nightscout/androidaps/data/DetailedBolusInfoTest.kt
+++ b/core/core-main/src/test/java/info/nightscout/androidaps/data/DetailedBolusInfoTest.kt
@@ -2,9 +2,9 @@ package info.nightscout.androidaps.data
import android.content.Context
import info.nightscout.androidaps.TestBase
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.TherapyEvent
import org.apache.commons.lang3.builder.EqualsBuilder
import org.junit.Assert
import org.junit.Test
diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt
index 4fd5150895..c85e1fc21a 100644
--- a/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt
+++ b/core/core-main/src/test/java/info/nightscout/androidaps/data/ProfileTest.kt
@@ -5,7 +5,7 @@ import dagger.android.AndroidInjector
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.TestPumpPlugin
import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/extensions/BlockExtensionKtTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/extensions/BlockExtensionKtTest.kt
index 7d905537b8..8d3dbd1e2e 100644
--- a/core/core-main/src/test/java/info/nightscout/androidaps/extensions/BlockExtensionKtTest.kt
+++ b/core/core-main/src/test/java/info/nightscout/androidaps/extensions/BlockExtensionKtTest.kt
@@ -1,8 +1,8 @@
package info.nightscout.androidaps.extensions
-import info.nightscout.androidaps.database.data.Block
-import info.nightscout.androidaps.database.data.TargetBlock
-import info.nightscout.androidaps.database.data.checkSanity
+import info.nightscout.database.entities.data.Block
+import info.nightscout.database.entities.data.TargetBlock
+import info.nightscout.database.entities.data.checkSanity
import info.nightscout.shared.utils.T
import org.junit.Assert
diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt
index 2b03644c96..5e9f4108ec 100644
--- a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt
+++ b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/aps/loop/APSResultTest.kt
@@ -3,10 +3,10 @@ package info.nightscout.androidaps.plugins.aps.loop
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBaseWithProfile
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.interfaces.Constraint
import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.interfaces.IobCobCalculator
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.interfaces.Constraint
import info.nightscout.interfaces.pump.PumpType
import info.nightscout.interfaces.utils.JsonHelper.safeGetDouble
import org.junit.Assert
diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt
index f9d8736b23..c024b526a4 100644
--- a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt
+++ b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCalculator/GlucoseStatusTest.kt
@@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.iob.iobCalculator
import info.nightscout.androidaps.TestBase
-import info.nightscout.androidaps.database.entities.GlucoseValue
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.asRounded
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import org.junit.Assert
@@ -14,7 +14,6 @@ import org.junit.Before
import org.junit.Test
import org.mockito.Mock
import org.mockito.Mockito.`when`
-import java.util.*
/**
* Created by mike on 26.03.2018.
diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStoreTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStoreTest.kt
index bca9698cb6..22475eccb1 100644
--- a/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStoreTest.kt
+++ b/core/core-main/src/test/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/AutosensDataStoreTest.kt
@@ -2,14 +2,13 @@ package info.nightscout.androidaps.plugins.iob.iobCobCalculator
import android.content.Context
import info.nightscout.androidaps.TestBase
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.mockito.Mock
-import java.util.*
class AutosensDataStoreTest : TestBase() {
diff --git a/core/core-main/src/test/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiserTest.kt b/core/core-main/src/test/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerializerTest.kt
similarity index 63%
rename from core/core-main/src/test/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiserTest.kt
rename to core/core-main/src/test/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerializerTest.kt
index 16123cf67b..7fdbaada58 100644
--- a/core/core-main/src/test/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerialiserTest.kt
+++ b/core/core-main/src/test/java/info/nightscout/androidaps/utils/serialisation/ValueWithUnitSerializerTest.kt
@@ -1,10 +1,10 @@
package info.nightscout.androidaps.utils.serialisation
-import info.nightscout.androidaps.database.entities.ValueWithUnit
+import info.nightscout.database.entities.ValueWithUnit
import org.junit.Assert
import org.junit.Test
-internal class ValueWithUnitSerialiserTest {
+internal class ValueWithUnitSerializerTest {
@Test
fun testSerialisationDeserization() {
@@ -15,8 +15,8 @@ internal class ValueWithUnitSerialiserTest {
ValueWithUnit.UNKNOWN
)
- val serialized = ValueWithUnitSerialiser.toSealedClassJson(list)
- val deserialized = ValueWithUnitSerialiser.fromJson(serialized)
+ val serialized = ValueWithUnitSerializer.toSealedClassJson(list)
+ val deserialized = ValueWithUnitSerializer.fromJson(serialized)
Assert.assertEquals(3, list.size)
Assert.assertEquals(list, deserialized)
@@ -27,8 +27,8 @@ internal class ValueWithUnitSerialiserTest {
val list = listOf()
- val serialized = ValueWithUnitSerialiser.toSealedClassJson(list)
- val deserialized = ValueWithUnitSerialiser.fromJson(serialized)
+ val serialized = ValueWithUnitSerializer.toSealedClassJson(list)
+ val deserialized = ValueWithUnitSerializer.fromJson(serialized)
Assert.assertEquals(0, list.size)
Assert.assertEquals(list, deserialized)
diff --git a/database/entities/.gitignore b/database/entities/.gitignore
new file mode 100644
index 0000000000..42afabfd2a
--- /dev/null
+++ b/database/entities/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/database/entities/build.gradle b/database/entities/build.gradle
new file mode 100644
index 0000000000..6a551950b7
--- /dev/null
+++ b/database/entities/build.gradle
@@ -0,0 +1,30 @@
+plugins {
+ id 'com.android.library'
+ id 'kotlin-android'
+ id 'kotlin-kapt'
+ id 'kotlin-allopen'
+ id 'com.hiya.jacoco-android'
+}
+
+apply from: "${project.rootDir}/core/core-main/android_dependencies.gradle"
+apply from: "${project.rootDir}/core/core-main/android_module_dependencies.gradle"
+
+android {
+
+ namespace 'info.nightscout.database.entities'
+}
+
+dependencies {
+ api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
+
+ api "androidx.core:core-ktx:$core_version"
+
+ kapt "androidx.room:room-compiler:$room_version"
+ api "androidx.room:room-ktx:$room_version"
+
+}
+
+allOpen {
+ // allows mocking for classes w/o directly opening them for release builds
+ annotation 'info.nightscout.androidaps.annotations.DbOpenForTesting'
+}
\ No newline at end of file
diff --git a/database/entities/consumer-rules.pro b/database/entities/consumer-rules.pro
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/database/entities/proguard-rules.pro b/database/entities/proguard-rules.pro
new file mode 100644
index 0000000000..481bb43481
--- /dev/null
+++ b/database/entities/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/database/entities/src/main/AndroidManifest.xml b/database/entities/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..44008a4332
--- /dev/null
+++ b/database/entities/src/main/AndroidManifest.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/APSResult.kt b/database/entities/src/main/java/info/nightscout/database/entities/APSResult.kt
similarity index 66%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/APSResult.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/APSResult.kt
index 42ef8e7dac..0f3f1ce826 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/APSResult.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/APSResult.kt
@@ -1,17 +1,20 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
-import androidx.room.*
-import info.nightscout.androidaps.database.TABLE_APS_RESULTS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
+import androidx.room.Embedded
+import androidx.room.Entity
+import androidx.room.ForeignKey
+import androidx.room.Index
+import androidx.room.PrimaryKey
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTime
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
import java.util.TimeZone
@Entity(tableName = TABLE_APS_RESULTS,
foreignKeys = [ForeignKey(
- entity = APSResult::class,
- parentColumns = ["id"],
- childColumns = ["referenceId"])],
+ entity = APSResult::class,
+ parentColumns = ["id"],
+ childColumns = ["referenceId"])],
indices = [Index("referenceId"), Index("timestamp")])
data class APSResult(
@PrimaryKey(autoGenerate = true)
diff --git a/database/entities/src/main/java/info/nightscout/database/entities/APSResultLink.kt b/database/entities/src/main/java/info/nightscout/database/entities/APSResultLink.kt
new file mode 100644
index 0000000000..8a3ae8a08f
--- /dev/null
+++ b/database/entities/src/main/java/info/nightscout/database/entities/APSResultLink.kt
@@ -0,0 +1,45 @@
+package info.nightscout.database.entities
+
+import androidx.room.Embedded
+import androidx.room.Entity
+import androidx.room.ForeignKey
+import androidx.room.Index
+import androidx.room.PrimaryKey
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+
+@Entity(tableName = TABLE_APS_RESULT_LINKS,
+ foreignKeys = [ForeignKey(
+ entity = APSResult::class,
+ parentColumns = arrayOf("id"),
+ childColumns = arrayOf("apsResultId")), ForeignKey(
+
+ entity = Bolus::class,
+ parentColumns = arrayOf("id"),
+ childColumns = arrayOf("smbId")), ForeignKey(
+
+ entity = TemporaryBasal::class,
+ parentColumns = arrayOf("id"),
+ childColumns = arrayOf("tbrId")), ForeignKey(
+
+ entity = APSResultLink::class,
+ parentColumns = arrayOf("id"),
+ childColumns = arrayOf("referenceId"))],
+ indices = [Index("referenceId"), Index("apsResultId"),
+ Index("smbId"), Index("tbrId")])
+data class APSResultLink(
+ @PrimaryKey(autoGenerate = true)
+ override var id: Long = 0,
+ override var version: Int = 0,
+ override var dateCreated: Long = -1,
+ override var isValid: Boolean = true,
+ override var referenceId: Long? = null,
+ @Embedded
+ override var interfaceIDs_backing: InterfaceIDs? = null,
+ var apsResultId: Long,
+ var smbId: Long? = null,
+ var tbrId: Long? = null
+) : TraceableDBEntry {
+ override val foreignKeysValid: Boolean
+ get() = super.foreignKeysValid && apsResultId != 0L && smbId != 0L && tbrId != 0L
+}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt b/database/entities/src/main/java/info/nightscout/database/entities/Bolus.kt
similarity index 83%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/Bolus.kt
index 1feec1c287..93a0cf0d5e 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/Bolus.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/Bolus.kt
@@ -1,16 +1,15 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_BOLUSES
-import info.nightscout.androidaps.database.embedments.InsulinConfiguration
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-import java.util.*
+import info.nightscout.database.entities.embedments.InsulinConfiguration
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTime
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import java.util.TimeZone
@Entity(
tableName = TABLE_BOLUSES,
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/BolusCalculatorResult.kt b/database/entities/src/main/java/info/nightscout/database/entities/BolusCalculatorResult.kt
similarity index 91%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/BolusCalculatorResult.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/BolusCalculatorResult.kt
index 681addd996..d7cf88dc6f 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/BolusCalculatorResult.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/BolusCalculatorResult.kt
@@ -1,15 +1,14 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_BOLUS_CALCULATOR_RESULTS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-import java.util.*
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTime
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import java.util.TimeZone
@Entity(
tableName = TABLE_BOLUS_CALCULATOR_RESULTS,
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/Carbs.kt b/database/entities/src/main/java/info/nightscout/database/entities/Carbs.kt
similarity index 79%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/Carbs.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/Carbs.kt
index 9d55e4ad6c..704869b38e 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/Carbs.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/Carbs.kt
@@ -1,22 +1,21 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_CARBS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTimeAndDuration
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-import java.util.*
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import java.util.TimeZone
@Entity(tableName = TABLE_CARBS,
- foreignKeys = [ForeignKey(
+ foreignKeys = [ForeignKey(
entity = Carbs::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [
+ indices = [
Index("id"),
Index("isValid"),
Index("nightscoutId"),
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/DeviceStatus.kt b/database/entities/src/main/java/info/nightscout/database/entities/DeviceStatus.kt
similarity index 78%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/DeviceStatus.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/DeviceStatus.kt
index 516be6f9ce..8555052e95 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/DeviceStatus.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/DeviceStatus.kt
@@ -1,17 +1,16 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_DEVICE_STATUS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
-import java.util.*
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTime
+import java.util.TimeZone
@Entity(tableName = TABLE_DEVICE_STATUS,
- foreignKeys = [],
- indices = [
+ foreignKeys = [],
+ indices = [
Index("id"),
Index("nightscoutId"),
Index("timestamp")
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/EffectiveProfileSwitch.kt b/database/entities/src/main/java/info/nightscout/database/entities/EffectiveProfileSwitch.kt
similarity index 82%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/EffectiveProfileSwitch.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/EffectiveProfileSwitch.kt
index 969a67c4f0..6d0bd8b5d1 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/EffectiveProfileSwitch.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/EffectiveProfileSwitch.kt
@@ -1,18 +1,17 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_EFFECTIVE_PROFILE_SWITCHES
-import info.nightscout.androidaps.database.data.Block
-import info.nightscout.androidaps.database.data.TargetBlock
-import info.nightscout.androidaps.database.embedments.InsulinConfiguration
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-import java.util.*
+import info.nightscout.database.entities.data.Block
+import info.nightscout.database.entities.data.TargetBlock
+import info.nightscout.database.entities.embedments.InsulinConfiguration
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTime
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import java.util.TimeZone
@Entity(
tableName = TABLE_EFFECTIVE_PROFILE_SWITCHES,
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/ExtendedBolus.kt b/database/entities/src/main/java/info/nightscout/database/entities/ExtendedBolus.kt
similarity index 84%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/ExtendedBolus.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/ExtendedBolus.kt
index f8ec3f52b4..b8989ac08e 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/ExtendedBolus.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/ExtendedBolus.kt
@@ -1,15 +1,14 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_EXTENDED_BOLUSES
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTimeAndDuration
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-import java.util.*
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import java.util.TimeZone
@Entity(
tableName = TABLE_EXTENDED_BOLUSES,
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/Food.kt b/database/entities/src/main/java/info/nightscout/database/entities/Food.kt
similarity index 91%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/Food.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/Food.kt
index 50a9601899..693fa07f61 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/Food.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/Food.kt
@@ -1,13 +1,12 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_FOODS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
@Entity(
tableName = TABLE_FOODS,
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/GlucoseValue.kt b/database/entities/src/main/java/info/nightscout/database/entities/GlucoseValue.kt
similarity index 92%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/GlucoseValue.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/GlucoseValue.kt
index 7a0e008e49..24d5efaf8d 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/GlucoseValue.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/GlucoseValue.kt
@@ -1,15 +1,14 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_GLUCOSE_VALUES
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-import java.util.*
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTime
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import java.util.TimeZone
@Entity(
tableName = TABLE_GLUCOSE_VALUES,
diff --git a/database/entities/src/main/java/info/nightscout/database/entities/MultiwaveBolusLink.kt b/database/entities/src/main/java/info/nightscout/database/entities/MultiwaveBolusLink.kt
new file mode 100644
index 0000000000..8057d40588
--- /dev/null
+++ b/database/entities/src/main/java/info/nightscout/database/entities/MultiwaveBolusLink.kt
@@ -0,0 +1,40 @@
+package info.nightscout.database.entities
+
+import androidx.room.Embedded
+import androidx.room.Entity
+import androidx.room.ForeignKey
+import androidx.room.Index
+import androidx.room.PrimaryKey
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+
+@Entity(tableName = TABLE_MULTIWAVE_BOLUS_LINKS,
+ foreignKeys = [ForeignKey(
+ entity = Bolus::class,
+ parentColumns = arrayOf("id"),
+ childColumns = arrayOf("bolusId")), ForeignKey(
+
+ entity = ExtendedBolus::class,
+ parentColumns = arrayOf("id"),
+ childColumns = arrayOf("extendedBolusId")), ForeignKey(
+
+ entity = MultiwaveBolusLink::class,
+ parentColumns = ["id"],
+ childColumns = ["referenceId"])],
+ indices = [Index("referenceId"), Index("bolusId"),
+ Index("extendedBolusId")])
+data class MultiwaveBolusLink(
+ @PrimaryKey(autoGenerate = true)
+ override var id: Long = 0,
+ override var version: Int = 0,
+ override var dateCreated: Long = -1,
+ override var isValid: Boolean = true,
+ override var referenceId: Long? = null,
+ @Embedded
+ override var interfaceIDs_backing: InterfaceIDs? = null,
+ var bolusId: Long,
+ var extendedBolusId: Long
+) : TraceableDBEntry {
+ override val foreignKeysValid: Boolean
+ get() = super.foreignKeysValid && bolusId != 0L && bolusId != 0L && extendedBolusId != 0L
+}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/OfflineEvent.kt b/database/entities/src/main/java/info/nightscout/database/entities/OfflineEvent.kt
similarity index 84%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/OfflineEvent.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/OfflineEvent.kt
index d4f83b4737..3ba6a14b14 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/OfflineEvent.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/OfflineEvent.kt
@@ -1,15 +1,14 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_OFFLINE_EVENTS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTimeAndDuration
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-import java.util.*
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import java.util.TimeZone
@Entity(
tableName = TABLE_OFFLINE_EVENTS,
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/PreferenceChange.kt b/database/entities/src/main/java/info/nightscout/database/entities/PreferenceChange.kt
similarity index 62%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/PreferenceChange.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/PreferenceChange.kt
index 8ff67ccb71..e4d56964c6 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/PreferenceChange.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/PreferenceChange.kt
@@ -1,10 +1,9 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Entity
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_PREFERENCE_CHANGES
-import info.nightscout.androidaps.database.interfaces.DBEntry
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
+import info.nightscout.database.entities.interfaces.DBEntry
+import info.nightscout.database.entities.interfaces.DBEntryWithTime
import java.util.TimeZone
@Entity(tableName = TABLE_PREFERENCE_CHANGES)
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/ProfileSwitch.kt b/database/entities/src/main/java/info/nightscout/database/entities/ProfileSwitch.kt
similarity index 81%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/ProfileSwitch.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/ProfileSwitch.kt
index dfda513382..ed541a3c7a 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/ProfileSwitch.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/ProfileSwitch.kt
@@ -1,18 +1,17 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_PROFILE_SWITCHES
-import info.nightscout.androidaps.database.data.Block
-import info.nightscout.androidaps.database.data.TargetBlock
-import info.nightscout.androidaps.database.embedments.InsulinConfiguration
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTimeAndDuration
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-import java.util.*
+import info.nightscout.database.entities.data.Block
+import info.nightscout.database.entities.data.TargetBlock
+import info.nightscout.database.entities.embedments.InsulinConfiguration
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import java.util.TimeZone
@Entity(
tableName = TABLE_PROFILE_SWITCHES,
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/TableNames.kt b/database/entities/src/main/java/info/nightscout/database/entities/TableNames.kt
similarity index 95%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/TableNames.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/TableNames.kt
index 6cfc7e1de0..f174622d05 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/TableNames.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/TableNames.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database
+package info.nightscout.database.entities
const val TABLE_APS_RESULTS = "apsResults"
const val TABLE_APS_RESULT_LINKS = "apsResultLinks"
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/TemporaryBasal.kt b/database/entities/src/main/java/info/nightscout/database/entities/TemporaryBasal.kt
similarity index 84%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/TemporaryBasal.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/TemporaryBasal.kt
index 8133f33635..dd6c2a9c1b 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/TemporaryBasal.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/TemporaryBasal.kt
@@ -1,22 +1,21 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_TEMPORARY_BASALS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTimeAndDuration
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-import java.util.*
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import java.util.TimeZone
@Entity(tableName = TABLE_TEMPORARY_BASALS,
- foreignKeys = [ForeignKey(
+ foreignKeys = [ForeignKey(
entity = TemporaryBasal::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [
+ indices = [
Index("id"),
Index("isValid"),
Index("nightscoutId"),
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/TemporaryTarget.kt b/database/entities/src/main/java/info/nightscout/database/entities/TemporaryTarget.kt
similarity index 78%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/TemporaryTarget.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/TemporaryTarget.kt
index a818a78904..9289561503 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/TemporaryTarget.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/TemporaryTarget.kt
@@ -1,16 +1,14 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import com.google.gson.annotations.SerializedName
-import info.nightscout.androidaps.database.TABLE_TEMPORARY_TARGETS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTimeAndDuration
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-import java.util.*
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import java.util.TimeZone
@Entity(
tableName = TABLE_TEMPORARY_TARGETS,
@@ -63,17 +61,11 @@ data class TemporaryTarget(
interfaceIDs.nightscoutId != null
enum class Reason(val text: String) {
- @SerializedName("Custom")
CUSTOM("Custom"),
- @SerializedName("Hypo")
HYPOGLYCEMIA("Hypo"),
- @SerializedName("Activity")
ACTIVITY("Activity"),
- @SerializedName("Eating Soon")
EATING_SOON("Eating Soon"),
- @SerializedName("Automation")
AUTOMATION("Automation"),
- @SerializedName("Wear")
WEAR("Wear")
;
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/TherapyEvent.kt b/database/entities/src/main/java/info/nightscout/database/entities/TherapyEvent.kt
similarity index 93%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/TherapyEvent.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/TherapyEvent.kt
index 57361f0e33..b2bf0aac9c 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/TherapyEvent.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/TherapyEvent.kt
@@ -1,14 +1,13 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_THERAPY_EVENTS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTimeAndDuration
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTimeAndDuration
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
import java.util.TimeZone
@Entity(
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/TotalDailyDose.kt b/database/entities/src/main/java/info/nightscout/database/entities/TotalDailyDose.kt
similarity index 75%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/TotalDailyDose.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/TotalDailyDose.kt
index 2426147b54..dda1a5b8a5 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/TotalDailyDose.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/TotalDailyDose.kt
@@ -1,22 +1,21 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_TOTAL_DAILY_DOSES
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-import java.util.*
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntryWithTime
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import java.util.TimeZone
@Entity(tableName = TABLE_TOTAL_DAILY_DOSES,
- foreignKeys = [ForeignKey(
+ foreignKeys = [ForeignKey(
entity = TotalDailyDose::class,
parentColumns = ["id"],
childColumns = ["referenceId"])],
- indices = [
+ indices = [
Index("id"),
Index("pumpId"),
Index("pumpType"),
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt b/database/entities/src/main/java/info/nightscout/database/entities/UserEntry.kt
similarity index 96%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/UserEntry.kt
index 4dd0942fac..c91244ead4 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/UserEntry.kt
@@ -1,15 +1,14 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_USER_ENTRY
-import info.nightscout.androidaps.database.interfaces.DBEntry
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
-import java.util.*
+import info.nightscout.database.entities.interfaces.DBEntry
+import info.nightscout.database.entities.interfaces.DBEntryWithTime
+import java.util.TimeZone
@Entity(tableName = TABLE_USER_ENTRY,
- indices = [
+ indices = [
Index("source"),
Index("timestamp")
])
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/ValueWithUnit.kt b/database/entities/src/main/java/info/nightscout/database/entities/ValueWithUnit.kt
similarity index 62%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/ValueWithUnit.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/ValueWithUnit.kt
index 55709888f7..b0f17f0b9e 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/ValueWithUnit.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/ValueWithUnit.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
sealed class ValueWithUnit {
@@ -36,22 +36,22 @@ sealed class ValueWithUnit {
fun value(): Any? {
return when(this) {
- is Gram -> this.value
- is Hour -> this.value
- is Insulin -> this.value
- is Mgdl -> this.value
- is Minute -> this.value
- is Mmoll -> this.value
- is Percent -> this.value
- is SimpleInt -> this.value
- is SimpleString -> this.value
+ is Gram -> this.value
+ is Hour -> this.value
+ is Insulin -> this.value
+ is Mgdl -> this.value
+ is Minute -> this.value
+ is Mmoll -> this.value
+ is Percent -> this.value
+ is SimpleInt -> this.value
+ is SimpleString -> this.value
is TherapyEventMeterType -> this.value
- is TherapyEventTTReason -> this.value
- is OfflineEventReason -> this.value
- is TherapyEventType -> this.value
- is Timestamp -> this.value
- is UnitPerHour -> this.value
- UNKNOWN -> null
+ is TherapyEventTTReason -> this.value
+ is OfflineEventReason -> this.value
+ is TherapyEventType -> this.value
+ is Timestamp -> this.value
+ is UnitPerHour -> this.value
+ UNKNOWN -> null
}
}
companion object {
@@ -60,9 +60,9 @@ sealed class ValueWithUnit {
const val MMOL = "mmol"
fun fromGlucoseUnit(value: Double, string: String): ValueWithUnit? = when (string) {
- MGDL, "mgdl" -> Mgdl(value)
- MMOL, "mmol/l" -> Mmoll(value)
- else -> null
+ MGDL, "mgdl" -> Mgdl(value)
+ MMOL, "mmol/l" -> Mmoll(value)
+ else -> null
}
}
}
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/VersionChange.kt b/database/entities/src/main/java/info/nightscout/database/entities/VersionChange.kt
similarity index 66%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/entities/VersionChange.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/VersionChange.kt
index 83ca1ccc40..7fc3470246 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/VersionChange.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/VersionChange.kt
@@ -1,10 +1,9 @@
-package info.nightscout.androidaps.database.entities
+package info.nightscout.database.entities
import androidx.room.Entity
import androidx.room.PrimaryKey
-import info.nightscout.androidaps.database.TABLE_VERSION_CHANGES
-import info.nightscout.androidaps.database.interfaces.DBEntry
-import info.nightscout.androidaps.database.interfaces.DBEntryWithTime
+import info.nightscout.database.entities.interfaces.DBEntry
+import info.nightscout.database.entities.interfaces.DBEntryWithTime
import java.util.TimeZone
@Entity(tableName = TABLE_VERSION_CHANGES)
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/data/Block.kt b/database/entities/src/main/java/info/nightscout/database/entities/data/Block.kt
similarity index 82%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/data/Block.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/data/Block.kt
index 0b4a98b5c1..473f524d39 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/data/Block.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/data/Block.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database.data
+package info.nightscout.database.entities.data
import java.util.concurrent.TimeUnit
diff --git a/database/entities/src/main/java/info/nightscout/database/entities/data/NewEntries.kt b/database/entities/src/main/java/info/nightscout/database/entities/data/NewEntries.kt
new file mode 100644
index 0000000000..b714a18d14
--- /dev/null
+++ b/database/entities/src/main/java/info/nightscout/database/entities/data/NewEntries.kt
@@ -0,0 +1,39 @@
+package info.nightscout.database.entities.data
+
+import info.nightscout.database.entities.APSResult
+import info.nightscout.database.entities.APSResultLink
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.MultiwaveBolusLink
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.PreferenceChange
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.TotalDailyDose
+import info.nightscout.database.entities.VersionChange
+
+data class NewEntries(
+ val apsResults: List,
+ val apsResultLinks: List,
+ val bolusCalculatorResults: List,
+ val boluses: List,
+ val carbs: List,
+ val effectiveProfileSwitches: List,
+ val extendedBoluses: List,
+ val glucoseValues: List,
+ val multiwaveBolusLinks: List,
+ val offlineEvents: List,
+ val preferencesChanges: List,
+ val profileSwitches: List,
+ val temporaryBasals: List,
+ val temporaryTarget: List,
+ val therapyEvents: List,
+ val totalDailyDoses: List,
+ val versionChanges: List
+)
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/data/TargetBlock.kt b/database/entities/src/main/java/info/nightscout/database/entities/data/TargetBlock.kt
similarity index 84%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/data/TargetBlock.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/data/TargetBlock.kt
index 4c95fba75f..22572eca16 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/data/TargetBlock.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/data/TargetBlock.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database.data
+package info.nightscout.database.entities.data
import java.util.concurrent.TimeUnit
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/embedments/InsulinConfiguration.kt b/database/entities/src/main/java/info/nightscout/database/entities/embedments/InsulinConfiguration.kt
similarity index 75%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/embedments/InsulinConfiguration.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/embedments/InsulinConfiguration.kt
index e6c8a1a437..98d74cc10e 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/embedments/InsulinConfiguration.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/embedments/InsulinConfiguration.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database.embedments
+package info.nightscout.database.entities.embedments
data class InsulinConfiguration(
var insulinLabel: String,
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/embedments/InterfaceIDs.kt b/database/entities/src/main/java/info/nightscout/database/entities/embedments/InterfaceIDs.kt
similarity index 96%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/embedments/InterfaceIDs.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/embedments/InterfaceIDs.kt
index 44452c9a44..5f78da4e8c 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/embedments/InterfaceIDs.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/embedments/InterfaceIDs.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database.embedments
+package info.nightscout.database.entities.embedments
data class InterfaceIDs(
var nightscoutSystemId: String? = null,
diff --git a/database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntry.kt b/database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntry.kt
new file mode 100644
index 0000000000..ac327c6b40
--- /dev/null
+++ b/database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntry.kt
@@ -0,0 +1,5 @@
+package info.nightscout.database.entities.interfaces
+
+interface DBEntry {
+ var id: Long
+}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithDuration.kt b/database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntryWithDuration.kt
similarity index 68%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithDuration.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntryWithDuration.kt
index 469ec17d6d..34c4f053ff 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithDuration.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntryWithDuration.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database.interfaces
+package info.nightscout.database.entities.interfaces
interface DBEntryWithDuration {
var duration: Long
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTime.kt b/database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntryWithTime.kt
similarity index 58%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTime.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntryWithTime.kt
index 103942fcf0..bae0a704e8 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTime.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntryWithTime.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database.interfaces
+package info.nightscout.database.entities.interfaces
interface DBEntryWithTime {
var timestamp: Long
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTimeAndDuration.kt b/database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntryWithTimeAndDuration.kt
similarity index 87%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTimeAndDuration.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntryWithTimeAndDuration.kt
index 475cd01f5d..ef7408c0e6 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntryWithTimeAndDuration.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/interfaces/DBEntryWithTimeAndDuration.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database.interfaces
+package info.nightscout.database.entities.interfaces
import kotlin.math.min
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/TraceableDBEntry.kt b/database/entities/src/main/java/info/nightscout/database/entities/interfaces/TraceableDBEntry.kt
similarity index 84%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/TraceableDBEntry.kt
rename to database/entities/src/main/java/info/nightscout/database/entities/interfaces/TraceableDBEntry.kt
index ad4679cea3..63e83bd822 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/TraceableDBEntry.kt
+++ b/database/entities/src/main/java/info/nightscout/database/entities/interfaces/TraceableDBEntry.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.interfaces
+package info.nightscout.database.entities.interfaces
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
+import info.nightscout.database.entities.embedments.InterfaceIDs
interface TraceableDBEntry: DBEntry {
var version: Int
diff --git a/database/impl/build.gradle b/database/impl/build.gradle
index 3b45869b87..39b78acc17 100644
--- a/database/impl/build.gradle
+++ b/database/impl/build.gradle
@@ -11,7 +11,7 @@ apply from: "${project.rootDir}/core/core-main/android_module_dependencies.gradl
android {
- namespace 'info.nightscout.androidaps.database'
+ namespace 'info.nightscout.database.impl'
defaultConfig {
kapt {
arguments {
@@ -23,6 +23,8 @@ android {
}
dependencies {
+ implementation project(':database:entities')
+
api "androidx.core:core-ktx:$core_version"
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
diff --git a/database/impl/src/debug/java/info/nightscout/androidaps/annotations/DbOpenForTesting.kt b/database/impl/src/debug/java/info/nightscout/database/annotations/DbOpenForTesting.kt
similarity index 80%
rename from database/impl/src/debug/java/info/nightscout/androidaps/annotations/DbOpenForTesting.kt
rename to database/impl/src/debug/java/info/nightscout/database/annotations/DbOpenForTesting.kt
index deca64872c..df0ea6bc13 100644
--- a/database/impl/src/debug/java/info/nightscout/androidaps/annotations/DbOpenForTesting.kt
+++ b/database/impl/src/debug/java/info/nightscout/database/annotations/DbOpenForTesting.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.annotations
+package info.nightscout.database.annotations
/**
* This is the actual annotation that makes the class open. Don't use it directly, only through [DbOpenForTesting]
@@ -10,6 +10,6 @@ annotation class DbOpenClass
/**
* Annotate a class with [DbOpenForTesting] if it should be extendable for testing.
*/
-@DbOpenClass
+@info.nightscout.database.annotations.DbOpenClass
@Target(AnnotationTarget.CLASS)
annotation class DbOpenForTesting
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt b/database/impl/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt
deleted file mode 100644
index 58fc350cec..0000000000
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/AppDatabase.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-package info.nightscout.androidaps.database
-
-import androidx.room.Database
-import androidx.room.RoomDatabase
-import androidx.room.TypeConverters
-import info.nightscout.androidaps.database.daos.*
-import info.nightscout.androidaps.database.entities.*
-
-const val DATABASE_VERSION = 22
-
-@Database(version = DATABASE_VERSION,
- entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
- EffectiveProfileSwitch::class, ExtendedBolus::class, GlucoseValue::class, ProfileSwitch::class,
- TemporaryBasal::class, TemporaryTarget::class, TherapyEvent::class, TotalDailyDose::class, APSResultLink::class,
- MultiwaveBolusLink::class, PreferenceChange::class, VersionChange::class, UserEntry::class,
- Food::class, DeviceStatus::class, OfflineEvent::class],
- exportSchema = true)
-@TypeConverters(Converters::class)
-internal abstract class AppDatabase : RoomDatabase() {
-
- abstract val glucoseValueDao: GlucoseValueDao
-
- abstract val therapyEventDao: TherapyEventDao
-
- abstract val temporaryBasalDao: TemporaryBasalDao
-
- abstract val bolusDao: BolusDao
-
- abstract val extendedBolusDao: ExtendedBolusDao
-
- abstract val multiwaveBolusLinkDao: MultiwaveBolusLinkDao
-
- abstract val totalDailyDoseDao: TotalDailyDoseDao
-
- abstract val carbsDao: CarbsDao
-
- abstract val temporaryTargetDao: TemporaryTargetDao
-
- abstract val apsResultLinkDao: APSResultLinkDao
-
- abstract val bolusCalculatorResultDao: BolusCalculatorResultDao
-
- abstract val effectiveProfileSwitchDao: EffectiveProfileSwitchDao
-
- abstract val profileSwitchDao: ProfileSwitchDao
-
- abstract val apsResultDao: APSResultDao
-
- abstract val versionChangeDao: VersionChangeDao
-
- abstract val userEntryDao: UserEntryDao
-
- abstract val preferenceChangeDao: PreferenceChangeDao
-
- abstract val foodDao: FoodDao
-
- abstract val deviceStatusDao: DeviceStatusDao
-
- abstract val offlineEventDao: OfflineEventDao
-
-}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/DelegatedAppDatabase.kt b/database/impl/src/main/java/info/nightscout/androidaps/database/DelegatedAppDatabase.kt
deleted file mode 100644
index f436dc99e7..0000000000
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/DelegatedAppDatabase.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package info.nightscout.androidaps.database
-
-import info.nightscout.androidaps.database.daos.*
-import info.nightscout.androidaps.database.daos.delegated.*
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.interfaces.DBEntry
-
-internal class DelegatedAppDatabase(val changes: MutableList, val database: AppDatabase) {
-
- val glucoseValueDao: GlucoseValueDao = DelegatedGlucoseValueDao(changes, database.glucoseValueDao)
- val therapyEventDao: TherapyEventDao = DelegatedTherapyEventDao(changes, database.therapyEventDao)
- val temporaryBasalDao: TemporaryBasalDao = DelegatedTemporaryBasalDao(changes, database.temporaryBasalDao)
- val bolusDao: BolusDao = DelegatedBolusDao(changes, database.bolusDao)
- val extendedBolusDao: ExtendedBolusDao = DelegatedExtendedExtendedBolusDao(changes, database.extendedBolusDao)
- val multiwaveBolusLinkDao: MultiwaveBolusLinkDao = DelegatedMultiwaveBolusLinkDao(changes, database.multiwaveBolusLinkDao)
- val totalDailyDoseDao: TotalDailyDoseDao = DelegatedTotalDailyDoseDao(changes, database.totalDailyDoseDao)
- val carbsDao: CarbsDao = DelegatedCarbsDao(changes, database.carbsDao)
- val temporaryTargetDao: TemporaryTargetDao = DelegatedTemporaryTargetDao(changes, database.temporaryTargetDao)
- val apsResultLinkDao: APSResultLinkDao = DelegatedAPSResultLinkLinkDao(changes, database.apsResultLinkDao)
- val bolusCalculatorResultDao: BolusCalculatorResultDao = DelegatedBolusCalculatorResultDao(changes, database.bolusCalculatorResultDao)
- val effectiveProfileSwitchDao: EffectiveProfileSwitchDao = DelegatedEffectiveProfileSwitchDao(changes, database.effectiveProfileSwitchDao)
- val profileSwitchDao: ProfileSwitchDao = DelegatedProfileSwitchDao(changes, database.profileSwitchDao)
- val apsResultDao: APSResultDao = DelegatedAPSResultDao(changes, database.apsResultDao)
- val versionChangeDao: VersionChangeDao = DelegatedVersionChangeDao(changes, database.versionChangeDao)
- val userEntryDao: UserEntryDao = DelegatedUserEntryDao(changes, database.userEntryDao)
- val preferenceChangeDao: PreferenceChangeDao = DelegatedPreferenceChangeDao(changes, database.preferenceChangeDao)
- val foodDao: FoodDao = DelegatedFoodDao(changes, database.foodDao)
- val deviceStatusDao: DeviceStatusDao = DelegatedDeviceStatusDao(changes, database.deviceStatusDao)
- val offlineEventDao: OfflineEventDao = DelegatedOfflineEventDao(changes, database.offlineEventDao)
- fun clearAllTables() = database.clearAllTables()
-}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedDeviceStatusDao.kt b/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedDeviceStatusDao.kt
deleted file mode 100644
index 1d798ef546..0000000000
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedDeviceStatusDao.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package info.nightscout.androidaps.database.daos.delegated
-
-import info.nightscout.androidaps.database.daos.DeviceStatusDao
-import info.nightscout.androidaps.database.interfaces.DBEntry
-
-internal class DelegatedDeviceStatusDao(changes: MutableList, private val dao: DeviceStatusDao) : DelegatedDao(changes), DeviceStatusDao by dao
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/data/NewEntries.kt b/database/impl/src/main/java/info/nightscout/androidaps/database/data/NewEntries.kt
deleted file mode 100644
index e951f37de2..0000000000
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/data/NewEntries.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package info.nightscout.androidaps.database.data
-
-import info.nightscout.androidaps.database.entities.*
-
-data class NewEntries(
- val apsResults: List,
- val apsResultLinks: List,
- val bolusCalculatorResults: List,
- val boluses: List,
- val carbs: List,
- val effectiveProfileSwitches: List,
- val extendedBoluses: List,
- val glucoseValues: List,
- val multiwaveBolusLinks: List,
- val offlineEvents: List,
- val preferencesChanges: List,
- val profileSwitches: List,
- val temporaryBasals: List,
- val temporaryTarget: List,
- val therapyEvents: List,
- val totalDailyDoses: List,
- val versionChanges: List
-)
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/APSResultLink.kt b/database/impl/src/main/java/info/nightscout/androidaps/database/entities/APSResultLink.kt
deleted file mode 100644
index 8fed1f9578..0000000000
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/APSResultLink.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package info.nightscout.androidaps.database.entities
-
-import androidx.room.*
-import info.nightscout.androidaps.database.TABLE_APS_RESULT_LINKS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-
-@Entity(tableName = TABLE_APS_RESULT_LINKS,
- foreignKeys = [ForeignKey(
- entity = APSResult::class,
- parentColumns = arrayOf("id"),
- childColumns = arrayOf("apsResultId")), ForeignKey(
-
- entity = Bolus::class,
- parentColumns = arrayOf("id"),
- childColumns = arrayOf("smbId")), ForeignKey(
-
- entity = TemporaryBasal::class,
- parentColumns = arrayOf("id"),
- childColumns = arrayOf("tbrId")), ForeignKey(
-
- entity = APSResultLink::class,
- parentColumns = arrayOf("id"),
- childColumns = arrayOf("referenceId"))],
- indices = [Index("referenceId"), Index("apsResultId"),
- Index("smbId"), Index("tbrId")])
-data class APSResultLink(
- @PrimaryKey(autoGenerate = true)
- override var id: Long = 0,
- override var version: Int = 0,
- override var dateCreated: Long = -1,
- override var isValid: Boolean = true,
- override var referenceId: Long? = null,
- @Embedded
- override var interfaceIDs_backing: InterfaceIDs? = null,
- var apsResultId: Long,
- var smbId: Long? = null,
- var tbrId: Long? = null
-) : TraceableDBEntry {
- override val foreignKeysValid: Boolean
- get() = super.foreignKeysValid && apsResultId != 0L && smbId != 0L && tbrId != 0L
-}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/MultiwaveBolusLink.kt b/database/impl/src/main/java/info/nightscout/androidaps/database/entities/MultiwaveBolusLink.kt
deleted file mode 100644
index e8fbf135e0..0000000000
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/entities/MultiwaveBolusLink.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package info.nightscout.androidaps.database.entities
-
-import androidx.room.*
-import info.nightscout.androidaps.database.TABLE_MULTIWAVE_BOLUS_LINKS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
-
-@Entity(tableName = TABLE_MULTIWAVE_BOLUS_LINKS,
- foreignKeys = [ForeignKey(
- entity = Bolus::class,
- parentColumns = arrayOf("id"),
- childColumns = arrayOf("bolusId")), ForeignKey(
-
- entity = ExtendedBolus::class,
- parentColumns = arrayOf("id"),
- childColumns = arrayOf("extendedBolusId")), ForeignKey(
-
- entity = MultiwaveBolusLink::class,
- parentColumns = ["id"],
- childColumns = ["referenceId"])],
- indices = [Index("referenceId"), Index("bolusId"),
- Index("extendedBolusId")])
-data class MultiwaveBolusLink(
- @PrimaryKey(autoGenerate = true)
- override var id: Long = 0,
- override var version: Int = 0,
- override var dateCreated: Long = -1,
- override var isValid: Boolean = true,
- override var referenceId: Long? = null,
- @Embedded
- override var interfaceIDs_backing: InterfaceIDs? = null,
- var bolusId: Long,
- var extendedBolusId: Long
-) : TraceableDBEntry {
- override val foreignKeysValid: Boolean
- get() = super.foreignKeysValid && bolusId != 0L && bolusId != 0L && extendedBolusId != 0L
-}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntry.kt b/database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntry.kt
deleted file mode 100644
index f6c01287a6..0000000000
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/interfaces/DBEntry.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package info.nightscout.androidaps.database.interfaces
-
-interface DBEntry {
- var id: Long
-}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/serialisation/SealedClassHelper.kt b/database/impl/src/main/java/info/nightscout/androidaps/database/serialisation/SealedClassHelper.kt
deleted file mode 100644
index 704819908e..0000000000
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/serialisation/SealedClassHelper.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package info.nightscout.androidaps.database.serialisation
-
-import com.google.gson.Gson
-import com.google.gson.GsonBuilder
-import com.google.gson.TypeAdapter
-import com.google.gson.TypeAdapterFactory
-import com.google.gson.reflect.TypeToken
-import com.google.gson.stream.JsonReader
-import com.google.gson.stream.JsonWriter
-import kotlin.jvm.internal.Reflection
-import kotlin.reflect.KClass
-
-object SealedClassHelper {
-
- val gson: Gson = GsonBuilder().registerTypeAdapterFactory(
- object : TypeAdapterFactory {
- override fun create(gson: Gson, type: TypeToken): TypeAdapter {
- val kClass = Reflection.getOrCreateKotlinClass(type.rawType)
- return if (kClass.sealedSubclasses.any()) {
- SealedClassTypeAdapter(kClass, gson)
- } else
- gson.getDelegateAdapter(this, type)
- }
- }).create()
-
- private class SealedClassTypeAdapter(private val kClass: KClass, val gson: Gson) : TypeAdapter() {
-
- override fun read(jsonReader: JsonReader): T? {
- jsonReader.beginObject()
- val nextName = jsonReader.nextName()
- val innerClass = kClass.sealedSubclasses.firstOrNull { it.simpleName == nextName }
- ?: throw Exception("$nextName is not a child of the sealed class ${kClass.qualifiedName}")
- val x = gson.fromJson(jsonReader, innerClass.javaObjectType)
- jsonReader.endObject()
- // if there a static object, actually return that
- @Suppress("UNCHECKED_CAST")
- return innerClass.objectInstance as T? ?: x
- }
-
- override fun write(out: JsonWriter, value: T) {
- val jsonString = gson.toJson(value)
- val name = value.javaClass.canonicalName
- if (name != null) {
- out.beginObject()
- out.name(name.splitToSequence(".").last()).jsonValue(jsonString)
- out.endObject()
- }
- }
- }
-}
-
-inline fun Gson.fromJson(json: String): T = fromJson(json, object : TypeToken() {}.type)
diff --git a/database/impl/src/main/java/info/nightscout/database/impl/AppDatabase.kt b/database/impl/src/main/java/info/nightscout/database/impl/AppDatabase.kt
new file mode 100644
index 0000000000..228c3cfa10
--- /dev/null
+++ b/database/impl/src/main/java/info/nightscout/database/impl/AppDatabase.kt
@@ -0,0 +1,99 @@
+package info.nightscout.database.impl
+
+import androidx.room.Database
+import androidx.room.RoomDatabase
+import androidx.room.TypeConverters
+import info.nightscout.database.impl.daos.APSResultDao
+import info.nightscout.database.impl.daos.APSResultLinkDao
+import info.nightscout.database.impl.daos.BolusCalculatorResultDao
+import info.nightscout.database.impl.daos.BolusDao
+import info.nightscout.database.impl.daos.CarbsDao
+import info.nightscout.database.impl.daos.DeviceStatusDao
+import info.nightscout.database.impl.daos.EffectiveProfileSwitchDao
+import info.nightscout.database.impl.daos.ExtendedBolusDao
+import info.nightscout.database.impl.daos.FoodDao
+import info.nightscout.database.impl.daos.GlucoseValueDao
+import info.nightscout.database.impl.daos.MultiwaveBolusLinkDao
+import info.nightscout.database.impl.daos.OfflineEventDao
+import info.nightscout.database.impl.daos.PreferenceChangeDao
+import info.nightscout.database.impl.daos.ProfileSwitchDao
+import info.nightscout.database.impl.daos.TemporaryBasalDao
+import info.nightscout.database.impl.daos.TemporaryTargetDao
+import info.nightscout.database.impl.daos.TherapyEventDao
+import info.nightscout.database.impl.daos.TotalDailyDoseDao
+import info.nightscout.database.impl.daos.UserEntryDao
+import info.nightscout.database.impl.daos.VersionChangeDao
+import info.nightscout.database.entities.APSResult
+import info.nightscout.database.entities.APSResultLink
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.DeviceStatus
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.Food
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.MultiwaveBolusLink
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.PreferenceChange
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.TotalDailyDose
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.VersionChange
+
+const val DATABASE_VERSION = 22
+
+@Database(version = DATABASE_VERSION,
+ entities = [APSResult::class, Bolus::class, BolusCalculatorResult::class, Carbs::class,
+ EffectiveProfileSwitch::class, ExtendedBolus::class, GlucoseValue::class, ProfileSwitch::class,
+ TemporaryBasal::class, TemporaryTarget::class, TherapyEvent::class, TotalDailyDose::class, APSResultLink::class,
+ MultiwaveBolusLink::class, PreferenceChange::class, VersionChange::class, UserEntry::class,
+ Food::class, DeviceStatus::class, OfflineEvent::class],
+ exportSchema = true)
+@TypeConverters(Converters::class)
+internal abstract class AppDatabase : RoomDatabase() {
+
+ abstract val glucoseValueDao: GlucoseValueDao
+
+ abstract val therapyEventDao: TherapyEventDao
+
+ abstract val temporaryBasalDao: TemporaryBasalDao
+
+ abstract val bolusDao: BolusDao
+
+ abstract val extendedBolusDao: ExtendedBolusDao
+
+ abstract val multiwaveBolusLinkDao: MultiwaveBolusLinkDao
+
+ abstract val totalDailyDoseDao: TotalDailyDoseDao
+
+ abstract val carbsDao: CarbsDao
+
+ abstract val temporaryTargetDao: TemporaryTargetDao
+
+ abstract val apsResultLinkDao: APSResultLinkDao
+
+ abstract val bolusCalculatorResultDao: BolusCalculatorResultDao
+
+ abstract val effectiveProfileSwitchDao: EffectiveProfileSwitchDao
+
+ abstract val profileSwitchDao: ProfileSwitchDao
+
+ abstract val apsResultDao: APSResultDao
+
+ abstract val versionChangeDao: VersionChangeDao
+
+ abstract val userEntryDao: UserEntryDao
+
+ abstract val preferenceChangeDao: PreferenceChangeDao
+
+ abstract val foodDao: FoodDao
+
+ abstract val deviceStatusDao: DeviceStatusDao
+
+ abstract val offlineEventDao: OfflineEventDao
+
+}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/AppRepository.kt b/database/impl/src/main/java/info/nightscout/database/impl/AppRepository.kt
similarity index 97%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/AppRepository.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/AppRepository.kt
index 1019581b80..1ad180b93b 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/AppRepository.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/AppRepository.kt
@@ -1,25 +1,37 @@
-package info.nightscout.androidaps.database
+package info.nightscout.database.impl
-import info.nightscout.androidaps.annotations.DbOpenForTesting
-import info.nightscout.androidaps.database.data.NewEntries
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.*
-import info.nightscout.androidaps.database.interfaces.DBEntry
-import info.nightscout.androidaps.database.transactions.Transaction
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.DeviceStatus
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.Food
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.TotalDailyDose
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.data.NewEntries
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.DBEntry
+import info.nightscout.database.impl.transactions.Transaction
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.schedulers.Schedulers
import io.reactivex.rxjava3.subjects.PublishSubject
-import java.lang.StringBuilder
import java.util.concurrent.Callable
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import javax.inject.Singleton
import kotlin.math.roundToInt
-@DbOpenForTesting
+@info.nightscout.database.annotations.DbOpenForTesting
@Singleton class AppRepository @Inject internal constructor(
internal val database: AppDatabase
) {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/Converters.kt b/database/impl/src/main/java/info/nightscout/database/impl/Converters.kt
similarity index 83%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/Converters.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/Converters.kt
index 371976cc5c..39d80b5d14 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/Converters.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/Converters.kt
@@ -1,14 +1,23 @@
-package info.nightscout.androidaps.database
+package info.nightscout.database.impl
import androidx.room.TypeConverter
-import info.nightscout.androidaps.database.data.Block
-import info.nightscout.androidaps.database.data.TargetBlock
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.*
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.serialisation.SealedClassHelper
-import info.nightscout.androidaps.database.serialisation.fromJson
+import info.nightscout.database.entities.APSResult
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.database.entities.data.Block
+import info.nightscout.database.entities.data.TargetBlock
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.impl.serialisation.SealedClassHelper
+import info.nightscout.database.impl.serialisation.fromJson
import org.json.JSONArray
import org.json.JSONObject
@@ -176,9 +185,11 @@ class Converters {
val list = mutableListOf()
for (i in 0 until jsonArray.length()) {
val jsonObject = jsonArray.getJSONObject(i)
- list.add(TargetBlock(jsonObject.getLong("duration"),
- jsonObject.getDouble("lowTarget"),
- jsonObject.getDouble("highTarget")))
+ list.add(
+ TargetBlock(jsonObject.getLong("duration"),
+ jsonObject.getDouble("lowTarget"),
+ jsonObject.getDouble("highTarget"))
+ )
}
return list
}
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt b/database/impl/src/main/java/info/nightscout/database/impl/DatabaseModule.kt
similarity index 99%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/DatabaseModule.kt
index a7093c55bb..b04411bafc 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/DatabaseModule.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/DatabaseModule.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database
+package info.nightscout.database.impl
import android.content.Context
import androidx.room.Room
diff --git a/database/impl/src/main/java/info/nightscout/database/impl/DelegatedAppDatabase.kt b/database/impl/src/main/java/info/nightscout/database/impl/DelegatedAppDatabase.kt
new file mode 100644
index 0000000000..ad6ecf8430
--- /dev/null
+++ b/database/impl/src/main/java/info/nightscout/database/impl/DelegatedAppDatabase.kt
@@ -0,0 +1,68 @@
+package info.nightscout.database.impl
+
+import info.nightscout.database.impl.daos.APSResultDao
+import info.nightscout.database.impl.daos.APSResultLinkDao
+import info.nightscout.database.impl.daos.BolusCalculatorResultDao
+import info.nightscout.database.impl.daos.BolusDao
+import info.nightscout.database.impl.daos.CarbsDao
+import info.nightscout.database.impl.daos.DeviceStatusDao
+import info.nightscout.database.impl.daos.EffectiveProfileSwitchDao
+import info.nightscout.database.impl.daos.ExtendedBolusDao
+import info.nightscout.database.impl.daos.FoodDao
+import info.nightscout.database.impl.daos.GlucoseValueDao
+import info.nightscout.database.impl.daos.MultiwaveBolusLinkDao
+import info.nightscout.database.impl.daos.OfflineEventDao
+import info.nightscout.database.impl.daos.PreferenceChangeDao
+import info.nightscout.database.impl.daos.ProfileSwitchDao
+import info.nightscout.database.impl.daos.TemporaryBasalDao
+import info.nightscout.database.impl.daos.TemporaryTargetDao
+import info.nightscout.database.impl.daos.TherapyEventDao
+import info.nightscout.database.impl.daos.TotalDailyDoseDao
+import info.nightscout.database.impl.daos.UserEntryDao
+import info.nightscout.database.impl.daos.VersionChangeDao
+import info.nightscout.database.impl.daos.delegated.DelegatedAPSResultDao
+import info.nightscout.database.impl.daos.delegated.DelegatedAPSResultLinkLinkDao
+import info.nightscout.database.impl.daos.delegated.DelegatedBolusCalculatorResultDao
+import info.nightscout.database.impl.daos.delegated.DelegatedBolusDao
+import info.nightscout.database.impl.daos.delegated.DelegatedCarbsDao
+import info.nightscout.database.impl.daos.delegated.DelegatedDeviceStatusDao
+import info.nightscout.database.impl.daos.delegated.DelegatedEffectiveProfileSwitchDao
+import info.nightscout.database.impl.daos.delegated.DelegatedExtendedExtendedBolusDao
+import info.nightscout.database.impl.daos.delegated.DelegatedFoodDao
+import info.nightscout.database.impl.daos.delegated.DelegatedGlucoseValueDao
+import info.nightscout.database.impl.daos.delegated.DelegatedMultiwaveBolusLinkDao
+import info.nightscout.database.impl.daos.delegated.DelegatedOfflineEventDao
+import info.nightscout.database.impl.daos.delegated.DelegatedPreferenceChangeDao
+import info.nightscout.database.impl.daos.delegated.DelegatedProfileSwitchDao
+import info.nightscout.database.impl.daos.delegated.DelegatedTemporaryBasalDao
+import info.nightscout.database.impl.daos.delegated.DelegatedTemporaryTargetDao
+import info.nightscout.database.impl.daos.delegated.DelegatedTherapyEventDao
+import info.nightscout.database.impl.daos.delegated.DelegatedTotalDailyDoseDao
+import info.nightscout.database.impl.daos.delegated.DelegatedUserEntryDao
+import info.nightscout.database.impl.daos.delegated.DelegatedVersionChangeDao
+import info.nightscout.database.entities.interfaces.DBEntry
+
+internal class DelegatedAppDatabase(val changes: MutableList, val database: AppDatabase) {
+
+ val glucoseValueDao: GlucoseValueDao = DelegatedGlucoseValueDao(changes, database.glucoseValueDao)
+ val therapyEventDao: TherapyEventDao = DelegatedTherapyEventDao(changes, database.therapyEventDao)
+ val temporaryBasalDao: TemporaryBasalDao = DelegatedTemporaryBasalDao(changes, database.temporaryBasalDao)
+ val bolusDao: BolusDao = DelegatedBolusDao(changes, database.bolusDao)
+ val extendedBolusDao: ExtendedBolusDao = DelegatedExtendedExtendedBolusDao(changes, database.extendedBolusDao)
+ val multiwaveBolusLinkDao: MultiwaveBolusLinkDao = DelegatedMultiwaveBolusLinkDao(changes, database.multiwaveBolusLinkDao)
+ val totalDailyDoseDao: TotalDailyDoseDao = DelegatedTotalDailyDoseDao(changes, database.totalDailyDoseDao)
+ val carbsDao: CarbsDao = DelegatedCarbsDao(changes, database.carbsDao)
+ val temporaryTargetDao: TemporaryTargetDao = DelegatedTemporaryTargetDao(changes, database.temporaryTargetDao)
+ val apsResultLinkDao: APSResultLinkDao = DelegatedAPSResultLinkLinkDao(changes, database.apsResultLinkDao)
+ val bolusCalculatorResultDao: BolusCalculatorResultDao = DelegatedBolusCalculatorResultDao(changes, database.bolusCalculatorResultDao)
+ val effectiveProfileSwitchDao: EffectiveProfileSwitchDao = DelegatedEffectiveProfileSwitchDao(changes, database.effectiveProfileSwitchDao)
+ val profileSwitchDao: ProfileSwitchDao = DelegatedProfileSwitchDao(changes, database.profileSwitchDao)
+ val apsResultDao: APSResultDao = DelegatedAPSResultDao(changes, database.apsResultDao)
+ val versionChangeDao: VersionChangeDao = DelegatedVersionChangeDao(changes, database.versionChangeDao)
+ val userEntryDao: UserEntryDao = DelegatedUserEntryDao(changes, database.userEntryDao)
+ val preferenceChangeDao: PreferenceChangeDao = DelegatedPreferenceChangeDao(changes, database.preferenceChangeDao)
+ val foodDao: FoodDao = DelegatedFoodDao(changes, database.foodDao)
+ val deviceStatusDao: DeviceStatusDao = DelegatedDeviceStatusDao(changes, database.deviceStatusDao)
+ val offlineEventDao: OfflineEventDao = DelegatedOfflineEventDao(changes, database.offlineEventDao)
+ fun clearAllTables() = database.clearAllTables()
+}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/APSResultDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/APSResultDao.kt
similarity index 82%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/APSResultDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/APSResultDao.kt
index 2958ba90db..c16a81486f 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/APSResultDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/APSResultDao.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_APS_RESULTS
-import info.nightscout.androidaps.database.entities.APSResult
+import info.nightscout.database.entities.APSResult
+import info.nightscout.database.entities.TABLE_APS_RESULTS
@Suppress("FunctionName")
@Dao
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/APSResultLinkDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/APSResultLinkDao.kt
similarity index 77%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/APSResultLinkDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/APSResultLinkDao.kt
index 1b0568c917..31c99be5ad 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/APSResultLinkDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/APSResultLinkDao.kt
@@ -1,10 +1,10 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_APS_RESULTS
-import info.nightscout.androidaps.database.TABLE_APS_RESULT_LINKS
-import info.nightscout.androidaps.database.entities.APSResultLink
+import info.nightscout.database.entities.APSResultLink
+import info.nightscout.database.entities.TABLE_APS_RESULTS
+import info.nightscout.database.entities.TABLE_APS_RESULT_LINKS
@Dao
internal interface APSResultLinkDao : TraceableDao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/BolusCalculatorResultDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/BolusCalculatorResultDao.kt
similarity index 93%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/BolusCalculatorResultDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/BolusCalculatorResultDao.kt
index 05554208c8..b2432d2ada 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/BolusCalculatorResultDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/BolusCalculatorResultDao.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_BOLUS_CALCULATOR_RESULTS
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.TABLE_BOLUS_CALCULATOR_RESULTS
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/BolusDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/BolusDao.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/BolusDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/BolusDao.kt
index c1a35fac28..df1a9c7d2f 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/BolusDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/BolusDao.kt
@@ -1,10 +1,10 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_BOLUSES
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.TABLE_BOLUSES
+import info.nightscout.database.entities.embedments.InterfaceIDs
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/CarbsDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/CarbsDao.kt
similarity index 96%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/CarbsDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/CarbsDao.kt
index 53bd6c789b..7cf52a10d8 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/CarbsDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/CarbsDao.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_CARBS
-import info.nightscout.androidaps.database.entities.Carbs
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.TABLE_CARBS
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/DeviceStatusDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/DeviceStatusDao.kt
similarity index 89%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/DeviceStatusDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/DeviceStatusDao.kt
index addf3e2f21..35627f67c6 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/DeviceStatusDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/DeviceStatusDao.kt
@@ -1,11 +1,11 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
-import info.nightscout.androidaps.database.TABLE_DEVICE_STATUS
-import info.nightscout.androidaps.database.entities.DeviceStatus
+import info.nightscout.database.entities.DeviceStatus
+import info.nightscout.database.entities.TABLE_DEVICE_STATUS
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/EffectiveProfileSwitchDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/EffectiveProfileSwitchDao.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/EffectiveProfileSwitchDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/EffectiveProfileSwitchDao.kt
index aeeb9d1066..5fa4b6b233 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/EffectiveProfileSwitchDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/EffectiveProfileSwitchDao.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_EFFECTIVE_PROFILE_SWITCHES
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.TABLE_EFFECTIVE_PROFILE_SWITCHES
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/ExtendedBolusDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/ExtendedBolusDao.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/ExtendedBolusDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/ExtendedBolusDao.kt
index 84a9aa4557..65ea850580 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/ExtendedBolusDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/ExtendedBolusDao.kt
@@ -1,10 +1,10 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_EXTENDED_BOLUSES
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.ExtendedBolus
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.TABLE_EXTENDED_BOLUSES
+import info.nightscout.database.entities.embedments.InterfaceIDs
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/FoodDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/FoodDao.kt
similarity index 90%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/FoodDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/FoodDao.kt
index 492f02329e..fc3d85989b 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/FoodDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/FoodDao.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_FOODS
-import info.nightscout.androidaps.database.entities.Food
+import info.nightscout.database.entities.Food
+import info.nightscout.database.entities.TABLE_FOODS
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/GlucoseValueDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/GlucoseValueDao.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/GlucoseValueDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/GlucoseValueDao.kt
index 02687b0a7d..f30847c410 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/GlucoseValueDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/GlucoseValueDao.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_GLUCOSE_VALUES
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.TABLE_GLUCOSE_VALUES
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/MultiwaveBolusLinkDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/MultiwaveBolusLinkDao.kt
similarity index 82%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/MultiwaveBolusLinkDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/MultiwaveBolusLinkDao.kt
index 0bdb02b863..26a8cfad20 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/MultiwaveBolusLinkDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/MultiwaveBolusLinkDao.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_MULTIWAVE_BOLUS_LINKS
-import info.nightscout.androidaps.database.entities.MultiwaveBolusLink
+import info.nightscout.database.entities.MultiwaveBolusLink
+import info.nightscout.database.entities.TABLE_MULTIWAVE_BOLUS_LINKS
@Dao
internal interface MultiwaveBolusLinkDao : TraceableDao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/OfflineEventDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/OfflineEventDao.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/OfflineEventDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/OfflineEventDao.kt
index d8ce6c88a3..06bcf84542 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/OfflineEventDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/OfflineEventDao.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_OFFLINE_EVENTS
-import info.nightscout.androidaps.database.entities.OfflineEvent
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.TABLE_OFFLINE_EVENTS
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/PreferenceChangeDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/PreferenceChangeDao.kt
similarity index 74%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/PreferenceChangeDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/PreferenceChangeDao.kt
index a617e254e3..60896ddcbd 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/PreferenceChangeDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/PreferenceChangeDao.kt
@@ -1,10 +1,10 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_PREFERENCE_CHANGES
-import info.nightscout.androidaps.database.entities.PreferenceChange
+import info.nightscout.database.entities.PreferenceChange
+import info.nightscout.database.entities.TABLE_PREFERENCE_CHANGES
@Dao
interface PreferenceChangeDao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/ProfileSwitchDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/ProfileSwitchDao.kt
similarity index 91%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/ProfileSwitchDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/ProfileSwitchDao.kt
index ca994c6ccf..a15d7e1315 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/ProfileSwitchDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/ProfileSwitchDao.kt
@@ -1,16 +1,15 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_PROFILE_SWITCHES
-import info.nightscout.androidaps.database.daos.workaround.ProfileSwitchDaoWorkaround
-import info.nightscout.androidaps.database.data.checkSanity
-import info.nightscout.androidaps.database.entities.ProfileSwitch
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.TABLE_PROFILE_SWITCHES
+import info.nightscout.database.entities.data.checkSanity
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
@Dao
-internal interface ProfileSwitchDao : ProfileSwitchDaoWorkaround {
+internal interface ProfileSwitchDao : info.nightscout.database.impl.daos.workaround.ProfileSwitchDaoWorkaround {
@Query("SELECT * FROM $TABLE_PROFILE_SWITCHES WHERE id = :id")
override fun findById(id: Long): ProfileSwitch?
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/TemporaryBasalDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/TemporaryBasalDao.kt
similarity index 95%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/TemporaryBasalDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/TemporaryBasalDao.kt
index 40a84e90c5..88865ce2e8 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/TemporaryBasalDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/TemporaryBasalDao.kt
@@ -1,10 +1,10 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_TEMPORARY_BASALS
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TABLE_TEMPORARY_BASALS
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.embedments.InterfaceIDs
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/TemporaryTargetDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/TemporaryTargetDao.kt
similarity index 93%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/TemporaryTargetDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/TemporaryTargetDao.kt
index c002085377..f123ecd975 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/TemporaryTargetDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/TemporaryTargetDao.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_TEMPORARY_TARGETS
-import info.nightscout.androidaps.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TABLE_TEMPORARY_TARGETS
+import info.nightscout.database.entities.TemporaryTarget
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/TherapyEventDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/TherapyEventDao.kt
similarity index 95%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/TherapyEventDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/TherapyEventDao.kt
index 4a170f7fae..8150021416 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/TherapyEventDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/TherapyEventDao.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_THERAPY_EVENTS
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.TABLE_THERAPY_EVENTS
+import info.nightscout.database.entities.TherapyEvent
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/TotalDailyDoseDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/TotalDailyDoseDao.kt
similarity index 89%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/TotalDailyDoseDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/TotalDailyDoseDao.kt
index f630a6ef20..35eaac29e5 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/TotalDailyDoseDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/TotalDailyDoseDao.kt
@@ -1,10 +1,10 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_TOTAL_DAILY_DOSES
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.TotalDailyDose
+import info.nightscout.database.entities.TABLE_TOTAL_DAILY_DOSES
+import info.nightscout.database.entities.TotalDailyDose
+import info.nightscout.database.entities.embedments.InterfaceIDs
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Single
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/TraceableDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/TraceableDao.kt
similarity index 87%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/TraceableDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/TraceableDao.kt
index 080987c185..f0e753c035 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/TraceableDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/TraceableDao.kt
@@ -1,11 +1,10 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Insert
import androidx.room.Update
-import info.nightscout.androidaps.database.daos.workaround.TraceableDaoWorkaround
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
-internal interface TraceableDao : TraceableDaoWorkaround {
+internal interface TraceableDao : info.nightscout.database.impl.daos.workaround.TraceableDaoWorkaround {
fun findById(id: Long): T?
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/UserEntryDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/UserEntryDao.kt
similarity index 77%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/UserEntryDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/UserEntryDao.kt
index a5f1979c35..9af90ad9aa 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/UserEntryDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/UserEntryDao.kt
@@ -1,11 +1,11 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_USER_ENTRY
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.TABLE_USER_ENTRY
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Sources
import io.reactivex.rxjava3.core.Single
@Dao
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/VersionChangeDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/VersionChangeDao.kt
similarity index 78%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/VersionChangeDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/VersionChangeDao.kt
index c691981c50..a93e00b812 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/VersionChangeDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/VersionChangeDao.kt
@@ -1,10 +1,10 @@
-package info.nightscout.androidaps.database.daos
+package info.nightscout.database.impl.daos
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
-import info.nightscout.androidaps.database.TABLE_VERSION_CHANGES
-import info.nightscout.androidaps.database.entities.VersionChange
+import info.nightscout.database.entities.TABLE_VERSION_CHANGES
+import info.nightscout.database.entities.VersionChange
@Dao
interface VersionChangeDao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedAPSResultDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedAPSResultDao.kt
similarity index 63%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedAPSResultDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedAPSResultDao.kt
index ffe6180770..e99f80efd7 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedAPSResultDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedAPSResultDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.APSResultDao
-import info.nightscout.androidaps.database.entities.APSResult
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.entities.APSResult
+import info.nightscout.database.entities.interfaces.DBEntry
+import info.nightscout.database.impl.daos.APSResultDao
internal class DelegatedAPSResultDao(changes: MutableList, private val dao: APSResultDao) : DelegatedDao(changes), APSResultDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedAPSResultLinkDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedAPSResultLinkDao.kt
similarity index 64%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedAPSResultLinkDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedAPSResultLinkDao.kt
index 2152d3f9f0..a165536fcd 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedAPSResultLinkDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedAPSResultLinkDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.APSResultLinkDao
-import info.nightscout.androidaps.database.entities.APSResultLink
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.APSResultLinkDao
+import info.nightscout.database.entities.APSResultLink
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedAPSResultLinkLinkDao(changes: MutableList, private val dao: APSResultLinkDao) : DelegatedDao(changes), APSResultLinkDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedBolusCalculatorResultDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedBolusCalculatorResultDao.kt
similarity index 64%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedBolusCalculatorResultDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedBolusCalculatorResultDao.kt
index 40e92dcb04..0a6817a3c3 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedBolusCalculatorResultDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedBolusCalculatorResultDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.BolusCalculatorResultDao
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.BolusCalculatorResultDao
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedBolusCalculatorResultDao(changes: MutableList, private val dao: BolusCalculatorResultDao) : DelegatedDao(changes), BolusCalculatorResultDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedBolusDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedBolusDao.kt
similarity index 63%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedBolusDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedBolusDao.kt
index 67afec9e18..d35b0f38ce 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedBolusDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedBolusDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.BolusDao
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.BolusDao
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedBolusDao(changes: MutableList, private val dao: BolusDao) : DelegatedDao(changes), BolusDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedCarbsDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedCarbsDao.kt
similarity index 63%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedCarbsDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedCarbsDao.kt
index 0a2da34a05..58bb4f809e 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedCarbsDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedCarbsDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.CarbsDao
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.CarbsDao
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedCarbsDao(changes: MutableList, private val dao: CarbsDao) : DelegatedDao(changes), CarbsDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedDao.kt
similarity index 55%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedDao.kt
index ff5fe9ba64..2c22734e97 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedDao.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.entities.interfaces.DBEntry
/**
* A DAO that adds updated or inserted entries to a list
diff --git a/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedDeviceStatusDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedDeviceStatusDao.kt
new file mode 100644
index 0000000000..cc11ece89c
--- /dev/null
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedDeviceStatusDao.kt
@@ -0,0 +1,6 @@
+package info.nightscout.database.impl.daos.delegated
+
+import info.nightscout.database.impl.daos.DeviceStatusDao
+import info.nightscout.database.entities.interfaces.DBEntry
+
+internal class DelegatedDeviceStatusDao(changes: MutableList, private val dao: DeviceStatusDao) : DelegatedDao(changes), DeviceStatusDao by dao
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedEffectiveProfileSwitchDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedEffectiveProfileSwitchDao.kt
similarity index 64%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedEffectiveProfileSwitchDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedEffectiveProfileSwitchDao.kt
index 6516ffbc6c..4180653fdc 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedEffectiveProfileSwitchDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedEffectiveProfileSwitchDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.EffectiveProfileSwitchDao
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.EffectiveProfileSwitchDao
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedEffectiveProfileSwitchDao(changes: MutableList, private val dao: EffectiveProfileSwitchDao) : DelegatedDao(changes), EffectiveProfileSwitchDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedExtendedBolusDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedExtendedBolusDao.kt
similarity index 64%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedExtendedBolusDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedExtendedBolusDao.kt
index fa3a6369fd..76e89815dd 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedExtendedBolusDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedExtendedBolusDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.ExtendedBolusDao
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.ExtendedBolusDao
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedExtendedExtendedBolusDao(changes: MutableList, private val dao: ExtendedBolusDao) : DelegatedDao(changes), ExtendedBolusDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedFoodDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedFoodDao.kt
similarity index 62%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedFoodDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedFoodDao.kt
index 2d37a3e5be..d78aac0fa8 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedFoodDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedFoodDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.FoodDao
-import info.nightscout.androidaps.database.entities.Food
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.FoodDao
+import info.nightscout.database.entities.Food
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedFoodDao(changes: MutableList, private val dao: FoodDao) : DelegatedDao(changes), FoodDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedGlucoseValueDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedGlucoseValueDao.kt
similarity index 63%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedGlucoseValueDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedGlucoseValueDao.kt
index d16e84ebc5..e2eec39c07 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedGlucoseValueDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedGlucoseValueDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.GlucoseValueDao
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.GlucoseValueDao
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedGlucoseValueDao(changes: MutableList, private val dao: GlucoseValueDao) : DelegatedDao(changes), GlucoseValueDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedMultiwaveBolusLinkDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedMultiwaveBolusLinkDao.kt
similarity index 64%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedMultiwaveBolusLinkDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedMultiwaveBolusLinkDao.kt
index fd6079a146..c4263e79d9 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedMultiwaveBolusLinkDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedMultiwaveBolusLinkDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.MultiwaveBolusLinkDao
-import info.nightscout.androidaps.database.entities.MultiwaveBolusLink
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.MultiwaveBolusLinkDao
+import info.nightscout.database.entities.MultiwaveBolusLink
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedMultiwaveBolusLinkDao(changes: MutableList, private val dao: MultiwaveBolusLinkDao) : DelegatedDao(changes), MultiwaveBolusLinkDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedOfflineEventDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedOfflineEventDao.kt
similarity index 63%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedOfflineEventDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedOfflineEventDao.kt
index fc2bc94c30..bd25c6afdc 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedOfflineEventDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedOfflineEventDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.OfflineEventDao
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.OfflineEventDao
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedOfflineEventDao(changes: MutableList, private val dao: OfflineEventDao) : DelegatedDao(changes), OfflineEventDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedPreferenceChangeDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedPreferenceChangeDao.kt
similarity index 55%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedPreferenceChangeDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedPreferenceChangeDao.kt
index 97ba761423..37210a727f 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedPreferenceChangeDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedPreferenceChangeDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.PreferenceChangeDao
-import info.nightscout.androidaps.database.entities.PreferenceChange
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.PreferenceChangeDao
+import info.nightscout.database.entities.PreferenceChange
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedPreferenceChangeDao(changes: MutableList, private val dao: PreferenceChangeDao) : DelegatedDao(changes), PreferenceChangeDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedProfileSwitchDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedProfileSwitchDao.kt
similarity index 63%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedProfileSwitchDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedProfileSwitchDao.kt
index 11ded9ccdc..4d22152451 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedProfileSwitchDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedProfileSwitchDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.ProfileSwitchDao
-import info.nightscout.androidaps.database.entities.ProfileSwitch
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.ProfileSwitchDao
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedProfileSwitchDao(changes: MutableList, private val dao: ProfileSwitchDao) : DelegatedDao(changes), ProfileSwitchDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTemporaryBasalDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTemporaryBasalDao.kt
similarity index 63%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTemporaryBasalDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTemporaryBasalDao.kt
index c48ca004cb..13ef3fe130 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTemporaryBasalDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTemporaryBasalDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.TemporaryBasalDao
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.TemporaryBasalDao
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedTemporaryBasalDao(changes: MutableList, private val dao: TemporaryBasalDao) : DelegatedDao(changes), TemporaryBasalDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTemporaryTargetDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTemporaryTargetDao.kt
similarity index 63%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTemporaryTargetDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTemporaryTargetDao.kt
index a3cba800f5..9b0b0307c3 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTemporaryTargetDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTemporaryTargetDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.TemporaryTargetDao
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.TemporaryTargetDao
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedTemporaryTargetDao(changes: MutableList, private val dao: TemporaryTargetDao) : DelegatedDao(changes), TemporaryTargetDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTherapyEventDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTherapyEventDao.kt
similarity index 63%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTherapyEventDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTherapyEventDao.kt
index 767edd50a9..099d043f4f 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTherapyEventDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTherapyEventDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.TherapyEventDao
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.TherapyEventDao
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedTherapyEventDao(changes: MutableList, private val dao: TherapyEventDao) : DelegatedDao(changes), TherapyEventDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTotalDailyDoseDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTotalDailyDoseDao.kt
similarity index 63%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTotalDailyDoseDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTotalDailyDoseDao.kt
index 95bc5ab108..f69e83e6f9 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedTotalDailyDoseDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedTotalDailyDoseDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.TotalDailyDoseDao
-import info.nightscout.androidaps.database.entities.TotalDailyDose
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.TotalDailyDoseDao
+import info.nightscout.database.entities.TotalDailyDose
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedTotalDailyDoseDao(changes: MutableList, private val dao: TotalDailyDoseDao) : DelegatedDao(changes), TotalDailyDoseDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedUserEntryDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedUserEntryDao.kt
similarity index 52%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedUserEntryDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedUserEntryDao.kt
index b0b8eb4c19..9faed2f2c0 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedUserEntryDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedUserEntryDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.UserEntryDao
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.UserEntryDao
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedUserEntryDao(changes: MutableList, private val dao: UserEntryDao) : DelegatedDao(changes), UserEntryDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedVersionChangeDao.kt b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedVersionChangeDao.kt
similarity index 54%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedVersionChangeDao.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedVersionChangeDao.kt
index 81a5ecb799..4f2564efa9 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/delegated/DelegatedVersionChangeDao.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/delegated/DelegatedVersionChangeDao.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.daos.delegated
+package info.nightscout.database.impl.daos.delegated
-import info.nightscout.androidaps.database.daos.VersionChangeDao
-import info.nightscout.androidaps.database.entities.VersionChange
-import info.nightscout.androidaps.database.interfaces.DBEntry
+import info.nightscout.database.impl.daos.VersionChangeDao
+import info.nightscout.database.entities.VersionChange
+import info.nightscout.database.entities.interfaces.DBEntry
internal class DelegatedVersionChangeDao(changes: MutableList, private val dao: VersionChangeDao) : DelegatedDao(changes), VersionChangeDao by dao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/workaround/ProfileSwitchDaoWorkaround.java b/database/impl/src/main/java/info/nightscout/database/impl/daos/workaround/ProfileSwitchDaoWorkaround.java
similarity index 60%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/workaround/ProfileSwitchDaoWorkaround.java
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/workaround/ProfileSwitchDaoWorkaround.java
index 9a817ff215..04fc586e06 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/workaround/ProfileSwitchDaoWorkaround.java
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/workaround/ProfileSwitchDaoWorkaround.java
@@ -1,11 +1,11 @@
-package info.nightscout.androidaps.database.daos.workaround;
+package info.nightscout.database.impl.daos.workaround;
import androidx.room.Transaction;
-import info.nightscout.androidaps.database.daos.ProfileSwitchDao;
-import info.nightscout.androidaps.database.daos.ProfileSwitchDaoKt;
-import info.nightscout.androidaps.database.daos.TraceableDao;
-import info.nightscout.androidaps.database.entities.ProfileSwitch;
+import info.nightscout.database.impl.daos.ProfileSwitchDaoKt;
+import info.nightscout.database.entities.ProfileSwitch;
+import info.nightscout.database.impl.daos.ProfileSwitchDao;
+import info.nightscout.database.impl.daos.TraceableDao;
public interface ProfileSwitchDaoWorkaround extends TraceableDao {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/workaround/TraceableDaoWorkaround.java b/database/impl/src/main/java/info/nightscout/database/impl/daos/workaround/TraceableDaoWorkaround.java
similarity index 71%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/workaround/TraceableDaoWorkaround.java
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/workaround/TraceableDaoWorkaround.java
index 0e2540d088..355d750a9d 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/workaround/TraceableDaoWorkaround.java
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/workaround/TraceableDaoWorkaround.java
@@ -1,10 +1,10 @@
-package info.nightscout.androidaps.database.daos.workaround;
+package info.nightscout.database.impl.daos.workaround;
import androidx.room.Transaction;
-import info.nightscout.androidaps.database.daos.TraceableDao;
-import info.nightscout.androidaps.database.daos.TraceableDaoKt;
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry;
+import info.nightscout.database.impl.daos.TraceableDaoKt;
+import info.nightscout.database.entities.interfaces.TraceableDBEntry;
+import info.nightscout.database.impl.daos.TraceableDao;
// keep in java, it's easier
public interface TraceableDaoWorkaround {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/workaround/package-info.java b/database/impl/src/main/java/info/nightscout/database/impl/daos/workaround/package-info.java
similarity index 74%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/daos/workaround/package-info.java
rename to database/impl/src/main/java/info/nightscout/database/impl/daos/workaround/package-info.java
index 089581be3b..5269c8bd8c 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/daos/workaround/package-info.java
+++ b/database/impl/src/main/java/info/nightscout/database/impl/daos/workaround/package-info.java
@@ -2,4 +2,4 @@
* Workarounds until Kotlin is able to properly translate interface default methods while annotation processing.
* See https://youtrack.jetbrains.com/issue/KT-25960
*/
-package info.nightscout.androidaps.database.daos.workaround;
\ No newline at end of file
+package info.nightscout.database.impl.daos.workaround;
\ No newline at end of file
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/utils/serialisation/SealedClassHelper.kt b/database/impl/src/main/java/info/nightscout/database/impl/serialisation/SealedClassHelper.kt
similarity index 97%
rename from core/core-main/src/main/java/info/nightscout/androidaps/utils/serialisation/SealedClassHelper.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/serialisation/SealedClassHelper.kt
index a3fd471bd2..3ef63cbaa4 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/utils/serialisation/SealedClassHelper.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/serialisation/SealedClassHelper.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.utils.serialisation
+package info.nightscout.database.impl.serialisation
import com.google.gson.Gson
import com.google.gson.GsonBuilder
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CancelCurrentOfflineEventIfAnyTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/CancelCurrentOfflineEventIfAnyTransaction.kt
similarity index 78%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CancelCurrentOfflineEventIfAnyTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/CancelCurrentOfflineEventIfAnyTransaction.kt
index 6d5e1c1794..a7e1144d48 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CancelCurrentOfflineEventIfAnyTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/CancelCurrentOfflineEventIfAnyTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.interfaces.end
class CancelCurrentOfflineEventIfAnyTransaction(
val timestamp: Long
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CancelCurrentTemporaryTargetIfAnyTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/CancelCurrentTemporaryTargetIfAnyTransaction.kt
similarity index 78%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CancelCurrentTemporaryTargetIfAnyTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/CancelCurrentTemporaryTargetIfAnyTransaction.kt
index f2d65145c2..79ee6841b3 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CancelCurrentTemporaryTargetIfAnyTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/CancelCurrentTemporaryTargetIfAnyTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.interfaces.end
class CancelCurrentTemporaryTargetIfAnyTransaction(
val timestamp: Long
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CgmSourceTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/CgmSourceTransaction.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CgmSourceTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/CgmSourceTransaction.kt
index 939ebbe817..1f3070a319 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CgmSourceTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/CgmSourceTransaction.kt
@@ -1,8 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.ProfileSwitch
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.TherapyEvent
/**
* Inserts data from a CGM source into the database
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CutCarbsTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/CutCarbsTransaction.kt
similarity index 85%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CutCarbsTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/CutCarbsTransaction.kt
index 90637de496..8b789e3434 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/CutCarbsTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/CutCarbsTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.interfaces.end
import kotlin.math.roundToInt
class CutCarbsTransaction(val id: Long, val end: Long) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentOfflineEventTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertAndCancelCurrentOfflineEventTransaction.kt
similarity index 84%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentOfflineEventTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertAndCancelCurrentOfflineEventTransaction.kt
index f4dd63fe81..2b49d95e37 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentOfflineEventTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertAndCancelCurrentOfflineEventTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.interfaces.end
class InsertAndCancelCurrentOfflineEventTransaction(
val offlineEvent: OfflineEvent
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentTemporaryTargetTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertAndCancelCurrentTemporaryTargetTransaction.kt
similarity index 86%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentTemporaryTargetTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertAndCancelCurrentTemporaryTargetTransaction.kt
index 87867309b6..687c27442b 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertAndCancelCurrentTemporaryTargetTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertAndCancelCurrentTemporaryTargetTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.interfaces.end
class InsertAndCancelCurrentTemporaryTargetTransaction(
val temporaryTarget: TemporaryTarget
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertBolusWithTempIdTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertBolusWithTempIdTransaction.kt
similarity index 88%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertBolusWithTempIdTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertBolusWithTempIdTransaction.kt
index 2b7ad086ac..3096e8c943 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertBolusWithTempIdTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertBolusWithTempIdTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
/**
* Creates or updates the Bolus from pump synchronization
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertGlucoseValueTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertGlucoseValueTransaction.kt
similarity index 64%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertGlucoseValueTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertGlucoseValueTransaction.kt
index b75c4a3928..3c0c8215c2 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertGlucoseValueTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertGlucoseValueTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
/**
* Creates the GlucoseValue
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertIfNewByTimestampCarbsTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertIfNewByTimestampCarbsTransaction.kt
similarity index 82%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertIfNewByTimestampCarbsTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertIfNewByTimestampCarbsTransaction.kt
index 9fed606fde..5d2cdfe2a1 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertIfNewByTimestampCarbsTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertIfNewByTimestampCarbsTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Carbs
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.embedments.InterfaceIDs
/**
* Creates Carbs if record doesn't exist
@@ -15,12 +15,14 @@ class InsertIfNewByTimestampCarbsTransaction(
amount: Double,
duration: Long,
interfaceIDs_backing: InterfaceIDs? = null
- ) : this(Carbs(
+ ) : this(
+ Carbs(
timestamp = timestamp,
amount = amount,
duration = duration,
interfaceIDs_backing = interfaceIDs_backing
- ))
+ )
+ )
override fun run(): TransactionResult {
val result = TransactionResult()
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertIfNewByTimestampTherapyEventTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertIfNewByTimestampTherapyEventTransaction.kt
similarity index 90%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertIfNewByTimestampTherapyEventTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertIfNewByTimestampTherapyEventTransaction.kt
index d283f0c6ca..1214595809 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertIfNewByTimestampTherapyEventTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertIfNewByTimestampTherapyEventTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.TherapyEvent
class InsertIfNewByTimestampTherapyEventTransaction(
val therapyEvent: TherapyEvent
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateBolusCalculatorResultTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateBolusCalculatorResultTransaction.kt
similarity index 82%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateBolusCalculatorResultTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateBolusCalculatorResultTransaction.kt
index dfef194370..0f4fee61d5 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateBolusCalculatorResultTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateBolusCalculatorResultTransaction.kt
@@ -1,7 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.BolusCalculatorResult
/**
* Creates or updates the BolusCalculatorResult
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateBolusTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateBolusTransaction.kt
similarity index 81%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateBolusTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateBolusTransaction.kt
index 25fe10c062..9d3d2ff894 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateBolusTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateBolusTransaction.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.embedments.InsulinConfiguration
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.embedments.InsulinConfiguration
+import info.nightscout.database.entities.embedments.InterfaceIDs
/**
* Creates or updates the Bolus
@@ -19,7 +19,8 @@ class InsertOrUpdateBolusTransaction(
isBasalInsulin: Boolean = false,
insulinConfiguration: InsulinConfiguration? = null,
interfaceIDs_backing: InterfaceIDs? = null
- ) : this(Bolus(
+ ) : this(
+ Bolus(
timestamp = timestamp,
amount = amount,
type = type,
@@ -27,7 +28,8 @@ class InsertOrUpdateBolusTransaction(
isBasalInsulin = isBasalInsulin,
insulinConfiguration = insulinConfiguration,
interfaceIDs_backing = interfaceIDs_backing
- ))
+ )
+ )
override fun run(): TransactionResult {
val result = TransactionResult()
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateCarbsTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateCarbsTransaction.kt
similarity index 83%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateCarbsTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateCarbsTransaction.kt
index 8f84cfb0ec..57d58dfb67 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateCarbsTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateCarbsTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Carbs
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.embedments.InterfaceIDs
/**
* Creates or updates the Carbs
@@ -16,13 +16,15 @@ class InsertOrUpdateCarbsTransaction(
duration: Long,
notes: String,
interfaceIDs_backing: InterfaceIDs? = null
- ) : this(Carbs(
+ ) : this(
+ Carbs(
timestamp = timestamp,
amount = amount,
duration = duration,
notes = notes,
interfaceIDs_backing = interfaceIDs_backing
- ))
+ )
+ )
override fun run(): TransactionResult {
val result = TransactionResult()
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateFoodTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateFoodTransaction.kt
similarity index 86%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateFoodTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateFoodTransaction.kt
index 7de6457542..e72bcb51db 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateFoodTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateFoodTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Food
+import info.nightscout.database.entities.Food
/**
* Inserts or updates the Food
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateProfileSwitch.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateProfileSwitch.kt
similarity index 86%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateProfileSwitch.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateProfileSwitch.kt
index 3a12a58e21..c420df5d69 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertOrUpdateProfileSwitch.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertOrUpdateProfileSwitch.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.ProfileSwitch
+import info.nightscout.database.entities.ProfileSwitch
class InsertOrUpdateProfileSwitch(val profileSwitch: ProfileSwitch) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertTemporaryBasalWithTempIdTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertTemporaryBasalWithTempIdTransaction.kt
similarity index 88%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertTemporaryBasalWithTempIdTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertTemporaryBasalWithTempIdTransaction.kt
index 27f931bcd9..9c94e62042 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertTemporaryBasalWithTempIdTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertTemporaryBasalWithTempIdTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryBasal
/**
* Creates or updates the TemporaryBasal from pump synchronization
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertTherapyEventAnnouncementTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertTherapyEventAnnouncementTransaction.kt
similarity index 86%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertTherapyEventAnnouncementTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertTherapyEventAnnouncementTransaction.kt
index fe9f4196f7..dca1c8afb2 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InsertTherapyEventAnnouncementTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InsertTherapyEventAnnouncementTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.embedments.InterfaceIDs
class InsertTherapyEventAnnouncementTransaction(
val therapyEvent: TherapyEvent
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateAAPSStartedTherapyEventTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateAAPSStartedTherapyEventTransaction.kt
similarity index 85%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateAAPSStartedTherapyEventTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateAAPSStartedTherapyEventTransaction.kt
index 2a152c408c..1c7ddc8c0e 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateAAPSStartedTherapyEventTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateAAPSStartedTherapyEventTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.TherapyEvent
class InvalidateAAPSStartedTherapyEventTransaction(private val note: String) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateBolusCalculatorResultTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateBolusCalculatorResultTransaction.kt
similarity index 85%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateBolusCalculatorResultTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateBolusCalculatorResultTransaction.kt
index 968efee665..e44afd114e 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateBolusCalculatorResultTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateBolusCalculatorResultTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.BolusCalculatorResult
class InvalidateBolusCalculatorResultTransaction(val id: Long) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateBolusTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateBolusTransaction.kt
similarity index 83%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateBolusTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateBolusTransaction.kt
index ac2dcad063..5f70905c5f 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateBolusTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateBolusTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
class InvalidateBolusTransaction(val id: Long) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateCarbsTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateCarbsTransaction.kt
similarity index 83%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateCarbsTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateCarbsTransaction.kt
index 9e9b373a33..ef9eabbe91 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateCarbsTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateCarbsTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Carbs
+import info.nightscout.database.entities.Carbs
class InvalidateCarbsTransaction(val id: Long) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateExtendedBolusTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateExtendedBolusTransaction.kt
similarity index 84%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateExtendedBolusTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateExtendedBolusTransaction.kt
index 7f28f09acf..b262c53627 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateExtendedBolusTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateExtendedBolusTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.ExtendedBolus
+import info.nightscout.database.entities.ExtendedBolus
class InvalidateExtendedBolusTransaction(val id: Long) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateFoodTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateFoodTransaction.kt
similarity index 85%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateFoodTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateFoodTransaction.kt
index a1f7b545e9..3074b16f11 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateFoodTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateFoodTransaction.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
class InvalidateFoodTransaction(val id: Long) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateGlucoseValueTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateGlucoseValueTransaction.kt
similarity index 85%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateGlucoseValueTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateGlucoseValueTransaction.kt
index 91669d5e70..77a6fd97ae 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateGlucoseValueTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateGlucoseValueTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
/**
* Invalidates the GlucoseValue with the specified id
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateNsIdProfileSwitchTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateNsIdProfileSwitchTransaction.kt
similarity index 77%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateNsIdProfileSwitchTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateNsIdProfileSwitchTransaction.kt
index 67cb703cc6..b70912bca3 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateNsIdProfileSwitchTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateNsIdProfileSwitchTransaction.kt
@@ -1,7 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Food
-import info.nightscout.androidaps.database.entities.ProfileSwitch
+import info.nightscout.database.entities.ProfileSwitch
class InvalidateNsIdProfileSwitchTransaction(val nsId: String) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateOfflineEventTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateOfflineEventTransaction.kt
similarity index 87%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateOfflineEventTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateOfflineEventTransaction.kt
index 9db9b8e84a..51cf8fc424 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateOfflineEventTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateOfflineEventTransaction.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
class InvalidateOfflineEventTransaction(val id: Long) : Transaction() {
override fun run() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateProfileSwitchTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateProfileSwitchTransaction.kt
similarity index 84%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateProfileSwitchTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateProfileSwitchTransaction.kt
index f51f46d106..f5089694fd 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateProfileSwitchTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateProfileSwitchTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.ProfileSwitch
+import info.nightscout.database.entities.ProfileSwitch
class InvalidateProfileSwitchTransaction(val id: Long) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryBasalTransaction.kt
similarity index 84%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryBasalTransaction.kt
index 5fcc6d90be..143fa2a92a 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryBasalTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryBasal
class InvalidateTemporaryBasalTransaction(val id: Long) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalTransactionWithPumpId.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryBasalTransactionWithPumpId.kt
similarity index 80%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalTransactionWithPumpId.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryBasalTransactionWithPumpId.kt
index 558731b28c..d4ed06050e 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalTransactionWithPumpId.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryBasalTransactionWithPumpId.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.embedments.InterfaceIDs
class InvalidateTemporaryBasalTransactionWithPumpId(val pumpId: Long, val pumpType: InterfaceIDs.PumpType, val
pumpSerial:
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalWithTempIdTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryBasalWithTempIdTransaction.kt
similarity index 85%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalWithTempIdTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryBasalWithTempIdTransaction.kt
index 1e1afaf4d8..9056ea96db 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryBasalWithTempIdTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryBasalWithTempIdTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryBasal
class InvalidateTemporaryBasalWithTempIdTransaction(val tempId: Long) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryTargetTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryTargetTransaction.kt
similarity index 87%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryTargetTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryTargetTransaction.kt
index 7109fbf672..043889f543 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTemporaryTargetTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTemporaryTargetTransaction.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
class InvalidateTemporaryTargetTransaction(val id: Long) : Transaction() {
override fun run() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTherapyEventTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTherapyEventTransaction.kt
similarity index 84%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTherapyEventTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTherapyEventTransaction.kt
index 3368d05996..2cf2319a3a 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/InvalidateTherapyEventTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/InvalidateTherapyEventTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.TherapyEvent
class InvalidateTherapyEventTransaction(val id: Long) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncBolusWithTempIdTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncBolusWithTempIdTransaction.kt
similarity index 90%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncBolusWithTempIdTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncBolusWithTempIdTransaction.kt
index 99449f5ce7..46624928d1 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncBolusWithTempIdTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncBolusWithTempIdTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
/**
* Creates or updates the Bolus from pump synchronization
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsBolusCalculatorResultTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsBolusCalculatorResultTransaction.kt
similarity index 93%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsBolusCalculatorResultTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsBolusCalculatorResultTransaction.kt
index bc9d4b0c07..c81cdaaadc 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsBolusCalculatorResultTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsBolusCalculatorResultTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.BolusCalculatorResult
/**
* Sync the BolusCalculatorResult from NS
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsBolusTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsBolusTransaction.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsBolusTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsBolusTransaction.kt
index a7f1c8b7f4..4098dc194a 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsBolusTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsBolusTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
/**
* Sync the Bolus from NS
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsCarbsTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsCarbsTransaction.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsCarbsTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsCarbsTransaction.kt
index 5e3bb60d94..f633bd1108 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsCarbsTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsCarbsTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Carbs
+import info.nightscout.database.entities.Carbs
/**
* Sync the carbs from NS
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsEffectiveProfileSwitchTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsEffectiveProfileSwitchTransaction.kt
similarity index 93%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsEffectiveProfileSwitchTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsEffectiveProfileSwitchTransaction.kt
index 81d264e79a..18f0c87203 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsEffectiveProfileSwitchTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsEffectiveProfileSwitchTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.EffectiveProfileSwitch
/**
* Sync the EffectiveProfileSwitch from NS
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsExtendedBolusTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsExtendedBolusTransaction.kt
similarity index 95%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsExtendedBolusTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsExtendedBolusTransaction.kt
index cd8f3accd1..7e13f94415 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsExtendedBolusTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsExtendedBolusTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.interfaces.end
import kotlin.math.abs
/**
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsFoodTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsFoodTransaction.kt
similarity index 91%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsFoodTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsFoodTransaction.kt
index 0ed3d70d93..33c1f68eb1 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsFoodTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsFoodTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Food
+import info.nightscout.database.entities.Food
/**
* Sync the TherapyEvents from NS
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsOfflineEventTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsOfflineEventTransaction.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsOfflineEventTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsOfflineEventTransaction.kt
index e787c591f3..44c142177e 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsOfflineEventTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsOfflineEventTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.interfaces.end
import kotlin.math.abs
/**
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsProfileSwitchTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsProfileSwitchTransaction.kt
similarity index 93%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsProfileSwitchTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsProfileSwitchTransaction.kt
index e11f5ebad0..33e90ecb9b 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsProfileSwitchTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsProfileSwitchTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.ProfileSwitch
+import info.nightscout.database.entities.ProfileSwitch
/**
* Sync the ProfileSwitch from NS
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsTemporaryBasalTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsTemporaryBasalTransaction.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsTemporaryBasalTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsTemporaryBasalTransaction.kt
index 1789102029..7f78c1a968 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsTemporaryBasalTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsTemporaryBasalTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.interfaces.end
import kotlin.math.abs
/**
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsTemporaryTargetTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsTemporaryTargetTransaction.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsTemporaryTargetTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsTemporaryTargetTransaction.kt
index d3fcb29cf1..f01d90e425 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsTemporaryTargetTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsTemporaryTargetTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.interfaces.end
import kotlin.math.abs
/**
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsTherapyEventTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsTherapyEventTransaction.kt
similarity index 94%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsTherapyEventTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsTherapyEventTransaction.kt
index f0fa5104c1..cd0c1e37e4 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncNsTherapyEventTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncNsTherapyEventTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.TherapyEvent
/**
* Sync the TherapyEvents from NS
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpBolusTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpBolusTransaction.kt
similarity index 92%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpBolusTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpBolusTransaction.kt
index c7ff85ba21..7063fb0db3 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpBolusTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpBolusTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
/**
* Creates or updates the Bolus from pump synchronization
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpCancelExtendedBolusIfAnyTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpCancelExtendedBolusIfAnyTransaction.kt
similarity index 82%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpCancelExtendedBolusIfAnyTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpCancelExtendedBolusIfAnyTransaction.kt
index 5553a7b1b1..e22e819d7a 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpCancelExtendedBolusIfAnyTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpCancelExtendedBolusIfAnyTransaction.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.end
class SyncPumpCancelExtendedBolusIfAnyTransaction(
private val timestamp: Long, private val endPumpId: Long, private val pumpType: InterfaceIDs.PumpType, private val pumpSerial: String
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpCancelTemporaryBasalIfAnyTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpCancelTemporaryBasalIfAnyTransaction.kt
similarity index 78%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpCancelTemporaryBasalIfAnyTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpCancelTemporaryBasalIfAnyTransaction.kt
index c66ab184e5..2523adbe18 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpCancelTemporaryBasalIfAnyTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpCancelTemporaryBasalIfAnyTransaction.kt
@@ -1,8 +1,8 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.database.entities.interfaces.end
class SyncPumpCancelTemporaryBasalIfAnyTransaction(
private val timestamp: Long, private val endPumpId: Long, private val pumpType: InterfaceIDs.PumpType, private val pumpSerial: String
@@ -27,6 +27,6 @@ class SyncPumpCancelTemporaryBasalIfAnyTransaction(
class TransactionResult {
- val updated = mutableListOf>()
+ val updated = mutableListOf>()
}
}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpExtendedBolusTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpExtendedBolusTransaction.kt
similarity index 92%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpExtendedBolusTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpExtendedBolusTransaction.kt
index ac73ba74ef..2f93d98b13 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpExtendedBolusTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpExtendedBolusTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.interfaces.end
/**
* Creates or updates the extended bolus from pump synchronization
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpTemporaryBasalTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpTemporaryBasalTransaction.kt
similarity index 90%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpTemporaryBasalTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpTemporaryBasalTransaction.kt
index cee4092633..fc8abfe8e0 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpTemporaryBasalTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpTemporaryBasalTransaction.kt
@@ -1,7 +1,7 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.interfaces.end
/**
* Creates or updates the Temporary basal from pump synchronization
@@ -50,6 +50,6 @@ class SyncPumpTemporaryBasalTransaction(
class TransactionResult {
val inserted = mutableListOf()
- val updated = mutableListOf>()
+ val updated = mutableListOf>()
}
}
\ No newline at end of file
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpTotalDailyDoseTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpTotalDailyDoseTransaction.kt
similarity index 92%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpTotalDailyDoseTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpTotalDailyDoseTransaction.kt
index 805d1cabb2..0321099227 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncPumpTotalDailyDoseTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncPumpTotalDailyDoseTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TotalDailyDose
+import info.nightscout.database.entities.TotalDailyDose
/**
* Creates or updates the TotalDailyDose from pump synchronization
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncTemporaryBasalWithTempIdTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncTemporaryBasalWithTempIdTransaction.kt
similarity index 91%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncTemporaryBasalWithTempIdTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncTemporaryBasalWithTempIdTransaction.kt
index 93a2e86ef8..b08f64f961 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/SyncTemporaryBasalWithTempIdTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/SyncTemporaryBasalWithTempIdTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryBasal
/**
* Creates or updates the TemporaryBasal from pump synchronization
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/Transaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/Transaction.kt
similarity index 69%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/Transaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/Transaction.kt
index 36d07a9926..3ba635334f 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/Transaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/Transaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.DelegatedAppDatabase
+import info.nightscout.database.impl.DelegatedAppDatabase
/**
* Base class for database transactions
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateGlucoseValueTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateGlucoseValueTransaction.kt
similarity index 65%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateGlucoseValueTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateGlucoseValueTransaction.kt
index 8d6ce188be..3ffa9fad5a 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateGlucoseValueTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateGlucoseValueTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
/**
* Updates the GlucoseValue
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdBolusCalculatorResultTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdBolusCalculatorResultTransaction.kt
similarity index 80%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdBolusCalculatorResultTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdBolusCalculatorResultTransaction.kt
index b824e1b4f4..99c9329a9c 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdBolusCalculatorResultTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdBolusCalculatorResultTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.BolusCalculatorResult
class UpdateNsIdBolusCalculatorResultTransaction(val bolusCalculatorResult: BolusCalculatorResult) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdBolusTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdBolusTransaction.kt
similarity index 78%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdBolusTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdBolusTransaction.kt
index 2504545419..1075094e0b 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdBolusTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdBolusTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
class UpdateNsIdBolusTransaction(val bolus: Bolus) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdCarbsTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdCarbsTransaction.kt
similarity index 78%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdCarbsTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdCarbsTransaction.kt
index 9595fd3a17..2c6ae614e3 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdCarbsTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdCarbsTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Carbs
+import info.nightscout.database.entities.Carbs
class UpdateNsIdCarbsTransaction(val carbs: Carbs) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdDeviceStatusTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdDeviceStatusTransaction.kt
similarity index 79%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdDeviceStatusTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdDeviceStatusTransaction.kt
index 159992ba5f..fc582722a3 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdDeviceStatusTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdDeviceStatusTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.DeviceStatus
+import info.nightscout.database.entities.DeviceStatus
class UpdateNsIdDeviceStatusTransaction(val deviceStatus: DeviceStatus) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdEffectiveProfileSwitchTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdEffectiveProfileSwitchTransaction.kt
similarity index 80%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdEffectiveProfileSwitchTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdEffectiveProfileSwitchTransaction.kt
index 027bf61b3a..d76205f75b 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdEffectiveProfileSwitchTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdEffectiveProfileSwitchTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.EffectiveProfileSwitch
class UpdateNsIdEffectiveProfileSwitchTransaction(val effectiveProfileSwitch: EffectiveProfileSwitch) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdExtendedBolusTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdExtendedBolusTransaction.kt
similarity index 78%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdExtendedBolusTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdExtendedBolusTransaction.kt
index cc174ad734..6d070a6516 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdExtendedBolusTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdExtendedBolusTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.ExtendedBolus
+import info.nightscout.database.entities.ExtendedBolus
class UpdateNsIdExtendedBolusTransaction(val bolus: ExtendedBolus) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdFoodTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdFoodTransaction.kt
similarity index 78%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdFoodTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdFoodTransaction.kt
index 78179c8cb8..f35b5a3efe 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdFoodTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdFoodTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.Food
+import info.nightscout.database.entities.Food
class UpdateNsIdFoodTransaction(val food: Food) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdGlucoseValueTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdGlucoseValueTransaction.kt
similarity index 79%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdGlucoseValueTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdGlucoseValueTransaction.kt
index 3b43b92943..eb047a377b 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdGlucoseValueTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdGlucoseValueTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
class UpdateNsIdGlucoseValueTransaction(val glucoseValue: GlucoseValue) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdOfflineEventTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdOfflineEventTransaction.kt
similarity index 79%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdOfflineEventTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdOfflineEventTransaction.kt
index 3da1b26ce7..48f8676d44 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdOfflineEventTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdOfflineEventTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.OfflineEvent
+import info.nightscout.database.entities.OfflineEvent
class UpdateNsIdOfflineEventTransaction(val offlineEvent: OfflineEvent) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdProfileSwitchTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdProfileSwitchTransaction.kt
similarity index 79%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdProfileSwitchTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdProfileSwitchTransaction.kt
index 368a66dc3f..b8886ed610 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdProfileSwitchTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdProfileSwitchTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.ProfileSwitch
+import info.nightscout.database.entities.ProfileSwitch
class UpdateNsIdProfileSwitchTransaction(val profileSwitch: ProfileSwitch) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdTemporaryBasalTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdTemporaryBasalTransaction.kt
similarity index 79%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdTemporaryBasalTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdTemporaryBasalTransaction.kt
index 571f3da027..1daa83442f 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdTemporaryBasalTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdTemporaryBasalTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryBasal
class UpdateNsIdTemporaryBasalTransaction(val temporaryBasal: TemporaryBasal) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdTemporaryTargetTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdTemporaryTargetTransaction.kt
similarity index 80%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdTemporaryTargetTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdTemporaryTargetTransaction.kt
index 28bd4211d6..0b4a369708 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdTemporaryTargetTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdTemporaryTargetTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TemporaryTarget
class UpdateNsIdTemporaryTargetTransaction(val temporaryTarget: TemporaryTarget) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdTherapyEventTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdTherapyEventTransaction.kt
similarity index 79%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdTherapyEventTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdTherapyEventTransaction.kt
index 0f04c6f81d..e310f1c1d3 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UpdateNsIdTherapyEventTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UpdateNsIdTherapyEventTransaction.kt
@@ -1,6 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.TherapyEvent
class UpdateNsIdTherapyEventTransaction(val therapyEvent: TherapyEvent) : Transaction() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UserEntryTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UserEntryTransaction.kt
similarity index 69%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UserEntryTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/UserEntryTransaction.kt
index 6443041f2c..72e52ab313 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/UserEntryTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/UserEntryTransaction.kt
@@ -1,9 +1,9 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
class UserEntryTransaction(private val entries: List) : Transaction>() {
diff --git a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/VersionChangeTransaction.kt b/database/impl/src/main/java/info/nightscout/database/impl/transactions/VersionChangeTransaction.kt
similarity index 77%
rename from database/impl/src/main/java/info/nightscout/androidaps/database/transactions/VersionChangeTransaction.kt
rename to database/impl/src/main/java/info/nightscout/database/impl/transactions/VersionChangeTransaction.kt
index ade887647f..b1a7dcab4b 100644
--- a/database/impl/src/main/java/info/nightscout/androidaps/database/transactions/VersionChangeTransaction.kt
+++ b/database/impl/src/main/java/info/nightscout/database/impl/transactions/VersionChangeTransaction.kt
@@ -1,7 +1,6 @@
-package info.nightscout.androidaps.database.transactions
+package info.nightscout.database.impl.transactions
-import info.nightscout.androidaps.database.entities.VersionChange
-import java.util.*
+import info.nightscout.database.entities.VersionChange
class VersionChangeTransaction(
private val versionName: String,
@@ -16,13 +15,15 @@ class VersionChangeTransaction(
|| current.versionCode != versionCode
|| current.gitRemote != gitRemote
|| current.commitHash != commitHash) {
- database.versionChangeDao.insert(VersionChange(
+ database.versionChangeDao.insert(
+ VersionChange(
timestamp = System.currentTimeMillis(),
versionCode = versionCode,
versionName = versionName,
gitRemote = gitRemote,
commitHash = commitHash
- ))
+ )
+ )
}
}
diff --git a/implementation/build.gradle b/implementation/build.gradle
index 21b9282f74..12b853240a 100644
--- a/implementation/build.gradle
+++ b/implementation/build.gradle
@@ -18,6 +18,7 @@ android {
dependencies {
implementation project(':app-wear-shared:rx')
implementation project(':app-wear-shared:shared')
+ implementation project(':database:entities')
implementation project(':database:impl')
implementation project(':automation')
implementation project(':interfaces')
diff --git a/implementation/src/main/java/info/nightscout/implementation/LocalAlertUtilsImpl.kt b/implementation/src/main/java/info/nightscout/implementation/LocalAlertUtilsImpl.kt
index e638859e77..587270034b 100644
--- a/implementation/src/main/java/info/nightscout/implementation/LocalAlertUtilsImpl.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/LocalAlertUtilsImpl.kt
@@ -1,29 +1,29 @@
package info.nightscout.implementation
-import info.nightscout.interfaces.Constants
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
+import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.Config
-import info.nightscout.interfaces.LocalAlertUtils
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
-import info.nightscout.interfaces.SmsCommunicator
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.LocalAlertUtils
+import info.nightscout.interfaces.SmsCommunicator
import info.nightscout.interfaces.notifications.Notification
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.shared.utils.T
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject
diff --git a/implementation/src/main/java/info/nightscout/implementation/TrendCalculatorImpl.kt b/implementation/src/main/java/info/nightscout/implementation/TrendCalculatorImpl.kt
index 05799ef818..e446a7059c 100644
--- a/implementation/src/main/java/info/nightscout/implementation/TrendCalculatorImpl.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/TrendCalculatorImpl.kt
@@ -1,10 +1,10 @@
package info.nightscout.implementation
-import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.TrendCalculator
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.utils.T
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/implementation/src/main/java/info/nightscout/implementation/XDripBroadcastImpl.kt b/implementation/src/main/java/info/nightscout/implementation/XDripBroadcastImpl.kt
index 6bfb75ed6c..993f5185b9 100644
--- a/implementation/src/main/java/info/nightscout/implementation/XDripBroadcastImpl.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/XDripBroadcastImpl.kt
@@ -4,17 +4,16 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import info.nightscout.androidaps.annotations.OpenForTesting
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.shared.extensions.safeQueryBroadcastReceivers
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.receivers.Intents
import info.nightscout.androidaps.utils.ToastUtils
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
-
+import info.nightscout.shared.extensions.safeQueryBroadcastReceivers
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import org.json.JSONArray
import org.json.JSONException
diff --git a/implementation/src/main/java/info/nightscout/implementation/pump/PumpSyncImplementation.kt b/implementation/src/main/java/info/nightscout/implementation/pump/PumpSyncImplementation.kt
index 59e55dcaca..8ab7ace961 100644
--- a/implementation/src/main/java/info/nightscout/implementation/pump/PumpSyncImplementation.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/pump/PumpSyncImplementation.kt
@@ -1,34 +1,24 @@
package info.nightscout.implementation.pump
-import info.nightscout.core.main.R
import info.nightscout.androidaps.data.DetailedBolusInfo
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.TotalDailyDose
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InsertBolusWithTempIdTransaction
-import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampCarbsTransaction
-import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
-import info.nightscout.androidaps.database.transactions.InsertTemporaryBasalWithTempIdTransaction
-import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
-import info.nightscout.androidaps.database.transactions.InvalidateTemporaryBasalTransaction
-import info.nightscout.androidaps.database.transactions.InvalidateTemporaryBasalTransactionWithPumpId
-import info.nightscout.androidaps.database.transactions.InvalidateTemporaryBasalWithTempIdTransaction
-import info.nightscout.androidaps.database.transactions.SyncBolusWithTempIdTransaction
-import info.nightscout.androidaps.database.transactions.SyncPumpBolusTransaction
-import info.nightscout.androidaps.database.transactions.SyncPumpCancelExtendedBolusIfAnyTransaction
-import info.nightscout.androidaps.database.transactions.SyncPumpCancelTemporaryBasalIfAnyTransaction
-import info.nightscout.androidaps.database.transactions.SyncPumpExtendedBolusTransaction
-import info.nightscout.androidaps.database.transactions.SyncPumpTemporaryBasalTransaction
-import info.nightscout.androidaps.database.transactions.SyncPumpTotalDailyDoseTransaction
-import info.nightscout.androidaps.database.transactions.SyncTemporaryBasalWithTempIdTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
+import info.nightscout.database.impl.transactions.InsertBolusWithTempIdTransaction
+import info.nightscout.database.impl.transactions.InsertIfNewByTimestampCarbsTransaction
+import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
+import info.nightscout.database.impl.transactions.InsertTemporaryBasalWithTempIdTransaction
+import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
+import info.nightscout.database.impl.transactions.InvalidateTemporaryBasalTransaction
+import info.nightscout.database.impl.transactions.InvalidateTemporaryBasalTransactionWithPumpId
+import info.nightscout.database.impl.transactions.InvalidateTemporaryBasalWithTempIdTransaction
+import info.nightscout.database.impl.transactions.SyncBolusWithTempIdTransaction
+import info.nightscout.database.impl.transactions.SyncPumpBolusTransaction
+import info.nightscout.database.impl.transactions.SyncPumpCancelExtendedBolusIfAnyTransaction
+import info.nightscout.database.impl.transactions.SyncPumpCancelTemporaryBasalIfAnyTransaction
+import info.nightscout.database.impl.transactions.SyncPumpExtendedBolusTransaction
+import info.nightscout.database.impl.transactions.SyncPumpTemporaryBasalTransaction
+import info.nightscout.database.impl.transactions.SyncPumpTotalDailyDoseTransaction
+import info.nightscout.database.impl.transactions.SyncTemporaryBasalWithTempIdTransaction
import info.nightscout.androidaps.extensions.fromDbPumpType
import info.nightscout.androidaps.extensions.toDbPumpType
import info.nightscout.androidaps.extensions.toDbSource
@@ -37,9 +27,19 @@ import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
-import info.nightscout.interfaces.pump.PumpType
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.TotalDailyDose
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.interfaces.VirtualPump
import info.nightscout.interfaces.notifications.Notification
+import info.nightscout.interfaces.pump.PumpType
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt
index c4b984e8a4..014996b3ee 100644
--- a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt
@@ -10,11 +10,8 @@ import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
-import info.nightscout.androidaps.database.entities.ProfileSwitch
-import info.nightscout.androidaps.database.interfaces.end
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.dialogs.BolusProgressDialog
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
@@ -29,6 +26,9 @@ import info.nightscout.androidaps.queue.commands.Command
import info.nightscout.androidaps.queue.commands.Command.CommandType
import info.nightscout.androidaps.utils.extensions.getCustomizedName
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.interfaces.end
import info.nightscout.implementation.R
import info.nightscout.implementation.queue.commands.CommandBolus
import info.nightscout.implementation.queue.commands.CommandCancelExtendedBolus
diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt
index d0169bb2db..bc37d95512 100644
--- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt
@@ -2,7 +2,7 @@ package info.nightscout.implementation.queue.commands
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.ValueWrapper
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.interfaces.Config
diff --git a/implementation/src/main/java/info/nightscout/implementation/stats/DexcomTirCalculatorImpl.kt b/implementation/src/main/java/info/nightscout/implementation/stats/DexcomTirCalculatorImpl.kt
index 27496e697e..8f62064ced 100644
--- a/implementation/src/main/java/info/nightscout/implementation/stats/DexcomTirCalculatorImpl.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/stats/DexcomTirCalculatorImpl.kt
@@ -4,7 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context
import android.view.ViewGroup
import android.widget.TableLayout
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.interfaces.stats.DexcomTIR
diff --git a/implementation/src/main/java/info/nightscout/implementation/stats/TddCalculatorImpl.kt b/implementation/src/main/java/info/nightscout/implementation/stats/TddCalculatorImpl.kt
index 33b7d2c55c..5731f6aab9 100644
--- a/implementation/src/main/java/info/nightscout/implementation/stats/TddCalculatorImpl.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/stats/TddCalculatorImpl.kt
@@ -8,25 +8,24 @@ import android.view.ViewGroup
import android.widget.TableLayout
import android.widget.TableRow
import android.widget.TextView
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.TotalDailyDose
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.extensions.toTableRow
import info.nightscout.androidaps.extensions.toTableRowHeader
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.interfaces.stats.TddCalculator
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.interfaces.utils.MidnightTime
-import info.nightscout.shared.utils.T
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.TotalDailyDose
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.implementation.R
+import info.nightscout.interfaces.utils.MidnightTime
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
-
+import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/implementation/src/main/java/info/nightscout/implementation/stats/TirCalculatorImpl.kt b/implementation/src/main/java/info/nightscout/implementation/stats/TirCalculatorImpl.kt
index 11bd1dd255..9c62357b90 100644
--- a/implementation/src/main/java/info/nightscout/implementation/stats/TirCalculatorImpl.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/stats/TirCalculatorImpl.kt
@@ -9,7 +9,7 @@ import android.view.ViewGroup
import android.widget.TableLayout
import android.widget.TextView
import info.nightscout.interfaces.Constants
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.shared.interfaces.ResourceHelper
diff --git a/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
index 693e5b0a30..6e2012ecd1 100644
--- a/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
+++ b/implementation/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
@@ -4,14 +4,14 @@ import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.embedments.InsulinConfiguration
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ProfileStore
import info.nightscout.androidaps.utils.extensions.pureProfileFromJson
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.embedments.InsulinConfiguration
import info.nightscout.interfaces.Config
import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.interfaces.ResourceHelper
diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt
index 5fde100e47..6767efaba0 100644
--- a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt
+++ b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt
@@ -8,15 +8,15 @@ import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.TestPumpPlugin
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.queue.commands.Command
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.Bolus
import info.nightscout.implementation.R
import info.nightscout.implementation.queue.commands.CommandBolus
import info.nightscout.implementation.queue.commands.CommandCustomCommand
diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt
index 4a57c089d5..415f774342 100644
--- a/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt
+++ b/implementation/src/test/java/info/nightscout/implementation/queue/QueueThreadTest.kt
@@ -6,7 +6,7 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.TestPumpPlugin
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.interfaces.ActivityNames
import info.nightscout.interfaces.AndroidPermission
diff --git a/openhumans/build.gradle b/openhumans/build.gradle
index e6736d3ad3..a2b03cecaa 100644
--- a/openhumans/build.gradle
+++ b/openhumans/build.gradle
@@ -18,6 +18,7 @@ android {
dependencies {
implementation project(':core:core-main')
+ implementation project(':database:entities')
implementation project(':database:impl')
implementation project(':interfaces')
implementation project(':app-wear-shared:rx')
diff --git a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt
index dc5788bee6..59ac4b7fa4 100644
--- a/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt
+++ b/openhumans/src/main/java/info/nightscout/androidaps/plugin/general/openhumans/OpenHumansUploader.kt
@@ -9,21 +9,29 @@ import android.util.DisplayMetrics
import android.view.WindowManager
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
-import androidx.work.*
+import androidx.work.BackoffPolicy
+import androidx.work.Constraints
+import androidx.work.ExistingPeriodicWorkPolicy
+import androidx.work.ExistingWorkPolicy
+import androidx.work.ForegroundInfo
+import androidx.work.NetworkType
+import androidx.work.OneTimeWorkRequestBuilder
+import androidx.work.PeriodicWorkRequestBuilder
+import androidx.work.WorkManager
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.data.Block
-import info.nightscout.androidaps.database.interfaces.TraceableDBEntry
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.events.EventPreferenceChange
-import info.nightscout.interfaces.PluginBase
-import info.nightscout.interfaces.PluginDescription
-import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.androidaps.plugin.general.openhumans.delegates.OHAppIDDelegate
import info.nightscout.androidaps.plugin.general.openhumans.delegates.OHCounterDelegate
import info.nightscout.androidaps.plugin.general.openhumans.delegates.OHStateDelegate
import info.nightscout.androidaps.plugin.general.openhumans.ui.OHFragment
import info.nightscout.androidaps.plugin.general.openhumans.ui.OHLoginActivity
+import info.nightscout.database.entities.data.Block
+import info.nightscout.database.entities.interfaces.TraceableDBEntry
+import info.nightscout.interfaces.PluginBase
+import info.nightscout.interfaces.PluginDescription
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 io.reactivex.rxjava3.disposables.CompositeDisposable
@@ -36,7 +44,9 @@ import org.json.JSONObject
import java.io.ByteArrayOutputStream
import java.security.MessageDigest
import java.text.SimpleDateFormat
-import java.util.*
+import java.util.Locale
+import java.util.TimeZone
+import java.util.UUID
import java.util.concurrent.TimeUnit
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
diff --git a/plugins/build.gradle b/plugins/build.gradle
index 2578589722..b2a00d7926 100644
--- a/plugins/build.gradle
+++ b/plugins/build.gradle
@@ -18,6 +18,7 @@ android {
dependencies {
implementation project(':app-wear-shared:rx')
implementation project(':app-wear-shared:shared')
+ implementation project(':database:entities')
implementation project(':database:impl')
implementation project(':graphview')
implementation project(':core:core-main')
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt
index 7020d10943..4f8fd1a4ab 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt
@@ -21,8 +21,6 @@ import dagger.android.HasAndroidInjector
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.data.LocalInsulin
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Profile
@@ -31,6 +29,8 @@ import info.nightscout.androidaps.interfaces.ProfileStore
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.utils.MidnightTime
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneIob.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneIob.kt
index b19aeb96c8..70f3611d92 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneIob.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneIob.kt
@@ -2,30 +2,30 @@ package info.nightscout.plugins.general.autotune
import info.nightscout.androidaps.data.IobTotal
import info.nightscout.androidaps.data.LocalInsulin
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.extensions.durationInMinutes
import info.nightscout.androidaps.extensions.iobCalc
import info.nightscout.androidaps.extensions.toJson
import info.nightscout.androidaps.extensions.toTemporaryBasal
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.plugins.sync.nsclient.extensions.toJson
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.shared.utils.T
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.utils.Round
import info.nightscout.plugins.R
import info.nightscout.plugins.general.autotune.data.ATProfile
+import info.nightscout.plugins.sync.nsclient.extensions.toJson
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import org.json.JSONArray
import org.json.JSONObject
import javax.inject.Inject
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt
index ffd4f5545f..9043b0605e 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt
@@ -4,25 +4,22 @@ import android.view.View
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.LocalInsulin
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.Autotune
-import info.nightscout.interfaces.BuildHelper
import info.nightscout.androidaps.interfaces.Insulin
-import info.nightscout.interfaces.PluginBase
-import info.nightscout.interfaces.PluginDescription
-import info.nightscout.interfaces.PluginType
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ProfileStore
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.shared.utils.DateUtil
+import info.nightscout.androidaps.utils.extensions.pureProfileFromJson
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.Autotune
+import info.nightscout.interfaces.BuildHelper
+import info.nightscout.interfaces.PluginBase
+import info.nightscout.interfaces.PluginDescription
+import info.nightscout.interfaces.PluginType
import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.interfaces.utils.MidnightTime
-import info.nightscout.shared.utils.T
-import info.nightscout.androidaps.utils.extensions.pureProfileFromJson
import info.nightscout.plugins.R
import info.nightscout.plugins.general.autotune.data.ATProfile
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
@@ -32,7 +29,10 @@ import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventLocalProfileChanged
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import org.json.JSONException
import org.json.JSONObject
import java.util.TimeZone
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePrep.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePrep.kt
index 0e6e88aada..37792897b3 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePrep.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePrep.kt
@@ -1,13 +1,11 @@
package info.nightscout.plugins.general.autotune
import info.nightscout.androidaps.data.LocalInsulin
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.shared.utils.DateUtil
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.utils.MidnightTime
import info.nightscout.interfaces.utils.Round
-import info.nightscout.shared.utils.T
import info.nightscout.plugins.R
import info.nightscout.plugins.general.autotune.data.ATProfile
import info.nightscout.plugins.general.autotune.data.BGDatum
@@ -16,6 +14,8 @@ import info.nightscout.plugins.general.autotune.data.DiaDeviation
import info.nightscout.plugins.general.autotune.data.PeakDeviation
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import javax.inject.Inject
import javax.inject.Singleton
import kotlin.math.abs
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/ATProfile.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/ATProfile.kt
index 326a9bcb8d..3148854abf 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/ATProfile.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/ATProfile.kt
@@ -1,27 +1,27 @@
package info.nightscout.plugins.general.autotune.data
import dagger.android.HasAndroidInjector
-import info.nightscout.core.main.R
import info.nightscout.androidaps.data.LocalInsulin
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.data.PureProfile
-import info.nightscout.androidaps.database.data.Block
import info.nightscout.androidaps.extensions.blockValueBySeconds
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Insulin
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ProfileStore
-import info.nightscout.shared.interfaces.ResourceHelper
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.shared.utils.T
import info.nightscout.androidaps.utils.extensions.pureProfileFromJson
+import info.nightscout.core.main.R
+import info.nightscout.database.entities.data.Block
import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.utils.Round
import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.SafeParse
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/BGDatum.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/BGDatum.kt
index 6be309eb58..a9337d87ff 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/BGDatum.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/data/BGDatum.kt
@@ -1,7 +1,7 @@
package info.nightscout.plugins.general.autotune.data
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.GlucoseValue.TrendArrow
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue.TrendArrow
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import org.json.JSONException
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt b/plugins/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt
index 7a57274a65..9327ed76d0 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/food/FoodFragment.kt
@@ -12,16 +12,16 @@ import android.widget.ArrayAdapter
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.Food
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.transactions.InvalidateFoodTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InvalidateFoodTransaction
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.ui.UIRunnable
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.Food
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.interfaces.ActivityNames
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.FoodFragmentBinding
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/food/FoodPlugin.kt b/plugins/src/main/java/info/nightscout/plugins/general/food/FoodPlugin.kt
index 1a154ef176..cafe8e9c0e 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/food/FoodPlugin.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/food/FoodPlugin.kt
@@ -5,19 +5,19 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.Food
-import info.nightscout.androidaps.database.transactions.SyncNsFoodTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.SyncNsFoodTransaction
import info.nightscout.androidaps.extensions.foodFromJson
+import info.nightscout.androidaps.receivers.DataWorkerStorage
+import info.nightscout.database.entities.Food
import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
-import info.nightscout.shared.interfaces.ResourceHelper
-import info.nightscout.androidaps.receivers.DataWorkerStorage
import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.plugins.R
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import org.json.JSONObject
import javax.inject.Inject
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
index 48d0084c44..3ae44eb019 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
@@ -13,16 +13,11 @@ import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.data.DetailedBolusInfo
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.CancelCurrentOfflineEventIfAnyTransaction
-import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentOfflineEventTransaction
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CancelCurrentOfflineEventIfAnyTransaction
+import info.nightscout.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentOfflineEventTransaction
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.extensions.valueToUnitsString
import info.nightscout.androidaps.interfaces.ActivePlugin
@@ -41,6 +36,11 @@ import info.nightscout.androidaps.receivers.DataWorkerStorage
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.Constraint
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt b/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt
index 33a53bf472..41cd2a3ace 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt
@@ -13,12 +13,12 @@ import android.view.WindowManager
import com.google.common.primitives.Ints.min
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.interfaces.SmsCommunicator
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.SmscommunicatorActivityOtpBinding
diff --git a/plugins/src/main/java/info/nightscout/plugins/insulin/ActivityGraph.kt b/plugins/src/main/java/info/nightscout/plugins/insulin/ActivityGraph.kt
index 58679ba98a..7a1c3321db 100644
--- a/plugins/src/main/java/info/nightscout/plugins/insulin/ActivityGraph.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/insulin/ActivityGraph.kt
@@ -6,10 +6,9 @@ import android.util.AttributeSet
import com.jjoe64.graphview.GraphView
import com.jjoe64.graphview.series.DataPoint
import com.jjoe64.graphview.series.LineGraphSeries
-import info.nightscout.androidaps.database.entities.Bolus
import info.nightscout.androidaps.interfaces.Insulin
+import info.nightscout.database.entities.Bolus
import info.nightscout.shared.utils.T
-import java.util.*
import kotlin.math.floor
class ActivityGraph : GraphView {
diff --git a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefBasePlugin.kt b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefBasePlugin.kt
index 8999ce4d78..3fac0105ab 100644
--- a/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefBasePlugin.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/insulin/InsulinOrefBasePlugin.kt
@@ -1,23 +1,23 @@
package info.nightscout.plugins.insulin
import dagger.android.HasAndroidInjector
-import info.nightscout.interfaces.data.Iob
-import info.nightscout.androidaps.database.embedments.InsulinConfiguration
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.interfaces.Config
import info.nightscout.androidaps.interfaces.Insulin
+import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
+import info.nightscout.androidaps.utils.HardLimits
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.embedments.InsulinConfiguration
+import info.nightscout.interfaces.Config
import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
-import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
-import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
+import info.nightscout.interfaces.data.Iob
import info.nightscout.interfaces.notifications.Notification
-import info.nightscout.androidaps.utils.HardLimits
-import info.nightscout.shared.utils.T
import info.nightscout.plugins.R
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger
+import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.shared.utils.T
import kotlin.math.exp
import kotlin.math.pow
diff --git a/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt b/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt
index 141c97d3de..c9c41de409 100644
--- a/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt
@@ -11,8 +11,6 @@ import android.widget.ArrayAdapter
import com.google.android.material.tabs.TabLayout
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
@@ -22,6 +20,8 @@ import info.nightscout.androidaps.utils.HardLimits
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.ActivityNames
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.GlucoseUnit
diff --git a/plugins/src/main/java/info/nightscout/plugins/source/BGSourceFragment.kt b/plugins/src/main/java/info/nightscout/plugins/source/BGSourceFragment.kt
index bbd9fa5650..dcb28c108c 100644
--- a/plugins/src/main/java/info/nightscout/plugins/source/BGSourceFragment.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/source/BGSourceFragment.kt
@@ -14,12 +14,8 @@ import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InvalidateGlucoseValueTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InvalidateGlucoseValueTransaction
import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.extensions.directionToIcon
import info.nightscout.androidaps.extensions.valueToUnitsString
@@ -29,6 +25,10 @@ import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.PluginBase
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.SourceFragmentBinding
diff --git a/plugins/src/main/java/info/nightscout/plugins/source/NSClientSourcePlugin.kt b/plugins/src/main/java/info/nightscout/plugins/source/NSClientSourcePlugin.kt
index 46658494b0..a82ce7769b 100644
--- a/plugins/src/main/java/info/nightscout/plugins/source/NSClientSourcePlugin.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/source/NSClientSourcePlugin.kt
@@ -5,16 +5,16 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.BgSource
-import info.nightscout.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.receivers.DataWorkerStorage
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.PluginBase
import info.nightscout.interfaces.PluginDescription
import info.nightscout.interfaces.PluginType
import info.nightscout.interfaces.notifications.Notification
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsShared/NSClientFragment.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsShared/NSClientFragment.kt
index 9f15c82c92..f1b792a522 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsShared/NSClientFragment.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsShared/NSClientFragment.kt
@@ -13,12 +13,12 @@ import android.widget.ScrollView
import androidx.core.view.MenuProvider
import androidx.lifecycle.Lifecycle
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.DataSyncSelector
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry
import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.NsClient
import info.nightscout.interfaces.PluginBase
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsShared/StoreDataForDb.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsShared/StoreDataForDb.kt
index a0161b55ff..99c60525e3 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsShared/StoreDataForDb.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsShared/StoreDataForDb.kt
@@ -5,39 +5,39 @@ import android.os.SystemClock
import androidx.work.Worker
import androidx.work.WorkerParameters
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.entities.ProfileSwitch
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
-import info.nightscout.androidaps.database.transactions.SyncNsBolusCalculatorResultTransaction
-import info.nightscout.androidaps.database.transactions.SyncNsBolusTransaction
-import info.nightscout.androidaps.database.transactions.SyncNsCarbsTransaction
-import info.nightscout.androidaps.database.transactions.SyncNsEffectiveProfileSwitchTransaction
-import info.nightscout.androidaps.database.transactions.SyncNsExtendedBolusTransaction
-import info.nightscout.androidaps.database.transactions.SyncNsOfflineEventTransaction
-import info.nightscout.androidaps.database.transactions.SyncNsProfileSwitchTransaction
-import info.nightscout.androidaps.database.transactions.SyncNsTemporaryBasalTransaction
-import info.nightscout.androidaps.database.transactions.SyncNsTemporaryTargetTransaction
-import info.nightscout.androidaps.database.transactions.SyncNsTherapyEventTransaction
-import info.nightscout.androidaps.database.transactions.UserEntryTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CgmSourceTransaction
+import info.nightscout.database.impl.transactions.SyncNsBolusCalculatorResultTransaction
+import info.nightscout.database.impl.transactions.SyncNsBolusTransaction
+import info.nightscout.database.impl.transactions.SyncNsCarbsTransaction
+import info.nightscout.database.impl.transactions.SyncNsEffectiveProfileSwitchTransaction
+import info.nightscout.database.impl.transactions.SyncNsExtendedBolusTransaction
+import info.nightscout.database.impl.transactions.SyncNsOfflineEventTransaction
+import info.nightscout.database.impl.transactions.SyncNsProfileSwitchTransaction
+import info.nightscout.database.impl.transactions.SyncNsTemporaryBasalTransaction
+import info.nightscout.database.impl.transactions.SyncNsTemporaryTargetTransaction
+import info.nightscout.database.impl.transactions.SyncNsTherapyEventTransaction
+import info.nightscout.database.impl.transactions.UserEntryTransaction
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.NsClient
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.NsClient
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.plugins.R
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
@@ -521,9 +521,10 @@ class StoreDataForDb @Inject constructor(
UserEntryTransaction.Entry(
dateUtil.now(),
action, UserEntry.Sources.NSClient, therapyEvent.note ?: "",
- listOf(ValueWithUnit.Timestamp(therapyEvent.timestamp),
- ValueWithUnit.TherapyEventType(therapyEvent.type),
- ValueWithUnit.fromGlucoseUnit(therapyEvent.glucose ?: 0.0, therapyEvent.glucoseUnit.toString).takeIf { therapyEvent.glucose != null })
+ listOf(
+ ValueWithUnit.Timestamp(therapyEvent.timestamp),
+ ValueWithUnit.TherapyEventType(therapyEvent.type),
+ ValueWithUnit.fromGlucoseUnit(therapyEvent.glucose ?: 0.0, therapyEvent.glucoseUnit.toString).takeIf { therapyEvent.glucose != null })
)
)
aapsLogger.debug(LTag.DATABASE, "Inserted TherapyEvent $therapyEvent")
@@ -534,9 +535,10 @@ class StoreDataForDb @Inject constructor(
UserEntryTransaction.Entry(
dateUtil.now(),
UserEntry.Action.CAREPORTAL_REMOVED, UserEntry.Sources.NSClient, therapyEvent.note ?: "",
- listOf(ValueWithUnit.Timestamp(therapyEvent.timestamp),
- ValueWithUnit.TherapyEventType(therapyEvent.type),
- ValueWithUnit.fromGlucoseUnit(therapyEvent.glucose ?: 0.0, therapyEvent.glucoseUnit.toString).takeIf { therapyEvent.glucose != null })
+ listOf(
+ ValueWithUnit.Timestamp(therapyEvent.timestamp),
+ ValueWithUnit.TherapyEventType(therapyEvent.type),
+ ValueWithUnit.fromGlucoseUnit(therapyEvent.glucose ?: 0.0, therapyEvent.glucoseUnit.toString).takeIf { therapyEvent.glucose != null })
)
)
aapsLogger.debug(LTag.DATABASE, "Invalidated TherapyEvent $therapyEvent")
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/DataSyncSelectorImplementation.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/DataSyncSelectorImplementation.kt
index 2b85ca8620..1871cdff35 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/DataSyncSelectorImplementation.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/DataSyncSelectorImplementation.kt
@@ -1,25 +1,25 @@
package info.nightscout.plugins.sync.nsclient
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.entities.DeviceStatus
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.entities.Food
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.entities.ProfileSwitch
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
import info.nightscout.androidaps.extensions.toJson
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.DataSyncSelector
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.utils.extensions.toJson
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.DeviceStatus
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.Food
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TherapyEvent
import info.nightscout.plugins.R
import info.nightscout.plugins.profile.ProfilePlugin
import info.nightscout.plugins.sync.nsclient.extensions.toJson
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSSettingsStatus.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSSettingsStatus.kt
index 83acdf14c2..cd727653e3 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSSettingsStatus.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/data/NSSettingsStatus.kt
@@ -2,13 +2,13 @@ package info.nightscout.plugins.sync.nsclient.data
import android.content.Context
import info.nightscout.androidaps.annotations.OpenForTesting
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.utils.JsonHelper
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/BolusExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/BolusExtension.kt
index 3dd977809e..54bd29fa90 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/BolusExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/BolusExtension.kt
@@ -1,15 +1,14 @@
package info.nightscout.plugins.sync.nsclient.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.shared.utils.DateUtil
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.interfaces.utils.JsonHelper
+import info.nightscout.shared.utils.DateUtil
import org.json.JSONObject
fun Bolus.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
JSONObject()
- .put("eventType", if (type == Bolus.Type.SMB) TherapyEvent.Type.CORRECTION_BOLUS.text else TherapyEvent.Type.MEAL_BOLUS.text)
+ .put("eventType", if (type == Bolus.Type.SMB) info.nightscout.database.entities.TherapyEvent.Type.CORRECTION_BOLUS.text else info.nightscout.database.entities.TherapyEvent.Type.MEAL_BOLUS.text)
.put("insulin", amount)
.put("created_at", dateUtil.toISOString(timestamp))
.put("date", timestamp)
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/CarbsExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/CarbsExtension.kt
index 3e588b8723..4ca0a041d4 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/CarbsExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/CarbsExtension.kt
@@ -1,15 +1,14 @@
package info.nightscout.plugins.sync.nsclient.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.shared.utils.DateUtil
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.interfaces.utils.JsonHelper
+import info.nightscout.shared.utils.DateUtil
import org.json.JSONObject
fun Carbs.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
JSONObject()
- .put("eventType", if (amount < 12) TherapyEvent.Type.CARBS_CORRECTION.text else TherapyEvent.Type.MEAL_BOLUS.text)
+ .put("eventType", if (amount < 12) info.nightscout.database.entities.TherapyEvent.Type.CARBS_CORRECTION.text else info.nightscout.database.entities.TherapyEvent.Type.MEAL_BOLUS.text)
.put("carbs", amount)
.put("notes", notes)
.put("created_at", dateUtil.toISOString(timestamp))
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/DeviceStatusExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/DeviceStatusExtension.kt
index f973198253..93acb73248 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/DeviceStatusExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/DeviceStatusExtension.kt
@@ -1,12 +1,12 @@
package info.nightscout.androidaps.utils.extensions
import android.os.Build
-import info.nightscout.androidaps.database.entities.DeviceStatus
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.Pump
import info.nightscout.androidaps.receivers.ReceiverStatusStore
+import info.nightscout.database.entities.DeviceStatus
import info.nightscout.plugins.configBuilder.RunningConfiguration
import info.nightscout.shared.utils.DateUtil
import org.json.JSONObject
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/EffectiveProfileSwitchExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/EffectiveProfileSwitchExtension.kt
index 5c0c6929eb..d4f0702c3b 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/EffectiveProfileSwitchExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/EffectiveProfileSwitchExtension.kt
@@ -1,13 +1,12 @@
package info.nightscout.plugins.sync.nsclient.extensions
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.interfaces.GlucoseUnit
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.androidaps.utils.extensions.pureProfileFromJson
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.utils.JsonHelper
+import info.nightscout.shared.utils.DateUtil
import org.json.JSONObject
fun EffectiveProfileSwitch.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
@@ -15,7 +14,7 @@ fun EffectiveProfileSwitch.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObjec
.put("created_at", dateUtil.toISOString(timestamp))
.put("enteredBy", "openaps://" + "AndroidAPS")
.put("isValid", isValid)
- .put("eventType", TherapyEvent.Type.NOTE.text) // move to separate collection when available in NS
+ .put("eventType", info.nightscout.database.entities.TherapyEvent.Type.NOTE.text) // move to separate collection when available in NS
.put("profileJson", ProfileSealed.EPS(this).toPureNsJson(dateUtil).toString())
.put("originalProfileName", originalProfileName)
.put("originalCustomizedName", originalCustomizedName)
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ExtendedBolusExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ExtendedBolusExtension.kt
index 03e45f2c1a..72803e5e17 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ExtendedBolusExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ExtendedBolusExtension.kt
@@ -1,14 +1,12 @@
package info.nightscout.plugins.sync.nsclient.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.extensions.toTemporaryBasal
import info.nightscout.androidaps.interfaces.Profile
-import info.nightscout.plugins.sync.nsclient.extensions.toJson
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
-import info.nightscout.interfaces.utils.JsonHelper
import org.json.JSONObject
fun ExtendedBolus.toJson(isAdd: Boolean, profile: Profile, dateUtil: DateUtil): JSONObject =
@@ -22,7 +20,7 @@ fun ExtendedBolus.toRealJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
JSONObject()
.put("created_at", dateUtil.toISOString(timestamp))
.put("enteredBy", "openaps://" + "AndroidAPS")
- .put("eventType", TherapyEvent.Type.COMBO_BOLUS.text)
+ .put("eventType", info.nightscout.database.entities.TherapyEvent.Type.COMBO_BOLUS.text)
.put("duration", T.msecs(duration).mins())
.put("durationInMilliseconds", duration)
.put("splitNow", 0)
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/OfflineEventExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/OfflineEventExtension.kt
index 704a47da3f..dcfca67c87 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/OfflineEventExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/OfflineEventExtension.kt
@@ -1,18 +1,17 @@
package info.nightscout.plugins.sync.nsclient.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.OfflineEvent
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
-import info.nightscout.interfaces.utils.JsonHelper
import org.json.JSONObject
fun OfflineEvent.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
JSONObject()
.put("created_at", dateUtil.toISOString(timestamp))
.put("enteredBy", "openaps://" + "AndroidAPS")
- .put("eventType", TherapyEvent.Type.APS_OFFLINE.text)
+ .put("eventType", info.nightscout.database.entities.TherapyEvent.Type.APS_OFFLINE.text)
.put("isValid", isValid)
.put("duration", T.msecs(duration).mins())
.put("durationInMilliseconds", duration)
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ProfileSwitchExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ProfileSwitchExtension.kt
index ac2b9378b3..03efb14c17 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ProfileSwitchExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/ProfileSwitchExtension.kt
@@ -1,16 +1,15 @@
package info.nightscout.plugins.sync.nsclient.extensions
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.ProfileSwitch
-import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.shared.utils.T
import info.nightscout.androidaps.utils.extensions.fromConstant
import info.nightscout.androidaps.utils.extensions.getCustomizedName
import info.nightscout.androidaps.utils.extensions.pureProfileFromJson
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.interfaces.utils.JsonHelper
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import org.json.JSONObject
fun ProfileSwitch.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
@@ -24,7 +23,7 @@ fun ProfileSwitch.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject =
.put("created_at", dateUtil.toISOString(timestamp))
.put("enteredBy", "openaps://" + "AndroidAPS")
.put("isValid", isValid)
- .put("eventType", TherapyEvent.Type.PROFILE_SWITCH.text)
+ .put("eventType", info.nightscout.database.entities.TherapyEvent.Type.PROFILE_SWITCH.text)
.also { // remove customization to store original profileJson in toPureNsJson call
timeshift = 0
percentage = 100
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryBasalExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryBasalExtension.kt
index eb2cc38596..25e6c352d3 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryBasalExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryBasalExtension.kt
@@ -1,21 +1,20 @@
package info.nightscout.plugins.sync.nsclient.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.entities.TemporaryBasal.Type.Companion.fromString
-import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.interfaces.Profile
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryBasal.Type.Companion.fromString
+import info.nightscout.database.entities.embedments.InterfaceIDs
+import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
-import info.nightscout.interfaces.utils.JsonHelper
import org.json.JSONObject
fun TemporaryBasal.toJson(isAdd: Boolean, profile: Profile, dateUtil: DateUtil): JSONObject =
JSONObject()
.put("created_at", dateUtil.toISOString(timestamp))
.put("enteredBy", "openaps://" + "AndroidAPS")
- .put("eventType", TherapyEvent.Type.TEMPORARY_BASAL.text)
+ .put("eventType", info.nightscout.database.entities.TherapyEvent.Type.TEMPORARY_BASAL.text)
.put("isValid", isValid)
.put("duration", T.msecs(duration).mins())
.put("durationInMilliseconds", duration) // rounded duration leads to different basal IOB
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryTargetExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryTargetExtension.kt
index 601edffeab..6034f4d930 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryTargetExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TemporaryTargetExtension.kt
@@ -1,13 +1,12 @@
package info.nightscout.plugins.sync.nsclient.extensions
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
-import info.nightscout.interfaces.Constants
-import info.nightscout.interfaces.utils.JsonHelper
import org.json.JSONObject
fun temporaryTargetFromJson(jsonObject: JSONObject): TemporaryTarget? {
@@ -50,7 +49,7 @@ fun temporaryTargetFromJson(jsonObject: JSONObject): TemporaryTarget? {
fun TemporaryTarget.toJson(isAdd: Boolean, units: GlucoseUnit, dateUtil: DateUtil): JSONObject =
JSONObject()
- .put("eventType", TherapyEvent.Type.TEMPORARY_TARGET.text)
+ .put("eventType", info.nightscout.database.entities.TherapyEvent.Type.TEMPORARY_TARGET.text)
.put("duration", T.msecs(duration).mins())
.put("durationInMilliseconds", duration)
.put("isValid", isValid)
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TherapyEventExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TherapyEventExtension.kt
index ce2bf354e8..a3bab73543 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TherapyEventExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/extensions/TherapyEventExtension.kt
@@ -1,9 +1,9 @@
package info.nightscout.plugins.sync.nsclient.extensions
import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.database.entities.TherapyEvent
import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.plugins.sync.nsclient.data.NSMbg
import info.nightscout.shared.interfaces.ResourceHelper
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt
index 5f604a7199..0c5ff7bd2f 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/services/NSClientService.kt
@@ -16,7 +16,7 @@ import com.google.gson.GsonBuilder
import com.google.gson.JsonDeserializer
import dagger.android.DaggerService
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.DataSyncSelector
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientAddAckWorker.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientAddAckWorker.kt
index aa9fcd4bed..6fa6f7ed50 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientAddAckWorker.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientAddAckWorker.kt
@@ -6,21 +6,20 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.DeviceStatus
-import info.nightscout.androidaps.database.transactions.UpdateNsIdBolusCalculatorResultTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdBolusTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdCarbsTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdDeviceStatusTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdEffectiveProfileSwitchTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdExtendedBolusTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdFoodTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdGlucoseValueTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdOfflineEventTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdProfileSwitchTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdTemporaryBasalTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdTemporaryTargetTransaction
-import info.nightscout.androidaps.database.transactions.UpdateNsIdTherapyEventTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.UpdateNsIdBolusCalculatorResultTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdBolusTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdCarbsTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdDeviceStatusTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdEffectiveProfileSwitchTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdExtendedBolusTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdFoodTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdGlucoseValueTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdOfflineEventTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdProfileSwitchTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdTemporaryBasalTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdTemporaryTargetTransaction
+import info.nightscout.database.impl.transactions.UpdateNsIdTherapyEventTransaction
import info.nightscout.androidaps.interfaces.DataSyncSelector
import info.nightscout.androidaps.interfaces.DataSyncSelector.PairBolus
import info.nightscout.androidaps.interfaces.DataSyncSelector.PairBolusCalculatorResult
@@ -35,8 +34,9 @@ import info.nightscout.androidaps.interfaces.DataSyncSelector.PairProfileSwitch
import info.nightscout.androidaps.interfaces.DataSyncSelector.PairTemporaryBasal
import info.nightscout.androidaps.interfaces.DataSyncSelector.PairTemporaryTarget
import info.nightscout.androidaps.interfaces.DataSyncSelector.PairTherapyEvent
-import info.nightscout.interfaces.NsClient
import info.nightscout.androidaps.receivers.DataWorkerStorage
+import info.nightscout.database.entities.DeviceStatus
+import info.nightscout.interfaces.NsClient
import info.nightscout.plugins.R
import info.nightscout.plugins.sync.nsShared.events.EventNSClientNewLog
import info.nightscout.plugins.sync.nsclient.acks.NSAddAck
@@ -278,7 +278,7 @@ class NSClientAddAckWorker(
dataSyncSelector.processChangedEffectiveProfileSwitchesCompat()
}
- is DeviceStatus -> {
+ is DeviceStatus -> {
val deviceStatus = ack.originalObject
deviceStatus.interfaceIDs.nightscoutId = ack.id
repository.runTransactionForResult(UpdateNsIdDeviceStatusTransaction(deviceStatus))
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientAddUpdateWorker.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientAddUpdateWorker.kt
index 18453033ef..1ccae0ac76 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientAddUpdateWorker.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientAddUpdateWorker.kt
@@ -5,13 +5,13 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.extensions.bolusCalculatorResultFromJson
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.receivers.DataWorkerStorage
+import info.nightscout.database.entities.TherapyEvent
import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.VirtualPump
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientUpdateRemoveAckWorker.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientUpdateRemoveAckWorker.kt
index 056b0870c3..5b73bcbec9 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientUpdateRemoveAckWorker.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclient/workers/NSClientUpdateRemoveAckWorker.kt
@@ -5,7 +5,7 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.DataSyncSelector
import info.nightscout.androidaps.interfaces.DataSyncSelector.PairBolus
import info.nightscout.androidaps.interfaces.DataSyncSelector.PairBolusCalculatorResult
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/BolusCalculatorResultExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/BolusCalculatorResultExtension.kt
index a79c4988ec..8104579e72 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/BolusCalculatorResultExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/BolusCalculatorResultExtension.kt
@@ -2,7 +2,7 @@ package info.nightscout.plugins.sync.nsclientV3.extensions
import com.google.gson.Gson
import com.google.gson.JsonSyntaxException
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.BolusCalculatorResult
import info.nightscout.sdk.localmodel.treatment.NSBolusWizard
fun NSBolusWizard.toBolusCalculatorResult(): BolusCalculatorResult? =
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/BolusExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/BolusExtension.kt
index bcd88ed1d5..23746cd94c 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/BolusExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/BolusExtension.kt
@@ -1,7 +1,7 @@
package info.nightscout.plugins.sync.nsclientV3.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.sdk.localmodel.treatment.NSBolus
fun NSBolus.toBolus(): Bolus =
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/CarbsExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/CarbsExtension.kt
index 4dc2bdac3a..25fed82df8 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/CarbsExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/CarbsExtension.kt
@@ -1,7 +1,7 @@
package info.nightscout.plugins.sync.nsclientV3.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.Carbs
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.sdk.localmodel.treatment.NSCarbs
fun NSCarbs.toCarbs(): Carbs =
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/EffectiveProfileSwitchExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/EffectiveProfileSwitchExtension.kt
index dcc9102f07..28c5db62d5 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/EffectiveProfileSwitchExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/EffectiveProfileSwitchExtension.kt
@@ -1,9 +1,9 @@
package info.nightscout.plugins.sync.nsclientV3.extensions
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
import info.nightscout.androidaps.utils.extensions.pureProfileFromJson
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.plugins.sync.nsclient.extensions.fromConstant
import info.nightscout.sdk.localmodel.treatment.NSEffectiveProfileSwitch
import info.nightscout.shared.utils.DateUtil
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ExtendedBolusExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ExtendedBolusExtension.kt
index 5a5c3e2303..c2dfeaa81b 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ExtendedBolusExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ExtendedBolusExtension.kt
@@ -1,7 +1,7 @@
package info.nightscout.plugins.sync.nsclientV3.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.ExtendedBolus
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.sdk.localmodel.treatment.NSExtendedBolus
fun NSExtendedBolus.toExtendedBolus(): ExtendedBolus =
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/OfflineEventExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/OfflineEventExtension.kt
index 3bfa4ce2ba..0c1bd0151c 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/OfflineEventExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/OfflineEventExtension.kt
@@ -1,7 +1,7 @@
package info.nightscout.plugins.sync.nsclientV3.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.OfflineEvent
+import info.nightscout.database.entities.OfflineEvent
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.sdk.localmodel.treatment.NSOfflineEvent
fun NSOfflineEvent.toOfflineEvent(): OfflineEvent =
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ProfileSwitchExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ProfileSwitchExtension.kt
index 8ed408fa57..2be54849db 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ProfileSwitchExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/ProfileSwitchExtension.kt
@@ -1,11 +1,11 @@
package info.nightscout.plugins.sync.nsclientV3.extensions
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.ProfileSwitch
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.utils.extensions.fromConstant
import info.nightscout.androidaps.utils.extensions.pureProfileFromJson
+import info.nightscout.database.entities.ProfileSwitch
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.sdk.localmodel.treatment.NSProfileSwitch
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TemporaryBasalExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TemporaryBasalExtension.kt
index 71dc0651d7..78463fd7a2 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TemporaryBasalExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TemporaryBasalExtension.kt
@@ -1,7 +1,7 @@
package info.nightscout.plugins.sync.nsclientV3.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.TemporaryBasal
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.sdk.localmodel.treatment.NSTemporaryBasal
fun NSTemporaryBasal.toTemporaryBasal(): TemporaryBasal =
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TemporaryTargetExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TemporaryTargetExtension.kt
index 17445fe2bf..066ea18e19 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TemporaryTargetExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TemporaryTargetExtension.kt
@@ -1,7 +1,7 @@
package info.nightscout.plugins.sync.nsclientV3.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.TemporaryTarget
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.sdk.localmodel.treatment.NSTemporaryTarget
fun NSTemporaryTarget.toTemporaryTarget(): TemporaryTarget =
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TherapyEventExtension.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TherapyEventExtension.kt
index ea94e4a770..b6e7644ade 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TherapyEventExtension.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/extensions/TherapyEventExtension.kt
@@ -1,7 +1,7 @@
package info.nightscout.plugins.sync.nsclientV3.extensions
-import info.nightscout.androidaps.database.embedments.InterfaceIDs
-import info.nightscout.androidaps.database.entities.TherapyEvent
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.sdk.localmodel.entry.NsUnits
import info.nightscout.sdk.localmodel.treatment.EventType
import info.nightscout.sdk.localmodel.treatment.NSTherapyEvent
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/workers/ProcessTreatmentsWorker.kt b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/workers/ProcessTreatmentsWorker.kt
index 981497f58a..b8dbc5c553 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/workers/ProcessTreatmentsWorker.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/nsclientV3/workers/ProcessTreatmentsWorker.kt
@@ -5,7 +5,7 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.logging.UserEntryLogger
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/comm/UploadChunk.kt b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/comm/UploadChunk.kt
index 4f8056b8bd..bf07c91769 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/comm/UploadChunk.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/comm/UploadChunk.kt
@@ -1,10 +1,10 @@
package info.nightscout.plugins.sync.tidepool.comm
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
-import info.nightscout.androidaps.database.entities.TemporaryBasal
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.TemporaryBasal
import info.nightscout.plugins.R
import info.nightscout.plugins.sync.tidepool.elements.BasalElement
import info.nightscout.plugins.sync.tidepool.elements.BaseElement
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BasalElement.kt b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BasalElement.kt
index cc92b0ebe0..b8788db10f 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BasalElement.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BasalElement.kt
@@ -1,9 +1,9 @@
package info.nightscout.plugins.sync.tidepool.elements
import com.google.gson.annotations.Expose
-import info.nightscout.androidaps.database.entities.TemporaryBasal
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.interfaces.Profile
+import info.nightscout.database.entities.TemporaryBasal
import info.nightscout.shared.utils.DateUtil
import java.util.UUID
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BloodGlucoseElement.kt b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BloodGlucoseElement.kt
index c4c919ccc3..8ff50b4757 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BloodGlucoseElement.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BloodGlucoseElement.kt
@@ -1,8 +1,8 @@
package info.nightscout.plugins.sync.tidepool.elements
import com.google.gson.annotations.Expose
-import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.interfaces.Profile
+import info.nightscout.database.entities.TherapyEvent
import info.nightscout.plugins.sync.nsclient.extensions.toMainUnit
import info.nightscout.shared.utils.DateUtil
import java.util.LinkedList
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BolusElement.kt b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BolusElement.kt
index 4918d735e8..f25ff9868d 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BolusElement.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/BolusElement.kt
@@ -1,7 +1,7 @@
package info.nightscout.plugins.sync.tidepool.elements
import com.google.gson.annotations.Expose
-import info.nightscout.androidaps.database.entities.Bolus
+import info.nightscout.database.entities.Bolus
import info.nightscout.shared.utils.DateUtil
import java.util.UUID
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/ProfileElement.kt b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/ProfileElement.kt
index f247ecbbf5..5bb9a5b151 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/ProfileElement.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/ProfileElement.kt
@@ -2,8 +2,8 @@ package info.nightscout.plugins.sync.tidepool.elements
import com.google.gson.annotations.Expose
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
import info.nightscout.androidaps.interfaces.Profile
+import info.nightscout.database.entities.EffectiveProfileSwitch
import info.nightscout.plugins.sync.tidepool.comm.TidepoolUploader
import info.nightscout.shared.utils.DateUtil
import java.util.UUID
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/SensorGlucoseElement.kt b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/SensorGlucoseElement.kt
index f7fb4ef6dd..c7cea855d7 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/SensorGlucoseElement.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/SensorGlucoseElement.kt
@@ -1,7 +1,7 @@
package info.nightscout.plugins.sync.tidepool.elements
import com.google.gson.annotations.Expose
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.shared.utils.DateUtil
import java.util.LinkedList
import java.util.UUID
diff --git a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/WizardElement.kt b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/WizardElement.kt
index b53252edc0..603e443add 100644
--- a/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/WizardElement.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/sync/tidepool/elements/WizardElement.kt
@@ -1,8 +1,8 @@
package info.nightscout.plugins.sync.tidepool.elements
import com.google.gson.annotations.Expose
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.Carbs
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.Carbs
import info.nightscout.shared.utils.DateUtil
import java.util.UUID
diff --git a/plugins/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/plugins/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
index 693e5b0a30..6e2012ecd1 100644
--- a/plugins/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
+++ b/plugins/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
@@ -4,14 +4,14 @@ import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.embedments.InsulinConfiguration
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ProfileStore
import info.nightscout.androidaps.utils.extensions.pureProfileFromJson
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.embedments.InsulinConfiguration
import info.nightscout.interfaces.Config
import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.interfaces.ResourceHelper
diff --git a/plugins/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt b/plugins/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt
index ed30a2a16e..96a9d91b02 100644
--- a/plugins/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt
+++ b/plugins/src/test/java/info/nightscout/plugins/constraints/bgQualityCheck/BgQualityCheckPluginTest.kt
@@ -3,10 +3,10 @@ package info.nightscout.plugins.constraints.bgQualityCheck
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
-import info.nightscout.androidaps.database.entities.GlucoseValue
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.Constraint
import info.nightscout.plugins.R
import info.nightscout.rx.bus.RxBus
diff --git a/plugins/src/test/java/info/nightscout/plugins/general/autotune/AutotuneCoreTest.kt b/plugins/src/test/java/info/nightscout/plugins/general/autotune/AutotuneCoreTest.kt
index a6ab41e52b..fb9a4946c9 100644
--- a/plugins/src/test/java/info/nightscout/plugins/general/autotune/AutotuneCoreTest.kt
+++ b/plugins/src/test/java/info/nightscout/plugins/general/autotune/AutotuneCoreTest.kt
@@ -5,16 +5,16 @@ import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.data.LocalInsulin
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.data.PureProfile
-import info.nightscout.androidaps.database.data.Block
-import info.nightscout.androidaps.database.data.TargetBlock
+import info.nightscout.database.entities.data.Block
+import info.nightscout.database.entities.data.TargetBlock
import info.nightscout.interfaces.GlucoseUnit
-import info.nightscout.shared.utils.DateUtil
import info.nightscout.interfaces.utils.JsonHelper
-import info.nightscout.shared.utils.T
import info.nightscout.plugins.R
import info.nightscout.plugins.general.autotune.data.ATProfile
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import org.json.JSONArray
import org.json.JSONObject
import org.junit.Assert
diff --git a/plugins/src/test/java/info/nightscout/plugins/general/autotune/AutotunePrepTest.kt b/plugins/src/test/java/info/nightscout/plugins/general/autotune/AutotunePrepTest.kt
index 8e2efcd58e..26785eebbe 100644
--- a/plugins/src/test/java/info/nightscout/plugins/general/autotune/AutotunePrepTest.kt
+++ b/plugins/src/test/java/info/nightscout/plugins/general/autotune/AutotunePrepTest.kt
@@ -6,23 +6,23 @@ import info.nightscout.androidaps.data.IobTotal
import info.nightscout.androidaps.data.LocalInsulin
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.data.PureProfile
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.data.Block
-import info.nightscout.androidaps.database.data.TargetBlock
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.entities.GlucoseValue
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.extensions.shiftBlock
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.utils.DateUtil
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.database.entities.data.Block
+import info.nightscout.database.entities.data.TargetBlock
+import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.utils.JsonHelper
-import info.nightscout.shared.utils.T
import info.nightscout.plugins.R
import info.nightscout.plugins.general.autotune.data.ATProfile
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import org.json.JSONArray
import org.json.JSONObject
import org.junit.Assert
diff --git a/plugins/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt b/plugins/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt
index 9b6ec2df22..cf18f7b6e9 100644
--- a/plugins/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt
+++ b/plugins/src/test/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPluginTest.kt
@@ -3,40 +3,40 @@ package info.nightscout.plugins.general.smsCommunicator
import android.telephony.SmsManager
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
-import info.nightscout.interfaces.Constants
import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.TestPumpPlugin
import info.nightscout.androidaps.data.IobTotal
import info.nightscout.androidaps.data.PumpEnactResultImpl
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.database.transactions.CancelCurrentOfflineEventIfAnyTransaction
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentOfflineEventTransaction
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
-import info.nightscout.androidaps.database.transactions.Transaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CancelCurrentOfflineEventIfAnyTransaction
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentOfflineEventTransaction
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
+import info.nightscout.database.impl.transactions.Transaction
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
-import info.nightscout.interfaces.Constraint
import info.nightscout.androidaps.interfaces.Constraints
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.interfaces.ProfileSource
-import info.nightscout.interfaces.pump.PumpDescription
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensDataStore
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
-import info.nightscout.interfaces.pump.PumpType
-import info.nightscout.interfaces.queue.Callback
-import info.nightscout.shared.utils.DateUtil
-import info.nightscout.shared.utils.T
+import info.nightscout.database.entities.GlucoseValue
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.Constraint
+import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.PluginType
import info.nightscout.interfaces.data.smsCommunicator.Sms
+import info.nightscout.interfaces.pump.PumpDescription
+import info.nightscout.interfaces.pump.PumpType
+import info.nightscout.interfaces.queue.Callback
import info.nightscout.plugins.R
import info.nightscout.plugins.general.smsCommunicator.otp.OneTimePassword
import info.nightscout.plugins.general.smsCommunicator.otp.OneTimePasswordValidationResult
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
+import info.nightscout.shared.utils.T
import io.reactivex.rxjava3.core.Single
import org.junit.Assert
import org.junit.Before
diff --git a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt
index 3d9e6a06c4..3df05ad905 100644
--- a/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt
+++ b/plugins/src/test/java/info/nightscout/plugins/insulin/InsulinOrefBasePluginTest.kt
@@ -2,15 +2,15 @@ package info.nightscout.plugins.insulin
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
-import info.nightscout.interfaces.Constants
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.interfaces.Config
import info.nightscout.androidaps.interfaces.Insulin
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.HardLimits
+import info.nightscout.database.entities.Bolus
+import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.Constants
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger
+import info.nightscout.shared.interfaces.ResourceHelper
import org.json.JSONObject
import org.junit.Assert
import org.junit.Before
diff --git a/pump/eopatch/build.gradle b/pump/eopatch/build.gradle
index e78198d09d..9018ca694a 100644
--- a/pump/eopatch/build.gradle
+++ b/pump/eopatch/build.gradle
@@ -24,6 +24,7 @@ dependencies {
implementation project(':libraries')
implementation project(':app-wear-shared:rx')
implementation project(':app-wear-shared:shared')
+ implementation project(':database:entities')
implementation project(':database:impl')
implementation project(':core:core-main')
implementation project(':core:fabric')
diff --git a/pump/omnipod-dash/build.gradle b/pump/omnipod-dash/build.gradle
index 141bc8d846..de98f59aff 100644
--- a/pump/omnipod-dash/build.gradle
+++ b/pump/omnipod-dash/build.gradle
@@ -33,6 +33,7 @@ android {
}
dependencies {
+ implementation project(':database:entities')
implementation project(':database:impl')
implementation project(':app-wear-shared:rx')
implementation project(':app-wear-shared:shared')
diff --git a/pump/omnipod-eros/build.gradle b/pump/omnipod-eros/build.gradle
index cbf0d8cb7e..f786ed4281 100644
--- a/pump/omnipod-eros/build.gradle
+++ b/pump/omnipod-eros/build.gradle
@@ -26,6 +26,7 @@ android {
}
dependencies {
+ implementation project(':database:entities')
implementation project(':database:impl')
implementation project(':app-wear-shared:rx')
implementation project(':app-wear-shared:shared')
diff --git a/settings.gradle b/settings.gradle
index 32c50837b6..ed3443202c 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,5 +1,6 @@
include ':app'
include ':wear'
+include ':database:entities'
include ':database:impl'
include ':core:core-main'
include ':core:fabric'
diff --git a/ui/build.gradle b/ui/build.gradle
index 1d4809a88c..354d748ae2 100644
--- a/ui/build.gradle
+++ b/ui/build.gradle
@@ -20,6 +20,7 @@ dependencies {
implementation project(':graphview')
implementation project(':app-wear-shared:rx')
implementation project(':app-wear-shared:shared')
+ implementation project(':database:entities')
implementation project(':database:impl')
implementation project(':core:core-main')
implementation project(':core:fabric')
diff --git a/ui/src/main/java/info/nightscout/ui/activities/ErrorHelperActivity.kt b/ui/src/main/java/info/nightscout/ui/activities/ErrorHelperActivity.kt
index e45d57feea..968b2c13fe 100644
--- a/ui/src/main/java/info/nightscout/ui/activities/ErrorHelperActivity.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/ErrorHelperActivity.kt
@@ -6,8 +6,8 @@ import android.os.Bundle
import androidx.annotation.RawRes
import info.nightscout.androidaps.activities.DialogAppCompatActivity
import info.nightscout.core.main.R
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
import info.nightscout.androidaps.dialogs.ErrorDialog
import info.nightscout.androidaps.services.AlarmSoundService
import info.nightscout.shared.sharedPreferences.SP
diff --git a/ui/src/main/java/info/nightscout/ui/activities/StatsActivity.kt b/ui/src/main/java/info/nightscout/ui/activities/StatsActivity.kt
index 4e1933517f..14fe7b7a77 100644
--- a/ui/src/main/java/info/nightscout/ui/activities/StatsActivity.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/StatsActivity.kt
@@ -4,14 +4,14 @@ import android.annotation.SuppressLint
import android.os.Bundle
import android.widget.TextView
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.interfaces.stats.DexcomTirCalculator
import info.nightscout.androidaps.interfaces.stats.TddCalculator
import info.nightscout.androidaps.interfaces.stats.TirCalculator
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.rx.AapsSchedulers
import info.nightscout.ui.R
import info.nightscout.ui.databinding.ActivityStatsBinding
diff --git a/ui/src/main/java/info/nightscout/ui/activities/TDDStatsActivity.kt b/ui/src/main/java/info/nightscout/ui/activities/TDDStatsActivity.kt
index c716e7dab4..f2d6d404fe 100644
--- a/ui/src/main/java/info/nightscout/ui/activities/TDDStatsActivity.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/TDDStatsActivity.kt
@@ -15,8 +15,7 @@ import android.widget.TableLayout
import android.widget.TableRow
import android.widget.TextView
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TotalDailyDose
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.extensions.total
import info.nightscout.androidaps.interfaces.ActivePlugin
@@ -24,6 +23,7 @@ import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.main.R
+import info.nightscout.database.entities.TotalDailyDose
import info.nightscout.interfaces.pump.PumpType
import info.nightscout.interfaces.queue.Callback
import info.nightscout.rx.AapsSchedulers
diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt
index 91d375a83e..5dcbcb9f68 100644
--- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt
@@ -16,17 +16,11 @@ import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.Bolus
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
-import info.nightscout.androidaps.database.entities.Carbs
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.CutCarbsTransaction
-import info.nightscout.androidaps.database.transactions.InvalidateBolusCalculatorResultTransaction
-import info.nightscout.androidaps.database.transactions.InvalidateBolusTransaction
-import info.nightscout.androidaps.database.transactions.InvalidateCarbsTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.CutCarbsTransaction
+import info.nightscout.database.impl.transactions.InvalidateBolusCalculatorResultTransaction
+import info.nightscout.database.impl.transactions.InvalidateBolusTransaction
+import info.nightscout.database.impl.transactions.InvalidateCarbsTransaction
import info.nightscout.androidaps.events.EventNewHistoryData
import info.nightscout.androidaps.extensions.iobCalc
import info.nightscout.androidaps.interfaces.ActivePlugin
@@ -36,6 +30,12 @@ import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.Bolus
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.database.entities.Carbs
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.BuildHelper
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsCareportalFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsCareportalFragment.kt
index 20c633edc4..9ae4c2e714 100644
--- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsCareportalFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsCareportalFragment.kt
@@ -14,19 +14,19 @@ import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InvalidateAAPSStartedTherapyEventTransaction
-import info.nightscout.androidaps.database.transactions.InvalidateTherapyEventTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InvalidateAAPSStartedTherapyEventTransaction
+import info.nightscout.database.impl.transactions.InvalidateTherapyEventTransaction
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.Translator
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.BuildHelper
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt
index bdc86cc466..4ccfcc74d0 100644
--- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt
@@ -15,13 +15,8 @@ import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.interfaces.end
-import info.nightscout.androidaps.database.transactions.InvalidateExtendedBolusTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InvalidateExtendedBolusTransaction
import info.nightscout.androidaps.extensions.iobCalc
import info.nightscout.androidaps.extensions.isInProgress
import info.nightscout.androidaps.interfaces.ActivePlugin
@@ -31,6 +26,11 @@ import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.database.entities.interfaces.end
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventExtendedBolusChange
diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt
index 4761dfbb33..878f8187f3 100644
--- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt
@@ -17,11 +17,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InvalidateProfileSwitchTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InvalidateProfileSwitchTransaction
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
import info.nightscout.androidaps.events.EventNewHistoryData
@@ -32,6 +29,9 @@ import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.extensions.getCustomizedName
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.BuildHelper
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTempTargetFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTempTargetFragment.kt
index e56ab42886..020ed558c6 100644
--- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTempTargetFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTempTargetFragment.kt
@@ -15,14 +15,9 @@ import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.interfaces.end
-import info.nightscout.androidaps.database.transactions.InvalidateTemporaryTargetTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
+import info.nightscout.database.impl.transactions.InvalidateTemporaryTargetTransaction
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
import info.nightscout.androidaps.events.EventNewHistoryData
import info.nightscout.androidaps.extensions.friendlyDescription
@@ -35,6 +30,11 @@ import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.Translator
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.database.entities.interfaces.end
import info.nightscout.interfaces.BuildHelper
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
index 2a5298df25..84c10618b8 100644
--- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
@@ -16,16 +16,10 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.data.IobTotal
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.ValueWrapper
-import info.nightscout.androidaps.database.entities.ExtendedBolus
-import info.nightscout.androidaps.database.entities.TemporaryBasal
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.interfaces.end
-import info.nightscout.androidaps.database.transactions.InvalidateExtendedBolusTransaction
-import info.nightscout.androidaps.database.transactions.InvalidateTemporaryBasalTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.ValueWrapper
+import info.nightscout.database.impl.transactions.InvalidateExtendedBolusTransaction
+import info.nightscout.database.impl.transactions.InvalidateTemporaryBasalTransaction
import info.nightscout.androidaps.extensions.iobCalc
import info.nightscout.androidaps.extensions.toStringFull
import info.nightscout.androidaps.extensions.toTemporaryBasal
@@ -36,6 +30,12 @@ import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.ExtendedBolus
+import info.nightscout.database.entities.TemporaryBasal
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.database.entities.interfaces.end
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventTempBasalChange
diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsUserEntryFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsUserEntryFragment.kt
index 60e7a27fd5..b719e71300 100644
--- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsUserEntryFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsUserEntryFragment.kt
@@ -12,10 +12,7 @@ import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
+import info.nightscout.database.impl.AppRepository
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.UserEntryLogger
@@ -23,6 +20,9 @@ import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.interfaces.ImportExportPrefs
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/CalibrationDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/CalibrationDialog.kt
index 072760124b..dc9e12f41f 100644
--- a/ui/src/main/java/info/nightscout/ui/dialogs/CalibrationDialog.kt
+++ b/ui/src/main/java/info/nightscout/ui/dialogs/CalibrationDialog.kt
@@ -6,23 +6,23 @@ import android.view.View
import android.view.ViewGroup
import com.google.common.base.Joiner
import dagger.android.HasAndroidInjector
-import info.nightscout.ui.R
-import info.nightscout.ui.databinding.DialogCalibrationBinding
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
-import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.utils.HtmlHelper
+import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.ui.R
+import info.nightscout.ui.databinding.DialogCalibrationBinding
import java.text.DecimalFormat
-import java.util.*
+import java.util.LinkedList
import javax.inject.Inject
class CalibrationDialog : DialogFragmentWithDate() {
diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt
index 6e468daacc..9ee87d9378 100644
--- a/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt
+++ b/ui/src/main/java/info/nightscout/ui/dialogs/CarbsDialog.kt
@@ -9,38 +9,37 @@ import android.view.View
import android.view.ViewGroup
import com.google.common.base.Joiner
import info.nightscout.androidaps.data.DetailedBolusInfo
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TemporaryTarget
-import info.nightscout.androidaps.database.entities.UserEntry.Action
-import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.extensions.formatColor
-import info.nightscout.interfaces.ActivityNames
-import info.nightscout.interfaces.BolusTimer
-import info.nightscout.interfaces.CarbTimer
import info.nightscout.androidaps.interfaces.CommandQueue
-import info.nightscout.interfaces.Constraint
-import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
-import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
-import info.nightscout.interfaces.queue.Callback
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.DefaultValueHelper
-import info.nightscout.interfaces.utils.HtmlHelper
-import info.nightscout.shared.utils.T
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
+import info.nightscout.database.entities.TemporaryTarget
+import info.nightscout.database.entities.UserEntry.Action
+import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.ActivityNames
+import info.nightscout.interfaces.BolusTimer
+import info.nightscout.interfaces.CarbTimer
+import info.nightscout.interfaces.Constraint
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.queue.Callback
+import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.logging.LTag
-
+import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.shared.utils.T
import info.nightscout.ui.R
import info.nightscout.ui.databinding.DialogCarbsBinding
import io.reactivex.rxjava3.disposables.CompositeDisposable
diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt
index 862d85184d..a64eccf599 100644
--- a/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt
+++ b/ui/src/main/java/info/nightscout/ui/dialogs/CareDialog.kt
@@ -10,26 +10,25 @@ import android.view.ViewGroup
import androidx.annotation.StringRes
import com.google.common.base.Joiner
import dagger.android.HasAndroidInjector
-import info.nightscout.interfaces.Constants
-import info.nightscout.androidaps.database.AppRepository
-import info.nightscout.androidaps.database.entities.TherapyEvent
-import info.nightscout.androidaps.database.entities.UserEntry
-import info.nightscout.androidaps.database.entities.ValueWithUnit
-import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
+import info.nightscout.database.impl.AppRepository
+import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.extensions.fromConstant
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
-import info.nightscout.interfaces.utils.HtmlHelper
-import info.nightscout.shared.utils.T
import info.nightscout.androidaps.utils.Translator
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
+import info.nightscout.database.entities.TherapyEvent
+import info.nightscout.database.entities.UserEntry
+import info.nightscout.database.entities.ValueWithUnit
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.logging.LTag
-
+import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.shared.utils.T
import info.nightscout.ui.R
import info.nightscout.ui.databinding.DialogCareBinding
import io.reactivex.rxjava3.disposables.CompositeDisposable
diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt
index 758a156c4c..93734121ab 100644
--- a/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt
+++ b/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt
@@ -7,14 +7,14 @@ import android.view.ViewGroup
import android.view.Window
import android.view.WindowManager
import dagger.android.support.DaggerDialogFragment
-import info.nightscout.androidaps.database.entities.BolusCalculatorResult
import info.nightscout.androidaps.extensions.bolusCalculatorResultFromJson
import info.nightscout.androidaps.extensions.toJson
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.database.entities.BolusCalculatorResult
+import info.nightscout.interfaces.Constants
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.utils.DateUtil
-import info.nightscout.interfaces.Constants
import info.nightscout.ui.R
import info.nightscout.ui.databinding.DialogWizardinfoBinding
import org.json.JSONObject
diff --git a/ui/src/main/java/info/nightscout/ui/widget/Widget.kt b/ui/src/main/java/info/nightscout/ui/widget/Widget.kt
index 6694f86066..2ca80b0d34 100644
--- a/ui/src/main/java/info/nightscout/ui/widget/Widget.kt
+++ b/ui/src/main/java/info/nightscout/ui/widget/Widget.kt
@@ -13,31 +13,30 @@ import android.os.HandlerThread
import android.view.View
import android.widget.RemoteViews
import dagger.android.HasAndroidInjector
-import info.nightscout.interfaces.Constants
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.interfaces.end
import info.nightscout.androidaps.extensions.directionToIcon
-import info.nightscout.shared.extensions.toVisibility
import info.nightscout.androidaps.extensions.valueToUnitsString
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.interfaces.ActivityNames
-import info.nightscout.interfaces.Config
import info.nightscout.androidaps.interfaces.Constraints
-import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.androidaps.interfaces.TrendCalculator
-import info.nightscout.interfaces.VariableSensitivityResult
import info.nightscout.androidaps.plugins.general.overview.OverviewData
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
-import info.nightscout.shared.utils.DateUtil
+import info.nightscout.database.entities.interfaces.end
+import info.nightscout.interfaces.ActivityNames
+import info.nightscout.interfaces.Config
+import info.nightscout.interfaces.Constants
+import info.nightscout.interfaces.GlucoseUnit
+import info.nightscout.interfaces.VariableSensitivityResult
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
-
+import info.nightscout.shared.extensions.toVisibility
+import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.shared.utils.DateUtil
import info.nightscout.ui.R
import java.util.Locale
import javax.inject.Inject
diff --git a/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt b/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
index 693e5b0a30..6e2012ecd1 100644
--- a/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
+++ b/ui/src/test/java/info/nightscout/androidaps/TestBaseWithProfile.kt
@@ -4,14 +4,14 @@ import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.database.embedments.InsulinConfiguration
-import info.nightscout.androidaps.database.entities.EffectiveProfileSwitch
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.IobCobCalculator
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ProfileStore
import info.nightscout.androidaps.utils.extensions.pureProfileFromJson
import info.nightscout.core.fabric.FabricPrivacy
+import info.nightscout.database.entities.EffectiveProfileSwitch
+import info.nightscout.database.entities.embedments.InsulinConfiguration
import info.nightscout.interfaces.Config
import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.interfaces.ResourceHelper