Add Maintenance source

This commit is contained in:
Philoul 2021-03-27 16:17:38 +01:00
parent b375ae45ae
commit 2bd2510bd8
4 changed files with 7 additions and 5 deletions

View file

@ -56,13 +56,12 @@ class MaintenanceFragment : DaggerFragment() {
super.onViewCreated(view, savedInstanceState)
binding.logSend.setOnClickListener { maintenancePlugin.sendLogs() }
binding.logDelete.setOnClickListener {
uel.log(Action.DELETE_LOGS)
uel.log(Action.DELETE_LOGS, ValueWithUnit(Sources.Maintenance))
maintenancePlugin.deleteLogs()
}
binding.navResetdb.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.maintenance), resourceHelper.gs(R.string.reset_db_confirm), Runnable {
uel.log(Action.RESET_DATABASES)
compositeDisposable.add(
fromAction {
databaseHelper.resetDatabases()
@ -78,18 +77,19 @@ class MaintenanceFragment : DaggerFragment() {
onComplete = { rxBus.send(EventNewBG(null)) }
)
)
uel.log(Action.RESET_DATABASES, ValueWithUnit(Sources.Maintenance))
})
}
}
binding.navExport.setOnClickListener {
uel.log(Action.EXPORT_SETTINGS)
uel.log(Action.EXPORT_SETTINGS, ValueWithUnit(Sources.Maintenance))
// start activity for checking permissions...
importExportPrefs.verifyStoragePermissions(this) {
importExportPrefs.exportSharedPreferences(this)
}
}
binding.navImport.setOnClickListener {
uel.log(Action.IMPORT_SETTINGS)
uel.log(Action.IMPORT_SETTINGS, ValueWithUnit(Sources.Maintenance))
// start activity for checking permissions...
importExportPrefs.verifyStoragePermissions(this) {
importExportPrefs.importSharedPreferences(this)
@ -99,7 +99,7 @@ class MaintenanceFragment : DaggerFragment() {
binding.exportCsv.setOnClickListener {
activity?.let { activity ->
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.ue_export_to_csv) + "?") {
uel.log(Action.EXPORT_CSV)
uel.log(Action.EXPORT_CSV, ValueWithUnit(Sources.Maintenance))
importExportPrefs.exportUserEntriesCsv(activity, repository.getAllUserEntries())
}
}

View file

@ -38,6 +38,7 @@ fun Sources.iconId(): Int {
Sources.Exercise -> R.drawable.ic_cp_exercise
Sources.Question -> R.drawable.ic_cp_question
Sources.Announcement -> R.drawable.ic_cp_announcement
Sources.Maintenance -> R.drawable.ic_maintenance
Sources.Actions -> R.drawable.ic_action
Sources.Automation -> R.drawable.ic_automation
Sources.Loop -> R.drawable.ic_loop_closed_white

View file

@ -156,6 +156,7 @@ data class UserEntry(
@SerializedName("Actions") Actions ("Actions"), //From Actions plugin
@SerializedName("Automation") Automation ("Automation"), //From Automation plugin
@SerializedName("Loop") Loop ("Loop"), //From Loop plugin
@SerializedName("Maintenance") Maintenance ("Maintenance"), //From Maintenance plugin
@SerializedName("NSClient") NSClient ("NSClient"), //From NSClient plugin
@SerializedName("Pump") Pump ("Pump"), //From Pump plugin (for example from pump history)
@SerializedName("SMS") SMS ("SMS"), //From SMS plugin