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

Update .NET MAUI app to .NET 9 #581

Merged
merged 12 commits into from
Oct 31, 2024
Merged

Update .NET MAUI app to .NET 9 #581

merged 12 commits into from
Oct 31, 2024

Conversation

jamesmontemagno
Copy link
Member

PR Classification

Code cleanup and upgrade to .NET 9.0.

PR Summary

This pull request updates the project to target .NET 9.0, includes code cleanup, and updates package references.

  • App.xaml.cs: Overridden CreateWindow method to return a new Window instance with AppShell and updated SetStatusBar method.
  • ClientApp.csproj and HybridApp.csproj: Target .NET 9.0 and updated package references.
  • Basket.cs: Improved protobuf parsing by handling end group tags.
  • DialogService.cs: Updated to use AppShell.Current.DisplayAlert instead of Application.Current.MainPage.DisplayAlert.
  • SettingsViewModel.cs: Made TitleUseAzureServices property non-static.

Updated App.xaml.cs to override CreateWindow and adjust SetStatusBar.
Targeted .NET 9.0 in ClientApp.csproj and updated packages.
Removed XML declarations from Styles.xaml and view files.
Handled end group tags in Basket.cs protobuf parsing.
Changed DisplayAlert usage in DialogService.cs.
Modified TitleUseAzureServices property in SettingsViewModel.cs.
Updated ClientApp.UnitTests.csproj with newer package versions.
Updated App.xaml.cs to use CreateWindow method for main window initialization.
Repositioned ManagePackageVersionsCentrally in HybridApp.csproj.
Updated SupportedOSPlatformVersion for iOS and MacCatalyst to 15.0.
Upgraded PackageReference versions to 9.0.0-rc.2.
Reformatted Routes.razor and _Imports.razor for consistency.
- MainPage.xaml: Added XML namespace `local` for `eShop.HybridApp.Components`.
- MauiProgram.cs: Updated `MobileBffHost` URL for Android to `http://10.0.2.2:11632/` and kept `http://localhost:11632/` for other platforms.
- AndroidManifest.xml: Enabled cleartext traffic and added network security config.
- Info.plist: Relaxed network security policies to allow HTTP connections.
- network_security_config.xml: Created to permit cleartext traffic for `10.0.2.2`.
Added Basket.API project to ClientApp.sln with GUID {0F0B89AF-EDEA-4479-941A-CCE9FFDBD057}. Updated solution configuration platforms to include build and active configuration settings for Debug and Release configurations.
jamesmontemagno and others added 2 commits October 18, 2024 17:29
* Add missing x:DataType

* Reenable warnings
@@ -86,7 +90,7 @@ private void App_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e

private void SetStatusBar()
{
var nav = Current.MainPage as NavigationPage;
var nav = Windows[0].Page as NavigationPage;
Copy link
Member Author

Choose a reason for hiding this comment

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

@jfversluis thoughts?

Copy link
Member

@jfversluis jfversluis Oct 29, 2024

Choose a reason for hiding this comment

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

Yep that is unfortunately what it is for now. Alternatively since you're using Shell you could do Shell.Current.CurrentPage which is a tiny bit nicer? But also I think that might be going away at some point since it's also not great.

@jamesmontemagno
Copy link
Member Author

@jfversluis can you pull this and take a look as to why teh fontawesome icons aren't loading....

src/HybridApp/App.xaml.cs Outdated Show resolved Hide resolved
@jamesmontemagno jamesmontemagno requested a review from Eilon October 22, 2024 19:11
simonrozsival and others added 2 commits October 22, 2024 12:13
* Use source-generated JSON serialization in ClientApp

* Refactor serialization of JSON content
The MauiProgram class has been updated to include a new method
ConfigureHandlers. This method is conditionally compiled for
iOS and Mac Catalyst platforms and adds custom handlers for
CollectionView and CarouselView controls. The ConfigureHandlers
method is called in the CreateMauiApp method to ensure these
handlers are configured during the app's initialization.
Copy link
Member

@Eilon Eilon left a comment

Choose a reason for hiding this comment

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

I focused my review on the HybridApp, which I'm most familiar with, and I think it's good. I scanned through the ClientApp but only quickly and didn't find any issues.

@jfversluis
Copy link
Member

@jfversluis can you pull this and take a look as to why teh fontawesome icons aren't loading....

Tested on iOS, macOS and Android and it shows the icons there, so maybe just a fluke?

@jfversluis
Copy link
Member

jfversluis commented Oct 29, 2024

I do see a couple of

Microsoft.Maui.Controls.BindableObject: Warning: Cannot convert 6 to type 'System.Int32'

and one

Microsoft.Maui.Controls.BindableObject: Warning: Value is an invalid value for ColumnSpan

In the debug output, but can't really pinpoint where its coming from. Does that ring a bell?

Removed the Grid.ColumnSpan="0" attribute from the <Image> element
in LoginView.xaml. This attribute was likely incorrect or
unnecessary, and its removal may correct the layout behavior of
the image within the grid.
@jamesmontemagno
Copy link
Member Author

was able to fix up the column span thing... nto srue about the "6" that is weird

It has to be somethign on the login page...

if i delete

 <Button
      Grid.Row="2"
      Grid.Column="0"
      Margin="8"
      BackgroundColor="Black"
      Command="{Binding SignInCommand}"
      CornerRadius="16"
      Text="Login"
      TextColor="White" />

the warnings go away

- Added `LoginPanel` grid with specific properties and bindings.
- Introduced a new logo image element for better visual structure.
- Reformatted and re-added the login button with necessary properties.
- Removed commented-out `<ScrollView>`, `<ContentView>`, and register button.
- Enhanced code readability by eliminating unused commented code.
@jamesmontemagno jamesmontemagno merged commit 5401748 into main Oct 31, 2024
5 checks passed
@jamesmontemagno jamesmontemagno deleted the maui-dotnet9 branch October 31, 2024 16:18
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.

4 participants