Skip to content

Commit fc1816b

Browse files
feat: v11.3.0 -alpha03 (#14)
* WIP * - new sample * - correct package version (cherry picked from commit 7002f7b68fd805250a98b39dc001b70fe983086d) * - hide build errors (cherry picked from commit 9746886adb1a4f6aa6d2fda209434d214a3ae7cb) * - hide build errors * - Checking iOS [WIP] * - set access token for iOS * - remove unnecessary code * - add groupindex and item index * - align built-in styles to v11.1.0 Android SDK * - upgrade nuget version * - Fix many TODOs * - MapboxMapsObjc v11.1.0 * - use Mapbox SDK v11 (many examples not working) * - Set lib version * - correct version in readme * Extend GeometryExtension on Android to support converting Point to MapTappedPosition * MapboxFragment - Implement long clicked listener * Add new event and command for shared MapboxView that handles long click * Android MapboxViewHandler - handle long click event from fragment * iOS MapboxViewHandler - support long press * Android - unsubscribe long press in handler * iOS - Check long press state and make sure event is triggered only 1 time, when it begins * iOS - Add extension which helps with creating MapTappedPosition * Android - Fix issue where MapTappedPosition doesn't contain actual screen coordinates * Android - for screen coordinates adjust pixels to dp * - use .NET8 - use latest Mapbox SDK 11.3.x * - use latesting Android SDK binding * - correct nuget.config * Support geojson string ios (#12) * feat: v11.x.y enhance window build (#13) * - use shared files to work on Windows - change Maui.Graphics.Point to GeoJSON.IPosition for location coordinate e.g. mapcenter * - bumb new version * - amend CI/CD * - correct ci/cd script * - trigger fake build * - config download token * - try pass csproj property from cli * feat: Sample AnimatePointAnnotation (not done) (#15) * - only pack the MAUI lib * - Change to IPosition instead of GeoJSON.Point for MapTappedLocation - Change MapTappedPosition to a record - Add CoordinateBounds * - Add empty example AnimatePointAnnotation * - fix issue of converting MapboxGeoJSON Point to GeoJSON.NET.Position * bumb new version --------- Co-authored-by: Andrei Dinca <> Co-authored-by: DincaAndrei <36826452+DincaAndrei2410@users.noreply.github.com>
1 parent 2eacf25 commit fc1816b

File tree

104 files changed

+1961
-2351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1961
-2351
lines changed

.config/dotnet-tools.json

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
{
2-
"version": 1,
3-
"isRoot": true,
4-
"tools": {}
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"cake.tool": {
6+
"version": "4.0.0",
7+
"commands": [
8+
"dotnet-cake"
9+
]
10+
}
11+
}
512
}

.github/workflows/publish-nuget.yml

+33-6
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ jobs:
1414
if: ${{ inputs.SHOULD_RUN }}
1515
steps:
1616
- uses: actions/checkout@v3
17-
- name: Set default Xamarin SDK versions
18-
run: |
19-
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=13.0
20-
17+
2118
- name: Set .netrc
2219
run: |
2320
echo $NETRC >> ~/.netrc
@@ -26,18 +23,48 @@ jobs:
2623
env:
2724
NETRC : ${{secrets.NETRC}}
2825

29-
- name: Setup .NET Core SDK 7.0.306
26+
- name: Setup .NET Core SDK 8.0
3027
uses: actions/setup-dotnet@v3
3128
with:
32-
dotnet-version: '7.0.306'
29+
dotnet-version: '8.0'
3330

3431
- name: Install ios workload
3532
run: |
3633
dotnet workload install ios android maui maui-ios maui-android
3734
35+
- name: Setup Java 17
36+
uses: actions/setup-java@v3
37+
with:
38+
distribution: 'microsoft'
39+
java-version: '17'
40+
41+
- name: Xcode Select Version
42+
uses: mobiledevops/xcode-select-version-action@v1
43+
with:
44+
xcode-select-version: 15.1
45+
46+
- name: Set MAPBOX_DOWNLOADS_TOKEN
47+
if: contains(${{ inputs.LIB_ARTIFACT }}, 'com.mapbox.maps')
48+
run: |
49+
echo "MAPBOX_DOWNLOADS_TOKEN=$MAPBOX_DOWNLOADS_TOKEN" >> ~/.gradle/gradle.properties
50+
cat ~/.gradle/gradle.properties
51+
shell: bash
52+
env:
53+
MAPBOX_DOWNLOADS_TOKEN : ${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
54+
55+
- name: Create MauiProgram.dev.cs
56+
run: |
57+
cp src/qs/MapboxMauiQs/MauiProgram.dev.cs.example src/qs/MapboxMauiQs/MauiProgram.dev.cs
58+
59+
# - name: Create MapboxMauiQs.props
60+
# run: |
61+
# echo "${{ secrets.PROJECT_PROPS }}" > src/qs/MapboxMauiQs/MapboxMauiQs.props
62+
3863
- name: Build
3964
run: |
4065
sh build.sh
66+
env:
67+
MAPBOX_DOWNLOADS_TOKEN : ${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
4168

4269
- name: Publish NuGet and symbols
4370
id: nuget-push

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A dedicated library and starting sample for integrating Mapbox into your MAUI ap
55
# Installation
66

77
```
8-
Install-Package Mapbox.Maui --version 10.11.1.1
8+
Install-Package Mapbox.Maui --version 11.1.0-alpha01
99
```
1010

1111
## Integrate into your project

build.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
dotnet nuget locals -c all
2-
dotnet pack -c Release -t:Clean,Rebuild src/libs/Mapbox.Maui/Mapbox.Maui.csproj --output $PWD/nugets
2+
3+
# Build to trigger gradle process
4+
dotnet build -t:Clean,Rebuild src/qs/MapboxMauiQs/MapboxMauiQs.csproj \
5+
-property:MAPBOX_DOWNLOADS_TOKEN=$MAPBOX_DOWNLOADS_TOKEN
6+
7+
dotnet pack -c Release -t:Clean,Rebuild src/libs/Mapbox.Maui/Mapbox.Maui.csproj \
8+
--output $PWD/nugets

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "7.0.306",
3+
"version": "8.0.100",
44
"rollForward": "latestFeature"
55
}
66
}

nuget.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4-
<add key="Mapbox-Local" value="nugets" />
4+
<add key="Local" value="nugets" />
55
</packageSources>
66
</configuration>

src/libs/Mapbox.Maui/IMapboxView.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public partial interface IMapboxView : IView
99
{
1010
CameraOptions CameraOptions { get; set; }
1111
MapboxStyle MapboxStyle { get; set; }
12-
Point? MapCenter { get; set; }
12+
IPosition MapCenter { get; set; }
1313
float? MapZoom { get; set; }
1414

1515
OrnamentVisibility ScaleBarVisibility { get; set; }
@@ -58,7 +58,13 @@ public interface IAnnotationController
5858

5959
public interface IMapFeatureQueryable
6060
{
61-
Task<IEnumerable<QueriedFeature>> QueryRenderedFeaturesWith(Point point, RenderedQueryOptions options);
61+
Task<IEnumerable<QueriedRenderedFeature>> QueryRenderedFeaturesWith(ScreenPosition point, RenderedQueryOptions options);
62+
}
63+
64+
public interface IMapboxController
65+
{
66+
IPosition GetMapPosition(ScreenPosition position);
67+
CoordinateBounds GetCoordinateBoundsForCamera(CameraOptions cameraOptions);
6268
}
6369

6470
public class MapTappedEventArgs : EventArgs

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

+25-20
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<Target Name="_CleanAarOutputPath" AfterTargets="_CreateAar" BeforeTargets="_IncludeAarInNuGetPackage">
3+
<Delete Files="$(_AarOutputPath)" />
4+
</Target>
25

36
<PropertyGroup>
4-
<TargetFrameworks>net6.0-android;net6.0-ios;net7.0-android;net7.0-ios;</TargetFrameworks>
7+
<TargetFrameworks>net8.0-android;net8.0-ios;</TargetFrameworks>
58
<UseMaui>true</UseMaui>
69
<SingleProject>true</SingleProject>
710
<ImplicitUsings>enable</ImplicitUsings>
811

912
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.4</SupportedOSPlatformVersion>
10-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
13+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">26.0</SupportedOSPlatformVersion>
1114
<RootNamespace>MapboxMaui</RootNamespace>
1215
<SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences>
1316
</PropertyGroup>
@@ -24,23 +27,20 @@
2427
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2528
<LangVersion>latestmajor</LangVersion>
2629
</PropertyGroup>
27-
<ItemGroup Condition="$(TargetFramework.Contains('-android')) != true">
30+
<ItemGroup Condition=" $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'android' ">
2831
<Compile Remove="**\**\*.Android.cs" />
2932
</ItemGroup>
3033

3134
<!-- Both iOS and Mac Catalyst -->
32-
<ItemGroup Condition="$(TargetFramework.Contains('-ios')) != true AND $(TargetFramework.Contains('-maccatalyst')) != true">
35+
<ItemGroup Condition=" $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'ios' AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'maccatalyst' ">
3336
<Compile Remove="**\**\*.MaciOS.cs" />
3437
<None Include="**\**\*.MaciOS.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
3538
</ItemGroup>
3639

3740
<!-- iOS -->
38-
<ItemGroup Condition="$(TargetFramework.Contains('-ios')) != true">
41+
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'ios'">
3942
<Compile Remove="**\**\*.iOS.cs" />
4043
</ItemGroup>
41-
<ItemGroup Condition="$(TargetFramework.Contains('-ios')) == true">
42-
<Compile Include="**\**\*.iOS.cs" />
43-
</ItemGroup>
4444

4545
<PropertyGroup>
4646
<PackageId>Mapbox.Maui</PackageId>
@@ -53,32 +53,34 @@
5353
<RepositoryUrl>https://github.com/tuyen-vuduc/mapbox-maui</RepositoryUrl>
5454
<PackageProjectUrl>https://mapbox.tuyen-vuduc.tech</PackageProjectUrl>
5555
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
56-
<PackageVersion>10.11.1.1</PackageVersion>
56+
<PackageVersion>11.3.0-alpha03</PackageVersion>
5757
<PackageReadmeFile>README.md</PackageReadmeFile>
5858
<PackageLicenseFile>LICENSE</PackageLicenseFile>
5959
<PackageIcon>tv-mapbox.png</PackageIcon>
6060
</PropertyGroup>
61+
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
62+
<CreatePackage>false</CreatePackage>
63+
</PropertyGroup>
6164
<ItemGroup>
6265
<None Include="../../../assets/tv-mapbox.png" Pack="True" PackagePath="tv-mapbox.png" />
6366
<None Include="../../../LICENSE" Pack="True" PackagePath="" />
6467
<None Include="../../../README.md" Pack="True" PackagePath="README.md" />
6568

66-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
69+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
6770
<PackageReference Include="Xamarin.Build.Download" Version="0.11.4" />
6871
<PackageReference Include="GeoJSON.Text" Version="1.0.2" />
72+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" />
6973
</ItemGroup>
70-
7174
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
72-
<PackageReference Include="Com.Mapbox.Maps.Android" Version="10.11.1" />
73-
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="1.9.0.1" />
74-
<PackageReference Include="Square.OkHttp3" Version="4.10.0.1" />
75-
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="1.9.0.1" />
76-
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.6.0.4" />
75+
<PackageReference Include="Com.Mapbox.Maps.Android" Version="11.3.1.7" />
76+
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.6.1.8" />
77+
<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.6.2.3" />
78+
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="1.9.23.1" PrivateAssets="none" />
79+
<PackageReference Include="Xamarin.Kotlin.StdLib.Common" Version="1.9.23.1" PrivateAssets="none" />
7780
</ItemGroup>
78-
7981
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
80-
<PackageReference Include="MapboxMapsObjC.iOS" Version="10.11.1.1" />
81-
<PackageReference Include="MapboxMobileEvents.iOS" Version="1.0.10.1" />
82+
<PackageReference Include="MapboxMapsObjC.iOS" Version="11.3.0.3" />
83+
<PackageReference Include="MapboxMaps.iOS" Version="11.3.0.2" />
8284
</ItemGroup>
8385
<ItemGroup>
8486
<Folder Include="Models\Styles\" />
@@ -102,4 +104,7 @@
102104
</Properties>
103105
</MonoDevelop>
104106
</ProjectExtensions>
107+
<ItemGroup>
108+
<PackageReference Update="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" />
109+
</ItemGroup>
105110
</Project>

src/libs/Mapbox.Maui/MapboxView.Events.cs

+23-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
partial class MapboxView
66
{
77
public event EventHandler<MapTappedEventArgs> MapTapped;
8+
public event EventHandler<MapTappedEventArgs> MapLongTapped;
89
internal void InvokeMapTapped(MapTappedPosition point)
910
{
1011
MapTapped?.Invoke(this, new MapTappedEventArgs(point));
@@ -14,6 +15,27 @@ internal void InvokeMapTapped(MapTappedPosition point)
1415
Command.Execute(point);
1516
}
1617
}
18+
19+
internal void InvokeMapLongTapped(MapTappedPosition position)
20+
{
21+
MapLongTapped?.Invoke(this, new MapTappedEventArgs(position));
22+
23+
if (LongTapCommand?.CanExecute(position) == true)
24+
{
25+
LongTapCommand.Execute(position);
26+
}
27+
}
28+
29+
public static readonly BindableProperty LongTapCommandProperty = BindableProperty.Create(
30+
nameof(LongTapCommand),
31+
typeof(ICommand),
32+
typeof(MapboxView)
33+
);
34+
public ICommand LongTapCommand
35+
{
36+
get => (ICommand)GetValue(CommandProperty);
37+
set => SetValue(CommandProperty, value);
38+
}
1739

1840
public static readonly BindableProperty CommandProperty = BindableProperty.Create(
1941
nameof(Command),
@@ -94,12 +116,4 @@ public ICommand MapLoadedCommand
94116
get => (ICommand)GetValue(MapLoadedCommandProperty);
95117
set => SetValue(MapLoadedCommandProperty, value);
96118
}
97-
}
98-
99-
public class MapTappedPosition
100-
{
101-
public Point ScreenPosition { get; set; }
102-
103-
public GeoJSON.Text.Geometry.Point Point { get; set; }
104-
}
105-
119+
}

src/libs/Mapbox.Maui/MapboxView.cs

+7-6
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ public CameraOptions CameraOptions
119119

120120
public static readonly BindableProperty MapCenterProperty = BindableProperty.Create(
121121
nameof(MapCenter),
122-
typeof(Point?),
122+
typeof(IPosition),
123123
typeof(MapboxView),
124-
default(Point?)
124+
default(IPosition)
125125
);
126-
public Point? MapCenter
126+
public IPosition MapCenter
127127
{
128128
get => CameraOptions.Center;
129129
set => CameraOptions = CameraOptions with
@@ -149,11 +149,11 @@ public Thickness? MapPadding
149149

150150
public static readonly BindableProperty MapAnchorProperty = BindableProperty.Create(
151151
nameof(MapAnchor),
152-
typeof(Point?),
152+
typeof(ScreenPosition?),
153153
typeof(MapboxView),
154-
default(Point?)
154+
default(ScreenPosition?)
155155
);
156-
public Point? MapAnchor
156+
public ScreenPosition? MapAnchor
157157
{
158158
get => CameraOptions.Anchor;
159159
set => CameraOptions = CameraOptions with
@@ -221,4 +221,5 @@ public MapboxStyle MapboxStyle
221221

222222
public IAnnotationController AnnotationController { get; internal set; }
223223
public IMapFeatureQueryable QueryManager { get; internal set; }
224+
public IMapboxController MapboxController { get; internal set; }
224225
}

src/libs/Mapbox.Maui/Models/Annotations/IPointAnnotationManager.cs

-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ public interface IPointAnnotationManager : IAnnotationManager<PointAnnotation>
99
double? IconPadding { get; set; }
1010
IconPitchAlignment? IconPitchAlignment { get; set; }
1111
IconRotationAlignment? IconRotationAlignment { get; set; }
12-
IconTextFit? IconTextFit { get; set; }
13-
double[] IconTextFitPadding { get; set; }
1412
bool? SymbolAvoidEdges { get; set; }
1513
SymbolPlacement? SymbolPlacement { get; set; }
1614
double? SymbolSpacing { get; set; }
@@ -30,7 +28,6 @@ public interface IPointAnnotationManager : IAnnotationManager<PointAnnotation>
3028
IconTranslateAnchor? IconTranslateAnchor { get; set; }
3129
double[] TextTranslate { get; set; }
3230
TextTranslateAnchor? TextTranslateAnchor { get; set; }
33-
double? TextLineHeight { get; set; }
3431
}
3532

3633
public partial class PointAnnotationManager

src/libs/Mapbox.Maui/Models/BaseKVContainer.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System.Collections.ObjectModel;
2-
using System.Collections.Specialized;
3-
4-
namespace MapboxMaui;
1+
namespace MapboxMaui;
52

63
public abstract class BaseKVContainer : INotifyCollectionChanged
74
{

src/libs/Mapbox.Maui/Models/CameraOptions.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
public record struct CameraOptions
44
{
5-
public Point? Center { get; set; }
5+
public IPosition Center { get; set; }
66
public Thickness? Padding { get; set; }
7-
public Point? Anchor { get; set; }
7+
public ScreenPosition? Anchor { get; set; }
88
public float? Zoom { get; set; }
99
public float? Bearing { get; set; }
1010
public float? Pitch { get; set; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace MapboxMaui;
2+
3+
public record CoordinateBounds (
4+
IPosition Southwest,
5+
IPosition Northeast,
6+
bool InfiniteBounds = false);

0 commit comments

Comments
 (0)