suspend fun lookupExpiredWallpaper(settings: Settings): Wallpaper? = withContext(coroutineDispatcher) { val name = settings.currentWallpaperName if (allAssetsExist(name)) { Wallpaper( name = name, collection = Wallpaper.DefaultCollection, textColor = settings.currentWallpaperTextColor, cardColorLight = settings.currentWallpaperCardColorLight, cardColorDark = settings.currentWallpaperCardColorDark, thumbnailFileState = Wallpaper.ImageFileState.Downloaded, assetsFileState = Wallpaper.ImageFileState.Downloaded, ) } else { null } }  private fun allAssetsExist(name: String): Boolean = Wallpaper.ImageType.values().all { type -> File(storageRootDirectory, getLocalPath(name, type)).exists() }
Lookup all the files for a wallpaper name. This lookup will fail if there are not files for each of a portrait and landscape orientation as well as a thumbnail.