Skip to content

Commit

Permalink
Don't prompt user to estimate height, tag maxheight:signed=no instead (
Browse files Browse the repository at this point in the history
…fixes #5458)
  • Loading branch information
westnordost committed Feb 5, 2024
1 parent e2621c7 commit 2c1493b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class AddMaxHeight : OsmElementQuestType<MaxHeightAnswer> {
tags["maxheight"] = answer.value.toOsmValue()
}
is NoMaxHeightSign -> {
tags["maxheight"] = if (answer.isTallEnough) "default" else "below_default"
tags["maxheight:signed"] = "no"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ class AddMaxHeightForm : AbstractOsmQuestForm<MaxHeightAnswer>() {
}

private fun confirmNoSign() {
activity?.let { AlertDialog.Builder(it)
.setMessage(R.string.quest_maxheight_answer_noSign_question)
.setPositiveButton(R.string.quest_maxheight_answer_noSign_question_yes) { _, _ -> applyAnswer(NoMaxHeightSign(true)) }
.setNegativeButton(R.string.quest_maxheight_answer_noSign_question_no) { _, _ -> applyAnswer(NoMaxHeightSign(false)) }
activity?.let { AlertDialog.Builder(requireContext())
.setTitle(R.string.quest_generic_confirmation_title)
.setPositiveButton(R.string.quest_generic_confirmation_yes) { _, _ -> applyAnswer(NoMaxHeightSign) }
.setNegativeButton(R.string.quest_generic_confirmation_no, null)
.show()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import de.westnordost.streetcomplete.osm.Length
sealed interface MaxHeightAnswer

data class MaxHeight(val value: Length) : MaxHeightAnswer
data class NoMaxHeightSign(val isTallEnough: Boolean) : MaxHeightAnswer
data object NoMaxHeightSign : MaxHeightAnswer
3 changes: 0 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1113,9 +1113,6 @@ If any lanes are reserved for buses, please leave a note instead."</string>
<string name="quest_maxheight_sign_below_bridge_title">What height limit is indicated below the bridge?</string>
<string name="quest_maxheight_answer_noSign">There is no sign…</string>
<string name="quest_maxheight_split_way_hint">If it doesn’t apply for the whole way, consider answering “%s”.</string>
<string name="quest_maxheight_answer_noSign_question">Is there easily enough space for even the tallest trucks (at least about 4.5 meters / 15 feet) to pass through?</string>
<string name="quest_maxheight_answer_noSign_question_yes">Tall trucks can pass through</string>
<string name="quest_maxheight_answer_noSign_question_no">"Tall trucks don’t fit"</string>
<string name="quest_maxheight_unusualInput_confirmation_description">This height looks implausible. Are you sure that it is correct?</string>

<string name="quest_maxspeed_title_short2">"What’s the speed limit for this street?"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,11 @@ class AddMaxHeightTest {
)
}

@Test fun `apply default height answer`() {
@Test fun `apply no height sign answer`() {
assertEquals(
setOf(StringMapEntryAdd("maxheight", "default")),
questType.answerApplied(NoMaxHeightSign(true))
setOf(StringMapEntryAdd("maxheight:signed", "no")),
questType.answerApplied(NoMaxHeightSign)
)
}

@Test fun `apply below default height answer`() {
assertEquals(
setOf(StringMapEntryAdd("maxheight", "below_default")),
questType.answerApplied(NoMaxHeightSign(false))
)
}
}

0 comments on commit 2c1493b

Please sign in to comment.