Giter VIP home page Giter VIP logo

uno.resizetizer's Introduction

Uno.Resizetizer

Based on the work from @redth from the .NET team, Uno.Resizetizer uses SVG and PNG files to generate images for all resolutions needed for your .NET 6+ apps. It is available for applications running with Uno Platform on iOS, Android, mac Catalyst, Gtk/WPF and WebAssembly target.

NuGet

To get started with Uno Platform, follow our guides, and get started with Resizetizer with our documentation!

uno.resizetizer's People

Contributors

agneszitte avatar dansiegel avatar jeromelaban avatar lukeblevins avatar morning4coffe-dev avatar mtmattei avatar nickrandolph avatar pedrojesus-work avatar pictos avatar youssef1313 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uno.resizetizer's Issues

Rename the lib

Rename the Maui names for something Uno like.
As mentioned here

What would you like to be added:

Why is this needed:

For which Platform:

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Anything else we need to know?

UnoImages doesn't work on the first run on Android

During the implementation of the Android appicon, I realised an odd behavior regarding the UnoImage. If you clean all the project git clean -xdf and run it, the images will not be found. But in the next incremental builds the app will be able to find the images. It could be an ordering issue on the MSBuild pipeline?

Should be fixed after the appicon android PR be merged

ForegroundScale is being parsed with the culture of the machine.

Current behavior

The value is parsed with the culture of the regional configuration of the machine.

Expected behavior

The value is parsed with invariant culture. So "0.65" is 65%.

How to reproduce it (as minimally and precisely as possible)

Assuming your regional configuration is English - United States (or another in which the symbol of the decimal separator is the dot).

  1. Create a new project with the Uno Visual Studio Extension.

  2. In base.props check UnoIcon item has ForegroundScale="0.65".

  3. Launch Windows head, the icon should be seen properly in the taskbar.

4, Change machine regional configuration to Spanish - Spain.

  1. Sign out & sign back in for changes to apply machine wide.

  2. Open the solution and rebuild the windows head.

  3. Launch Windows head, the icon in the taskbar is a blank background.

  4. In base.props change ForegroundScale value to 0,65 (with a comma).

  5. Rebuild the windows head.

  6. Launch Windows head, the icon should be seen properly in the taskbar.

Environment

Nuget Package:

Package Version(s): 1.0.2

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • 2022 (version: 17.5.2)
  • for Mac (version: )

Anything else we need to know?

I think the problem is located here. It should use the overload with IFormatProvider and pass CultureInfo.InvariantCulture.

[WASM] Splash image disappears on subsequent runs

Current behavior

Create new app using Blank preset in Wizard
Build and run WASM - correct splash screen image appears (just Uno logo)
Stop, then build and run again

  • At some point the correct image isn't displayed and the default splash image is displayed (Uno log with "Uno platform" text)

Expected behavior

Correct splash should always be displayed

Repro steps

Create new app using dotnet new
dotnet new unoapp -preset blank -o CheckSplashApp

Open app in Visual Studio
Wait for "reload" message to appear (it may not, so can ignore this step if it doesn't) and click reload
Set Wasm target as start project
Rebuild wasm target
Run wasm target without debugging -> this will launch app with correct splash screen
Close browser
Rebuild the class library not the wasm project
Run wasm target without debugging -> this will launch app with the wrong splash screen

Splash screen PNG files are not generated when UnoIcon and UnoSplashScreen are the same file.

Current behavior

Splash screen PNG files are not being generated in all heads when UnoSplashScreen Include attribute is the same SVG file as UnoIcon but with a Link attribute. This has different behaviors on each head:

  • WinUI. PNG files are generated and the splash screen is shown.
  • Android. PNG files are not generated and provoke compiler errors APT2062 failed linking references and APT2260 resource drawable/splash_screen not found.
  • iOS. Although the PNG files are not generated the splash screen image is shown.
  • WebAssembly. PNG files are not generated and alternate text is shown instead of the splash screen image.
  • Skia.WPF. PNG files are not generated and the splash screen image is not shown.

Expected behavior

I think it should generate the PNG files in all heads based on the filename that is in the Link attribute. It is not uncommon that the splash screen is the same vector file as the application icon.

At minimum, a validation error or warning provided by uno.resizetizer saying that doing that is not supported (the same way it signals when the is more than on UnoSplashScreen item).

How to reproduce it (as minimally and precisely as possible)

  1. Create a new Uno Platform app with the Visual Studio Extension.
  2. Close Visual Studio.
  3. Go to Base folder.
  4. Remove iconapp.svg and rename appconfig.svg to iconapp.svg
  5. Go to base.props and modify UnoSplashScreen so the Include attribute is the same as UnoIcon. Also add Link="splash_screen.svg" to UnoSplashScreen and remove ForegroundFile of UnoIcon.
  6. Ensure bin and obj folders of all heads are deleted and delete them manually if not.
  7. Open the solution.
  8. Compile all heads.

Environment

Nuget Package:

Package Version(s): 1.0.2

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Skia
  • Windows
  • Build tasks

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • 2022 (version: 17.5.2)
  • for Mac (version: )

[Windows] Respect icon path

See comment in PR: #15 (comment)

Currently all icons are generated in the Images folder in the package
Icons should be generated and added to the package in the same folder that the source image was in. Eg if the source file was in the MyIcons folder, the generated files should be found in the MyIcons folder in the application package

[iOS/Android] App icons don't show the correct size it is showing a bit zoomed

Current behavior

The App icon is showing a bit zoomed for the Android as well as IOS , I will also attach the screenshot of both the platform

IOS

Screenshot 2023-03-24 at 5 01 17 AM

Android
Screenshot 2023-03-24 at 5 03 05 AM

Expected behavior

App Icon should have been shown clearly and fit but unfortunately it is not

How to reproduce it (as minimally and precisely as possible)

<UnoIcon Include="$(MSBuildThisFileDirectory)Icons\iconapp.svg"
				 ForegroundFile="$(MSBuildThisFileDirectory)Icons\appconfig.svg"
				 Color="#FFFFFF" />

Environment

Nuget Package: uno.resizetizer

Package Version(s): 1.0.2

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • [x ] 2022 (version: Version 17.5.2)
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

[Documentation] Feedback for using-uno-resizetizer.md

On which page?

https://github.com/unoplatform/uno.resizetizer/blob/main/doc/using-uno-resizetizer.md

What's wrong?

  • 1. Installing Uno.Resizetizer
    Should be mentioned as an optional step (instead of step 1) for anyone that does not start with the solution template that includes Uno.Resizetizer by default with Uno Platform 4.8.
  • [!TIP] To create an app, make sure to visit our getting started tutorials.
    Add a link in the tip to the getstarted.md
  • Missing screenshots
    Please add proper screenshots of actual svg files in the correct location on all the steps
  • Now open the base.props file, inside the MyApp.Base folder project and add the following block:
    Add a link to the proper file of the sample app as an example will help
  • In each of your project heads (iOS, Android, WebAssembly, ...) add the following block:
    Should precise csproj to make it clear (for UnoIcon and UnoSplashScreen)
  • Adjustments for every platforms
    Please add a link to every file in the sample app matching the adjustments for every platform so it's easier to have a proper example
  • Windows - remove everything that's related to the application icon
    image
    We don't show a proper example of anything related to the application that should be removed in this snippet. A proper example of what should be removed should be added instead + a link to the proper matching file in the sample app as an example
  • #FFFFFF(transparent)
    image
    #FFFFFF is white not transparent
  • Create a SplashScreen folder inside the Base project
    Make sure to update the name of the folder in the Sample App to SplashScreen instead of ``Splash` to match
  • Open the Style.xml file
    It should be Styles.xml instead of Style.xml
  • UnoImage - One or more invalid file names were detected. File names must be lowercase, start and end with a letter character, and contain only alphanumeric characters or underscores
    These detail should be mentioned in the documentation also
  • UnoImage - Image Width="300" Height="300" Source="Assets\Images\myImage.png"
    The source path is incorrect here should be <Image Width="300" Height="300" Source="ms-appx:///NameOfTheApp/Assets/Images/nameoftheasset.png"

Splashscreen is not displaying the correct image size even when specifying BaseSize

Current behavior

Splashscreen is not displaying the correct image size even when specifying BaseSize (here the icon should be 50*50 for example)

Windows
image

WASM
image

Expected behavior

Splashscreen should have the correct size following the BaseSize we specified in the code

How to reproduce it (as minimally and precisely as possible)

<UnoSplashScreen Include="$(MSBuildThisFileDirectory)SplashScreen\splashscreen.svg"
						 BaseSize="50,50"
						 Color="#FFFFFF" />

Environment

Nuget Package: uno.resizetizer

Package Version(s): 1.0.2

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2022 (version: Version 17.5.2)
  • 2019 (version: )
  • for Mac (version: )

[Android] Set Icon property on the ApplicationAttribute

What would you like to be added:

Want to avoid developers having to manually set the Icon property on the ApplicationAttribute

[global::Android.App.ApplicationAttribute(
	Label = "@string/ApplicationName",
	**Icon = "@mipmap/icon"**, ..... )]


Why is this needed:

The only thing a developer should have to do is to include . Everything else should be automatically set

For which Platform:

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Anything else we need to know?

PWA Manifest is invalid

During the build process the pwa manifest isn't generate correctly, looks like to be a timing issue, since it's correct generate when the debugger is attached.

PWA manifest should have the same extension as the original one

Actually, Resizetizer creates a json file for the pwamanifest, the extension should be whatever is the original file.

At this point it should be json or webmanifest, so the fix is to grab the extension of the existing file and apply it to the generated one

[Android] Unable to deploy after rebuild

Current behavior

Forcing a rebuild on Mobile project prevents Android app from being able to be deployed with following errors:
12:59:43:995 APT2260: resource drawable/splash_screen (aka com.companyname.UnoApp1:drawable/splash_screen) not found.
12:59:43:996 APT2260: resource drawable/splash_screen (aka com.companyname.UnoApp1:drawable/splash_screen) not found.
12:59:43:996 APT2260: resource drawable/splash_screen (aka com.companyname.UnoApp1:drawable/splash_screen) not found.
12:59:43:996 APT2260: resource drawable/splash_screen (aka com.companyname.UnoApp1:drawable/splash_screen) not found.
12:59:43:996 APT2062: failed linking references.

Expected behavior

No errors and successful deploy/run

How to reproduce it (as minimally and precisely as possible)

  • Create new project using Blank preset in Wizard
  • Build and run the Mobile project
  • Force Rebuild on the Mobile project
  • Press Run which should deploy and run the project but will fail with errors

Environment

Nuget Package:

Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

Convert MauiSplashscreen to UnoSplashscreen

What would you like to be added:

Why is this needed:

For which Platform:

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Anything else we need to know?

[Dicussion] handling with app icon assets with Resizetizer

Some title

It's known that each Platform has its own guidelines for handling app icons. In general, Resizetizer can generate assets for both Idioms (mobile and desktop), but it lacks some intrinsic guidelines, where we can't infer if the user will deliver an asset following the guidelines or not. To better illustrate the scenario will be used Android and Windows.

SVG with padding

The svg used by this first sample is one that respects the guidelines for mobile Idiom. That means the foreground is centered and there's padding, represented by the fact the svg image is smaller than the ViewBox. The assets used are in the zip file below.

icons_with_padding.zip

The dimensions of the Foreground assets are:
svg width="456" height="456"
viewBox="0 0 912 912"

The dimensions of the Background assets are:
svg width="456" height="456"
viewBox="0 0 456 456"

As you can see, we just have to add the padding on the Foreground file.

On mobile we will have the following result:

appIcon_android

As you can see the Uno logo is centered and there's a padding around it.

For Windows the result is different, because of that extra size on ViewBox the Uno logo becomes very smaller, you can see the result at image below:

appIcon_windows

SVG without padding

The svg used by this second sample is one that doesn't respect the guidelines for mobile Idiom. That means the foreground is not centered and there's no padding. The assets used are in the zip file below.

icons_without_padding.zip

The dimensions of the Foreground assets are:
svg width="450" height="450"
viewBox="0 0 50.369617 49.826836"

The dimensions of the Background assets are:
svg width="456" height="456"
viewBox="0 0 456 456"

On mobile we will have the following result:

old_appIcon_android

As you can see the Uno logo fills all the icon space horizontally and vertically. The padding is not respected.

Otherwise, for Windows the result is different, it looks good because the Uno logo is centered and the icon is bigger than before. You can see the result in image below:

old_appIcon_windows

Possible solutions

1. Using the ForegroundScale property

If needed the user can specify the scale of the Foreground asset, increasing or reducing its size. Something like this:

<UnoIcon Include="$(MSBuildThisFileDirectory)Icons\iconapp.svg"
        ForegroundFile="$(MSBuildThisFileDirectory)Icons\appconfig.svg"
        Color="#00000000" 
        ForegroundScale="0.65"/>

This can work for some cases, but there are cases where the Foreground just disappears, and it has to do with the content position inside the svg file, I couldn't find a good metric for that with the svg that I've available, so that will be a more empiric way to test and resize the app icon.

2. During the resizing process, we add a padding to the image

We can infer that assets will not have the padding, so we can add it during the resizing process. And we can do that per platform, which will give us more control over asset generation. The question here is, should this padding be added implicitly or should we add a new property to the UnoIcon item? Something like AddPadding="true", where the padding will be implicitly added by Resizetizer defaults, or per platform, something like, WindowsPadding= "10" and AndroidPadding="20" where the user can specify the padding value for each platform if doesn't specify the value will be 0.

3. Infer that the asset will have a padding

We can infer that the asset will have a padding, so on Desktop idioms we can increase the scale of the generated ForegroundFile, that way the icon will not too small.

4. Use the platform idioms to take care

Instead of trying to apply those paddings on Resizetizer code (which uses Skia to renderer the image) we can use what the platform gives to us, on android, we can adjust the inset property and that will be aligned with their units. So the xml for the adaptive-icon will be:

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
  <background android:drawable="@color/ic_launcher_background"/>
  <foreground>
    <inset
      android:drawable="@drawable/ic_launcher_foreground"
      android:inset="16%" />
  </foreground>
</adaptive-icon>

For more context and other points of view, you can see this issue on .NET MAUI repo: dotnet/maui#11295
And this one on Flutter's repo: fluttercommunity/flutter_launcher_icons#96

[Android] Compiler error when UnoSplashScreen does not have Color attribute.

Current behavior

Android target framework of mobile head does not compile when Color attribute is not present in UnoSplashScreen.

Expected behavior

Android target framework of Mobile head compiles when Color attribute is not present in UnoSplashScreen.

How to reproduce it (as minimally and precisely as possible)

Create a Uno Platform project with the Visual Studio Extension.

Go to base.props and remove Color attribute of UnoSplashScreen.

Compile Mobile head.
APT2061 failed linking resources
and
APT2260 resource: color/uno_splash_color.
compiler errors happen.

Environment

Nuget Package:

Package Version(s): 1.0.2

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • 2022 (version: 17.5.2)
  • for Mac (version: )

[Skia] Package.appxmanifest incorrectly embedded

Current behavior

image

Expected behavior

Resource name should be [Assembly].Packageappx.manifest

How to reproduce it (as minimally and precisely as possible)

Create new app using unoapp target
Build and run Skia target

Environment

Nuget Package:

Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

Duplicate images are being emited for UnoImage

Current behavior

Any UnoImage is being duplicated in the target platform package when it's defined in a class library (ie new solution structure)
The image appears in the root folder and in a classlibrary sub folder
eg
If you have in class library MyAppLibrary this will appear at
MyImages\Test.png (and other scales)
and at
MyAppLibrary\MyImages\Test.png

Expected behavior

Should only appear at
MyAppLibrary\MyImages\Test.png

UnoImage generating warning on Android

Current behavior

Create app using the extension template, build and run

16:53:51:223	1>obj\Debug\net7.0-android\resizetizer\r\Assets\Icons\back.scale-100.png : warning XA0101: @(Content) build action is not supported
16:53:51:223	1>obj\Debug\net7.0-android\resizetizer\r\Assets\Icons\back.scale-125.png : warning XA0101: @(Content) build action is not supported
16:53:51:223	1>obj\Debug\net7.0-android\resizetizer\r\Assets\Icons\back.scale-150.png : warning XA0101: @(Content) build action is not supported
16:53:51:275	1>obj\Debug\net7.0-android\resizetizer\r\Assets\Icons\back.scale-200.png : warning XA0101: @(Content) build action is not supported
16:53:51:275	1>obj\Debug\net7.0-android\resizetizer\r\Assets\Icons\back.scale-300.png : warning XA0101: @(Content) build action is not supported
16:53:51:275	1>obj\Debug\net7.0-android\resizetizer\r\Assets\Icons\back.scale-400.png : warning XA0101: @(Content) build action is not supported

Expected behavior

No warnings

[SPEC] Resize assets to uno project

NR: General comment - I think when detailing each platform we should be very specific about the image sizes that we need to generate for splash, icon, etc. Remember that this will form the spec for what we're going to be using resizitizer for - if you're calling resizitizer, what output dimensions are you going to be requesting.

This file will discuss the guidelines for Splash screens and App icons across Android and iOS platforms. Then it will discuss the Resizetizer and ideas on how to make the work of creating those components easier for developers.

Splash Screen

Android

From android docs the elements that compose the Splash Screen should be defined by XML resources in the Android Manifest. And these elements are:

  • App icon
  • Icon background
  • Window background

And the Splash screen dimensions should be:

  • Branded image: 200x80 dp
  • App icon with an icon background: 240x240 dp, and fit within a circle of 160 dp in diameter
  • App icon without an icon background: 288x288 dp, and fit within a circle of 192 dp in diameter

For Android <12 we need to include a splashscreen.xml file that defines the layout of the splash screen for legacy support. If we still support old targets.

Android also supports animated splash screens, but you need to define those in Animated Vector Drawable (AVD) XML format. I believe it's out of the scope right now and can be investigated in the future as an enhancement.

iOS

Apple doesn't have a requirement for Splash Screen as Android does, in general, is just a page that fills the entire device screen and you can set whatever you want there. The guidelines say to be a representation of the App's first-page layout, but normally apps use to present the same splash screen as Android, with a company icon.

WPF

From docs the Splash Screen should be an image file using a format that's supported by Windows Imaging Component, like BMP, GIF, JPEG, PNG, or TIFF format.

But there's no specification about the size.

App Icon

Android

From android docs the icon can assume different shapes, visual effects, and user theming. It's called Adaptive icons. The icon design requirements are:

  • All layers must be sized at 108 x 108 dp.
  • The icons should be clean edges; the layers must not have masks or background shadows around the outline of the icon.
  • The logo must be at least 48 x 48 dp; it must not exceed 72 x 72 dp because the inner 72 x 72 dp of the icon appears within the masked viewport.
  • The outer 18 dp on each of the four sides of the layers are reserved for masking and to create visual effects such as parallax or pulsing.

And the adaptive icon is represented by XML.

iOS

From apple docs the app you can see the guideline changes across devices, so here the focus will be on iOS and iPadOS.
From the Specifications section, the icon should follow these guidelines:

  • One single layer
  • No transparency
  • Asset shape should be square
  • Should provide different sizes (documented in the Specification section)

The assets are represented by a JSON file, containing the name and location of each icon size.

Linux

From gnome docs the app icons are drawn in canvas with 128x128 area, but the space shouldn't be filled. In order to generate the icons, we must follow these guidelines:

  • Provide a icon with the sizes of 32x32, 64x64, and 128x128 pixels;
  • A Symbolic App Icon, that is simpler than the icon provided in the last item

From this source the icon can be .svg, so we don't need to care about sizing, the OS will do that for us, or .png in this case we need to provide different files using the required sizes. From the PDF file, chapter 3 section 1.

If you use bitmap icons, you’ll need to provide several files with different resolutions. The most important one for applications and file types is a 48 × 48 pixel square, and 16, 32 and 64 pixel square shapes are also common

WPF

For WPF we've a large set of icon sizes, but focusing on application icons we should provide the following sizes, for the current mode:

  • 16x16
  • 32x32
  • 48x48
  • 256x256

And the following sizes for the Classic mode:

  • 16x16
  • 24x24
  • 32x32
  • 48x48
  • 64x64

All apps should be of type .ico.

Resizetizer Spec

Today we can use the MauiResizetizer on Uno images and that pretty much works, the splash screen and icons partially work, probably some adjustments on our end will make it compatible.

So the first spec is to use the Resizetizer NuGet package, today the highest version that works at Uno is 6.0.101-preview.11.2349. Newer versions didn't compile, maybe Uno uses an old .net6 version? Not sure yet.

Specification in general

The assets can live inside the Shared project, inside the assets folder, and then get into the right place through MSBuild tasks. We can split the type using folders inside the asset, like Images, AppIcon, SplashScreen, Fonts, etc and use wild cards to control their meaning.

We also need an MSBuild property for those assets, so I'll use the Resizetizer as a reference.

For Images we will have something like:

<MauiImage Include="Assets/Images/myImg.svg BaseSize="100x100" TintColor="#FF0000" />

  • Include: The path of the asset, it can also support wild cards, something like Assets/Images/*
  • BaseSize: The size that should be used as a base to generate the final assets in the respective resolution
  • TintColor: Customizes the Image color.

For icons:

<MauiIcon Include="Assets\AppIcon\appicon.svg" ForegroundFile="Assets\AppIcon\appiconfg.svg" Color="#512BD4" />

  • Include: The path of the background asset
  • Foreground: The path of the foreground asset
  • Color: Customizes the background color.

For Splash screen:

<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

  • Include: The path of the asset that represents the splash screen
  • Color: Customizes the background color.

Image asset resize

The asset resizing scales based on the BaseSize property value, if a value isn't provided we can use the default asset size. Let's use iOS as a sample since it's simple. For iOS we have 3 sizes, there's the normal size then @2x and @3x, that's two times the base size and 3 times the base size, respectively. So the tooling should grab the BaseSize and generate assets that are x1, x2, and x3 its value.
For Android, it will work the same, but we've more scales to work.

I can see two options for Uno to add this feature as a public API.

Use the .NET MAUI Resizetizer

Using the risizetizer we can see better what we need to change, in our template and build tasks to support it and work with the .NET MAUI team to add features and hooks that can be used by Uno projects. Like adding support, out of the box, for wasm, Linux, and other targets.

Create our own MSBuild tasks

If we go on this path, I suggest using a pattern of no naming the MSBuild properties, following a convention of having Uno as a prefix, something like:

  • UnoSplashScreen
  • UnoImage
  • UnoIcon

And we can keep the same MSBuild properties, with different names if needed.

UnoImage doesn't respect the location on Windows

In the new template, we've this scenario. We must make Windows works as all platforms

<!--  This works on Windows  -->
<Image
	Width="300"
	Height="300"
	Source="ms-appx:///NewTemplate.NugetTest/Images/dotnet_bot2.png" />

<!--  This works everywhere but Windows  -->
<Image
	Width="300"
	Height="300"
	Source="Images\\dotnet_bot2.png" />

Handle AppIcon per platform

Right now for 4.9, we make sure that ForegroundScale will have a variation per platform but still uses the Skia code to re-scale the asset. We've an opportunity to make this even more platform-specific, handling that using whatever the platform exposes to us.

On Android, for example, we can do that inside the splash drawable xml file, using the android:inset attribute, so we can create this xml when user specifies the AnroidForegroundScale:

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
  <background android:drawable="@color/ic_launcher_background"/>
  <foreground>
    <inset
      android:drawable="@drawable/ic_launcher_foreground"
      android:inset="16%" />
  </foreground>
</adaptive-icon>

And we can extend that for platforms that exposes ways to customize the app icon

Testing the released NuGet package

Those are the results of the testing of Uno.Resizetizer Version="0.31.0-dev.95"
Sample project:
Resizetizer_Nuget.zip

Shared Project

Wasm checklist

  • Images
  • Icons
  • PWA (need to update the Uno.Wasm.Bootstrap and Uno.Wasm.Bootstrap.DevServer packages to 7.0.11. Change the manifest to be .webmanifest and add that on webconfig and remove the icons values on that manifest)

WPF checklist

  • Images
  • Icons

Windows checklist

  • Images
  • Icons (need to change the Package.appxmanifest and remove the default icons)

Android checklist

  • Images
  • Icons (Change the Icon attribute at Application class, remove old icons)

iOS checklist

  • Images
  • Icons

macCatalyst checklist

  • Images
  • Icons

GTK checklist

  • Images
  • Icons

Multi-target Project

Wasm checklist

  • Images (not working the red border)
  • Icons
  • PWA (need to update the Uno.Wasm.Bootstrap and Uno.Wasm.Bootstrap.DevServer packages to 7.0.11. Change the manifest to be .webmanifest and add that on webconfig and remove the icons values on that manifest)

WPF checklist

  • Images
  • Icons

Windows checklist

  • Images
  • Icons (need to change the Package.appxmanifest and remove the default icons)

Android checklist

  • Images (Still a bug on the first build)
  • Icons (Change the Icon attribute at Application class, remove old icons)

iOS checklist

  • Images (Just the red border is working for Resizetizer and Link images)
  • Icons

macCatalyst checklist

  • Images (Just the red border is working for Resizetizer and Link images)
  • Icons

GTK checklist

  • Images
  • Icons

[Android] The SplashScreen is displaying strangely when it is running

Current behavior

When running the android platform for the TubePlayer project the splashscreen should be shown only once but wiredly it is showing us the SplashScreen twice. You can refer to below photo for more details.
Screenshot 2023-03-24 at 5 20 44 AM

Expected behavior

The middle logo when running the android platform should be only one but it is two.

How to reproduce it (as minimally and precisely as possible)

		<UnoSplashScreen
			 Include="$(MSBuildThisFileDirectory)SplashScreen\splashscreen.svg"
			 BaseSize="110,110"
			 Color="#FFFFFF" />

Environment

Nuget Package: uno.resizetizer

Package Version(s): 1.0.2

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2022 (version: Version 17.5.2)
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

[WASM/Skia] Targets require rebuild in order for icon and splashscreen images to appear

Current behavior

Create new application using latest unoapp template, which should include icon and splashscreen (once unoplatform/uno.extensions#1272 has merged). Build and run the WASM, GTK or WPF targets. They will run successfully but the icon and/or splashscreen images are either incorrect or not shown.

Force a rebuild on the targets and then run in order to correct icon/splash image

Expected behavior

All targets should build and run successfully the first time after solution creation

Convert MauiIcon to UnoIcon

What would you like to be added:

Why is this needed:

For which Platform:

  • iOS
  • Android
  • MacOS
  • Catalyst
  • WebAssembly
  • Windows
  • Skia GTK
  • Skia Linux
  • WPF

Anything else we need to know?

Convert MauiImage to UnoImage

What would you like to be added:

Why is this needed:

For which Platform:

  • iOS
  • Android
  • WebAssembly
  • Windows
  • Build tasks

Anything else we need to know?

Icon not set on WinUI window

The .ico file is being created for WinUI but isn't being set on the ApplicationIcon property, so results in the default icon

Remove unnecessary code

For handling Images, all platforms use the UWP pattern since we've Uno tasks to handle that at each platform level. So, we can remove code from .targets and tasks that handles it.

For appIcon we need to it per platform because we don't have Uno tasks to handle that, so we need to keep existing code and implement new features.

[ ] Remove unnecessary code

[WASM] Splash should use x200 not x400 image

Current behavior

dic["splashScreenImage"] = $"\"{info.OutputName}.scale-400.png\"";

Expected behavior

Change to "-200" for x2 image

How to reproduce it (as minimally and precisely as possible)

Environment

Nuget Package:

Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

Update Manifest at root to include icons

linked to: #59

What would you like to be added:

The manifest file that's in the root of the distribution folder (for older browsers that don't look for the link element in the index.html) needs to be updated to include the icons

Why is this needed:

There's currently a limitation in the Uno code that prevents the location of the manifest file from being updated to a path that's not relative to the project (ie can't be in obj folder).

For which Platform:

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Anything else we need to know?

Fix UnitTests

Since we don't follow the same pattern as .NET MAUI to handle images assets (is specific per platform) the UnitTests now are failing, but it's a false negative, since it's working for us.

So we need to map and fix all the failing unit tests and make sure the tests are testing correctly

Normalize SplashScreen generation on WinUI

Right now, WinUI creates splash assets in a very specific way and it causes issues with the naming because it adds the SplashScreen suffix on the asset, so for example, if the user adds splash_screen.svg the generated will be splash_screenSplashScreen, that works for windows but will fail for Skia targets that use the Package.appxmanifest.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.