unoplatform / uno.resizetizer

The home for Uno.Resizetizer, an image resizting tooling for Uno Platform apps
https://platform.uno
Other
15 stars 6 forks source link

[WinAppSDK] Resizetizer should not set Window title #267

Closed MartinZikmund closed 2 weeks ago

MartinZikmund commented 3 weeks ago

Currently the SetIcon extension changes the window title to the <ApplicationTitle> value in .csproj. This should not happen, as usually application name should be localized, so it is user's responsibility to set it. However, when they do and call SetIcon afterwards, it overwrites the user's set value:

https://github.com/unoplatform/uno.resizetizer/blob/5f0471df73a6b7b9db9792317f63239927d36a2b/src/Resizetizer/src/WindowIconGeneratorTask.cs#L72

jeromelaban commented 2 weeks ago

Agreed. This should not happen, and the method should be removed entirely, as we're now supporting the content generated by on all platforms. if I'm not mistaken @MartinZikmund ?

dansiegel commented 2 weeks ago

This logic was specifically added. While I'm not saying we should continue to do it or at the very least ensure we don't overwrite a value a user has given the Window, let's please be sure we understand what the original issue was that created the requirement before we go removing it. It seems that at its heart was #208

When running Windows target unpackaged, the title isn't being set. This needs to be read from packageappx.manifest and then set using appWindow.Title (reading packageappx.manifest can be done either at runtime, or at design time when resizetizer runs)

cc: @nickrandolph

MartinZikmund commented 2 weeks ago

Agreed. This should not happen, and the method should be removed entirely, as we're now supporting the content generated by on all platforms. if I'm not mistaken @MartinZikmund ?

@jeromelaban Not sure what you mean here 🤔

@dansiegel If the value would be read from Packageappx.manifest it would be fine, but it would have to happen during the app initialization as part of Uno itself (also because the manifest supports localization, so value like ms-resource:ApplicationName is valid and will set the title to the localized value. For unpackaged it should still be doable to "inject" the default title into Appplication.InitializeComponent() maybe, so that Uno itself can reference it?

Btw, how does <ApplicationTitle> in .csproj related to <Properties><DisplayName> in Package.appxmanifest?

jeromelaban commented 2 weeks ago

I mean that the whole code here is supported by uno, right? or maybe I'm mistaken with some other APIs.

https://github.com/unoplatform/uno.resizetizer/blob/5f0471df73a6b7b9db9792317f63239927d36a2b/src/Resizetizer/src/WindowIconGeneratorTask.cs#L60-L75

MartinZikmund commented 2 weeks ago

@jeromelaban the SetIcon method is not xplat, which is the main reason this method is needed I think