Skip to content

Commit

Permalink
fix: filter duplicated device dimensions before generating splash scr…
Browse files Browse the repository at this point in the history
…eens (#11)
  • Loading branch information
userquin authored Aug 20, 2023
1 parent a668bdc commit b96d0d3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,14 @@ async function generateAppleSplashScreens(
folder: string,
links: string[],
) {
const sizesMap = new Map<number, number>()
const splashScreens: SplashScreenData[] = sizes.reduce((acc, size) => {
// cleanup duplicates screen dimensions:
// should we add the links (maybe scaleFactor is different)?
if (sizesMap.get(size.width) === size.height)
return acc

sizesMap.set(size.width, size.height)
const { width: height, height: width, ...restSize } = size
const {
width: lheight,
Expand Down Expand Up @@ -356,6 +363,8 @@ async function generateAppleSplashScreens(
return acc
}, [] as SplashScreenData[])

sizesMap.clear()

await Promise.all(splashScreens.map(async (size) => {
let filePath = resolve(folder, name(size.landscape, size.size, size.dark))
if (!buildOptions.overrideAssets && existsSync(filePath)) {
Expand Down

0 comments on commit b96d0d3

Please sign in to comment.