Skip to content

Commit 2eacf25

Browse files
authored
Merge pull request #9 from clm-unifly/main
Added support for .NET 7
2 parents 18b3a8f + 06a25aa commit 2eacf25

File tree

4 files changed

+68
-64
lines changed

4 files changed

+68
-64
lines changed

src/libs/Mapbox.Maui/Mapbox.Maui.csproj

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0-android;net6.0-ios;</TargetFrameworks>
4+
<TargetFrameworks>net6.0-android;net6.0-ios;net7.0-android;net7.0-ios;</TargetFrameworks>
55
<UseMaui>true</UseMaui>
66
<SingleProject>true</SingleProject>
77
<ImplicitUsings>enable</ImplicitUsings>
88

9-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
10-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
9+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.4</SupportedOSPlatformVersion>
1110
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
12-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
13-
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
14-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
1511
<RootNamespace>MapboxMaui</RootNamespace>
12+
<SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences>
1613
</PropertyGroup>
14+
15+
<PropertyGroup Condition="$(TargetFramework.Contains('-ios'))">
16+
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
17+
</PropertyGroup>
18+
1719
<!-- Android -->
1820
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1921
<WarningLevel>4</WarningLevel>
@@ -22,21 +24,21 @@
2224
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2325
<LangVersion>latestmajor</LangVersion>
2426
</PropertyGroup>
25-
<ItemGroup Condition="$(TargetFramework.StartsWith('net6.0-android')) != true">
27+
<ItemGroup Condition="$(TargetFramework.Contains('-android')) != true">
2628
<Compile Remove="**\**\*.Android.cs" />
2729
</ItemGroup>
2830

2931
<!-- Both iOS and Mac Catalyst -->
30-
<ItemGroup Condition="$(TargetFramework.StartsWith('net6.0-ios')) != true AND $(TargetFramework.StartsWith('net6.0-maccatalyst')) != true">
32+
<ItemGroup Condition="$(TargetFramework.Contains('-ios')) != true AND $(TargetFramework.Contains('-maccatalyst')) != true">
3133
<Compile Remove="**\**\*.MaciOS.cs" />
3234
<None Include="**\**\*.MaciOS.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
3335
</ItemGroup>
3436

3537
<!-- iOS -->
36-
<ItemGroup Condition="$(TargetFramework.StartsWith('net6.0-ios')) != true">
38+
<ItemGroup Condition="$(TargetFramework.Contains('-ios')) != true">
3739
<Compile Remove="**\**\*.iOS.cs" />
3840
</ItemGroup>
39-
<ItemGroup Condition="$(TargetFramework.StartsWith('net6.0-ios')) == true">
41+
<ItemGroup Condition="$(TargetFramework.Contains('-ios')) == true">
4042
<Compile Include="**\**\*.iOS.cs" />
4143
</ItemGroup>
4244

@@ -68,10 +70,10 @@
6870

6971
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
7072
<PackageReference Include="Com.Mapbox.Maps.Android" Version="10.11.1" />
71-
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="1.8.21.1" />
73+
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="1.9.0.1" />
7274
<PackageReference Include="Square.OkHttp3" Version="4.10.0.1" />
73-
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="1.8.21.1" />
74-
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.6.0.2" />
75+
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="1.9.0.1" />
76+
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.6.0.4" />
7577
</ItemGroup>
7678

7779
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">

src/qs/MapboxMauiQs/Examples/41.OfflineManager/OfflineManagerExample.cs

+41-41
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,58 @@ public class OfflineManagerExample : ContentPage, IExamplePage, IQueryAttributab
99
float tokyoZoom = 12;
1010
IOfflineManager offlineManager;
1111

12-
public OfflineManagerExample()
12+
public OfflineManagerExample()
1313
{
14-
iOSPage.SetUseSafeArea(this, false);
14+
iOSPage.SetUseSafeArea(this, false);
1515
Content = map = new MapboxView();
1616
tokyoCoord = new Point(35.682027, 139.769305);
1717

18-
map.MapReady += Map_MapReady;
18+
map.MapReady += Map_MapReady;
1919
}
2020

2121
private void Map_MapReady(object sender, EventArgs e)
2222
{
23-
var cameraOptions = new CameraOptions
23+
var cameraOptions = new CameraOptions
2424
{
25-
Center = tokyoCoord,
26-
Zoom = tokyoZoom,
25+
Center = tokyoCoord,
26+
Zoom = tokyoZoom,
2727
};
2828
map.CameraOptions = cameraOptions;
2929
map.MapboxStyle = MapboxStyle.OUTDOORS;
3030

3131
offlineManager = new OfflineManager(
32-
MauiProgram.ACCESS_TOKEN,
32+
MauiProgram.AccessToken,
3333
cameraOptions);
3434

3535
offlineManager.IsMapboxStackConnected = true;
3636

3737
offlineManager.DownloadStyle(
3838
MapboxStyle.OUTDOORS.Value,
39-
new StylePackLoadOptions
39+
new StylePackLoadOptions
4040
{
41-
Mode = GlyphsRasterizationMode.IdeographsRasterizedLocally,
42-
Metadata = new Dictionary<string, object>
43-
{
44-
{ @"tag", @"my-outdoors-style-pack" }
45-
}
41+
Mode = GlyphsRasterizationMode.IdeographsRasterizedLocally,
42+
Metadata = new Dictionary<string, object>
43+
{
44+
{ @"tag", @"my-outdoors-style-pack" }
45+
}
4646
},
47-
(progress) =>
47+
(progress) =>
4848
{
49-
System.Diagnostics.Debug.WriteLine($"PROGRESS:DownloadStyle {
50-
progress.CompletedResourceCount}/{
51-
progress.RequiredResourceCount}");
49+
System.Diagnostics.Debug.WriteLine($"PROGRESS:DownloadStyle {
50+
progress.CompletedResourceCount}/{
51+
progress.RequiredResourceCount}");
5252
},
53-
(stylePack, exception) =>
53+
(stylePack, exception) =>
5454
{
55-
if (exception != null)
56-
{
57-
System.Diagnostics.Debug.WriteLine($"ERR:DownloadStyle {exception.Message}");
58-
return;
55+
if (exception != null)
56+
{
57+
System.Diagnostics.Debug.WriteLine($"ERR:DownloadStyle {exception.Message}");
58+
return;
5959
}
60-
61-
System.Diagnostics.Debug.WriteLine($"DONE:DownloadStyle {
62-
stylePack.CompletedResourceCount}/{
63-
stylePack.RequiredResourceCount}");
60+
61+
System.Diagnostics.Debug.WriteLine($"DONE:DownloadStyle {
62+
stylePack.CompletedResourceCount}/{
63+
stylePack.RequiredResourceCount}");
6464
});
6565

6666
var tilesetDescriptorOptions = new TilesetDescriptorOptions(
@@ -76,31 +76,31 @@ private void Map_MapReady(object sender, EventArgs e)
7676
TilesetDescriptors: new [] { tilesetDescriptorOptions },
7777
AcceptsExpired: true,
7878
NetworkRestriction: NetworkRestriction.None,
79-
Metadata: new Dictionary<string, object>
80-
{
81-
{ @"tag", @"my-outdoors-tile-region" }
79+
Metadata: new Dictionary<string, object>
80+
{
81+
{ @"tag", @"my-outdoors-tile-region" }
8282
});
8383

8484
offlineManager.DownloadTile(
8585
tileRegionId,
8686
tileRegionLoadOptions,
87-
progress =>
87+
progress =>
8888
{
89-
System.Diagnostics.Debug.WriteLine($"PROGRESS:DownloadTile {
90-
progress.CompletedResourceCount}/{
91-
progress.RequiredResourceCount}");
89+
System.Diagnostics.Debug.WriteLine($"PROGRESS:DownloadTile {
90+
progress.CompletedResourceCount}/{
91+
progress.RequiredResourceCount}");
9292
},
93-
(tileRegion, exception) =>
93+
(tileRegion, exception) =>
9494
{
95-
if (exception != null)
96-
{
97-
System.Diagnostics.Debug.WriteLine($"ERR:DownloadTile {exception.Message}");
98-
return;
95+
if (exception != null)
96+
{
97+
System.Diagnostics.Debug.WriteLine($"ERR:DownloadTile {exception.Message}");
98+
return;
9999
}
100100

101-
System.Diagnostics.Debug.WriteLine($"DONE:DownloadTile {
102-
tileRegion.CompletedResourceCount}/{
103-
tileRegion.RequiredResourceCount}");
101+
System.Diagnostics.Debug.WriteLine($"DONE:DownloadTile {
102+
tileRegion.CompletedResourceCount}/{
103+
tileRegion.RequiredResourceCount}");
104104
});
105105
}
106106

src/qs/MapboxMauiQs/MapboxMauiQs.csproj

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<SingleProject>true</SingleProject>
1010
<ImplicitUsings>enable</ImplicitUsings>
1111
<IsPackable>false</IsPackable>
12-
12+
1313
<!-- Display name -->
1414
<ApplicationTitle>MapboxQs</ApplicationTitle>
1515

@@ -21,12 +21,12 @@
2121
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
2222
<ApplicationVersion>1</ApplicationVersion>
2323

24-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
25-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
24+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.4</SupportedOSPlatformVersion>
2625
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
27-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
28-
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
29-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
26+
</PropertyGroup>
27+
28+
<PropertyGroup Condition="$(TargetFramework.Contains('-ios'))">
29+
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
3030
</PropertyGroup>
3131

3232
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
@@ -75,10 +75,10 @@
7575

7676
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
7777
<PackageReference Include="Com.Mapbox.Maps.Android" Version="10.11.1" />
78-
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="1.8.21.1" />
78+
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="1.9.0.1" />
7979
<PackageReference Include="Square.OkHttp3" Version="4.10.0.1" />
80-
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="1.8.21.1" />
81-
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.6.0.2" />
80+
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="1.9.0.1" />
81+
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.6.0.4" />
8282
</ItemGroup>
8383
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
8484
<PackageReference Include="MapboxMapsObjC.iOS" Version="10.11.1.1" />

src/qs/MapboxMauiQs/MauiProgram.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ namespace MapboxMauiQs;
55

66
public static partial class MauiProgram
77
{
8+
public static string AccessToken => throw new Exception("[your token]");
9+
810
public static MauiApp CreateMauiApp()
911
{
1012
var builder = MauiApp.CreateBuilder();
1113
builder
1214
.UseMauiApp<App>()
13-
.UseMapbox(ACCESS_TOKEN)
15+
.UseMapbox(AccessToken)
1416
.ConfigureFonts(fonts =>
1517
{
1618
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");

0 commit comments

Comments
 (0)