Skip to content

Commit 963b93b

Browse files
authored
Updates Float.Core for MAUI 9 (#49)
1 parent 9deaf4c commit 963b93b

File tree

8 files changed

+48
-44
lines changed

8 files changed

+48
-44
lines changed

.github/workflows/deploy.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,35 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
with:
1414
fetch-depth: 0
1515
- name: Setup .NET
16-
uses: actions/setup-dotnet@v3
16+
uses: actions/setup-dotnet@v4
1717
with:
18-
dotnet-version: |
19-
6.0.x
20-
7.0.x
21-
8.0.x
18+
dotnet-version: 9.0.x
2219
- name: Retore Workload
2320
run: dotnet workload restore
2421
- name: Restore dependencies
2522
run: dotnet restore
26-
# This action does a nice job of updating the version, but it does not ensure a valid version format.
27-
- name: .NET project version updater
23+
- name: Prepare assembly version
24+
id: version
25+
run: |
26+
VERSION=${{ github.event.release.name }}
27+
echo "assembly=${VERSION%-*}.${{ github.run_number }}" >> "$GITHUB_OUTPUT"
28+
- name: Update project version
2829
uses: vers-one/dotnet-project-version-updater@v1.7
2930
with:
30-
file: |
31-
"Float.Core/Float.Core.csproj", "**/*.nuspec", "**/AssemblyInfo.cs"
31+
file: "**/*.csproj"
3232
version: ${{ github.event.release.name }}
33+
- name: Update assembly version
34+
uses: vers-one/dotnet-project-version-updater@v1.7
35+
with:
36+
file: "**/AssemblyInfo.cs"
37+
version: ${{ steps.version.outputs.assembly }}
3338
- name: Build Library
3439
run: dotnet build ./Float.Core/Float.Core.csproj --configuration Release --no-restore
35-
- name: Pack and Upload
40+
- name: Pack
3641
run: dotnet pack --configuration Release --no-restore
3742
- name: Archive artifact
3843
uses: actions/upload-artifact@v4

.github/workflows/test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
- name: Setup .NET
14-
uses: actions/setup-dotnet@v3
14+
uses: actions/setup-dotnet@v4
1515
with:
1616
dotnet-version: |
17-
6.0.x
18-
7.0.x
1917
8.0.x
18+
9.0.x
2019
- name: Restore Workload
2120
run: dotnet workload restore
2221
- name: Restore dependencies

Float.Core.Tests/DebounceCommand.tests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ namespace Float.Core.Tests
1313
{
1414
public class DebounceCommandTests
1515
{
16+
Timer timer;
17+
1618
[Fact]
1719
public async Task TestDoesDebounceTimer()
1820
{
@@ -23,7 +25,7 @@ public async Task TestDoesDebounceTimer()
2325
var debouncedIncrementCommand = new DebounceCommand(incrementCommand, 450);
2426

2527
// attempt to increment every 100ms
26-
new Timer(arg => debouncedIncrementCommand.Execute(arg), null, 100, 100);
28+
timer = new Timer(arg => debouncedIncrementCommand.Execute(arg), null, 100, 100);
2729

2830
// wait one second
2931
await Task.Delay(1000);

Float.Core.Tests/Float.Core.Tests.csproj

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net7.0;net8.0;</TargetFrameworks>
3+
<TargetFrameworks>net8.0;net9.0;</TargetFrameworks>
44
<IsPackable>false</IsPackable>
55
<LangVersion>9.0</LangVersion>
6-
<UseMaui>true</UseMaui>
76
</PropertyGroup>
87
<ItemGroup>
98
<AdditionalFiles Include="../stylecop.json" />
109
</ItemGroup>
1110
<PropertyGroup>
1211
<CodeAnalysisRuleSet>../stylecop.ruleset</CodeAnalysisRuleSet>
1312
</PropertyGroup>
14-
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0' OR '$(TargetFramework)' == 'net7.0'">
15-
<PackageReference Include="coverlet.collector" Version="6.0.0">
13+
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0' OR '$(TargetFramework)' == 'net8.0'">
14+
<PackageReference Include="coverlet.collector" Version="6.0.4">
1615
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1716
<PrivateAssets>all</PrivateAssets>
1817
</PackageReference>
19-
<PackageReference Include="xunit" Version="2.5.0" />
20-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
18+
<PackageReference Include="xunit" Version="2.9.3" />
19+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.0">
2120
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2221
<PrivateAssets>all</PrivateAssets>
2322
</PackageReference>
@@ -33,9 +32,9 @@
3332
</ItemGroup>
3433
<ItemGroup>
3534
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
36-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
37-
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
38-
<PackageReference Include="XunitContext" Version="3.2.5" />
35+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
36+
<PackageReference Include="Newtonsoft.Json" Version="[13.0.3,]" />
37+
<PackageReference Include="XunitContext" Version="3.3.2" />
3938
</ItemGroup>
4039
<ItemGroup>
4140
<ProjectReference Include="..\Float.Core\Float.Core.csproj" />

Float.Core/Float.Core.csproj

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net7.0;net8.0;</TargetFrameworks>
3+
<TargetFrameworks>netstandard2;net7.0;net8.0;net9.0;</TargetFrameworks>
44
<AssemblyName>Float.Core</AssemblyName>
55
<AssemblyAuthor>Float</AssemblyAuthor>
66
<AssemblyDescription>Common utility code used by Float projects.</AssemblyDescription>
@@ -37,11 +37,20 @@
3737
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3838
<PrivateAssets>all</PrivateAssets>
3939
</PackageReference>
40-
<PackageReference Include="Newtonsoft.Json" Version="[12.0.1,]" />
40+
<PackageReference Include="Newtonsoft.Json" Version="[13.0.1,]" />
4141
<PackageReference Include="CommunityToolkit.Mvvm" Version="[8.2.2,9)" />
4242
</ItemGroup>
43-
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
44-
<PackageReference Include="Xamarin.Forms" Version="[5.0.0.1874,6)" />
43+
<ItemGroup Condition="$(TargetFramework.StartsWith('net7'))">
44+
<PackageReference Include="Microsoft.Maui.Controls" Version="[8.0.20,9)" />
45+
</ItemGroup>
46+
<ItemGroup Condition="$(TargetFramework.StartsWith('net8'))">
47+
<PackageReference Include="Microsoft.Maui.Controls" Version="[8.0.100,9)" />
48+
</ItemGroup>
49+
<ItemGroup Condition="$(TargetFramework.StartsWith('net9'))">
50+
<PackageReference Include="Microsoft.Maui.Controls" Version="[9.0.0,10)" />
51+
</ItemGroup>
52+
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
53+
<PackageReference Include="Xamarin.Forms" Version="[5.0.0.1874,6)" />
4554
</ItemGroup>
4655
<ItemGroup>
4756
<Folder Include="Properties\" />

Float.Core/L10n/TranslateExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using Xamarin.Forms;
88
using Xamarin.Forms.Xaml;
99
#else
10-
using Microsoft.Maui;
1110
using Microsoft.Maui.Controls;
1211
using Microsoft.Maui.Controls.Xaml;
1312
#endif
@@ -18,6 +17,7 @@ namespace Float.Core.L10n
1817
/// The markup extension allowing XAML to contain localization.
1918
/// </summary>
2019
[ContentProperty("Text")]
20+
[AcceptEmptyServiceProvider]
2121
public class TranslateExtension : IMarkupExtension
2222
{
2323
static readonly List<ResourceManager> RegisteredResourceManagers = new ()

Float.Core/Notifications/AlertNotificationHandler.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ protected void DisplayAlert(string title, string message)
7070
{
7171
DeviceProxy.BeginInvokeOnMainThread(() =>
7272
{
73+
#if NET8_0_OR_GREATER
74+
var page = context ?? Application.Current.Windows[0].Page;
75+
#else
7376
var page = context ?? Application.Current.MainPage;
77+
#endif
7478
page.DisplayAlert(title, message, Localize.String("OK"));
7579
});
7680
}

version.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)