Skip to content

Commit

Permalink
Add "only for return delivieries" option (fixes #5687)
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Jun 15, 2024
1 parent 885b201 commit 9a7cc6a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import de.westnordost.streetcomplete.data.osm.mapdata.filter
import de.westnordost.streetcomplete.data.osm.osmquests.OsmFilterQuestType
import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement.POSTMAN
import de.westnordost.streetcomplete.osm.Tags
import de.westnordost.streetcomplete.quests.YesNoQuestForm
import de.westnordost.streetcomplete.util.ktx.toYesNo

class AddParcelLockerMailIn : OsmFilterQuestType<Boolean>() {
class AddParcelLockerMailIn : OsmFilterQuestType<ParcelLockerMailIn>() {

override val elementFilter = "nodes with amenity = parcel_locker and !parcel_mail_in"
override val changesetComment = "Specify if it's possible to drop off parcels with this locker"
Expand All @@ -25,9 +23,9 @@ class AddParcelLockerMailIn : OsmFilterQuestType<Boolean>() {
override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) =
getMapData().filter("nodes with amenity = parcel_locker")

override fun createForm() = YesNoQuestForm()
override fun createForm() = AddParcelLockerMailInForm()

override fun applyAnswerTo(answer: Boolean, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) {
tags["parcel_mail_in"] = answer.toYesNo()
override fun applyAnswerTo(answer: ParcelLockerMailIn, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) {
tags["parcel_mail_in"] = answer.osmValue
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package de.westnordost.streetcomplete.quests.parcel_locker_mail_in

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.AbstractOsmQuestForm
import de.westnordost.streetcomplete.quests.AnswerItem

class AddParcelLockerMailInForm : AbstractOsmQuestForm<ParcelLockerMailIn>() {
override val buttonPanelAnswers = listOf(
AnswerItem(R.string.quest_generic_hasFeature_no) { applyAnswer(ParcelLockerMailIn.NO) },
AnswerItem(R.string.quest_generic_hasFeature_yes) { applyAnswer(ParcelLockerMailIn.YES ) },
)

override val otherAnswers get() = listOf(
AnswerItem(R.string.quest_wheelchairAccessPat_noToilet) {
applyAnswer(ParcelLockerMailIn.RETURNS_ONLY)
}
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package de.westnordost.streetcomplete.quests.parcel_locker_mail_in

enum class ParcelLockerMailIn(val osmValue: String) {
YES("yes"),
NO("no"),
RETURNS_ONLY("returns_only")
}
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,7 @@ If there are no signs along the whole street which apply for the highlighted sec
<string name="quest_parcel_locker_brand">"What’s the brand of this parcel locker?"</string>
<string name="quest_parcel_locker_pickup">Can you pick up parcels here?</string>
<string name="quest_parcel_locker_mail_in">Can you drop off parcels here?</string>
<string name="quest_parcel_locker_mail_in_answer_returns_only">Only for return deliveries</string>

<string name="quest_parking_access_title2">Who is allowed to park here? Parking may be free or paid.</string>
<string name="quest_access_yes">Any member of the general public</string>
Expand Down

0 comments on commit 9a7cc6a

Please sign in to comment.