@@ -259,6 +259,45 @@ const SettingsPerAcStateComponent: FC = () => {
259259 ) ;
260260} ;
261261
262+ const SettingsPollingComponent : FC = ( ) => {
263+ const [ enabled , setEnabled ] = useState < boolean > ( Settings . appPollingEnabled ( ) ) ;
264+ const [ show , setShow ] = useState < boolean > ( Settings . ensureEnable ( ) ) ;
265+
266+ useEffect ( ( ) => {
267+ PluginManager . listenUpdateComponent (
268+ ComponentName . SETTINGS_POLLING ,
269+ [ ComponentName . SETTINGS_POLLING ] ,
270+ ( _ComponentName , updateType : string ) => {
271+ if ( updateType === UpdateType . UPDATE ) {
272+ setEnabled ( Settings . appPollingEnabled ( ) ) ;
273+ setShow ( Settings . ensureEnable ( ) ) ;
274+ } else if ( updateType === UpdateType . SHOW ) {
275+ setShow ( true ) ;
276+ } else if ( updateType === UpdateType . HIDE ) {
277+ setShow ( false ) ;
278+ }
279+ }
280+ ) ;
281+ } , [ ] ) ;
282+
283+ if ( ! show ) return null ;
284+
285+ return (
286+ < PanelSectionRow >
287+ < ToggleField
288+ label = { localizationManager . getString ( localizeStrEnum . SETTINGS_POLLING ) }
289+ description = { localizationManager . getString (
290+ localizeStrEnum . SETTINGS_POLLING_DESC
291+ ) }
292+ checked = { enabled }
293+ onChange = { ( value ) => {
294+ Settings . setPollingEnabled ( value ) ;
295+ } }
296+ />
297+ </ PanelSectionRow >
298+ ) ;
299+ } ;
300+
262301export const SettingsComponent : FC < {
263302 isTab ?: boolean ;
264303} > = ( { isTab = false } ) => {
@@ -296,6 +335,7 @@ export const SettingsComponent: FC<{
296335 < SettingsEnableComponent />
297336 < SettingsPerAppComponent />
298337 < SettingsPerAcStateComponent />
338+ < SettingsPollingComponent />
299339 </ >
300340 ) }
301341 </ PanelSection >
0 commit comments