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

[config] automate android icon #2087

Merged
merged 33 commits into from
Sep 4, 2020
Merged

[config] automate android icon #2087

merged 33 commits into from
Sep 4, 2020

Conversation

cruzach
Copy link
Contributor

@cruzach cruzach commented May 7, 2020

Why?

This would automate setting the android icon and adaptive icons (Android 8+) on eject, and would enable developers to change their app icons much more easily when using the bare workflow. Plus, we could use the same code when building shell apps.

Testing

Run yarn test. CodeCov report should go up even more if we replace the current android icons code with calls to AndroidConfig.setIconAsync 😉

Additional info

This should replace the current android icons code, and would fix expo/expo#7374 (if we remove the old AndroidIcons code and replace with a call to Config.setIconAsync)

@cruzach cruzach requested review from brentvatne and fson May 7, 2020 19:19
@cruzach
Copy link
Contributor Author

cruzach commented May 8, 2020

hm for some reason this call is causing those expo-cli package tests to fail... still trying to investigate why

@codecov
Copy link

codecov bot commented May 19, 2020

Codecov Report

Merging #2087 into master will increase coverage by 8.71%.
The diff coverage is 16.95%.

Flag Coverage Δ
#babelPresetCli 100.00% <ø> (ø)
#config 59.09% <16.95%> (-2.23%) ⬇️
#devServer 60.53% <ø> (ø)
#expoCli 33.65% <ø> (-2.26%) ⬇️
#expoCodemod 83.81% <ø> (ø)
#jsonFile 65.49% <ø> (ø)
#metroConfig 65.22% <ø> (-2.78%) ⬇️
#packageManager 16.67% <ø> (-8.10%) ⬇️
#plist 70.64% <ø> (ø)
#pwa 34.32% <ø> (ø)
#schemer 69.88% <ø> (+0.37%) ⬆️
#uriScheme 32.05% <ø> (-2.64%) ⬇️
#webpackConfig 53.56% <ø> (+6.86%) ⬆️
#xdl 23.37% <ø> (+17.47%) ⬆️
@@            Coverage Diff             @@
##           master    #2087      +/-   ##
==========================================
+ Coverage   36.19%   44.90%   +8.71%     
==========================================
  Files         153      122      -31     
  Lines        7047     5010    -2037     
  Branches     1640     1193     -447     
==========================================
- Hits         2550     2249     -301     
+ Misses       3279     1943    -1336     
+ Partials     1218      818     -400     

@cruzach cruzach requested review from dsokal and removed request for fson July 1, 2020 13:54
Copy link
Contributor

@dsokal dsokal left a comment

Choose a reason for hiding this comment

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

  • Looking good - except for a few missing awaits
  • I don't have much context about why we need this. (I've read the PR description and the linked issue.)
  • Because of that, I think I'm going to resign from approving/disapproving this PR. Maybe @brentvatne or @bbarthec could take a look at this?

packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
@dsokal dsokal requested a review from bbarthec July 2, 2020 09:27
Copy link
Contributor

@bbarthec bbarthec left a comment

Choose a reason for hiding this comment

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

Left a few suggestions, but overall it looks good 💪 Good job on that! 🥳

packages/config/package.json Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
packages/config/src/android/Icon.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@bbarthec bbarthec left a comment

Choose a reason for hiding this comment

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

I've misclicked approve instead of request changes 😞

@@ -35,6 +35,9 @@ async function resizeAsync(imageOptions: ImageOptions): Promise<Buffer> {
if (imageOptions.removeTransparency) {
jimp.colorType(2);
}
if (imageOptions.circle) {
jimp.circle();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

would like to do something similar here to how we're doing this same operation with sharp, that way this could be a setting to round the corners instead of just cut out a circle, but was running into some mimeType issues trying to create a Sharp image. but can look into that soon

Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps a borderRadius property would scale better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed it to borderRadius: number. Right now if using Jimp any number will just make the image a circle though

@EvanBacon EvanBacon added expo apply cli ⌘ to apply changes to native projects enhancement New feature or request labels Sep 4, 2020
@cruzach cruzach merged commit 6d017dc into master Sep 4, 2020
@cruzach cruzach deleted the @cruzach/android-icon branch September 4, 2020 14:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request expo apply cli ⌘ to apply changes to native projects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How correctly set background color in android adaptive icon
4 participants