diff --git a/app/src/main/kotlin/de/hbch/traewelling/api/models/status/StatusPoints.kt b/app/src/main/kotlin/de/hbch/traewelling/api/models/status/StatusPoints.kt index f148846e..558cd83e 100644 --- a/app/src/main/kotlin/de/hbch/traewelling/api/models/status/StatusPoints.kt +++ b/app/src/main/kotlin/de/hbch/traewelling/api/models/status/StatusPoints.kt @@ -12,8 +12,10 @@ data class StatusPointCalculation( @SerializedName("base") val base: Float, @SerializedName("distance") val distance: Float, @SerializedName("factor") val factor: Float, - @SerializedName("reason") val reason: PointReason -) + @SerializedName("reason") val reason: PointReason? +) { + val safeReason get() = reason ?: PointReason.UNKNOWN +} @Suppress("unused") enum class PointReason { @@ -32,6 +34,13 @@ enum class PointReason { @SerializedName("3") FORCED { override fun getExplanation() = R.string.point_reason_forced + }, + @SerializedName("4") + MANUAL { + override fun getExplanation() = R.string.point_reason_manual + }, + UNKNOWN { + override fun getExplanation() = null }; abstract fun getExplanation(): Int? diff --git a/app/src/main/kotlin/de/hbch/traewelling/ui/checkInResult/CheckInResult.kt b/app/src/main/kotlin/de/hbch/traewelling/ui/checkInResult/CheckInResult.kt index 46bc3f54..08ab5a3c 100644 --- a/app/src/main/kotlin/de/hbch/traewelling/ui/checkInResult/CheckInResult.kt +++ b/app/src/main/kotlin/de/hbch/traewelling/ui/checkInResult/CheckInResult.kt @@ -193,7 +193,7 @@ private fun SuccessfulCheckInResult( isOwnStatus = true, defaultVisibility = loggedInUserViewModel.defaultStatusVisibility ) - val pointReasonText = checkInResponse.data.points.calculation.reason.getExplanation() + val pointReasonText = checkInResponse.data.points.calculation.safeReason.getExplanation() if (pointReasonText != null) { Text( modifier = Modifier.fillMaxWidth(), diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml index 59349563..975bb83a 100644 --- a/app/src/main/res/values-de-rDE/strings.xml +++ b/app/src/main/res/values-de-rDE/strings.xml @@ -127,7 +127,10 @@ Punkte zu erhalten. - Weil du diesen Check-In erzwungen hast, hast du nur 0 Punkte erhalten. + Weil du diesen Check-In erzwungen hast, hast du nicht alle Punkte erhalten. + + + Weil du in eine manuell erstellte Fahrt eingecheckt hast, hast du keine Punkte erhalten. Teilen oder diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0e6f6aa6..2688942d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -131,6 +131,9 @@ Because you forced this check-in, you received 0 points. + + Because you checked into a manual trip, you received 0 points. + Share v%1$s (%2$d) or