maintenance -> :core:configuration
This commit is contained in:
parent
57c96770b0
commit
25cf632008
|
@ -0,0 +1,3 @@
|
|||
package info.nightscout.rx.events
|
||||
|
||||
class EventDiaconnG8PumpLogReset : Event()
|
|
@ -70,7 +70,7 @@
|
|||
android:exported="false"
|
||||
android:theme="@style/AppTheme"/>
|
||||
<activity
|
||||
android:name=".plugins.general.maintenance.activities.PrefImportListActivity"
|
||||
android:name="info.nightscout.configuration.maintenance.activities.PrefImportListActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme" />
|
||||
<activity
|
||||
|
@ -141,7 +141,7 @@
|
|||
<service android:name=".plugins.general.persistentNotification.DummyService" />
|
||||
|
||||
<activity
|
||||
android:name=".plugins.general.maintenance.activities.LogSettingActivity"
|
||||
android:name="info.nightscout.configuration.maintenance.activities.LogSettingActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
|
||||
|
|
|
@ -33,8 +33,9 @@ import com.joanzapata.iconify.fonts.FontAwesomeModule
|
|||
import info.nightscout.androidaps.activities.HistoryBrowseActivity
|
||||
import info.nightscout.androidaps.activities.PreferencesActivity
|
||||
import info.nightscout.androidaps.databinding.ActivityMainBinding
|
||||
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.configuration.activities.SingleFragmentActivity
|
||||
import info.nightscout.configuration.setupwizard.SetupWizardActivity
|
||||
import info.nightscout.core.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.core.ui.UIRunnable
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.ui.locale.LocaleHelper
|
||||
|
@ -67,7 +68,6 @@ import info.nightscout.rx.events.EventRebuildTabs
|
|||
import info.nightscout.rx.logging.LTag
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.ui.activities.ProfileHelperActivity
|
||||
import info.nightscout.ui.activities.SingleFragmentActivity
|
||||
import info.nightscout.ui.activities.StatsActivity
|
||||
import info.nightscout.ui.activities.TreatmentsActivity
|
||||
import info.nightscout.ui.tabs.TabPageAdapter
|
||||
|
|
|
@ -21,14 +21,15 @@ import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
|||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||
import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
|
||||
import info.nightscout.automation.AutomationPlugin
|
||||
import info.nightscout.configuration.maintenance.MaintenancePlugin
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.implementation.plugin.PluginStore
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.nsclient.NSSettingsStatus
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.interfaces.profile.Profile
|
||||
import info.nightscout.interfaces.profile.ProfileFunction
|
||||
|
@ -53,7 +54,6 @@ import info.nightscout.plugins.source.IntelligoPlugin
|
|||
import info.nightscout.plugins.source.PoctechPlugin
|
||||
import info.nightscout.plugins.source.TomatoPlugin
|
||||
import info.nightscout.plugins.sync.nsclient.NSClientPlugin
|
||||
import info.nightscout.interfaces.nsclient.NSSettingsStatus
|
||||
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
||||
import info.nightscout.plugins.sync.tidepool.TidepoolPlugin
|
||||
import info.nightscout.pump.combo.ComboPlugin
|
||||
|
|
|
@ -9,7 +9,7 @@ import androidx.preference.PreferenceFragmentCompat
|
|||
import androidx.preference.PreferenceScreen
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.ActivityPreferencesBinding
|
||||
import info.nightscout.core.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.core.ui.locale.LocaleHelper
|
||||
|
||||
class PreferencesActivity : DaggerAppCompatActivityWithResult(), PreferenceFragmentCompat.OnPreferenceStartScreenCallback {
|
||||
|
|
|
@ -5,8 +5,8 @@ import dagger.android.ContributesAndroidInjector
|
|||
import info.nightscout.androidaps.MainActivity
|
||||
import info.nightscout.androidaps.activities.HistoryBrowseActivity
|
||||
import info.nightscout.androidaps.activities.PreferencesActivity
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
|
||||
import info.nightscout.ui.activities.SingleFragmentActivity
|
||||
import info.nightscout.configuration.activities.SingleFragmentActivity
|
||||
import info.nightscout.configuration.maintenance.activities.LogSettingActivity
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
||||
|
@ -14,7 +14,7 @@ abstract class ActivitiesModule {
|
|||
|
||||
@ContributesAndroidInjector abstract fun contributesHistoryBrowseActivity(): HistoryBrowseActivity
|
||||
@ContributesAndroidInjector abstract fun contributesLogSettingActivity(): LogSettingActivity
|
||||
@ContributesAndroidInjector abstract fun contributeMainActivity(): MainActivity
|
||||
@ContributesAndroidInjector abstract fun contributesMainActivity(): MainActivity
|
||||
@ContributesAndroidInjector abstract fun contributesPreferencesActivity(): PreferencesActivity
|
||||
@ContributesAndroidInjector abstract fun contributesSingleFragmentActivity(): SingleFragmentActivity
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ import javax.inject.Singleton
|
|||
ReceiversModule::class,
|
||||
ServicesModule::class,
|
||||
WorkflowModule::class,
|
||||
WorkersModule::class,
|
||||
|
||||
// Gradle modules
|
||||
AutomationModule::class,
|
||||
|
|
|
@ -9,11 +9,9 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.implementations.ActivityNamesImpl
|
||||
import info.nightscout.androidaps.implementations.ConfigImpl
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl
|
||||
import info.nightscout.androidaps.workflow.CalculationWorkflowImpl
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
|
||||
|
@ -50,7 +48,6 @@ open class AppModule {
|
|||
@Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector
|
||||
@Binds fun bindConfigInterface(config: ConfigImpl): Config
|
||||
|
||||
@Binds fun bindImportExportPrefsInterface(importExportPrefs: ImportExportPrefsImpl): ImportExportPrefs
|
||||
@Binds fun bindActivityNamesInterface(activityNames: ActivityNamesImpl): ActivityNames
|
||||
@Binds fun bindCalculationWorkflowInterface(calculationWorkflow: CalculationWorkflowImpl): CalculationWorkflow
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.di
|
|||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.activities.MyPreferenceFragment
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenanceFragment
|
||||
import info.nightscout.configuration.maintenance.MaintenanceFragment
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
||||
|
|
|
@ -8,7 +8,6 @@ import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
|||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
||||
|
@ -17,6 +16,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.OmnipodDashPumpPlugi
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
|
||||
import info.nightscout.automation.AutomationPlugin
|
||||
import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.configuration.maintenance.MaintenancePlugin
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
package info.nightscout.androidaps.di
|
||||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
||||
abstract class WorkersModule {
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesCsvExportWorker(): ImportExportPrefsImpl.CsvExportWorker
|
||||
}
|
|
@ -7,17 +7,18 @@ import androidx.annotation.RawRes
|
|||
import androidx.annotation.StringRes
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import info.nightscout.androidaps.MainActivity
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.HistoryBrowseActivity
|
||||
import info.nightscout.androidaps.activities.MyPreferenceFragment
|
||||
import info.nightscout.androidaps.activities.PreferencesActivity
|
||||
import info.nightscout.androidaps.services.AlarmSoundService
|
||||
import info.nightscout.configuration.activities.SingleFragmentActivity
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
import info.nightscout.ui.activities.BolusProgressHelperActivity
|
||||
import info.nightscout.ui.activities.ErrorHelperActivity
|
||||
import info.nightscout.ui.activities.SingleFragmentActivity
|
||||
import info.nightscout.ui.activities.TDDStatsActivity
|
||||
import info.nightscout.ui.dialogs.BolusProgressDialog
|
||||
import info.nightscout.ui.dialogs.CalibrationDialog
|
||||
|
@ -47,6 +48,7 @@ class ActivityNamesImpl @Inject constructor(
|
|||
override val singleFragmentActivity: Class<*> = SingleFragmentActivity::class.java
|
||||
override val preferencesActivity: Class<*> = PreferencesActivity::class.java
|
||||
override val myPreferenceFragment: Class<*> = MyPreferenceFragment::class.java
|
||||
override val prefGeneral: Int = R.xml.pref_general
|
||||
|
||||
override fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int) {
|
||||
val i = Intent(ctx, errorHelperActivity)
|
||||
|
|
|
@ -22,6 +22,10 @@ class ConfigImpl @Inject constructor(
|
|||
override val FLAVOR = BuildConfig.FLAVOR
|
||||
override val VERSION_NAME = BuildConfig.VERSION_NAME
|
||||
override val BUILD_VERSION = BuildConfig.BUILDVERSION
|
||||
override val REMOTE: String = BuildConfig.REMOTE
|
||||
override val BUILD_TYPE: String = BuildConfig.BUILD_TYPE
|
||||
override val VERSION: String = BuildConfig.VERSION
|
||||
override val APPLICATION_ID: String = BuildConfig.APPLICATION_ID
|
||||
override val DEBUG = BuildConfig.DEBUG
|
||||
|
||||
override val currentDeviceModelString =
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.google.common.util.concurrent.ListenableFuture
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.BuildConfig
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||
import info.nightscout.configuration.maintenance.MaintenancePlugin
|
||||
import info.nightscout.core.profile.ProfileSealed
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.core.utils.receivers.ReceiverStatusStore
|
||||
|
@ -22,13 +22,13 @@ import info.nightscout.database.impl.AppRepository
|
|||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.LocalAlertUtils
|
||||
import info.nightscout.interfaces.aps.Loop
|
||||
import info.nightscout.interfaces.configBuilder.RunningConfiguration
|
||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.interfaces.profile.ProfileFunction
|
||||
import info.nightscout.interfaces.queue.Command
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.configBuilder.RunningConfiguration
|
||||
import info.nightscout.plugins.sync.nsclient.extensions.buildDeviceStatus
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
import info.nightscout.rx.events.EventProfileSwitchChanged
|
||||
|
|
|
@ -32,31 +32,12 @@
|
|||
<string name="key_protection_settings" translatable="false">protection</string>
|
||||
<string name="key_last_cleanup_run" translatable="false">last_cleanup_run</string>
|
||||
<string name="nav_preferences_plugin">%1$s Preferences</string>
|
||||
<string name="nav_preferences">Preferences</string>
|
||||
<string name="nav_refreshtreatments">Refresh treatments from NS</string>
|
||||
<string name="nav_resetdb">Reset Databases</string>
|
||||
<string name="reset_db_confirm">Do you really want to reset the databases?</string>
|
||||
<string name="nav_exit">Exit</string>
|
||||
<string name="description_persistent_notification">Shows an ongoing notification with a short overview of what your loop is doing</string>
|
||||
<string name="delta">Delta</string>
|
||||
<string name="profile_label">Profile</string>
|
||||
<string name="configbuilder_nightscoutversion_label">Nightscout version:</string>
|
||||
<string name="exported">Preferences exported</string>
|
||||
<string name="ue_exported">User Entries exported</string>
|
||||
<string name="export_to">Export settings to</string>
|
||||
<string name="import_from">Import settings from</string>
|
||||
<string name="setting_imported">Settings imported</string>
|
||||
<string name="filenotfound">File not found</string>
|
||||
<string name="nav_export">Export settings</string>
|
||||
<string name="language" translatable="false">Language</string>
|
||||
<string name="password_preferences_encrypt_prompt">You will be asked for master password, which will be used to encrypt exported preferences.</string>
|
||||
<string name="preferences_export_canceled">Export canceled! Preferences were NOT exported!</string>
|
||||
<string name="preferences_import_canceled">Import canceled! Preferences were NOT imported!</string>
|
||||
<string name="preferences_import_impossible">Cannot import preferences!</string>
|
||||
<string name="goto_main_try_again">Please go back to main screen and try again.</string>
|
||||
<string name="old_master_password">Old Master Password</string>
|
||||
<string name="different_password_used">This file was exported and encrypted with different master password. Provide old master password to decrypt file.</string>
|
||||
<string name="master_password_will_be_replaced">As a result of successful import current master password WILL BE REPLACED with that old master password!</string>
|
||||
<string name="save">Save</string>
|
||||
<string name="reloadprofile">Reload profile</string>
|
||||
<string name="correctionbous">Corr</string>
|
||||
|
@ -65,7 +46,6 @@
|
|||
<string name="wear">Wear</string>
|
||||
<string name="ongoingnotificaction">Ongoing Notification</string>
|
||||
<string name="old_data">OLD DATA</string>
|
||||
<string name="restartingapp">Exiting application to apply settings.</string>
|
||||
<string name="nav_about">About</string>
|
||||
<string name="smscommunicator_missingphonestatepermission">Missing phone state permission</string>
|
||||
<string name="ns_alarm_options">Alarm options</string>
|
||||
|
@ -87,29 +67,13 @@
|
|||
<string name="enable_pump_unreachable_alert">Alert if pump is unreachable</string>
|
||||
<string name="pump_unreachable_threshold">Pump unreachable threshold [min]</string>
|
||||
<string name="enable_carbs_req_alert">Alert if carbs are required</string>
|
||||
<string name="engineering_mode_enabled">Engineering mode enabled</string>
|
||||
<string name="open_navigation">Open navigation</string>
|
||||
<string name="close_navigation">Close navigation</string>
|
||||
<string name="remove_items">Remove items</string>
|
||||
<string name="sort_items">Sort items</string>
|
||||
<string name="error_adding_treatment_title">Treatment data incomplete</string>
|
||||
<string name="maintenance_settings">Maintenance Settings</string>
|
||||
<string name="maintenance_email">Email recipient</string>
|
||||
<string name="key_maintenance_logs_email" translatable="false">maintenance_logs_email</string>
|
||||
<string name="key_maintenance_logs_amount" translatable="false">maintenance_logs_amount</string>
|
||||
<string name="key_logshipper_amount" translatable="false">logshipper_amount</string>
|
||||
<string name="maintenance_amount">No of Logs to send</string>
|
||||
<string name="maintenance">Maintenance</string>
|
||||
<string name="maintenance_shortname">MAINT</string>
|
||||
<string name="description_maintenance">Provides several functions for maintenance (eg. log sending, log deletion).</string>
|
||||
<string name="send_all_logs">Send Logs by Email</string>
|
||||
<string name="delete_logs">Delete Logs</string>
|
||||
<string name="error_adding_treatment_message">A treatment (insulin: %1$.2f, carbs: %2$d, at: %3$s) could not be added to treatments. Please check and manually add a record as appropriate.</string>
|
||||
<string name="generated_ecarbs_note">eCarbs: %1$d g (%2$d h), delay: %3$d m</string>
|
||||
<string name="log_files">Log files</string>
|
||||
<string name="miscellaneous">Miscellaneous</string>
|
||||
<string name="nav_logsettings">Log settings</string>
|
||||
<string name="resettodefaults">Reset to defaults</string>
|
||||
<string name="profile_total">== ∑ %1$s U</string>
|
||||
<string name="unitsnosemicolon">Units</string>
|
||||
<string name="show_removed">Show removed</string>
|
||||
|
@ -133,8 +97,4 @@
|
|||
<string name="sort_label">Sort</string>
|
||||
<string name="search">Search</string>
|
||||
|
||||
<string name="database_cleanup">Database cleanup</string>
|
||||
<string name="cleanup_db_confirm">Do you want to cleanup the database?\nIt will remove tracked changes and historic data older than 3 months.</string>
|
||||
<string name="cleared_entries">Cleared entries</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -7,6 +7,7 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.TestBaseWithProfile
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.androidaps.implementations.ConfigImpl
|
||||
import info.nightscout.androidaps.insight.database.InsightDatabase
|
||||
import info.nightscout.androidaps.insight.database.InsightDatabaseDao
|
||||
import info.nightscout.androidaps.insight.database.InsightDbHelper
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||
|
@ -41,6 +42,7 @@ import info.nightscout.plugins.source.GlimpPlugin
|
|||
import info.nightscout.pump.combo.ComboPlugin
|
||||
import info.nightscout.pump.combo.ruffyscripter.RuffyScripter
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
|
@ -68,6 +70,8 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var ruffyScripter: RuffyScripter
|
||||
@Mock lateinit var activityNames: ActivityNames
|
||||
@Mock lateinit var profileInstantiator: ProfileInstantiator
|
||||
@Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase
|
||||
@Mock lateinit var insightDatabase: InsightDatabase
|
||||
|
||||
private lateinit var hardLimits: HardLimits
|
||||
private lateinit var danaPump: DanaPump
|
||||
|
@ -139,7 +143,8 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator)
|
||||
objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, config)
|
||||
comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter, activityNames)
|
||||
danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync, activityNames)
|
||||
danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync,
|
||||
activityNames, danaHistoryDatabase)
|
||||
danaRSPlugin =
|
||||
info.nightscout.pump.danars.DanaRSPlugin(
|
||||
injector,
|
||||
|
@ -158,9 +163,10 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
temporaryBasalStorage,
|
||||
fabricPrivacy,
|
||||
dateUtil,
|
||||
activityNames
|
||||
activityNames,
|
||||
danaHistoryDatabase
|
||||
)
|
||||
insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, rh, sp, commandQueue, profileFunction, context, config, dateUtil, insightDbHelper, pumpSync)
|
||||
insightPlugin = LocalInsightPlugin(injector, aapsLogger, rxBus, rh, sp, commandQueue, profileFunction, context, config, dateUtil, insightDbHelper, pumpSync, insightDatabase)
|
||||
openAPSSMBPlugin =
|
||||
OpenAPSSMBPlugin(
|
||||
injector,
|
||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.general.maintenance
|
|||
import android.content.Context
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.configuration.maintenance.MaintenancePlugin
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.logging.LoggerUtils
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
|
|
|
@ -32,7 +32,7 @@ dependencies {
|
|||
api "com.google.dagger:dagger-android-support:$dagger_version"
|
||||
|
||||
//WorkManager
|
||||
api "androidx.work:work-runtime:$work_version" // DataWorkerStorage
|
||||
api "androidx.work:work-runtime-ktx:$work_version" // DataWorkerStorage
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package info.nightscout.core.di
|
||||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity
|
||||
import info.nightscout.core.ui.elements.SingleClickButton
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
||||
abstract class CoreFragmentsModule {
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesPrefImportListActivity(): PrefImportListActivity
|
||||
@ContributesAndroidInjector abstract fun contributesSingleClickButton(): SingleClickButton
|
||||
|
||||
}
|
|
@ -9,7 +9,6 @@ import dagger.Provides
|
|||
@Module(
|
||||
includes = [
|
||||
CoreReceiversModule::class,
|
||||
CoreFragmentsModule::class,
|
||||
CoreDataClassesModule::class,
|
||||
PreferencesModule::class
|
||||
]
|
||||
|
|
|
@ -2,15 +2,11 @@ package info.nightscout.core.di
|
|||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat
|
||||
import info.nightscout.core.utils.CryptoUtil
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
||||
abstract class PreferencesModule {
|
||||
|
||||
@ContributesAndroidInjector abstract fun cryptoUtilInjector(): CryptoUtil
|
||||
@ContributesAndroidInjector abstract fun encryptedPrefsFormatInjector(): EncryptedPrefsFormat
|
||||
@ContributesAndroidInjector abstract fun prefImportListProviderInjector(): PrefFileListProvider
|
||||
}
|
|
@ -10,6 +10,10 @@ interface Config {
|
|||
val FLAVOR: String
|
||||
val VERSION_NAME: String
|
||||
val BUILD_VERSION: String
|
||||
val REMOTE: String
|
||||
val BUILD_TYPE: String
|
||||
val VERSION: String
|
||||
val APPLICATION_ID: String
|
||||
val DEBUG: Boolean
|
||||
val currentDeviceModelString : String
|
||||
val appName: Int
|
||||
|
|
|
@ -6,14 +6,18 @@ import info.nightscout.database.entities.Bolus
|
|||
import info.nightscout.database.entities.BolusCalculatorResult
|
||||
import info.nightscout.database.entities.Carbs
|
||||
import info.nightscout.database.entities.TemporaryTarget
|
||||
import info.nightscout.database.entities.UserEntry
|
||||
import info.nightscout.interfaces.queue.Callback
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
|
||||
interface PersistenceLayer {
|
||||
|
||||
fun clearDatabases()
|
||||
fun cleanupDatabase(keepDays: Long, deleteTrackedChanges: Boolean): String
|
||||
fun insertOrUpdate(bolusCalculatorResult: BolusCalculatorResult)
|
||||
fun insertOrUpdateCarbs(carbs: Carbs, callback: Callback? = null, injector: HasAndroidInjector? = null)
|
||||
fun insertOrUpdateBolus(bolus: Bolus)
|
||||
|
||||
fun getTemporaryTargetActiveAt(timestamp: Long): Single<ValueWrapper<TemporaryTarget>>
|
||||
fun getUserEntryFilteredDataFromTime(timestamp: Long): Single<List<UserEntry>>
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package info.nightscout.interfaces.plugin
|
||||
|
||||
interface OwnDatabasePlugin {
|
||||
fun clearAllTables()
|
||||
}
|
|
@ -20,6 +20,7 @@ interface ActivityNames {
|
|||
val preferencesActivity: Class<*>
|
||||
val myPreferenceFragment: Class<*>
|
||||
|
||||
val prefGeneral: Int
|
||||
/**
|
||||
* Show ErrorHelperActivity and start alarm
|
||||
* @param ctx Context
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
<string name="superbolus">Superbolus</string>
|
||||
<string name="pump_paused">Pump paused</string>
|
||||
<string name="and">And</string>
|
||||
<string name="patient_name_default" comment="This is default patient display name, when user does not provide real one">User</string>
|
||||
<string name="result">Result</string>
|
||||
<string name="settings">Settings</string>
|
||||
|
||||
<!-- Pumps -->
|
||||
<string name="battery_label">Battery</string>
|
||||
|
@ -106,4 +109,7 @@
|
|||
<string name="location_not_found_title">Location Is Not Enabled</string>
|
||||
<string name="location_not_found_message">For Bluetooth discovery to work on newer devices, location must be enabled. AAPS does not track your location and it can be disabled after pairing is successful.</string>
|
||||
|
||||
<!-- Preferences -->
|
||||
<string name="nav_plugin_preferences">Plugin preferences</string>
|
||||
|
||||
</resources>
|
|
@ -35,5 +35,5 @@ dependencies {
|
|||
api "com.google.crypto.tink:tink-android:$tink_version"
|
||||
|
||||
//WorkManager
|
||||
api "androidx.work:work-runtime:$work_version" // DataWorkerStorage
|
||||
api "androidx.work:work-runtime-ktx:$work_version" // DataWorkerStorage
|
||||
}
|
|
@ -7,6 +7,7 @@ import info.nightscout.database.entities.Bolus
|
|||
import info.nightscout.database.entities.BolusCalculatorResult
|
||||
import info.nightscout.database.entities.Carbs
|
||||
import info.nightscout.database.entities.TemporaryTarget
|
||||
import info.nightscout.database.entities.UserEntry
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.transactions.InsertOrUpdateBolusCalculatorResultTransaction
|
||||
import info.nightscout.database.impl.transactions.InsertOrUpdateBolusTransaction
|
||||
|
@ -28,6 +29,8 @@ class PersistenceLayerImpl @Inject constructor(
|
|||
) : PersistenceLayer {
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
override fun clearDatabases() = repository.clearDatabases()
|
||||
override fun cleanupDatabase(keepDays: Long, deleteTrackedChanges: Boolean): String = cleanupDatabase(keepDays, deleteTrackedChanges)
|
||||
|
||||
override fun insertOrUpdate(bolusCalculatorResult: BolusCalculatorResult) {
|
||||
disposable += repository.runTransactionForResult(InsertOrUpdateBolusCalculatorResultTransaction(bolusCalculatorResult))
|
||||
|
@ -64,4 +67,5 @@ class PersistenceLayerImpl @Inject constructor(
|
|||
}
|
||||
|
||||
override fun getTemporaryTargetActiveAt(timestamp: Long): Single<ValueWrapper<TemporaryTarget>> = repository.getTemporaryTargetActiveAt(timestamp)
|
||||
override fun getUserEntryFilteredDataFromTime(timestamp: Long): Single<List<UserEntry>> = repository.getUserEntryFilteredDataFromTime(timestamp)
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import dagger.Binds
|
|||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.core.graph.OverviewData
|
||||
import info.nightscout.implementation.AndroidPermissionImpl
|
||||
import info.nightscout.implementation.BolusTimerImpl
|
||||
import info.nightscout.implementation.CarbTimerImpl
|
||||
import info.nightscout.implementation.DefaultValueHelperImpl
|
||||
|
@ -18,7 +17,6 @@ import info.nightscout.implementation.androidNotification.NotificationHolderImpl
|
|||
import info.nightscout.implementation.constraints.ConstraintsImpl
|
||||
import info.nightscout.implementation.db.PersistenceLayerImpl
|
||||
import info.nightscout.implementation.logging.LoggerUtilsImpl
|
||||
import info.nightscout.implementation.maintenance.PrefFileListProviderImpl
|
||||
import info.nightscout.implementation.overview.OverviewDataImpl
|
||||
import info.nightscout.implementation.plugin.PluginStore
|
||||
import info.nightscout.implementation.profile.ProfileFunctionImpl
|
||||
|
@ -39,7 +37,6 @@ import info.nightscout.implementation.stats.DexcomTirCalculatorImpl
|
|||
import info.nightscout.implementation.stats.TddCalculatorImpl
|
||||
import info.nightscout.implementation.stats.TirCalculatorImpl
|
||||
import info.nightscout.implementation.storage.FileStorage
|
||||
import info.nightscout.interfaces.AndroidPermission
|
||||
import info.nightscout.interfaces.BolusTimer
|
||||
import info.nightscout.interfaces.CarbTimer
|
||||
import info.nightscout.interfaces.LocalAlertUtils
|
||||
|
@ -50,7 +47,6 @@ import info.nightscout.interfaces.constraints.Constraints
|
|||
import info.nightscout.interfaces.db.PersistenceLayer
|
||||
import info.nightscout.interfaces.logging.LoggerUtils
|
||||
import info.nightscout.interfaces.logging.UserEntryLogger
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.profile.DefaultValueHelper
|
||||
import info.nightscout.interfaces.profile.ProfileFunction
|
||||
|
@ -88,7 +84,6 @@ abstract class ImplementationModule {
|
|||
interface Bindings {
|
||||
@Binds fun bindPersistenceLayer(persistenceLayerImpl: PersistenceLayerImpl): PersistenceLayer
|
||||
@Binds fun bindActivePlugin(pluginStore: PluginStore): ActivePlugin
|
||||
@Binds fun bindPrefFileListProvider(prefFileListProviderImpl: PrefFileListProviderImpl): PrefFileListProvider
|
||||
@Binds fun bindOverviewData(overviewData: OverviewDataImpl): OverviewData
|
||||
@Binds fun bindUserEntryLogger(userEntryLoggerImpl: UserEntryLoggerImpl): UserEntryLogger
|
||||
@Binds fun bindDetailedBolusInfoStorage(detailedBolusInfoStorageImpl: DetailedBolusInfoStorageImpl): DetailedBolusInfoStorage
|
||||
|
@ -113,7 +108,6 @@ abstract class ImplementationModule {
|
|||
@Binds fun bindXDripBroadcastInterface(xDripBroadcastImpl: XDripBroadcastImpl): XDripBroadcast
|
||||
@Binds fun bindCarbTimerInterface(carbTimer: CarbTimerImpl): CarbTimer
|
||||
@Binds fun bindBolusTimerInterface(bolusTimer: BolusTimerImpl): BolusTimer
|
||||
@Binds fun bindAndroidPermissionInterface(androidPermission: AndroidPermissionImpl): AndroidPermission
|
||||
@Binds fun bindLocalAlertUtilsInterface(localAlertUtils: LocalAlertUtilsImpl): LocalAlertUtils
|
||||
@Binds fun bindIconsProviderInterface(iconsProvider: IconsProviderImplementation): IconsProvider
|
||||
@Binds fun bindNotificationHolderInterface(notificationHolder: NotificationHolderImpl): NotificationHolder
|
||||
|
|
|
@ -10,10 +10,7 @@
|
|||
<string name="time_to_bolus">Time to bolus!\nRun Bolus wizard and do calculation again.</string>
|
||||
<string name="executing_right_now">Command is executed right now</string>
|
||||
<string name="basal_value_below_minimum">Basal value below minimum. Profile not set!</string>
|
||||
<string name="request">Request</string>
|
||||
<string name="permission">Permission</string>
|
||||
<string name="error_asking_for_permissions">Error asking for permissions</string>
|
||||
<string name="alert_dialog_permission_battery_optimization_failed">This device does not appear to support battery optimization whitelisting - you may experience performance issues.</string>
|
||||
<string name="need_whitelisting">%1$s needs battery optimization whitelisting for proper performance</string>
|
||||
<string name="need_location_permission">Application needs location permission for BT scan and WiFi identification</string>
|
||||
<string name="need_storage_permission">Application needs storage permission to be able store log files and export settings</string>
|
||||
|
|
|
@ -29,6 +29,7 @@ import javax.inject.Singleton;
|
|||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.insight.R;
|
||||
import info.nightscout.androidaps.insight.database.InsightBolusID;
|
||||
import info.nightscout.androidaps.insight.database.InsightDatabase;
|
||||
import info.nightscout.androidaps.insight.database.InsightDbHelper;
|
||||
import info.nightscout.androidaps.insight.database.InsightHistoryOffset;
|
||||
import info.nightscout.androidaps.insight.database.InsightPumpID;
|
||||
|
@ -104,6 +105,7 @@ import info.nightscout.interfaces.Config;
|
|||
import info.nightscout.interfaces.constraints.Constraint;
|
||||
import info.nightscout.interfaces.constraints.Constraints;
|
||||
import info.nightscout.interfaces.notifications.Notification;
|
||||
import info.nightscout.interfaces.plugin.OwnDatabasePlugin;
|
||||
import info.nightscout.interfaces.plugin.PluginDescription;
|
||||
import info.nightscout.interfaces.plugin.PluginType;
|
||||
import info.nightscout.interfaces.profile.Profile;
|
||||
|
@ -132,7 +134,7 @@ import info.nightscout.shared.utils.DateUtil;
|
|||
import info.nightscout.shared.utils.T;
|
||||
|
||||
@Singleton
|
||||
public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight, Constraints,
|
||||
public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight, Constraints, OwnDatabasePlugin,
|
||||
InsightConnectionService.StateCallback {
|
||||
|
||||
private final AAPSLogger aapsLogger;
|
||||
|
@ -145,6 +147,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
|
|||
private final DateUtil dateUtil;
|
||||
private final InsightDbHelper insightDbHelper;
|
||||
private final PumpSync pumpSync;
|
||||
private final InsightDatabase insightDatabase;
|
||||
|
||||
public static final String ALERT_CHANNEL_ID = "AAPS-InsightAlert";
|
||||
|
||||
|
@ -205,7 +208,8 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
|
|||
Config config,
|
||||
DateUtil dateUtil,
|
||||
InsightDbHelper insightDbHelper,
|
||||
PumpSync pumpSync
|
||||
PumpSync pumpSync,
|
||||
InsightDatabase insightDatabase
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.pluginIcon(R.drawable.ic_insight_128)
|
||||
|
@ -228,6 +232,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
|
|||
this.dateUtil = dateUtil;
|
||||
this.insightDbHelper = insightDbHelper;
|
||||
this.pumpSync = pumpSync;
|
||||
this.insightDatabase = insightDatabase;
|
||||
|
||||
pumpDescription = new PumpDescription();
|
||||
pumpDescription.fillFor(PumpType.ACCU_CHEK_INSIGHT);
|
||||
|
@ -1646,4 +1651,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override public void clearAllTables() {
|
||||
insightDatabase.clearAllTables();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
<string name="openapsma_iob_data_label">IOB data</string>
|
||||
<string name="openapsma_profile_label">Profile</string>
|
||||
<string name="openapsma_meal_data_label">Meal data</string>
|
||||
<string name="result">Result</string>
|
||||
<string name="openapsma_request_label">Request</string>
|
||||
<string name="constraints">Constraints</string>
|
||||
<string name="openapsma_autosensdata_label">Autosens data</string>
|
||||
|
|
|
@ -20,8 +20,13 @@ dependencies {
|
|||
implementation project(':app-wear-shared:shared')
|
||||
implementation project(':database:entities')
|
||||
implementation project(':core:core-main')
|
||||
implementation project(':core:graph')
|
||||
implementation project(':core:interfaces')
|
||||
implementation project(':core:ns-sdk')
|
||||
implementation project(':core:utils')
|
||||
implementation project(':core:ui')
|
||||
//WorkManager
|
||||
api "androidx.work:work-runtime-ktx:$work_version"
|
||||
// Maintenance
|
||||
api "androidx.gridlayout:gridlayout:$gridlayout_version"
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<application>
|
||||
|
||||
<activity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.implementation
|
||||
package info.nightscout.configuration
|
||||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
|
@ -13,7 +13,7 @@ import android.os.PowerManager
|
|||
import android.provider.Settings
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import info.nightscout.core.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.ui.toast.ToastUtils
|
||||
import info.nightscout.interfaces.AndroidPermission
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.core.activities
|
||||
package info.nightscout.configuration.activities
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
|
@ -7,7 +7,7 @@ import android.os.Bundle
|
|||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.app.ActivityCompat
|
||||
import dagger.android.support.DaggerAppCompatActivity
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefsFileContract
|
||||
import info.nightscout.configuration.maintenance.PrefsFileContract
|
||||
import info.nightscout.core.main.R
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.ui.locale.LocaleHelper
|
|
@ -1,17 +1,16 @@
|
|||
package info.nightscout.ui.activities
|
||||
package info.nightscout.configuration.activities
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import info.nightscout.core.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.core.ui.locale.LocaleHelper
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.interfaces.protection.ProtectionCheck
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.ui.R
|
||||
import javax.inject.Inject
|
||||
|
||||
class SingleFragmentActivity : DaggerAppCompatActivityWithResult() {
|
|
@ -3,11 +3,19 @@ package info.nightscout.configuration.di
|
|||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.configuration.AndroidPermissionImpl
|
||||
import info.nightscout.configuration.configBuilder.ConfigBuilderFragment
|
||||
import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.configuration.configBuilder.RunningConfigurationImpl
|
||||
import info.nightscout.configuration.maintenance.ImportExportPrefsImpl
|
||||
import info.nightscout.configuration.maintenance.PrefFileListProviderImpl
|
||||
import info.nightscout.configuration.maintenance.activities.PrefImportListActivity
|
||||
import info.nightscout.configuration.maintenance.formats.EncryptedPrefsFormat
|
||||
import info.nightscout.interfaces.AndroidPermission
|
||||
import info.nightscout.interfaces.ConfigBuilder
|
||||
import info.nightscout.interfaces.configBuilder.RunningConfiguration
|
||||
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
|
||||
@Module(
|
||||
includes = [
|
||||
|
@ -17,11 +25,18 @@ import info.nightscout.interfaces.configBuilder.RunningConfiguration
|
|||
abstract class ConfigurationModule {
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesConfigBuilderFragment(): ConfigBuilderFragment
|
||||
@ContributesAndroidInjector abstract fun contributesCsvExportWorker(): ImportExportPrefsImpl.CsvExportWorker
|
||||
@ContributesAndroidInjector abstract fun contributesPrefImportListActivity(): PrefImportListActivity
|
||||
@ContributesAndroidInjector abstract fun encryptedPrefsFormatInjector(): EncryptedPrefsFormat
|
||||
@ContributesAndroidInjector abstract fun prefImportListProviderInjector(): PrefFileListProvider
|
||||
|
||||
@Module
|
||||
interface Bindings {
|
||||
|
||||
@Binds fun bindAndroidPermissionInterface(androidPermission: AndroidPermissionImpl): AndroidPermission
|
||||
@Binds fun bindPrefFileListProvider(prefFileListProviderImpl: PrefFileListProviderImpl): PrefFileListProvider
|
||||
@Binds fun bindRunningConfiguration(runningConfigurationImpl: RunningConfigurationImpl): RunningConfiguration
|
||||
@Binds fun bindConfigBuilderInterface(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilder
|
||||
@Binds fun bindImportExportPrefsInterface(importExportPrefs: ImportExportPrefsImpl): ImportExportPrefs
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.general.maintenance
|
||||
package info.nightscout.configuration.maintenance
|
||||
|
||||
import android.Manifest
|
||||
import android.bluetooth.BluetoothManager
|
||||
|
@ -20,21 +20,21 @@ import androidx.work.Worker
|
|||
import androidx.work.WorkerParameters
|
||||
import androidx.work.workDataOf
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.BuildConfig
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.PreferencesActivity
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat
|
||||
import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper
|
||||
import info.nightscout.core.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.configuration.maintenance.dialogs.PrefImportSummaryDialog
|
||||
import info.nightscout.configuration.maintenance.formats.EncryptedPrefsFormat
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.ui.dialogs.TwoMessagesAlertDialog
|
||||
import info.nightscout.core.ui.dialogs.WarningDialog
|
||||
import info.nightscout.core.ui.toast.ToastUtils
|
||||
import info.nightscout.database.entities.UserEntry
|
||||
import info.nightscout.database.entities.UserEntry.Action
|
||||
import info.nightscout.database.entities.UserEntry.Sources
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.AndroidPermission
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.db.PersistenceLayer
|
||||
import info.nightscout.interfaces.logging.UserEntryLogger
|
||||
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
|
@ -48,17 +48,17 @@ import info.nightscout.interfaces.maintenance.PrefsMetadataKey
|
|||
import info.nightscout.interfaces.maintenance.PrefsStatus
|
||||
import info.nightscout.interfaces.protection.PasswordCheck
|
||||
import info.nightscout.interfaces.storage.Storage
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.interfaces.utils.MidnightTime
|
||||
import info.nightscout.pump.diaconn.events.EventDiaconnG8PumpLogReset
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
import info.nightscout.rx.events.EventAppExit
|
||||
import info.nightscout.rx.events.EventDiaconnG8PumpLogReset
|
||||
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 info.nightscout.ui.alertDialogs.PrefImportSummaryDialog
|
||||
import java.io.File
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.IOException
|
||||
|
@ -82,7 +82,8 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
private val encryptedPrefsFormat: EncryptedPrefsFormat,
|
||||
private val prefFileList: PrefFileListProvider,
|
||||
private val uel: UserEntryLogger,
|
||||
private val dateUtil: DateUtil
|
||||
private val dateUtil: DateUtil,
|
||||
private val activityNames: ActivityNames
|
||||
) : ImportExportPrefs {
|
||||
|
||||
override fun prefsFileExists(): Boolean {
|
||||
|
@ -111,8 +112,8 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
|
||||
metadata[PrefsMetadataKey.DEVICE_NAME] = PrefMetadata(detectUserName(context), PrefsStatus.OK)
|
||||
metadata[PrefsMetadataKey.CREATED_AT] = PrefMetadata(dateUtil.toISOString(dateUtil.now()), PrefsStatus.OK)
|
||||
metadata[PrefsMetadataKey.AAPS_VERSION] = PrefMetadata(BuildConfig.VERSION_NAME, PrefsStatus.OK)
|
||||
metadata[PrefsMetadataKey.AAPS_FLAVOUR] = PrefMetadata(BuildConfig.FLAVOR, PrefsStatus.OK)
|
||||
metadata[PrefsMetadataKey.AAPS_VERSION] = PrefMetadata(config.VERSION_NAME, PrefsStatus.OK)
|
||||
metadata[PrefsMetadataKey.AAPS_FLAVOUR] = PrefMetadata(config.FLAVOR, PrefsStatus.OK)
|
||||
metadata[PrefsMetadataKey.DEVICE_MODEL] = PrefMetadata(config.currentDeviceModelString, PrefsStatus.OK)
|
||||
metadata[PrefsMetadataKey.ENCRYPTION] = PrefMetadata("Enabled", PrefsStatus.OK)
|
||||
|
||||
|
@ -171,12 +172,12 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
|
||||
private fun assureMasterPasswordSet(activity: FragmentActivity, @StringRes wrongPwdTitle: Int): Boolean {
|
||||
if (!sp.contains(R.string.key_master_password) || (sp.getString(R.string.key_master_password, "") == "")) {
|
||||
info.nightscout.core.ui.dialogs.WarningDialog.showWarning(activity,
|
||||
rh.gs(wrongPwdTitle),
|
||||
rh.gs(R.string.master_password_missing, rh.gs(R.string.configbuilder_general), rh.gs(R.string.protection)),
|
||||
R.string.nav_preferences, {
|
||||
val intent = Intent(activity, PreferencesActivity::class.java).apply {
|
||||
putExtra("id", R.xml.pref_general)
|
||||
WarningDialog.showWarning(activity,
|
||||
rh.gs(wrongPwdTitle),
|
||||
rh.gs(R.string.master_password_missing, rh.gs(R.string.configbuilder_general), rh.gs(R.string.protection)),
|
||||
R.string.nav_preferences, {
|
||||
val intent = Intent(activity, activityNames.preferencesActivity).apply {
|
||||
putExtra("id", activityNames.prefGeneral)
|
||||
}
|
||||
activity.startActivity(intent)
|
||||
})
|
||||
|
@ -384,19 +385,19 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
|
||||
@Inject lateinit var injector: HasAndroidInjector
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var rh: ResourceHelper
|
||||
@Inject lateinit var prefFileList: PrefFileListProvider
|
||||
@Inject lateinit var context: Context
|
||||
@Inject lateinit var userEntryPresentationHelper: UserEntryPresentationHelper
|
||||
@Inject lateinit var storage: Storage
|
||||
@Inject lateinit var persistenceLayer: PersistenceLayer
|
||||
|
||||
init {
|
||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
||||
}
|
||||
|
||||
override fun doWork(): Result {
|
||||
val entries = repository.getUserEntryFilteredDataFromTime(MidnightTime.calc() - T.days(90).msecs()).blockingGet()
|
||||
val entries = persistenceLayer.getUserEntryFilteredDataFromTime(MidnightTime.calc() - T.days(90).msecs()).blockingGet()
|
||||
prefFileList.ensureExportDirExists()
|
||||
val newFile = prefFileList.newExportCsvFile()
|
||||
var ret = Result.success()
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.general.maintenance
|
||||
package info.nightscout.configuration.maintenance
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
|
@ -7,29 +7,26 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import androidx.core.text.toSpanned
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.MaintenanceFragmentBinding
|
||||
import info.nightscout.androidaps.insight.database.InsightDatabase
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.databinding.MaintenanceFragmentBinding
|
||||
import info.nightscout.configuration.maintenance.activities.LogSettingActivity
|
||||
import info.nightscout.core.graph.OverviewData
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.database.entities.UserEntry.Action
|
||||
import info.nightscout.database.entities.UserEntry.Sources
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.db.PersistenceLayer
|
||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||
import info.nightscout.interfaces.logging.UserEntryLogger
|
||||
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.plugin.OwnDatabasePlugin
|
||||
import info.nightscout.interfaces.protection.ProtectionCheck
|
||||
import info.nightscout.interfaces.protection.ProtectionCheck.Protection.PREFERENCES
|
||||
import info.nightscout.interfaces.pump.PumpSync
|
||||
import info.nightscout.interfaces.sync.DataSyncSelector
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.interfaces.utils.HtmlHelper
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase
|
||||
import info.nightscout.pump.diaconn.database.DiaconnHistoryDatabase
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
import info.nightscout.rx.events.EventPreferenceChange
|
||||
|
@ -51,12 +48,7 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
@Inject lateinit var rh: ResourceHelper
|
||||
@Inject lateinit var importExportPrefs: ImportExportPrefs
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var danaHistoryDatabase: DanaHistoryDatabase
|
||||
@Inject lateinit var insightDatabase: InsightDatabase
|
||||
@Inject lateinit var diaconnDatabase: DiaconnHistoryDatabase
|
||||
@Inject lateinit var erosDatabase: ErosHistoryDatabase
|
||||
@Inject lateinit var dashDatabase: DashHistoryDatabase
|
||||
@Inject lateinit var persistenceLayer: PersistenceLayer
|
||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
@Inject lateinit var dataSyncSelector: DataSyncSelector
|
||||
|
@ -65,6 +57,7 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
@Inject lateinit var overviewData: OverviewData
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var activityNames: ActivityNames
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
private var inMenu = false
|
||||
|
@ -96,12 +89,10 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
OKDialog.showConfirmation(activity, rh.gs(R.string.maintenance), rh.gs(R.string.reset_db_confirm), Runnable {
|
||||
disposable +=
|
||||
Completable.fromAction {
|
||||
repository.clearDatabases()
|
||||
danaHistoryDatabase.clearAllTables()
|
||||
insightDatabase.clearAllTables()
|
||||
diaconnDatabase.clearAllTables()
|
||||
erosDatabase.clearAllTables()
|
||||
dashDatabase.clearAllTables()
|
||||
persistenceLayer.clearDatabases()
|
||||
for (plugin in activePlugin.getSpecificPluginsListByInterface(OwnDatabasePlugin::class.java)) {
|
||||
(plugin as OwnDatabasePlugin).clearAllTables()
|
||||
}
|
||||
dataSyncSelector.resetToNextFullSync()
|
||||
pumpSync.connectNewPump()
|
||||
overviewData.reset()
|
||||
|
@ -121,7 +112,7 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
activity?.let { activity ->
|
||||
var result = ""
|
||||
OKDialog.showConfirmation(activity, rh.gs(R.string.maintenance), rh.gs(R.string.cleanup_db_confirm), Runnable {
|
||||
disposable += Completable.fromAction { result = repository.cleanupDatabase(93, deleteTrackedChanges = true) }
|
||||
disposable += Completable.fromAction { result = persistenceLayer.cleanupDatabase(93, deleteTrackedChanges = true) }
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribeBy(
|
|
@ -1,19 +1,18 @@
|
|||
package info.nightscout.androidaps.plugins.general.maintenance
|
||||
package info.nightscout.configuration.maintenance
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import androidx.core.content.FileProvider
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.BuildConfig
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.logging.LoggerUtils
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
import info.nightscout.interfaces.nsclient.NSSettingsStatus
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.interfaces.plugin.PluginDescription
|
||||
import info.nightscout.interfaces.plugin.PluginType
|
||||
import info.nightscout.interfaces.nsclient.NSSettingsStatus
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
|
@ -63,7 +62,7 @@ class MaintenancePlugin @Inject constructor(
|
|||
aapsLogger.debug("zipFile: ${zipFile.absolutePath}")
|
||||
val zip = zipLogs(zipFile, logs)
|
||||
val attachmentUri =
|
||||
FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileprovider", zip)
|
||||
FileProvider.getUriForFile(context, config.APPLICATION_ID + ".fileprovider", zip)
|
||||
val emailIntent: Intent = this.sendMail(attachmentUri, recipient, "Log Export")
|
||||
aapsLogger.debug("sending emailIntent")
|
||||
context.startActivity(emailIntent)
|
||||
|
@ -185,11 +184,11 @@ class MaintenancePlugin @Inject constructor(
|
|||
builder.append("If you want to provide logs for event older than a few hours," + System.lineSeparator())
|
||||
builder.append("you have to do it manually)" + System.lineSeparator())
|
||||
builder.append("-------------------------------------------------------" + System.lineSeparator())
|
||||
builder.append(rh.gs(R.string.app_name) + " " + BuildConfig.VERSION + System.lineSeparator())
|
||||
builder.append(rh.gs(config.appName) + " " + config.VERSION + System.lineSeparator())
|
||||
if (config.NSCLIENT) builder.append("NSCLIENT" + System.lineSeparator())
|
||||
builder.append("Build: " + BuildConfig.BUILDVERSION + System.lineSeparator())
|
||||
builder.append("Remote: " + BuildConfig.REMOTE + System.lineSeparator())
|
||||
builder.append("Flavor: " + BuildConfig.FLAVOR + BuildConfig.BUILD_TYPE + System.lineSeparator())
|
||||
builder.append("Build: " + config.BUILD_VERSION + System.lineSeparator())
|
||||
builder.append("Remote: " + config.REMOTE + System.lineSeparator())
|
||||
builder.append("Flavor: " + config.FLAVOR + config.BUILD_TYPE + System.lineSeparator())
|
||||
builder.append(rh.gs(R.string.configbuilder_nightscoutversion_label) + " " + nsSettingsStatus.getVersion() + System.lineSeparator())
|
||||
if (config.isEngineeringMode()) builder.append(rh.gs(R.string.engineering_mode_enabled))
|
||||
return sendMail(attachmentUri, recipient, subject, builder.toString())
|
|
@ -1,13 +1,12 @@
|
|||
package info.nightscout.implementation.maintenance
|
||||
package info.nightscout.configuration.maintenance
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Environment
|
||||
import dagger.Lazy
|
||||
import dagger.Reusable
|
||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat
|
||||
import info.nightscout.configuration.maintenance.formats.EncryptedPrefsFormat
|
||||
import info.nightscout.core.main.R
|
||||
import info.nightscout.interfaces.versionChecker.VersionCheckerUtils
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
import info.nightscout.interfaces.maintenance.PrefMetadata
|
||||
|
@ -17,6 +16,7 @@ import info.nightscout.interfaces.maintenance.PrefsImportDir
|
|||
import info.nightscout.interfaces.maintenance.PrefsMetadataKey
|
||||
import info.nightscout.interfaces.maintenance.PrefsStatus
|
||||
import info.nightscout.interfaces.storage.Storage
|
||||
import info.nightscout.interfaces.versionChecker.VersionCheckerUtils
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import org.joda.time.DateTime
|
||||
import org.joda.time.Days
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.general.maintenance
|
||||
package info.nightscout.configuration.maintenance
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity
|
||||
import info.nightscout.configuration.maintenance.activities.PrefImportListActivity
|
||||
import info.nightscout.core.utils.extensions.safeGetParcelableExtra
|
||||
import info.nightscout.interfaces.maintenance.PrefsFile
|
||||
|
||||
|
@ -25,5 +25,4 @@ class PrefsFileContract : ActivityResultContract<Void?, PrefsFile?>() {
|
|||
override fun createIntent(context: Context, input: Void?): Intent {
|
||||
return Intent(context, PrefImportListActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.general.maintenance.activities
|
||||
package info.nightscout.configuration.maintenance.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
|
@ -6,8 +6,8 @@ import android.widget.CheckBox
|
|||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import dagger.android.support.DaggerAppCompatActivity
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.ActivityLogsettingBinding
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.databinding.ActivityLogsettingBinding
|
||||
import info.nightscout.rx.interfaces.L
|
||||
import info.nightscout.rx.interfaces.LogElement
|
||||
import javax.inject.Inject
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.general.maintenance.activities
|
||||
package info.nightscout.configuration.maintenance.activities
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
|
@ -11,10 +11,10 @@ import androidx.fragment.app.FragmentActivity
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import dagger.android.support.DaggerAppCompatActivity
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefsFileContract
|
||||
import info.nightscout.configuration.databinding.MaintenanceImportListActivityBinding
|
||||
import info.nightscout.configuration.databinding.MaintenanceImportListItemBinding
|
||||
import info.nightscout.configuration.maintenance.PrefsFileContract
|
||||
import info.nightscout.core.main.R
|
||||
import info.nightscout.core.main.databinding.MaintenanceImportListActivityBinding
|
||||
import info.nightscout.core.main.databinding.MaintenanceImportListItemBinding
|
||||
import info.nightscout.core.ui.locale.LocaleHelper
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
import info.nightscout.interfaces.maintenance.PrefsFile
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.ui.alertDialogs
|
||||
package info.nightscout.configuration.maintenance.dialogs
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
|
@ -17,11 +17,11 @@ import androidx.annotation.StringRes
|
|||
import androidx.annotation.StyleRes
|
||||
import androidx.appcompat.view.ContextThemeWrapper
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.core.ui.toast.ToastUtils
|
||||
import info.nightscout.interfaces.maintenance.Prefs
|
||||
import info.nightscout.interfaces.maintenance.PrefsStatus
|
||||
import info.nightscout.shared.extensions.runOnUiThread
|
||||
import info.nightscout.ui.R
|
||||
import java.util.LinkedList
|
||||
|
||||
object PrefImportSummaryDialog {
|
||||
|
@ -136,4 +136,4 @@ object PrefImportSummaryDialog {
|
|||
dialog.setCanceledOnTouchOutside(false)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.general.maintenance.formats
|
||||
package info.nightscout.configuration.maintenance.formats
|
||||
|
||||
import info.nightscout.core.main.R
|
||||
import info.nightscout.core.utils.CryptoUtil
|
|
@ -6,9 +6,9 @@ import android.view.View
|
|||
import android.widget.TextView
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.configuration.databinding.ActivitySetupwizardBinding
|
||||
import info.nightscout.configuration.setupwizard.elements.SWItem
|
||||
import info.nightscout.core.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.ui.locale.LocaleHelper.update
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:tint="#FFFFFF"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<group
|
||||
android:pivotX="12"
|
||||
android:pivotY="12"
|
||||
android:scaleX="0.66"
|
||||
android:scaleY="0.66">
|
||||
<path
|
||||
android:fillColor="#000"
|
||||
android:pathData="M23,12L19,8V11H10V13H19V16M1,18V6C1,4.89 1.9,4 3,4H15A2,2 0 0,1 17,6V9H15V6H3V18H15V15H17V18A2,2 0 0,1 15,20H3A2,2 0 0,1 1,18Z" />
|
||||
</group>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:tint="#FFFFFF"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<group
|
||||
android:pivotX="12"
|
||||
android:pivotY="12"
|
||||
android:scaleX="0.66"
|
||||
android:scaleY="0.66">
|
||||
<path
|
||||
android:fillColor="#000"
|
||||
android:pathData="M23,12L19,8V11H10V13H19V16M1,18V6C1,4.89 1.9,4 3,4H15A2,2 0 0,1 17,6V9H15V6H3V18H15V15H17V18A2,2 0 0,1 15,20H3A2,2 0 0,1 1,18Z" />
|
||||
</group>
|
||||
</vector>
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".plugins.general.maintenance.activities.LogSettingActivity">
|
||||
tools:context="info.nightscout.configuration.maintenance.activities.LogSettingActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -24,7 +24,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAccessibility="no"
|
||||
app:srcCompat="@mipmap/ic_launcher" />
|
||||
app:srcCompat="@drawable/ic_aaps" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="2dp"
|
||||
tools:context=".plugins.general.maintenance.MaintenanceFragment">
|
||||
tools:context="info.nightscout.configuration.maintenance.MaintenanceFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
|
@ -4,7 +4,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="vertical"
|
||||
tools:context="info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity">
|
||||
tools:context="info.nightscout.configuration.maintenance.activities.PrefImportListActivity">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview"
|
|
@ -24,7 +24,6 @@
|
|||
<string name="need_storage_permission">Application needs storage permission to be able store log files and export settings</string>
|
||||
<string name="askforpermission">Ask for permission</string>
|
||||
<string name="need_whitelisting">%1$s needs battery optimization whitelisting for proper performance</string>
|
||||
<string name="import_setting">Import settings</string>
|
||||
<string name="storedsettingsfound">Stored settings found</string>
|
||||
<string name="master_password_summary">Master password is used for backup encryption and to override security in application. Remember it or store on a safe place.</string>
|
||||
<string name="current_master_password">Current master password</string>
|
||||
|
@ -54,9 +53,11 @@
|
|||
<string name="allow_automated_crash_reporting">Allow automated crash reporting and feature usage data to be sent to the developers via the fabric.io service.</string>
|
||||
<string name="summary_email_for_crash_report">This identification will attached to crash reports so we can contact you in urgent cases. It\'s optional.</string>
|
||||
<string name="identification">Identification (email, FB or Discord nick etc)</string>
|
||||
|
||||
<string name="request">Request</string>
|
||||
<string name="apsmode_title">APS Mode</string>
|
||||
<string name="setupwizard_preferred_aps_mode">Preferred APS mode</string>
|
||||
<string name="error_asking_for_permissions">Error asking for permissions</string>
|
||||
<string name="alert_dialog_permission_battery_optimization_failed">This device does not appear to support battery optimization whitelisting - you may experience performance issues.</string>
|
||||
|
||||
<!-- ConfigBuilder-->
|
||||
<string name="config_builder">Config Builder</string>
|
||||
|
@ -83,5 +84,56 @@
|
|||
<string name="allow_hardware_pump_text">Attention: If you activate and connect to a hardware pump, AAPS will copy the basal settings from the profile to the pump, overwriting the existing basal rate stored on the pump. Make sure you have the correct basal setting in AAPS. If you are not sure or don\'t want to overwrite the basal settings on your pump, press cancel and repeat switching to the pump at a later time.</string>
|
||||
<string name="a11y_open_settings">open settings</string>
|
||||
|
||||
<!--ImportExport-->
|
||||
<string name="nav_preferences">Preferences</string>
|
||||
<string name="password_preferences_encrypt_prompt">You will be asked for master password, which will be used to encrypt exported preferences.</string>
|
||||
<string name="preferences_export_canceled">Export canceled! Preferences were NOT exported!</string>
|
||||
<string name="preferences_import_canceled">Import canceled! Preferences were NOT imported!</string>
|
||||
<string name="preferences_import_impossible">Cannot import preferences!</string>
|
||||
<string name="check_preferences_details_btn">Explain import issues…</string>
|
||||
<string name="check_preferences_details_title">Import issues details</string>
|
||||
<string name="check_preferences_import_btn">Import</string>
|
||||
<string name="check_preferences_import_anyway_btn">Import anyway (DANGEROUS!)</string>
|
||||
<string name="import_setting">Import settings</string>
|
||||
<string name="check_preferences_before_import">Please check preferences before importing:</string>
|
||||
<string name="check_preferences_cannot_import">Preferences cannot be imported!</string>
|
||||
<string name="check_preferences_dangerous_import">Preferences should not be imported!</string>
|
||||
<string name="nav_export">Export settings</string>
|
||||
<string name="export_to">Export settings to</string>
|
||||
<string name="import_from">Import settings from</string>
|
||||
<string name="setting_imported">Settings imported</string>
|
||||
<string name="old_master_password">Old Master Password</string>
|
||||
<string name="different_password_used">This file was exported and encrypted with different master password. Provide old master password to decrypt file.</string>
|
||||
<string name="master_password_will_be_replaced">As a result of successful import current master password WILL BE REPLACED with that old master password!</string>
|
||||
<string name="exported">Preferences exported</string>
|
||||
<string name="filenotfound">File not found</string>
|
||||
<string name="goto_main_try_again">Please go back to main screen and try again.</string>
|
||||
<string name="restartingapp">Exiting application to apply settings.</string>
|
||||
<string name="ue_exported">User Entries exported</string>
|
||||
|
||||
|
||||
<!-- Maintenance-->
|
||||
<string name="maintenance">Maintenance</string>
|
||||
<string name="maintenance_shortname">MAINT</string>
|
||||
<string name="description_maintenance">Provides several functions for maintenance (eg. log sending, log deletion).</string>
|
||||
<string name="database_cleanup">Database cleanup</string>
|
||||
<string name="cleanup_db_confirm">Do you want to cleanup the database?\nIt will remove tracked changes and historic data older than 3 months.</string>
|
||||
<string name="cleared_entries">Cleared entries</string>
|
||||
<string name="reset_db_confirm">Do you really want to reset the databases?</string>
|
||||
<string name="maintenance_settings">Maintenance Settings</string>
|
||||
<string name="maintenance_email">Email recipient</string>
|
||||
<string name="key_maintenance_logs_email" translatable="false">maintenance_logs_email</string>
|
||||
<string name="key_maintenance_logs_amount" translatable="false">maintenance_logs_amount</string>
|
||||
<string name="key_logshipper_amount" translatable="false">logshipper_amount</string>
|
||||
<string name="maintenance_amount">No of Logs to send</string>
|
||||
<string name="send_all_logs">Send Logs by Email</string>
|
||||
<string name="delete_logs">Delete Logs</string>
|
||||
<string name="configbuilder_nightscoutversion_label">Nightscout version:</string>
|
||||
<string name="engineering_mode_enabled">Engineering mode enabled</string>
|
||||
<string name="log_files">Log files</string>
|
||||
<string name="nav_logsettings">Log settings</string>
|
||||
<string name="miscellaneous">Miscellaneous</string>
|
||||
<string name="nav_resetdb">Reset Databases</string>
|
||||
<string name="resettodefaults">Reset to defaults</string>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,39 @@
|
|||
package info.nightscout.androidaps
|
||||
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.rx.TestAapsSchedulers
|
||||
import info.nightscout.rx.logging.AAPSLoggerTest
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.junit.MockitoJUnit
|
||||
import org.mockito.junit.MockitoRule
|
||||
import java.util.Locale
|
||||
|
||||
open class TestBase {
|
||||
|
||||
val aapsLogger = AAPSLoggerTest()
|
||||
val aapsSchedulers: AapsSchedulers = TestAapsSchedulers()
|
||||
|
||||
// Add a JUnit rule that will setup the @Mock annotated vars and log.
|
||||
// Another possibility would be to add `MockitoAnnotations.initMocks(this) to the setup method.
|
||||
@get:Rule
|
||||
val mockitoRule: MockitoRule = MockitoJUnit.rule()
|
||||
|
||||
@Before
|
||||
fun setupLocale() {
|
||||
Locale.setDefault(Locale.ENGLISH)
|
||||
System.setProperty("disableFirebase", "true")
|
||||
}
|
||||
|
||||
// Workaround for Kotlin nullability.
|
||||
// https://medium.com/@elye.project/befriending-kotlin-and-mockito-1c2e7b0ef791
|
||||
// https://stackoverflow.com/questions/30305217/is-it-possible-to-use-mockito-in-kotlin
|
||||
fun <T> anyObject(): T {
|
||||
Mockito.any<T>()
|
||||
return uninitialized()
|
||||
}
|
||||
|
||||
@Suppress("Unchecked_Cast")
|
||||
fun <T> uninitialized(): T = null as T
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.general.maintenance.formats
|
||||
package info.nightscout.configuration.maintenance.formats
|
||||
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.core.utils.CryptoUtil
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.general.maintenance.formats
|
||||
package info.nightscout.configuration.maintenance.formats
|
||||
|
||||
import info.nightscout.interfaces.storage.Storage
|
||||
import java.io.File
|
|
@ -54,7 +54,6 @@ dependencies {
|
|||
api 'com.google.android.flexbox:flexbox:3.0.0'
|
||||
|
||||
// Food
|
||||
api "androidx.work:work-runtime:$work_version"
|
||||
api "androidx.work:work-runtime-ktx:$work_version"
|
||||
|
||||
// DataLayerListenerService
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
<string name="smscommunicator_otp_reset_warning">By resetting authenticator you make all already provisioned authenticators invalid. You will need to set up them again!</string>
|
||||
<string name="sms_wrong_code">Wrong code. Command cancelled.</string>
|
||||
<string name="sms_timeout_while_waiting">Timeout while waiting for finish of previous pump communication</string>
|
||||
<string name="patient_name_default" comment="This is default patient display name, when user does not provide real one">User</string>
|
||||
<string name="smscommunicator_allowednumbers">Allowed phone numbers</string>
|
||||
<string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string>
|
||||
<string name="smscommunicator_bolus_reply_with_code">To deliver bolus %1$.2fU reply with code %2$s</string>
|
||||
|
|
|
@ -28,7 +28,6 @@ dependencies {
|
|||
api "androidx.browser:browser:1.4.0"
|
||||
|
||||
//WorkManager
|
||||
api "androidx.work:work-runtime:$work_version"
|
||||
api "androidx.work:work-runtime-ktx:$work_version"
|
||||
//api "androidx.work:work-rxjava3:$work_version"
|
||||
//api 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
|
||||
|
|
|
@ -23,6 +23,7 @@ import info.nightscout.interfaces.queue.CommandQueue
|
|||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.interfaces.utils.Round
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
import info.nightscout.rx.events.EventAppExit
|
||||
|
@ -55,8 +56,9 @@ class DanaRKoreanPlugin @Inject constructor(
|
|||
dateUtil: DateUtil,
|
||||
private val fabricPrivacy: FabricPrivacy,
|
||||
pumpSync: PumpSync,
|
||||
activityNames: ActivityNames
|
||||
) : AbstractDanaRPlugin(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames) {
|
||||
activityNames: ActivityNames,
|
||||
danaHistoryDatabase: DanaHistoryDatabase
|
||||
) : AbstractDanaRPlugin(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames, danaHistoryDatabase) {
|
||||
|
||||
init {
|
||||
pluginDescription.description(R.string.description_pump_dana_r_korean)
|
||||
|
|
|
@ -30,6 +30,7 @@ import info.nightscout.interfaces.queue.CommandQueue;
|
|||
import info.nightscout.interfaces.ui.ActivityNames;
|
||||
import info.nightscout.interfaces.utils.Round;
|
||||
import info.nightscout.pump.dana.DanaPump;
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase;
|
||||
import info.nightscout.rx.AapsSchedulers;
|
||||
import info.nightscout.rx.bus.RxBus;
|
||||
import info.nightscout.rx.events.EventAppExit;
|
||||
|
@ -74,9 +75,10 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
|||
DateUtil dateUtil,
|
||||
FabricPrivacy fabricPrivacy,
|
||||
PumpSync pumpSync,
|
||||
ActivityNames activityNames
|
||||
ActivityNames activityNames,
|
||||
DanaHistoryDatabase danaHistoryDatabase
|
||||
) {
|
||||
super(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames);
|
||||
super(injector, danaPump, rh, constraintChecker, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames, danaHistoryDatabase);
|
||||
this.aapsLogger = aapsLogger;
|
||||
this.context = context;
|
||||
this.rh = rh;
|
||||
|
|
|
@ -11,6 +11,7 @@ import info.nightscout.interfaces.constraints.Constraint;
|
|||
import info.nightscout.interfaces.constraints.Constraints;
|
||||
import info.nightscout.interfaces.notifications.Notification;
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin;
|
||||
import info.nightscout.interfaces.plugin.OwnDatabasePlugin;
|
||||
import info.nightscout.interfaces.plugin.PluginDescription;
|
||||
import info.nightscout.interfaces.plugin.PluginType;
|
||||
import info.nightscout.interfaces.profile.Profile;
|
||||
|
@ -28,6 +29,7 @@ import info.nightscout.interfaces.utils.Round;
|
|||
import info.nightscout.pump.dana.DanaFragment;
|
||||
import info.nightscout.pump.dana.DanaPump;
|
||||
import info.nightscout.pump.dana.comm.RecordTypes;
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase;
|
||||
import info.nightscout.rx.AapsSchedulers;
|
||||
import info.nightscout.rx.bus.RxBus;
|
||||
import info.nightscout.rx.events.EventConfigBuilderChange;
|
||||
|
@ -44,7 +46,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
|||
* Created by mike on 28.01.2018.
|
||||
*/
|
||||
|
||||
public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump, Dana, Constraints {
|
||||
public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump, Dana, Constraints, OwnDatabasePlugin {
|
||||
protected AbstractDanaRExecutionService sExecutionService;
|
||||
|
||||
protected CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
@ -61,7 +63,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
protected AapsSchedulers aapsSchedulers;
|
||||
protected PumpSync pumpSync;
|
||||
protected ActivityNames activityNames;
|
||||
|
||||
protected DanaHistoryDatabase danaHistoryDatabase;
|
||||
protected AbstractDanaRPlugin(
|
||||
HasAndroidInjector injector,
|
||||
DanaPump danaPump,
|
||||
|
@ -75,7 +77,8 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
SP sp,
|
||||
DateUtil dateUtil,
|
||||
PumpSync pumpSync,
|
||||
ActivityNames activityNames
|
||||
ActivityNames activityNames,
|
||||
DanaHistoryDatabase danaHistoryDatabase
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.PUMP)
|
||||
|
@ -96,6 +99,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
this.aapsSchedulers = aapsSchedulers;
|
||||
this.pumpSync = pumpSync;
|
||||
this.activityNames = activityNames;
|
||||
this.danaHistoryDatabase = danaHistoryDatabase;
|
||||
}
|
||||
|
||||
@Override protected void onStart() {
|
||||
|
@ -516,4 +520,8 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
|
||||
@Override public void clearPairing() {
|
||||
}
|
||||
|
||||
@Override public void clearAllTables() {
|
||||
danaHistoryDatabase.clearAllTables();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import info.nightscout.interfaces.queue.CommandQueue;
|
|||
import info.nightscout.interfaces.ui.ActivityNames;
|
||||
import info.nightscout.interfaces.utils.Round;
|
||||
import info.nightscout.pump.dana.DanaPump;
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase;
|
||||
import info.nightscout.rx.AapsSchedulers;
|
||||
import info.nightscout.rx.bus.RxBus;
|
||||
import info.nightscout.rx.events.EventAppExit;
|
||||
|
@ -64,9 +65,10 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
DateUtil dateUtil,
|
||||
FabricPrivacy fabricPrivacy,
|
||||
PumpSync pumpSync,
|
||||
ActivityNames activityNames
|
||||
ActivityNames activityNames,
|
||||
DanaHistoryDatabase danaHistoryDatabase
|
||||
) {
|
||||
super(injector, danaPump, rh, constraints, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames);
|
||||
super(injector, danaPump, rh, constraints, aapsLogger, aapsSchedulers, commandQueue, rxBus, activePlugin, sp, dateUtil, pumpSync, activityNames, danaHistoryDatabase);
|
||||
this.aapsLogger = aapsLogger;
|
||||
this.context = context;
|
||||
this.rh = rh;
|
||||
|
|
|
@ -14,6 +14,7 @@ import info.nightscout.interfaces.pump.PumpSync
|
|||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
|
@ -29,6 +30,7 @@ class DanaRPluginTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var profileInstantiator: ProfileInstantiator
|
||||
@Mock lateinit var activityNames: ActivityNames
|
||||
@Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase
|
||||
|
||||
lateinit var danaPump: DanaPump
|
||||
|
||||
|
@ -46,7 +48,8 @@ class DanaRPluginTest : TestBaseWithProfile() {
|
|||
`when`(rh.gs(R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
|
||||
`when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
|
||||
danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator)
|
||||
danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync, activityNames)
|
||||
danaRPlugin = DanaRPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync,
|
||||
activityNames, danaHistoryDatabase)
|
||||
}
|
||||
|
||||
@Test @Throws(Exception::class)
|
||||
|
|
|
@ -14,6 +14,7 @@ import info.nightscout.interfaces.pump.PumpSync
|
|||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
|
@ -29,6 +30,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var profileInstantiator: ProfileInstantiator
|
||||
@Mock lateinit var activityNames: ActivityNames
|
||||
@Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase
|
||||
|
||||
lateinit var danaPump: DanaPump
|
||||
|
||||
|
@ -47,7 +49,7 @@ class DanaRKoreanPluginTest : TestBaseWithProfile() {
|
|||
`when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
|
||||
danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator)
|
||||
danaRPlugin = DanaRKoreanPlugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump, dateUtil, fabricPrivacy,
|
||||
pumpSync, activityNames)
|
||||
pumpSync, activityNames, danaHistoryDatabase)
|
||||
}
|
||||
|
||||
@Test @Throws(Exception::class)
|
||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.interfaces.pump.TemporaryBasalStorage
|
|||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
@ -32,6 +33,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var profileInstantiator: ProfileInstantiator
|
||||
@Mock lateinit var activityNames: ActivityNames
|
||||
@Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase
|
||||
|
||||
lateinit var danaPump: DanaPump
|
||||
|
||||
|
@ -50,7 +52,7 @@ class DanaRv2PluginTest : TestBaseWithProfile() {
|
|||
`when`(rh.gs(R.string.limitingpercentrate)).thenReturn("Limiting max percent rate to %1\$d%% because of %2\$s")
|
||||
danaPump = DanaPump(aapsLogger, sp, dateUtil, profileInstantiator)
|
||||
danaRv2Plugin = DanaRv2Plugin(injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePluginProvider, sp, commandQueue, danaPump,detailedBolusInfoStorage,
|
||||
temporaryBasalStorage, dateUtil, fabricPrivacy, pumpSync, activityNames)
|
||||
temporaryBasalStorage, dateUtil, fabricPrivacy, pumpSync, activityNames, danaHistoryDatabase)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -13,6 +13,7 @@ import info.nightscout.core.utils.fabric.FabricPrivacy
|
|||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.interfaces.plugin.OwnDatabasePlugin
|
||||
import info.nightscout.interfaces.plugin.PluginDescription
|
||||
import info.nightscout.interfaces.plugin.PluginType
|
||||
import info.nightscout.interfaces.profile.Profile
|
||||
|
@ -35,6 +36,7 @@ import info.nightscout.interfaces.utils.Round
|
|||
import info.nightscout.pump.dana.DanaFragment
|
||||
import info.nightscout.pump.dana.DanaPump
|
||||
import info.nightscout.pump.dana.comm.RecordTypes
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase
|
||||
import info.nightscout.pump.danars.events.EventDanaRSDeviceChange
|
||||
import info.nightscout.pump.danars.services.DanaRSService
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
|
@ -76,7 +78,8 @@ class DanaRSPlugin @Inject constructor(
|
|||
private val temporaryBasalStorage: TemporaryBasalStorage,
|
||||
private val fabricPrivacy: FabricPrivacy,
|
||||
private val dateUtil: DateUtil,
|
||||
private val activityNames: ActivityNames
|
||||
private val activityNames: ActivityNames,
|
||||
private val danaHistoryDatabase: DanaHistoryDatabase
|
||||
) : PumpPluginBase(
|
||||
PluginDescription()
|
||||
.mainType(PluginType.PUMP)
|
||||
|
@ -88,7 +91,7 @@ class DanaRSPlugin @Inject constructor(
|
|||
.preferencesId(R.xml.pref_danars)
|
||||
.description(R.string.description_pump_dana_rs),
|
||||
injector, aapsLogger, rh, commandQueue
|
||||
), Pump, Dana, Constraints {
|
||||
), Pump, Dana, Constraints, OwnDatabasePlugin {
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
private var danaRSService: DanaRSService? = null
|
||||
|
@ -637,4 +640,6 @@ class DanaRSPlugin @Inject constructor(
|
|||
sp.remove(rh.gs(R.string.key_danars_v3_randomsynckey) + mDeviceName)
|
||||
sp.remove(rh.gs(R.string.key_dana_ble5_pairingkey) + mDeviceName)
|
||||
}
|
||||
|
||||
override fun clearAllTables() = danaHistoryDatabase.clearAllTables()
|
||||
}
|
|
@ -10,6 +10,7 @@ import info.nightscout.interfaces.pump.DetailedBolusInfoStorage
|
|||
import info.nightscout.interfaces.pump.PumpSync
|
||||
import info.nightscout.interfaces.pump.TemporaryBasalStorage
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
@ -26,6 +27,7 @@ class DanaRSPluginTest : DanaRSTestBase() {
|
|||
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
|
||||
@Mock lateinit var temporaryBasalStorage: TemporaryBasalStorage
|
||||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase
|
||||
|
||||
private lateinit var danaRSPlugin: DanaRSPlugin
|
||||
|
||||
|
@ -77,7 +79,8 @@ class DanaRSPluginTest : DanaRSTestBase() {
|
|||
temporaryBasalStorage,
|
||||
fabricPrivacy,
|
||||
dateUtil,
|
||||
activityNames
|
||||
activityNames,
|
||||
danaHistoryDatabase
|
||||
)
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import info.nightscout.interfaces.pump.DetailedBolusInfoStorage
|
|||
import info.nightscout.interfaces.pump.PumpSync
|
||||
import info.nightscout.interfaces.pump.TemporaryBasalStorage
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase
|
||||
import info.nightscout.pump.danars.DanaRSTestBase
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
|
@ -24,6 +25,7 @@ class DanaRsPacketBolusSetStepBolusStartTest : DanaRSTestBase() {
|
|||
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
|
||||
@Mock lateinit var temporaryBasalStorage: TemporaryBasalStorage
|
||||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase
|
||||
|
||||
private lateinit var danaRSPlugin: info.nightscout.pump.danars.DanaRSPlugin
|
||||
|
||||
|
@ -71,7 +73,8 @@ class DanaRsPacketBolusSetStepBolusStartTest : DanaRSTestBase() {
|
|||
temporaryBasalStorage,
|
||||
fabricPrivacy,
|
||||
dateUtil,
|
||||
activityNames
|
||||
activityNames,
|
||||
danaHistoryDatabase
|
||||
)
|
||||
Mockito.`when`(constraintChecker.applyBolusConstraints(anyObject())).thenReturn(Constraint(0.0))
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ import android.content.Context
|
|||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.pump.DetailedBolusInfoStorage
|
||||
import info.nightscout.interfaces.pump.PumpSync
|
||||
import info.nightscout.interfaces.pump.TemporaryBasalStorage
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.pump.dana.database.DanaHistoryDatabase
|
||||
import info.nightscout.pump.danars.DanaRSTestBase
|
||||
import info.nightscout.rx.events.EventOverviewBolusProgress
|
||||
import org.junit.Assert
|
||||
|
@ -20,7 +20,7 @@ import org.mockito.Mockito.`when`
|
|||
|
||||
class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() {
|
||||
|
||||
@Mock lateinit var activePlugin: ActivePlugin
|
||||
@Mock lateinit var danaHistoryDatabase: DanaHistoryDatabase
|
||||
@Mock lateinit var constraintChecker: Constraints
|
||||
@Mock lateinit var commandQueue: CommandQueue
|
||||
@Mock lateinit var context: Context
|
||||
|
@ -77,7 +77,8 @@ class DanaRsPacketNotifyDeliveryRateDisplayTest : DanaRSTestBase() {
|
|||
temporaryBasalStorage,
|
||||
fabricPrivacy,
|
||||
dateUtil,
|
||||
activityNames
|
||||
activityNames,
|
||||
danaHistoryDatabase
|
||||
)
|
||||
danaPump.bolusingTreatment = EventOverviewBolusProgress.Treatment(0.0, 0, true, 0)
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import info.nightscout.core.utils.fabric.FabricPrivacy
|
|||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.interfaces.plugin.OwnDatabasePlugin
|
||||
import info.nightscout.interfaces.plugin.PluginDescription
|
||||
import info.nightscout.interfaces.plugin.PluginType
|
||||
import info.nightscout.interfaces.profile.Profile
|
||||
|
@ -35,6 +36,7 @@ import info.nightscout.interfaces.queue.CommandQueue
|
|||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.interfaces.utils.DecimalFormatter
|
||||
import info.nightscout.interfaces.utils.Round
|
||||
import info.nightscout.pump.diaconn.database.DiaconnHistoryDatabase
|
||||
import info.nightscout.pump.diaconn.events.EventDiaconnG8DeviceChange
|
||||
import info.nightscout.pump.diaconn.service.DiaconnG8Service
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
|
@ -75,7 +77,8 @@ class DiaconnG8Plugin @Inject constructor(
|
|||
private val fabricPrivacy: FabricPrivacy,
|
||||
private val dateUtil: DateUtil,
|
||||
private val aapsSchedulers: AapsSchedulers,
|
||||
private val activityNames: ActivityNames
|
||||
private val activityNames: ActivityNames,
|
||||
private val diaconnHistoryDatabase: DiaconnHistoryDatabase
|
||||
) : PumpPluginBase(
|
||||
PluginDescription()
|
||||
.mainType(PluginType.PUMP)
|
||||
|
@ -86,7 +89,7 @@ class DiaconnG8Plugin @Inject constructor(
|
|||
.preferencesId(R.xml.pref_diaconn)
|
||||
.description(R.string.description_pump_diaconn_g8),
|
||||
injector, aapsLogger, rh, commandQueue
|
||||
), Pump, Diaconn, Constraints {
|
||||
), Pump, Diaconn, Constraints, OwnDatabasePlugin {
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
private var diaconnG8Service: DiaconnG8Service? = null
|
||||
|
@ -605,4 +608,6 @@ class DiaconnG8Plugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
override fun clearAllTables() = diaconnHistoryDatabase.clearAllTables()
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package info.nightscout.pump.diaconn.events
|
||||
|
||||
import info.nightscout.rx.events.Event
|
||||
|
||||
class EventDiaconnG8PumpLogReset : Event()
|
|
@ -30,6 +30,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.BasalVa
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.BolusRecord
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.BolusType
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.TempBasalRecord
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.OmnipodDashOverviewFragment
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.Constants
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.mapProfileToBasalProgram
|
||||
|
@ -37,6 +38,7 @@ import info.nightscout.core.events.EventNewNotification
|
|||
import info.nightscout.core.utils.DateTimeUtil
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.interfaces.plugin.OwnDatabasePlugin
|
||||
import info.nightscout.interfaces.plugin.PluginDescription
|
||||
import info.nightscout.interfaces.plugin.PluginType
|
||||
import info.nightscout.interfaces.profile.Profile
|
||||
|
@ -105,8 +107,9 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
injector: HasAndroidInjector,
|
||||
aapsLogger: AAPSLogger,
|
||||
rh: ResourceHelper,
|
||||
commandQueue: CommandQueue
|
||||
) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump, OmnipodDash {
|
||||
commandQueue: CommandQueue,
|
||||
private val dashHistoryDatabase: DashHistoryDatabase
|
||||
) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump, OmnipodDash, OwnDatabasePlugin {
|
||||
|
||||
@Volatile var bolusCanceled = false
|
||||
@Volatile var bolusDeliveryInProgress = false
|
||||
|
@ -1524,4 +1527,6 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
else -> true
|
||||
}
|
||||
}
|
||||
|
||||
override fun clearAllTables() = dashHistoryDatabase.clearAllTables()
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodEr
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosPumpValuesChanged;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosTbrChanged;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosUncertainTbrRecovered;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandGetPodStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandReadPulseLog;
|
||||
|
@ -76,6 +77,7 @@ import info.nightscout.core.utils.DateTimeUtil;
|
|||
import info.nightscout.core.utils.fabric.FabricPrivacy;
|
||||
import info.nightscout.interfaces.notifications.Notification;
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin;
|
||||
import info.nightscout.interfaces.plugin.OwnDatabasePlugin;
|
||||
import info.nightscout.interfaces.plugin.PluginDescription;
|
||||
import info.nightscout.interfaces.plugin.PluginType;
|
||||
import info.nightscout.interfaces.profile.Profile;
|
||||
|
@ -120,7 +122,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
|||
* @author Andy Rozman (andy.rozman@gmail.com)
|
||||
*/
|
||||
@Singleton
|
||||
public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, RileyLinkPumpDevice, OmnipodEros {
|
||||
public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, RileyLinkPumpDevice, OmnipodEros, OwnDatabasePlugin {
|
||||
private static final long RILEY_LINK_CONNECT_TIMEOUT_MILLIS = 3 * 60 * 1_000L; // 3 minutes
|
||||
private static final long STATUS_CHECK_INTERVAL_MILLIS = 60 * 1_000L; // 1 minute
|
||||
public static final int STARTUP_STATUS_REQUEST_TRIES = 2;
|
||||
|
@ -147,6 +149,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
|||
private final PumpType pumpType = PumpType.OMNIPOD_EROS;
|
||||
private final PumpSync pumpSync;
|
||||
private final ActivityNames activityNames;
|
||||
private final ErosHistoryDatabase erosHistoryDatabase;
|
||||
|
||||
private final CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
|
@ -186,7 +189,8 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
|||
OmnipodAlertUtil omnipodAlertUtil,
|
||||
ProfileFunction profileFunction,
|
||||
PumpSync pumpSync,
|
||||
ActivityNames activityNames
|
||||
ActivityNames activityNames,
|
||||
ErosHistoryDatabase erosHistoryDatabase
|
||||
) {
|
||||
super(new PluginDescription() //
|
||||
.mainType(PluginType.PUMP) //
|
||||
|
@ -215,6 +219,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
|||
this.profileFunction = profileFunction;
|
||||
this.pumpSync = pumpSync;
|
||||
this.activityNames = activityNames;
|
||||
this.erosHistoryDatabase = erosHistoryDatabase;
|
||||
|
||||
pumpDescription = new PumpDescription(pumpType);
|
||||
|
||||
|
@ -1180,4 +1185,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
|||
return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(resourceId);
|
||||
}
|
||||
|
||||
@Override public void clearAllTables() {
|
||||
erosHistoryDatabase.clearAllTables();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import dagger.android.AndroidInjector
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.profile.Profile
|
||||
|
@ -38,6 +39,7 @@ class OmnipodErosPumpPluginTest : TestBase() {
|
|||
@Mock lateinit var commandQueue: CommandQueue
|
||||
@Mock lateinit var rileyLinkUtil: RileyLinkUtil
|
||||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var erosHistoryDatabase: ErosHistoryDatabase
|
||||
|
||||
private var rxBusWrapper = RxBus(TestAapsSchedulers(), aapsLogger)
|
||||
|
||||
|
@ -54,7 +56,7 @@ class OmnipodErosPumpPluginTest : TestBase() {
|
|||
injector, aapsLogger, TestAapsSchedulers(), rxBusWrapper, null,
|
||||
rh, activePlugin, null, null, aapsOmnipodErosManager, commandQueue,
|
||||
null, null, null, null,
|
||||
rileyLinkUtil, null, null, pumpSync, activityNames
|
||||
rileyLinkUtil, null, null, pumpSync, activityNames, erosHistoryDatabase
|
||||
)
|
||||
val pumpState = PumpSync.PumpState(null, null, null, null, "")
|
||||
`when`(pumpSync.expectedPumpState()).thenReturn(pumpState)
|
||||
|
|
|
@ -46,13 +46,13 @@
|
|||
<activity
|
||||
android:name=".activities.TreatmentsActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme" />
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".activities.ProfileHelperActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".activities.SingleFragmentActivity"
|
||||
android:name="info.nightscout.configuration.activities.SingleFragmentActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme" />
|
||||
|
||||
|
|
|
@ -147,16 +147,4 @@
|
|||
<!-- BolusProgressDialog-->
|
||||
<string name="stop_pressed">STOP PRESSED</string>
|
||||
|
||||
<!-- PrefImport-->
|
||||
<string name="check_preferences_details_btn">Explain import issues…</string>
|
||||
<string name="check_preferences_details_title">Import issues details</string>
|
||||
<string name="check_preferences_import_btn">Import</string>
|
||||
<string name="check_preferences_import_anyway_btn">Import anyway (DANGEROUS!)</string>
|
||||
<string name="import_setting">Import settings</string>
|
||||
<string name="check_preferences_before_import">Please check preferences before importing:</string>
|
||||
<string name="check_preferences_cannot_import">Preferences cannot be imported!</string>
|
||||
<string name="check_preferences_dangerous_import">Preferences should not be imported!</string>
|
||||
|
||||
<!-- Preferences -->
|
||||
<string name="nav_plugin_preferences">Plugin preferences</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue