Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit c1f65cf

Browse files
committed
1 parent 4e10028 commit c1f65cf

File tree

4 files changed

+216
-177
lines changed

4 files changed

+216
-177
lines changed

lib/IpaReader.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const Reader = require('./Reader');
33
const utils = require('./utils');
44
const plist = require('./plistParser');
5+
const cgbiToPng = require('cgbi-to-png');
56

67
const PLIST_REG = new RegExp(/payload\/.+?\.app\/info.plist$/, 'i');
78
const PROVISION_REG = /payload\/.+?\.app\/embedded.mobileprovision/;
@@ -57,7 +58,8 @@ class IpaReader extends Reader {
5758

5859
return that.getEntry(new RegExp(iconPath.toLowerCase()), (error, icon) => {
5960
if (error) return callback(error);
60-
plistInfo.icon = 'data:image/png;base64,' + icon.toString('base64');
61+
const pngBuffer = cgbiToPng.revert(icon);
62+
plistInfo.icon = 'data:image/png;base64,' + pngBuffer.toString('base64');
6163
callback(null, plistInfo);
6264
});
6365
}

lib/utils.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ function findOutIcon(pkgInfo, extension) {
184184
if (pkgInfo.CFBundleIcons && pkgInfo.CFBundleIcons.CFBundlePrimaryIcon
185185
&& pkgInfo.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles &&
186186
pkgInfo.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length) {
187-
// It's an array...just try the last one
188-
return pkgInfo.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles[pkgInfo.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.length - 1];
187+
return pkgInfo.CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles.slice(-1)[0];
189188
}
190189
// Maybe there is a default one
191190
return '.app/Icon.png';

0 commit comments

Comments
 (0)