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

[msbuild] Add support for alternate app icons. #21475

Merged
merged 4 commits into from
Nov 4, 2024

Conversation

rolfbjarne
Copy link
Member

@rolfbjarne rolfbjarne commented Oct 17, 2024

This adds support for including all app icons in the app, as well as for specifying alternate app icons.

Including all app icons is enabled by setting the following MSBuild property:

<PropertyGroup>
    <IncludeAllAppIcons>true</IncludeAllAppIcons>
</PropertyGroup>

This will make the ACTool task pass --include-all-app-icons to actool when compiling the asset catalog.

Specifying alternate app icon(s) is enabled by setting the following MSBuild item:

<ItemGroup>
    <AlternateAppIcon Include="MyAlternateAppIcon" />
    <AlternateAppIcon Include="MyOtherAlternateAppIcon" />
</ItemGroup>

Note that the included value is the name if the icon in question, not the path or the filename of the actual icon file (this way there's no need to have different items for different platforms, because there are some platform differences with regards to paths and icon file extensions).

In order to make the behavior consistent, this PR also adds support for specifying the app icon itself using an MSBuild property (in addition to the existing Info.plist property XSAppIconAssets, which will eventually be deprecated):

<PropertyGroup>
    <AppIcon>MyAppIcon</AppIcon>
</PropertyGroup>

The same note applies here: the value is the name of the icon.

Note about platforms: the code is there for all platforms (iOS, tvOS, macOS and Mac Catalyst), but alternate app icons only seem to work for iOS and tvOS. UIApplication.SupportsAlternateIcons always returns false on Mac Catalyst (googling only find people in the same situation), and macOS doesn't have this API to begin with (nor anything similar):

Also:

Fixes #12790.
Fixes #20182.

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne force-pushed the dev/rolf/msbuild-alternate-app-icons branch from 3bfd073 to ed2baa4 Compare October 24, 2024 16:44
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne force-pushed the dev/rolf/msbuild-alternate-app-icons branch from ed2baa4 to 9ad35cb Compare October 25, 2024 10:35
@rolfbjarne rolfbjarne changed the title [WIP] Add support for alternate app icons. [msbuild] Add support for alternate app icons. Oct 25, 2024
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne marked this pull request as ready for review October 29, 2024 16:43
@rolfbjarne
Copy link
Member Author

CC @Redth since you requested this feature in #12790.

@rolfbjarne rolfbjarne requested a review from Redth October 29, 2024 16:44
Copy link
Contributor

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Contributor

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 326d8bf10ffc44ce3ba1dacea59ac5c01e23f390 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 326d8bf10ffc44ce3ba1dacea59ac5c01e23f390 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET (No breaking changes)

✅ API diff vs stable

.NET (No breaking changes)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 326d8bf10ffc44ce3ba1dacea59ac5c01e23f390 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 326d8bf10ffc44ce3ba1dacea59ac5c01e23f390 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 326d8bf10ffc44ce3ba1dacea59ac5c01e23f390 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 101 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 3 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 40 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 7 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 8 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 7 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 326d8bf10ffc44ce3ba1dacea59ac5c01e23f390 [PR build]

Copy link
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

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

re 👍

rolfbjarne added a commit to dotnet/macios-samples that referenced this pull request Nov 4, 2024
… app icons on iOS and tvOS. (#2)

These samples show the features implemented in xamarin/xamarin-macios#21475.
@rolfbjarne rolfbjarne merged commit 67d072e into main Nov 4, 2024
12 checks passed
@rolfbjarne rolfbjarne deleted the dev/rolf/msbuild-alternate-app-icons branch November 4, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants