Skip to content

Commit 7de0cf9

Browse files
committed
feat: Updated ns generate icons to be compatible with android ic_launcher.
1 parent bb3a696 commit 7de0cf9

File tree

2 files changed

+76
-17
lines changed

2 files changed

+76
-17
lines changed

lib/services/assets-generation/assets-generation-service.ts

+17
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const enum Operations {
2020
OverlayWith = "overlayWith",
2121
Blank = "blank",
2222
Resize = "resize",
23+
OuterScale = "outerScale",
2324
}
2425

2526
export class AssetsGenerationService implements IAssetsGenerationService {
@@ -151,6 +152,22 @@ export class AssetsGenerationService implements IAssetsGenerationService {
151152
case Operations.Resize:
152153
image = await this.resize(generationData.imagePath, width, height);
153154
break;
155+
case Operations.OuterScale:
156+
// Resize image without applying scale
157+
image = await this.resize(
158+
generationData.imagePath,
159+
assetItem.width,
160+
assetItem.height
161+
);
162+
// The scale will apply to the underlying layer of the generated image
163+
image = this.generateImage(
164+
"#00000000",
165+
width,
166+
height,
167+
outputPath,
168+
image
169+
);
170+
break;
154171
default:
155172
throw new Error(`Invalid image generation operation: ${operation}`);
156173
}

resources/assets/image-definitions.json

+59-17
Original file line numberDiff line numberDiff line change
@@ -416,39 +416,81 @@
416416
{
417417
"width": 72,
418418
"height": 72,
419-
"directory": "drawable-hdpi",
420-
"filename": "icon.png"
421-
},
422-
{
423-
"width": 36,
424-
"height": 36,
425-
"directory": "drawable-ldpi",
426-
"filename": "icon.png"
419+
"directory": "mipmap-hdpi",
420+
"filename": "ic_launcher.png"
427421
},
428422
{
429423
"width": 48,
430424
"height": 48,
431-
"directory": "drawable-mdpi",
432-
"filename": "icon.png"
425+
"directory": "mipmap-mdpi",
426+
"filename": "ic_launcher.png"
433427
},
434428
{
435429
"width": 96,
436430
"height": 96,
437-
"directory": "drawable-xhdpi",
438-
"filename": "icon.png"
431+
"directory": "mipmap-xhdpi",
432+
"filename": "ic_launcher.png"
439433
},
440434
{
441435
"width": 144,
442436
"height": 144,
437+
"directory": "mipmap-xxhdpi",
438+
"filename": "ic_launcher.png"
439+
},
440+
{
441+
"width": 192,
442+
"height": 192,
443+
"directory": "mipmap-xxxhdpi",
444+
"filename": "ic_launcher.png"
445+
},
446+
{
447+
"width": 108,
448+
"height": 108,
449+
"directory": "drawable-hdpi",
450+
"filename": "ic_launcher_foreground.png",
451+
"resizeOperation": "outerScale",
452+
"scale": "1.5x"
453+
},
454+
{
455+
"width": 54,
456+
"height": 54,
457+
"directory": "drawable-ldpi",
458+
"filename": "ic_launcher_foreground.png",
459+
"resizeOperation": "outerScale",
460+
"scale": "1.5x"
461+
},
462+
{
463+
"width": 72,
464+
"height": 72,
465+
"directory": "drawable-mdpi",
466+
"filename": "ic_launcher_foreground.png",
467+
"resizeOperation": "outerScale",
468+
"scale": "1.5x"
469+
},
470+
{
471+
"width": 144,
472+
"height": 144,
473+
"directory": "drawable-xhdpi",
474+
"filename": "ic_launcher_foreground.png",
475+
"resizeOperation": "outerScale",
476+
"scale": "1.5x"
477+
},
478+
{
479+
"width": 216,
480+
"height": 216,
443481
"directory": "drawable-xxhdpi",
444-
"filename": "icon.png"
482+
"filename": "ic_launcher_foreground.png",
483+
"resizeOperation": "outerScale",
484+
"scale": "1.5x"
445485
},
446486
{
447-
"width": 345,
448-
"height": 345,
487+
"width": 288,
488+
"height": 288,
449489
"directory": "drawable-xxxhdpi",
450-
"filename": "icon.png"
451-
}
490+
"filename": "ic_launcher_foreground.png",
491+
"resizeOperation": "outerScale",
492+
"scale": "1.5x"
493+
},
452494
],
453495
"splashBackgrounds": [
454496
{

0 commit comments

Comments
 (0)