mirror of
https://github.com/home-assistant/core.git
synced 2025-08-30 09:51:37 +02:00
Use OptionsFlowWithReload in google
This commit is contained in:
@@ -134,8 +134,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: GoogleConfigEntry) -> bo
|
||||
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
entry.async_on_unload(entry.add_update_listener(async_reload_entry))
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@@ -151,12 +149,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: GoogleConfigEntry) -> b
|
||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
|
||||
|
||||
async def async_reload_entry(hass: HomeAssistant, entry: GoogleConfigEntry) -> None:
|
||||
"""Reload config entry if the access options change."""
|
||||
if not async_entry_has_scopes(entry):
|
||||
await hass.config_entries.async_reload(entry.entry_id)
|
||||
|
||||
|
||||
async def async_remove_entry(hass: HomeAssistant, entry: GoogleConfigEntry) -> None:
|
||||
"""Handle removal of a local storage."""
|
||||
store = LocalCalendarStore(hass, entry.entry_id)
|
||||
|
@@ -11,7 +11,11 @@ from gcal_sync.api import GoogleCalendarService
|
||||
from gcal_sync.exceptions import ApiException, ApiForbiddenException
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlowResult, OptionsFlow
|
||||
from homeassistant.config_entries import (
|
||||
SOURCE_REAUTH,
|
||||
ConfigFlowResult,
|
||||
OptionsFlowWithReload,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import config_entry_oauth2_flow
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
@@ -237,12 +241,12 @@ class OAuth2FlowHandler(
|
||||
@callback
|
||||
def async_get_options_flow(
|
||||
config_entry: GoogleConfigEntry,
|
||||
) -> OptionsFlow:
|
||||
) -> OptionsFlowHandler:
|
||||
"""Create an options flow."""
|
||||
return OptionsFlowHandler()
|
||||
|
||||
|
||||
class OptionsFlowHandler(OptionsFlow):
|
||||
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||
"""Google Calendar options flow."""
|
||||
|
||||
async def async_step_init(
|
||||
|
Reference in New Issue
Block a user