Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #43 from dotnet-architecture/dotnet8-update
Browse files Browse the repository at this point in the history
.net 8 update
  • Loading branch information
jamesmontemagno authored Nov 27, 2023
2 parents cd009eb + 358b1fc commit 252020b
Show file tree
Hide file tree
Showing 22 changed files with 187 additions and 177 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
- '**.xaml'

env:
DOTNET_VERSION: '7.0.x' # The .NET SDK version to use
DOTNET_VERSION: '8.0.x' # The .NET SDK version to use

jobs:
build:
Expand All @@ -33,7 +33,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ The app targets **four** platforms:
- **Visual Studio Community Edition is fully supported!**
- .NET MAUI add-ons for Visual Studio (available via the Visual Studio installer)

or

- [Visual Studio Code](https://learn.microsoft.com/dotnet/maui/get-started/installation?tabs=visual-studio-code) configured for .NET MAUI development on Mac, Windows, or Linux.

## Setup

### 1. Ensure the .NET MAUI platform is installed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<UseMaui>true</UseMaui>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
10 changes: 8 additions & 2 deletions eShopOnContainers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers", "eShopOnContainers\eShopOnContainers.csproj", "{A3FDE011-C268-4319-A0BF-3151DEA5EF90}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "eShopOnContainers", "eShopOnContainers\eShopOnContainers.csproj", "{A3FDE011-C268-4319-A0BF-3151DEA5EF90}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopOnContainers.UnitTests", "eShopOnContainers.UnitTests\eShopOnContainers.UnitTests.csproj", "{2F62F414-42B8-4663-96BB-FF00E63B2929}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "eShopOnContainers.UnitTests", "eShopOnContainers.UnitTests\eShopOnContainers.UnitTests.csproj", "{2F62F414-42B8-4663-96BB-FF00E63B2929}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{26C3A3EB-3DB4-46A0-91C8-500FEC1CDA16}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build-validation.yml = .github\workflows\build-validation.yml
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
62 changes: 12 additions & 50 deletions eShopOnContainers/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,46 +24,14 @@
<Color x:Key="LightTextColor">#979797</Color>
<Color x:Key="iOSDefaultTintColor">#007aff</Color>
<Color x:Key="SeparatorLineColor">#CCCCCC</Color>
<Color x:Key="AndroidDefaultButtonClassBackgroundColor">#C9C9C9</Color>
<Color x:Key="iOSDefaultButtonClassBackgroundColor">Transparent</Color>
<Color x:Key="AndroidDefaultButtonClassBorderColor">Transparent</Color>
<Color x:Key="iOSDefaultButtonClassBorderColor">#007aff</Color>
<Color x:Key="AndroidDefaultButtonClassTextColor">#FFFFFF</Color>
<Color x:Key="iOSDefaultButtonClassTextColor">#007aff</Color>
<Color x:Key="AndroidEntryBackgroundColor">Transparent</Color>
<Color x:Key="iOSEntryBackgroundColor">#FFFFFF</Color>
<Color x:Key="AndroidDefaultAccentColorColor">#1FAECE</Color>
<Color x:Key="AndroidListViewBackgroundColor">Transparent</Color>
<Color x:Key="iOSListViewBackgroundColor">Transparent</Color>

<OnPlatform x:Key="ActivityIndicatorColor" x:TypeArguments="Color">
<On Platform="iOS" Value="{StaticResource iOSDefaultTintColor}" />
</OnPlatform>

<OnPlatform x:Key="DefaultButtonClassBackgroundColor" x:TypeArguments="Color">
<On Platform="iOS" Value="{StaticResource iOSDefaultButtonClassBackgroundColor}" />
<On Platform="Android" Value="{StaticResource AndroidDefaultButtonClassBackgroundColor}" />
</OnPlatform>

<OnPlatform x:Key="DefaultButtonClassBorderColor" x:TypeArguments="Color">
<On Platform="iOS" Value="{StaticResource iOSDefaultButtonClassBorderColor}" />
<On Platform="Android" Value="{StaticResource AndroidDefaultButtonClassBorderColor}" />
</OnPlatform>

<OnPlatform x:Key="DefaultButtonClassTextColor" x:TypeArguments="Color">
<On Platform="iOS" Value="{StaticResource iOSDefaultButtonClassTextColor}" />
<On Platform="Android" Value="{StaticResource AndroidDefaultButtonClassTextColor}" />
</OnPlatform>

<OnPlatform x:Key="EntryBackgroundColor" x:TypeArguments="Color">
<On Platform="iOS" Value="{StaticResource iOSEntryBackgroundColor}" />
<On Platform="Android" Value="{StaticResource AndroidEntryBackgroundColor}" />
</OnPlatform>

<OnPlatform x:Key="ThemeListViewBackgroundColor" x:TypeArguments="Color">
<On Platform="iOS" Value="{StaticResource iOSListViewBackgroundColor}" />
<On Platform="Android" Value="{StaticResource AndroidListViewBackgroundColor}" />
</OnPlatform>
<Color x:Key="DefaultButtonClassBackgroundColor">#C9C9C9</Color>
<Color x:Key="DefaultButtonClassBorderColor">Transparent</Color>
<Color x:Key="DefaultButtonClassTextColor">#FFFFFF</Color>
<Color x:Key="EntryBackgroundColor">Transparent</Color>
<Color x:Key="DefaultAccentColorColor">#1FAECE</Color>
<Color x:Key="ListViewBackgroundColor">Transparent</Color>
<Color x:Key="ThemeListViewBackgroundColor">Transparent</Color>
<Color x:Key="ActivityIndicatorColor">#00857D</Color>

<!-- Theme Colors -->
<Color x:Key="LightBackgroundColor">#FFFFFF</Color>
Expand All @@ -75,14 +43,8 @@
<Color x:Key="LightSeparatorColor">#222222</Color>
<Color x:Key="DarkSeparatorColor">#E7E7E7</Color>

<!-- SIZES -->
<OnPlatform x:Key="BaseButtonBorderRadius" x:TypeArguments="x:Double">
<On Platform="iOS" Value="6" />
</OnPlatform>

<OnPlatform x:Key="BaseButtonBorderWidth" x:TypeArguments="x:Double">
<On Platform="iOS, Android" Value="0" />
</OnPlatform>
<x:Double x:Key="BaseButtonBorderRadius">6</x:Double>
<x:Double x:Key="BaseButtonBorderWidth">0</x:Double>

<!-- FONTS -->
<x:String x:Key="SettingsIcon">&#xf013;</x:String>
Expand Down Expand Up @@ -288,8 +250,8 @@

<Style x:Key="WinUIEntryStyle" TargetType="{x:Type Entry}">
<Setter Property="FontFamily" Value="Montserrat-Regular" />
<Setter Property="TextColor" Value="{StaticResource BlackColor}" />
<Setter Property="PlaceholderColor" Value="{StaticResource BlackColor}" />
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource BlackColor}, Dark=White}" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource BlackColor}, Dark=White}" />
<Setter Property="FontSize" Value="{StaticResource LargeSize}" />
<Setter Property="HorizontalOptions" Value="FillAndExpand" />
<Setter Property="FontAttributes" Value="Bold" />
Expand Down
16 changes: 8 additions & 8 deletions eShopOnContainers/AppShell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public AppShell(INavigationService navigationService)
InitializeComponent();
}

protected override async void OnHandlerChanged()
{
base.OnHandlerChanged();

if (Handler is not null)
{
await _navigationService.InitializeAsync();
}
protected override async void OnHandlerChanged()
{
base.OnHandlerChanged();

if (Handler is not null)
{
await _navigationService.InitializeAsync();
}
}

private static void InitializeRouting()
Expand Down
12 changes: 6 additions & 6 deletions eShopOnContainers/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage(
"Interoperability",
"CA1416:Validate platform compatibility",
Justification = "Using latest Microsoft MAUI components",
using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage(
"Interoperability",
"CA1416:Validate platform compatibility",
Justification = "Using latest Microsoft MAUI components",
Scope = "module")]
5 changes: 5 additions & 0 deletions eShopOnContainers/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using eShopOnContainers.Services.Theme;
using eShopOnContainers.Services.User;
using eShopOnContainers.Views;
using Microsoft.Extensions.Logging;

namespace eShopOnContainers;

Expand Down Expand Up @@ -85,6 +86,10 @@ public static MauiAppBuilder RegisterAppServices(this MauiAppBuilder mauiAppBuil
return aes;
});

#if DEBUG
mauiAppBuilder.Logging.AddDebug();
#endif

return mauiAppBuilder;
}

Expand Down
30 changes: 9 additions & 21 deletions eShopOnContainers/Platforms/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.companyname.eshoponcontainers"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="21"
android:targetSdkVersion="33" />
<application android:allowBackup="true"
android:icon="@mipmap/appicon"
android:roundIcon="@mipmap/appicon_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:label="eShopOnContainers">
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="YOUR_KEY_GOES_HERE" />
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:supportsRtl="true" android:usesCleartextTraffic="true">
<meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR_KEY_GOES_HERE" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest>
11 changes: 11 additions & 0 deletions eShopOnContainers/Platforms/MacCatalyst/Entitlements.Debug.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Enable this value to use browser developer tools while debugging.-->
<!-- See https://aka.ms/blazor-hybrid-developer-tools -->
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>

12 changes: 12 additions & 0 deletions eShopOnContainers/Platforms/MacCatalyst/Entitlements.Release.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- See https://aka.ms/maui-publish-app-store#add-entitlements for more information about adding entitlements.-->
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

Binary file modified eShopOnContainers/Resources/Images/eshop_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion eShopOnContainers/ViewModels/LoginViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ await IsBusyFor(
try
{
await Task.Delay(10);
await Task.Delay(1000);
isAuthenticated = true;
}
Expand Down
2 changes: 1 addition & 1 deletion eShopOnContainers/ViewModels/ProfileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ await IsBusyFor(
[RelayCommand]
private async Task OrderDetailAsync(Order order)
{
if (order is null)
if (order is null || IsBusy)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion eShopOnContainers/Views/CatalogView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
SelectionChangedCommandParameter="{Binding SelectedItem, Source={RelativeSource Self}}">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical"
Span="{OnPlatform iOS=1, Android=1, Default=2}" />
Span="2" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
Expand Down
55 changes: 27 additions & 28 deletions eShopOnContainers/Views/CatalogView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using CommunityToolkit.Mvvm.Messaging;


namespace eShopOnContainers.Views;

public partial class CatalogView : ContentPageBase
Expand All @@ -9,31 +9,30 @@ public CatalogView(CatalogViewModel viewModel)
BindingContext = viewModel;

InitializeComponent();
}

protected override void OnAppearing()
{
base.OnAppearing();

WeakReferenceMessenger.Default
.Register<CatalogView, Messages.AddProductMessage>(
this,
async (recipient, message) =>
{
await recipient.Dispatcher.DispatchAsync(
async () =>
{
await recipient.badge.ScaleTo(1.2);
await recipient.badge.ScaleTo(1.0);
});
});
}

protected override void OnDisappearing()
{
base.OnDisappearing();

WeakReferenceMessenger.Default
.Unregister<Messages.AddProductMessage>(this);
}
}

protected override void OnAppearing()
{
base.OnAppearing();

WeakReferenceMessenger.Default
.Register<CatalogView, Messages.AddProductMessage>(
this,
async (recipient, message) =>
{
await recipient.Dispatcher.DispatchAsync(
async () =>
{
await recipient.badge.ScaleTo(1.2);
await recipient.badge.ScaleTo(1.0);
});
});
}

protected override void OnDisappearing()
{
base.OnDisappearing();

WeakReferenceMessenger.Default.Unregister<Messages.AddProductMessage>(this);
}
}
Loading

0 comments on commit 252020b

Please sign in to comment.