pchalupa / expo-alternate-app-icons

Provides functions that let you change the app icon.
https://www.npmjs.com/package/expo-alternate-app-icons
MIT License
43 stars 4 forks source link

Android support #37

Closed dylmye closed 1 month ago

dylmye commented 8 months ago

Thanks for the awesome package! We see that this functionality is possible on Android too with some Android Manifest tweaking. Would it be possible to add support for this in this library? Or would you be willing to take a PR for this? :)

pchalupa commented 8 months ago

Hey, thank you for opening an issue here! It would be nice to add Android support. I will read through the docs and try to implement it. Or, If you feel like this could be a nice weekend project for you, I would be more than grateful to review your PR! :)

pchalupa commented 8 months ago

This blog post seems like a good source.

dylmye commented 8 months ago

Definitely looks good - from analysing popular apps that implement this functionality it seems like that's the most common way of doing it!

I'll see if I can find some spare time but I don't have a lot of experience with developing config plugins :)

pchalupa commented 8 months ago

Definitely looks good - from analysing popular apps that implement this functionality it seems like that's the most common way of doing it!

I'll see if I can find some spare time but I don't have a lot of experience with developing config plugins :)

No worries! I am going to start working on that. I will keep you posted about the progress.

hasanfd commented 7 months ago

great job for ios support! looking forward to see android one as well. Thank you for efforts.

pchalupa commented 7 months ago

The work is in progress. So far no struggles. The module API will remain the same. There is a branch.

castdrian commented 6 months ago

Any progress report?, since there haven't been any commits in a while, this lib is the only properly maintained one that is designed with expo in mind

pchalupa commented 6 months ago

Any progress report?, since there haven't been any commits in a while, this lib is the only properly maintained one that is designed with expo in mind

Thanks for checking this library! Unfortunately, I was not able to proceed with this issue. Regarding the timeline, I want to release this feature until 15.5.2024. Stay tuned! 💪

dylmye commented 6 months ago

If we can help at all, please let us know how :)

pchalupa commented 6 months ago

Status update Today I was able to change the app icon on the Android! 🎉 Now I need to polish the code and start working on the config plugins.

https://github.com/pchalupa/expo-alternate-app-icons/assets/20438579/a4634901-3640-4020-8c17-faa172e7e56d

pchalupa commented 6 months ago

Status update The key part of AndroidManifest can be updated with Config Plugins. 🎉 Now, I am seeking how to reuse an existing Config Plugin for asset generation: https://github.com/expo/expo/blob/3f2a537ad63b231e527aa7206ce8d271e91a2e84/packages/%40expo/prebuild-config/src/plugins/icons/withAndroidIcons.ts#L39

dylmye commented 6 months ago

Petr you're a legend :D

castdrian commented 6 months ago

true and real

pchalupa commented 6 months ago

Sorry guys I did not make any progress in the past few days. What I need to do next, is to design the config plugin API, because the current one is not sufficient for the Android Adaptive Icons, see: https://docs.expo.dev/versions/latest/config/app/#adaptiveicon. Most likely I am going to copy the API of the Expo app.json.

SaintNick1214 commented 1 month ago

Been awhile since the last real commit here, and it sounds like you were 90% the way to the finish line! You have a ton of dependabot commits failing because of an expired github token too. Are you planning on continuing with this project? It's the only managed expo plugin that actually works for ios, and hopefully with some effort, android too!

pchalupa commented 1 month ago

@SaintNick1214 The short answer is yes! Dependabot issues have been resolved. The aim is to add Android support asap. Mr. @riccardo-welld has offered me help with this and he is already pushing some commits!

INDAPP commented 1 month ago

Hi all, I am working on the integration of adaptive icons on Android and will add the developed features as soon as possible.

I will not use the @riccardo-welld account, but this one.

Some clarifications: the current developments involve the use of adaptive icons only, so there will not be the possibility to use a single image for now.

Also at the moment there is a lot of copy-pasted code from the original Expo repository. I hope in the future to be able to reduce the duplication and be able to use utilities that are not currently exported from the original Expo repository.

INDAPP commented 1 month ago

I introduce a breaking change in the plugin props type. Now you can define the alternate icons as follows:

      [
        "../app.plugin.js",
        [
          {
            "name": "IconA",
            "ios": "./assets/icon-a.png",
            "android": {
              "foregroundImage": "./assets/icon-a-foreground.png",
              "backgroundColor": "#001413"
            }
          },
          {
            "name": "IconB",
            "ios": "./assets/icon-b.png",
            "android": {
              "foregroundImage": "./assets/icon-b-foreground.png",
              "backgroundColor": "#001413"
            }
          },
          {
            "name": "IconC",
            "ios": "./assets/icon-c.png",
            "android": {
              "foregroundImage": "./assets/icon-c-foreground.png",
              "backgroundColor": "#001413"
            }
          }
        ]
      ]
pchalupa commented 1 month ago

I introduce a breaking change in the plugin props type. Now you can define the alternate icons as follows:

      [
        "../app.plugin.js",
        [
          {
            "name": "IconA",
            "ios": "./assets/icon-a.png",
            "android": {
              "foregroundImage": "./assets/icon-a-foreground.png",
              "backgroundColor": "#001413"
            }
          },
          {
            "name": "IconB",
            "ios": "./assets/icon-b.png",
            "android": {
              "foregroundImage": "./assets/icon-b-foreground.png",
              "backgroundColor": "#001413"
            }
          },
          {
            "name": "IconC",
            "ios": "./assets/icon-c.png",
            "android": {
              "foregroundImage": "./assets/icon-c-foreground.png",
              "backgroundColor": "#001413"
            }
          }
        ]
      ]

I got your point! This change of API is necessary because of the Android support.

Do you think, that It would be possible to keep the existing API functional for a few releases? I am thinking about the ones who are using this package only on iOS. This also can be solved by throwing a clear error with migration instructions.

Also, the docs have to be updated and I can help you with that.

INDAPP commented 1 month ago

I believe we can maintain backward compatibility by using a union type that allows icons to be specified either as simple strings (the path) or as objects of type AlternateIcon.

This would require some further development, but might make it easier for older users.

When the old approach is used, no icons are generated on Android.

In later development, the simple path array could be handled on Android as well, to generate a nonadaptive icon.

pchalupa commented 1 month ago

The 1.0.0 with Android support has been released! 🎉 Big kudos to @INDAPP 👏

dylmye commented 1 month ago

Thank you @pchalupa @INDAPP !! This is massive for all expo developers!