Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Generate iOS icons on eject and apply #2495

Merged
merged 7 commits into from
Aug 25, 2020

Conversation

EvanBacon
Copy link
Contributor

How

  • Read icons from config on eject and apply
  • Utilize image-utils to switch between global sharp-cli instance and jimp. If I'm not mistaken, this'll add a noticeable amount to the package size due to the Jimp instance.
    • This package also caches the images in .expo based on the image hash so reapplying is very quick since it only needs to copy the images.
    • Also support for remote URLs as icons works too -- this may not apply to other tools in the CLI.
  • Resize icons to squares with white backgrounds to ensure shape and limited transparency
    • Does not fully remove the alpha channel when using with sharp, it does with Jimp though. I'm almost certain transparency cannot be added to the image regardless.
  • Use Contents.json to reuse icons across platforms.

Test Plan

  • Wrote tests to ensure the expected amount of images are generated and the icon resolution works as expected.

@EvanBacon EvanBacon added enhancement New feature or request expo eject This issue pertains to the command expo eject labels Aug 24, 2020
@EvanBacon EvanBacon requested a review from brentvatne August 24, 2020 23:13
@EvanBacon EvanBacon self-assigned this Aug 24, 2020
Copy link
Member

@brentvatne brentvatne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great, thank you for leaving detailed comments in addition to the tests

if (!(filename in generatedIcons)) {
const iconSizePx = size * scale;

// Using this method will cache the images in `.expo` based on the properties used to generate them.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

export function getSourceRoot(projectRoot: string) {
const paths = globSync('ios/*/AppDelegate.m', {
export function getSourceRoot(projectRoot: string): string {
// Account for Swift or Objective-C
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@EvanBacon EvanBacon merged commit 4aab89e into master Aug 25, 2020
@EvanBacon EvanBacon deleted the @evanbacon/config/generate-ios-icons branch August 25, 2020 21:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request expo eject This issue pertains to the command expo eject
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants