pakstr 0.19.1 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,21 +64,34 @@ async function patchIcon(androidRoot, iconPath, backgroundColor = "#FFFFFF", man
64
64
  fs_1.default.mkdirSync(adaptiveDrawablePath, {
65
65
  recursive: true,
66
66
  });
67
- await (0, sharp_1.default)(absoluteIconPath)
68
- .trim({ background: transparent, threshold: 0 })
69
- .resize(264, 264, {
70
- fit: "contain",
71
- background: transparent,
72
- })
73
- .extend({
74
- top: 84,
75
- bottom: 84,
76
- left: 84,
77
- right: 84,
78
- background: transparent,
79
- })
80
- .webp()
81
- .toFile(path_1.default.join(adaptiveDrawablePath, "ic_launcher_foreground.webp"));
67
+ const foregroundPath = path_1.default.join(adaptiveDrawablePath, "ic_launcher_foreground.webp");
68
+ const { isOpaque } = await (0, sharp_1.default)(absoluteIconPath).stats();
69
+ if (isOpaque) {
70
+ await (0, sharp_1.default)(absoluteIconPath)
71
+ .resize(432, 432, {
72
+ fit: "contain",
73
+ background: transparent,
74
+ })
75
+ .webp()
76
+ .toFile(foregroundPath);
77
+ }
78
+ else {
79
+ await (0, sharp_1.default)(absoluteIconPath)
80
+ .trim({ background: transparent, threshold: 0 })
81
+ .resize(264, 264, {
82
+ fit: "contain",
83
+ background: transparent,
84
+ })
85
+ .extend({
86
+ top: 84,
87
+ bottom: 84,
88
+ left: 84,
89
+ right: 84,
90
+ background: transparent,
91
+ })
92
+ .webp()
93
+ .toFile(foregroundPath);
94
+ }
82
95
  console.log("🖼️ Generated adaptive foreground");
83
96
  //
84
97
  // 3. REMOVE OLD UNQUALIFIED FOREGROUNDS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pakstr",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "CLI for packaging Nostr web apps into Android APKs",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",