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