Skip to content

Commit

Permalink
Display update version in the homescreen update tooltip (#976)
Browse files Browse the repository at this point in the history
* Make update_version of the API available

* Add update version to the update tooltip

* Fix formatting

* Update translations to reflect the new tooltip

* Fix car controller test

* Add update_version to the mqtt documentation
  • Loading branch information
ayonix authored and adriankumpf committed Oct 8, 2020
1 parent b5f3f4e commit 43a9cb8
Show file tree
Hide file tree
Showing 20 changed files with 138 additions and 102 deletions.
12 changes: 10 additions & 2 deletions lib/teslamate/vehicles/vehicle/summary.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule TeslaMate.Vehicles.Vehicle.Summary do
speed outside_temp inside_temp is_climate_on is_preconditioning locked sentry_mode
plugged_in scheduled_charging_start_time charge_limit_soc charger_power windows_open doors_open
odometer shift_state charge_port_door_open time_to_full_charge charger_phases
charger_actual_current charger_voltage version update_available is_user_present geofence
charger_actual_current charger_voltage version update_available update_version is_user_present geofence
model trim_badging exterior_color wheel_type spoiler_type trunk_open frunk_open elevation
)a

Expand Down Expand Up @@ -113,7 +113,8 @@ defmodule TeslaMate.Vehicles.Vehicle.Summary do
frunk_open: frunk_open(vehicle),
is_user_present: get_in_struct(vehicle, [:vehicle_state, :is_user_present]),
version: version(vehicle),
update_available: update_available(vehicle)
update_available: update_available(vehicle),
update_version: update_version(vehicle)
}
end

Expand Down Expand Up @@ -179,6 +180,13 @@ defmodule TeslaMate.Vehicles.Vehicle.Summary do
end
end

defp update_version(vehicle) do
case get_in_struct(vehicle, [:vehicle_state, :software_update, :version]) do
version when is_binary(version) -> List.first(String.split(version, " "))
nil -> nil
end
end

defp to_datetime(val) when val in [nil, :unknown], do: val
defp to_datetime(ts), do: DateTime.from_unix!(ts)

Expand Down
2 changes: 1 addition & 1 deletion lib/teslamate_web/live/car_live/summary.html.leex
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</span>
<% end %>
<%= if @summary.update_available do %>
<span class="icon has-text-grey-dark has-tooltip-top has-tooltip-left-mobile" data-tooltip='<%= gettext "Software Update available" %>'>
<span class="icon has-text-grey-dark has-tooltip-top has-tooltip-left-mobile" data-tooltip='<%= gettext "Software Update available (%{version})", version: @summary.update_version %>'>
<span class="mdi mdi-gift-outline"></span>
</span>
<% end %>
Expand Down
14 changes: 7 additions & 7 deletions priv/gettext/da/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ msgid "Driver present"
msgstr "Fører tilstede"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:298
#: lib/teslamate_web/live/car_live/summary.html.leex:297
msgid "cancel sleep attempt"
msgstr "afbryd forsøg på at sove"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:293
#: lib/teslamate_web/live/car_live/summary.html.leex:292
msgid "try to sleep"
msgstr "forsøg at sove"

Expand Down Expand Up @@ -321,11 +321,6 @@ msgstr "Udetemperatur"
msgid "Version"
msgstr "Version"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available"
msgstr "Softwareopdatering tilgængelig"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:79
msgid "Health check failed"
Expand Down Expand Up @@ -578,3 +573,8 @@ msgstr "Bagklap åben"
#: lib/teslamate_web/live/geofence_live/form.html.leex:66
msgid "Per Minute"
msgstr ""

#, elixir-format, fuzzy
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available (%{version})"
msgstr "Softwareopdatering tilgængelig (%{version})"
14 changes: 7 additions & 7 deletions priv/gettext/de/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ msgid "Driver present"
msgstr "Fahrer anwesend"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:298
#: lib/teslamate_web/live/car_live/summary.html.leex:297
msgid "cancel sleep attempt"
msgstr "Schlafversuch abbrechen"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:293
#: lib/teslamate_web/live/car_live/summary.html.leex:292
msgid "try to sleep"
msgstr "versuchen zu schlafen"

Expand Down Expand Up @@ -321,11 +321,6 @@ msgstr "Außentemperatur"
msgid "Version"
msgstr ""

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available"
msgstr "Software Update verfügbar"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:79
msgid "Health check failed"
Expand Down Expand Up @@ -578,3 +573,8 @@ msgstr "Kofferraum is geöffnet"
#: lib/teslamate_web/live/geofence_live/form.html.leex:66
msgid "Per Minute"
msgstr "Pro Minute"

#, elixir-format, fuzzy
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available (%{version})"
msgstr "Software Update verfügbar (%{version})"
14 changes: 7 additions & 7 deletions priv/gettext/default.pot
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@ msgid "Driver present"
msgstr ""

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:298
#: lib/teslamate_web/live/car_live/summary.html.leex:297
msgid "cancel sleep attempt"
msgstr ""

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:293
#: lib/teslamate_web/live/car_live/summary.html.leex:292
msgid "try to sleep"
msgstr ""

Expand Down Expand Up @@ -320,11 +320,6 @@ msgstr ""
msgid "Version"
msgstr ""

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available"
msgstr ""

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:79
msgid "Health check failed"
Expand Down Expand Up @@ -577,3 +572,8 @@ msgstr ""
#: lib/teslamate_web/live/geofence_live/form.html.leex:66
msgid "Per Minute"
msgstr ""

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available (%{version})"
msgstr ""
14 changes: 7 additions & 7 deletions priv/gettext/en/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ msgid "Driver present"
msgstr ""

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:298
#: lib/teslamate_web/live/car_live/summary.html.leex:297
msgid "cancel sleep attempt"
msgstr ""

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:293
#: lib/teslamate_web/live/car_live/summary.html.leex:292
msgid "try to sleep"
msgstr ""

Expand Down Expand Up @@ -321,11 +321,6 @@ msgstr ""
msgid "Version"
msgstr ""

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available"
msgstr ""

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:79
msgid "Health check failed"
Expand Down Expand Up @@ -578,3 +573,8 @@ msgstr ""
#: lib/teslamate_web/live/geofence_live/form.html.leex:66
msgid "Per Minute"
msgstr ""

#, elixir-format, fuzzy
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available (%{version})"
msgstr ""
14 changes: 7 additions & 7 deletions priv/gettext/es/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ msgid "Driver present"
msgstr "Conductor presente"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:298
#: lib/teslamate_web/live/car_live/summary.html.leex:297
msgid "cancel sleep attempt"
msgstr "cancelar intento de poner en estado reposo"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:293
#: lib/teslamate_web/live/car_live/summary.html.leex:292
msgid "try to sleep"
msgstr "intentando poner en estado reposo"

Expand Down Expand Up @@ -321,11 +321,6 @@ msgstr "Temperatura en el exterior"
msgid "Version"
msgstr "Versión"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available"
msgstr "Actualización de software disponible"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:79
msgid "Health check failed"
Expand Down Expand Up @@ -578,3 +573,8 @@ msgstr ""
#: lib/teslamate_web/live/geofence_live/form.html.leex:66
msgid "Per Minute"
msgstr ""

#, elixir-format, fuzzy
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available (%{version})"
msgstr "Actualización de software disponible (%{version})"
14 changes: 7 additions & 7 deletions priv/gettext/fr/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@ msgid "Driver present"
msgstr "Conducteur présent"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:298
#: lib/teslamate_web/live/car_live/summary.html.leex:297
msgid "cancel sleep attempt"
msgstr "Annuler la tentative de sommeil"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:293
#: lib/teslamate_web/live/car_live/summary.html.leex:292
msgid "try to sleep"
msgstr "Tentative de mise en veille"

Expand Down Expand Up @@ -320,11 +320,6 @@ msgstr "Température extérieure"
msgid "Version"
msgstr "Version"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available"
msgstr "Mise à jour disponible"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:79
msgid "Health check failed"
Expand Down Expand Up @@ -577,3 +572,8 @@ msgstr "Le coffre est ouvert"
#: lib/teslamate_web/live/geofence_live/form.html.leex:66
msgid "Per Minute"
msgstr ""

#, elixir-format, fuzzy
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available (%{version})"
msgstr "Mise à jour disponible (%{version})"
14 changes: 7 additions & 7 deletions priv/gettext/ko/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ msgid "Driver present"
msgstr "현재 운전자"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:298
#: lib/teslamate_web/live/car_live/summary.html.leex:297
msgid "cancel sleep attempt"
msgstr "절전모드 시도 취소"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:293
#: lib/teslamate_web/live/car_live/summary.html.leex:292
msgid "try to sleep"
msgstr "절전모드 시도"

Expand Down Expand Up @@ -321,11 +321,6 @@ msgstr "실외 온도"
msgid "Version"
msgstr "소프트웨어 버전"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available"
msgstr "소프트웨어 업데이트 가능"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:79
msgid "Health check failed"
Expand Down Expand Up @@ -578,3 +573,8 @@ msgstr "트렁크가 열려있습니다."
#: lib/teslamate_web/live/geofence_live/form.html.leex:66
msgid "Per Minute"
msgstr ""

#, elixir-format, fuzzy
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available (%{version})"
msgstr "소프트웨어 업데이트 가능 (%{version})"
14 changes: 7 additions & 7 deletions priv/gettext/nb/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ msgid "Driver present"
msgstr "Fører er tilstede"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:298
#: lib/teslamate_web/live/car_live/summary.html.leex:297
msgid "cancel sleep attempt"
msgstr "Avbryt dvale"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:293
#: lib/teslamate_web/live/car_live/summary.html.leex:292
msgid "try to sleep"
msgstr "forsøk på dvale"

Expand Down Expand Up @@ -322,11 +322,6 @@ msgstr "Temperatur utvendig"
msgid "Version"
msgstr "Software versjon"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available"
msgstr "Ny software tilgjengelig"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:79
msgid "Health check failed"
Expand Down Expand Up @@ -579,3 +574,8 @@ msgstr "Bagasjeluken er åpen"
#: lib/teslamate_web/live/geofence_live/form.html.leex:66
msgid "Per Minute"
msgstr ""

#, elixir-format, fuzzy
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available (%{version})"
msgstr "Ny software tilgjengelig (%{version})"
14 changes: 7 additions & 7 deletions priv/gettext/nl/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ msgid "Driver present"
msgstr "Bestuurder aanwezig"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:298
#: lib/teslamate_web/live/car_live/summary.html.leex:297
msgid "cancel sleep attempt"
msgstr "annuleer slaap-poging"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:293
#: lib/teslamate_web/live/car_live/summary.html.leex:292
msgid "try to sleep"
msgstr "probeer te slapen"

Expand Down Expand Up @@ -321,11 +321,6 @@ msgstr "Buitentemperatuur"
msgid "Version"
msgstr "Versie"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available"
msgstr "Software-update beschikbaar"

#, elixir-format
#: lib/teslamate_web/live/car_live/summary.html.leex:79
msgid "Health check failed"
Expand Down Expand Up @@ -578,3 +573,8 @@ msgstr "Kofferbak is open"
#: lib/teslamate_web/live/geofence_live/form.html.leex:66
msgid "Per Minute"
msgstr "Per minuut"

#, elixir-format, fuzzy
#: lib/teslamate_web/live/car_live/summary.html.leex:74
msgid "Software Update available (%{version})"
msgstr "Software-update beschikbaar (%{version})"
Loading

0 comments on commit 43a9cb8

Please sign in to comment.