import sleep from 'tings/lib/sleep' ; import { apps } from '../../config/apps' ; import { installedAppsRetrieved } from '../state/actions' ; import { dispatch } from '../state/store' ; import { filterAppsByInstalled } from './filter-apps-by-installed' ; export async function getInstalledAppIds ( ) { const installedApps = await filterAppsByInstalled ( apps ) ; if ( installedApps . length === 0 ) { await sleep ( 500 ) ; getInstalledAppIds ( ) ; } else { dispatch ( installedAppsRetrieved ( installedApps ) ) ; } }