Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(apk): add support for adaptive icon parsing #92

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Klowner
Copy link

@Klowner Klowner commented May 11, 2023

This change adds support for Android adaptive icons as discussed in #91.

If application.icon is an XML resource, it is assumed to be an adaptive icon file. The individual components are parsed from it and assigned to apkInfo in the format:

icon: {
   foreground: '<base64 encoded png>',
   background: '<base64 encoded png>',
   monochrome: '<base64 encoded png>',
}

If any of foreground, background, or monochrome are not present in the XML or cannot be mapped to valid resources, those keys are omitted from the result object.

Please feel free to request any modifications!
Thank you!
-Mark

@chenquincy
Copy link
Owner

chenquincy commented May 15, 2023

@Klowner I haven't reviewed the code yet, but have a comment about the output. The icon's type is changed from string to object, that brings a break-change to this library. Maybe store the adaptive icon output to a new key like adaptiveIcons is better. In addition, could you provide a package with adaptive icon for testing?

@Klowner
Copy link
Author

Klowner commented May 17, 2023

Thank you for the feedback, @chenquincy.

I've changed it so the adaptive icons are exposed via {adaptiveIcons: {}} rather than reusing {icon}.

Here's an example apk containing adaptive icon specification (this example only contains a "foreground" image).
adaptive-icon-example.zip
(Change extension from .zip to .apk)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants