// To load assets asynchronously

import { Asset } from "expo-asset";

import { LOG } from "@logger";

const log = LOG.extend("assetsCache");

export default function cacheAssetsAsync({
	images = [],
	fonts = [],
	videos = [],
}: { images?: string[]; fonts?: string[]; videos?: string[] }) {
	return Promise.all([...cacheImages(images)]);
}

function cacheImages(images: string[]) {
	return images.map((image) => Asset.fromModule(image).downloadAsync());
}

// function cacheVideos(videos) {
// 	return videos.map((video) => Asset.fromModule(video).downloadAsync());
// }

// function cacheFonts(fonts) {
// 	return fonts.map((font) => Font.loadAsync(font));
// }
