diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt index ccc2c19596..a5aa201156 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt @@ -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() } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt index 8da1e6b188..42006090c5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt @@ -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 diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt index 606eb0e693..18d2aab752 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.kt @@ -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(".", "_"))) diff --git a/core/src/main/java/info/nightscout/androidaps/utils/extensions/UserEntryExt.kt b/core/src/main/java/info/nightscout/androidaps/utils/extensions/UserEntryExt.kt index 0c15a92023..1ae362d5c1 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/extensions/UserEntryExt.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/extensions/UserEntryExt.kt @@ -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 diff --git a/app/src/main/res/drawable/ic_local_profile.xml b/core/src/main/res/drawable/ic_local_profile.xml similarity index 100% rename from app/src/main/res/drawable/ic_local_profile.xml rename to core/src/main/res/drawable/ic_local_profile.xml diff --git a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt index 23387ffe15..f82f92eff5 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/entities/UserEntry.kt @@ -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