Use common strings in life360 config flow (#42375)

* Use common strings for life360 config flow

* Address feedback comments

* Keep two space indentation

* Fix indentation hopefully
This commit is contained in:
springstan 2020-10-28 13:29:28 +01:00 committed by GitHub
parent 989ab5029a
commit 4e28ae8e3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -58,10 +58,10 @@ class Life360ConfigFlow(config_entries.ConfigFlow):
_LOGGER.error(
"Unexpected error communicating with Life360 server: %s", error
)
errors["base"] = "unexpected"
errors["base"] = "unknown"
else:
if self._username in self.configured_usernames:
errors["base"] = "user_already_configured"
errors["base"] = "already_configured"
else:
return self.async_create_entry(
title=self._username,
@ -99,7 +99,7 @@ class Life360ConfigFlow(config_entries.ConfigFlow):
_LOGGER.error(
"Unexpected error communicating with Life360 server: %s", error
)
return self.async_abort(reason="unexpected")
return self.async_abort(reason="unknown")
return self.async_create_entry(
title=f"{username} (from configuration)",
data={

View file

@ -13,15 +13,15 @@
"error": {
"invalid_username": "Invalid username",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"user_already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
"unexpected": "Unexpected error communicating with Life360 server"
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
"unknown": "[%key:common::config_flow::error::unknown%]"
},
"create_entry": {
"default": "To set advanced options, see [Life360 documentation]({docs_url})."
},
"abort": {
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"user_already_configured": "[%key:common::config_flow::abort::already_configured_account%]"
"unknown": "[%key:common::config_flow::error::unknown%]"
}
}
}