Mobile app: Drop descriptive emoji name support (#67120)

This commit is contained in:
Paulus Schoutsen 2022-02-23 09:54:27 -08:00 committed by GitHub
parent c243247e35
commit 3380a15bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 23 deletions

View File

@ -4,10 +4,8 @@ from __future__ import annotations
from contextlib import suppress from contextlib import suppress
from http import HTTPStatus from http import HTTPStatus
import secrets import secrets
from typing import cast
from aiohttp.web import Request, Response from aiohttp.web import Request, Response
import emoji
from nacl.secret import SecretBox from nacl.secret import SecretBox
import voluptuous as vol import voluptuous as vol
@ -82,18 +80,8 @@ class RegistrationsView(HomeAssistantView):
data[CONF_USER_ID] = request["hass_user"].id data[CONF_USER_ID] = request["hass_user"].id
if slugify(data[ATTR_DEVICE_NAME], separator=""): # Fallback to DEVICE_ID if slug is empty.
# if slug is not empty and would not only be underscores if not slugify(data[ATTR_DEVICE_NAME], separator=""):
# use DEVICE_NAME
pass
elif emoji.emoji_count(data[ATTR_DEVICE_NAME]):
# If otherwise empty string contains emoji
# use descriptive name of the first emoji
data[ATTR_DEVICE_NAME] = emoji.demojize(
cast(str, emoji.emoji_lis(data[ATTR_DEVICE_NAME])[0]["emoji"])
).replace(":", "")
else:
# Fallback to DEVICE_ID
data[ATTR_DEVICE_NAME] = data[ATTR_DEVICE_ID] data[ATTR_DEVICE_NAME] = data[ATTR_DEVICE_ID]
await hass.async_create_task( await hass.async_create_task(

View File

@ -3,11 +3,11 @@
"name": "Mobile App", "name": "Mobile App",
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/mobile_app", "documentation": "https://www.home-assistant.io/integrations/mobile_app",
"requirements": ["PyNaCl==1.4.0", "emoji==1.6.3"], "requirements": ["PyNaCl==1.4.0"],
"dependencies": ["http", "webhook", "person", "tag", "websocket_api"], "dependencies": ["http", "webhook", "person", "tag", "websocket_api"],
"after_dependencies": ["cloud", "camera", "notify"], "after_dependencies": ["cloud", "camera", "notify"],
"codeowners": ["@home-assistant/core"], "codeowners": ["@home-assistant/core"],
"quality_scale": "internal", "quality_scale": "internal",
"iot_class": "local_push", "iot_class": "local_push",
"loggers": ["emoji", "nacl"] "loggers": ["nacl"]
} }

View File

@ -13,7 +13,6 @@ bcrypt==3.1.7
certifi>=2021.5.30 certifi>=2021.5.30
ciso8601==2.2.0 ciso8601==2.2.0
cryptography==35.0.0 cryptography==35.0.0
emoji==1.6.3
hass-nabucasa==0.53.1 hass-nabucasa==0.53.1
home-assistant-frontend==20220222.0 home-assistant-frontend==20220222.0
httpx==0.21.3 httpx==0.21.3

View File

@ -608,9 +608,6 @@ elkm1-lib==1.2.0
# homeassistant.components.elmax # homeassistant.components.elmax
elmax_api==0.0.2 elmax_api==0.0.2
# homeassistant.components.mobile_app
emoji==1.6.3
# homeassistant.components.emulated_roku # homeassistant.components.emulated_roku
emulated_roku==0.2.1 emulated_roku==0.2.1

View File

@ -400,9 +400,6 @@ elkm1-lib==1.2.0
# homeassistant.components.elmax # homeassistant.components.elmax
elmax_api==0.0.2 elmax_api==0.0.2
# homeassistant.components.mobile_app
emoji==1.6.3
# homeassistant.components.emulated_roku # homeassistant.components.emulated_roku
emulated_roku==0.2.1 emulated_roku==0.2.1