Skip to content

[AlternateAppIcons] Add new sample for specifying and using alternate app icons on iOS and tvOS.#2

Merged
rolfbjarne merged 3 commits intodotnet:mainfrom
rolfbjarne:alternateappicons
Nov 4, 2024
Merged

[AlternateAppIcons] Add new sample for specifying and using alternate app icons on iOS and tvOS.#2
rolfbjarne merged 3 commits intodotnet:mainfrom
rolfbjarne:alternateappicons

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

@rolfbjarne rolfbjarne commented Oct 29, 2024

These samples show the features implemented in dotnet/macios#21475.

Copy link
Copy Markdown
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.

❤️

@rolfbjarne rolfbjarne merged commit aceea41 into dotnet:main Nov 4, 2024
@rolfbjarne rolfbjarne deleted the alternateappicons branch November 4, 2024 10:40
rolfbjarne added a commit to dotnet/macios that referenced this pull request Nov 4, 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:

```xml
<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:

```xml
<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):

```xml
<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:

* Add a bunch of tests.
* Document on our website: dotnet/docs-mobile#53
* Samples for iOS and tvOS: dotnet/macios-samples#2

Fixes #12790.
Fixes #20182.
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