Add Local Profile source
This commit is contained in:
parent
23c44b388b
commit
8214874495
6 changed files with 9 additions and 6 deletions
|
@ -163,7 +163,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (localProfilePlugin.isEdited) {
|
||||
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
|
||||
} else {
|
||||
uel.log(Action.NEW_PROFILE)
|
||||
uel.log(Action.NEW_PROFILE, ValueWithUnit(Sources.LocalProfile))
|
||||
localProfilePlugin.addNewProfile()
|
||||
build()
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (localProfilePlugin.isEdited) {
|
||||
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
|
||||
} else {
|
||||
uel.log(Action.CLONE_PROFILE, localProfilePlugin.currentProfile()?.name ?: "")
|
||||
uel.log(Action.CLONE_PROFILE, ValueWithUnit(Sources.LocalProfile), ValueWithUnit(localProfilePlugin.currentProfile()?.name ?: "", Units.None))
|
||||
localProfilePlugin.cloneProfile()
|
||||
build()
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
binding.profileRemove.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.deletecurrentprofile), {
|
||||
uel.log(Action.PROFILE_REMOVED, localProfilePlugin.currentProfile()?.name ?: "")
|
||||
uel.log(Action.PROFILE_REMOVED, ValueWithUnit(Sources.LocalProfile), ValueWithUnit(localProfilePlugin.currentProfile()?.name ?: "", Units.None))
|
||||
localProfilePlugin.removeCurrentProfile()
|
||||
build()
|
||||
}, null)
|
||||
|
@ -210,6 +210,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (!localProfilePlugin.isValidEditState()) {
|
||||
return@setOnClickListener //Should not happen as saveButton should not be visible if not valid
|
||||
}
|
||||
uel.log(Action.STORE_PROFILE, ValueWithUnit(Sources.LocalProfile), ValueWithUnit(localProfilePlugin.currentProfile()?.name ?: "", Units.None))
|
||||
localProfilePlugin.storeSettings(activity)
|
||||
build()
|
||||
}
|
||||
|
|
|
@ -116,7 +116,6 @@ class LocalProfilePlugin @Inject constructor(
|
|||
createAndStoreConvertedProfile()
|
||||
isEdited = false
|
||||
aapsLogger.debug(LTag.PROFILE, "Storing settings: " + rawProfile?.data.toString())
|
||||
uel.log(Action.STORE_PROFILE)
|
||||
rxBus.send(EventProfileStoreChanged())
|
||||
var namesOK = true
|
||||
profiles.forEach {
|
||||
|
@ -294,6 +293,7 @@ class LocalProfilePlugin @Inject constructor(
|
|||
|
||||
fun cloneProfile() {
|
||||
val p = profiles[currentProfileIndex].deepClone()
|
||||
val sourceName = p.name
|
||||
p.name = p.name + " copy"
|
||||
profiles.add(p)
|
||||
currentProfileIndex = profiles.size - 1
|
||||
|
|
|
@ -148,7 +148,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord),
|
||||
resourceHelper.gs(R.string.careportal_profileswitch) + ": " + profileSwitch.profileName +
|
||||
"\n" + resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
|
||||
uel.log(Action.PROFILE_SWITCH_REMOVED, profileSwitch.profileName, ValueWithUnit(Sources.Treatments), ValueWithUnit(profileSwitch.date, Units.Timestamp))
|
||||
uel.log(Action.PROFILE_SWITCH_REMOVED, ValueWithUnit(Sources.Treatments), ValueWithUnit(profileSwitch.date, Units.Timestamp), ValueWithUnit(profileSwitch.profileName, Units.None))
|
||||
val id = profileSwitch._id
|
||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||
else uploadQueue.removeByMongoId("dbAdd", id)
|
||||
|
@ -161,7 +161,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
val profileSwitch = it.tag as ProfileSwitch
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), resourceHelper.gs(R.string.copytolocalprofile) + "\n" + profileSwitch.customizedName + "\n" + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
|
||||
profileSwitch.profileObject?.let {
|
||||
uel.log(Action.PROFILE_SWITCH_CLONED, ValueWithUnit(Sources.Treatments), ValueWithUnit(profileSwitch.date, Units.Timestamp), ValueWithUnit(profileSwitch.profileName, Units.None))
|
||||
uel.log(Action.PROFILE_SWITCH_CLONED, profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_") , ValueWithUnit(Sources.Treatments), ValueWithUnit(profileSwitch.date, Units.Timestamp), ValueWithUnit(profileSwitch.profileName, Units.None))
|
||||
val nonCustomized = it.convertToNonCustomizedProfile()
|
||||
if (nonCustomized.isValid(resourceHelper.gs(R.string.careportal_profileswitch, false))) {
|
||||
localProfilePlugin.addProfile(localProfilePlugin.copyFrom(nonCustomized, profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_")))
|
||||
|
|
|
@ -40,6 +40,7 @@ fun Sources.iconId(): Int {
|
|||
Sources.Announcement -> R.drawable.ic_cp_announcement
|
||||
Sources.Maintenance -> R.drawable.ic_maintenance
|
||||
Sources.Treatments -> R.drawable.ic_treatments
|
||||
Sources.LocalProfile -> R.drawable.ic_local_profile
|
||||
Sources.Actions -> R.drawable.ic_action
|
||||
Sources.Automation -> R.drawable.ic_automation
|
||||
Sources.Loop -> R.drawable.ic_loop_closed_white
|
||||
|
|
|
@ -155,6 +155,7 @@ data class UserEntry(
|
|||
@SerializedName("Announcement") Announcement ("Announcement"),
|
||||
@SerializedName("Actions") Actions ("Actions"), //From Actions plugin
|
||||
@SerializedName("Automation") Automation ("Automation"), //From Automation plugin
|
||||
@SerializedName("LocalProfile") LocalProfile ("LocalProfile"), //From LocalProfile plugin
|
||||
@SerializedName("Loop") Loop ("Loop"), //From Loop plugin
|
||||
@SerializedName("Maintenance") Maintenance ("Maintenance"), //From Maintenance plugin
|
||||
@SerializedName("NSClient") NSClient ("NSClient"), //From NSClient plugin
|
||||
|
|
Loading…
Reference in a new issue