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

feat: v11.3.0 -alpha03 #14

Merged
merged 32 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
598a9e5
WIP
tuyen-vuduc Feb 16, 2024
132d415
- new sample
tuyen-vuduc Feb 16, 2024
b147e2f
- correct package version
tuyen-vuduc Feb 17, 2024
b2d5f36
- hide build errors
tuyen-vuduc Feb 17, 2024
5d35791
- hide build errors
tuyen-vuduc Feb 17, 2024
f1cbb77
- Checking iOS [WIP]
tuyen-vuduc Feb 17, 2024
1209a17
- set access token for iOS
tuyen-vuduc Feb 17, 2024
e079c66
- remove unnecessary code
tuyen-vuduc Feb 17, 2024
230873e
- add groupindex and item index
tuyen-vuduc Feb 19, 2024
9987436
- align built-in styles to v11.1.0 Android SDK
tuyen-vuduc Feb 19, 2024
5fa3bd9
- upgrade nuget version
tuyen-vuduc Feb 21, 2024
b773262
- Fix many TODOs
tuyen-vuduc Feb 22, 2024
e9a919f
- MapboxMapsObjc v11.1.0
tuyen-vuduc Feb 23, 2024
b7722f7
- use Mapbox SDK v11 (many examples not working)
tuyen-vuduc Feb 28, 2024
e8aac6b
- Set lib version
tuyen-vuduc Feb 28, 2024
5bd2943
- correct version in readme
tuyen-vuduc Feb 28, 2024
7596279
Extend GeometryExtension on Android to support converting Point to Ma…
Apr 20, 2024
f130e0d
MapboxFragment - Implement long clicked listener
Apr 20, 2024
79ef62c
Add new event and command for shared MapboxView that handles long click
Apr 20, 2024
3f6be90
Android MapboxViewHandler - handle long click event from fragment
Apr 20, 2024
01a0e28
iOS MapboxViewHandler - support long press
Apr 20, 2024
9536462
Android - unsubscribe long press in handler
Apr 20, 2024
d2e5eb2
iOS - Check long press state and make sure event is triggered only 1 …
Apr 20, 2024
120d243
iOS - Add extension which helps with creating MapTappedPosition
Apr 20, 2024
b88b021
Android - Fix issue where MapTappedPosition doesn't contain actual sc…
Apr 20, 2024
d96d986
Android - for screen coordinates adjust pixels to dp
Apr 20, 2024
30029c0
- use .NET8
tuyen-vuduc May 25, 2024
43098fe
- use latesting Android SDK binding
tuyen-vuduc May 25, 2024
c890ce8
- correct nuget.config
tuyen-vuduc May 25, 2024
5f5cd29
Support geojson string ios (#12)
DincaAndrei2410 Jun 20, 2024
1ef495e
feat: v11.x.y enhance window build (#13)
tuyen-vuduc Jun 25, 2024
7be4507
feat: Sample AnimatePointAnnotation (not done) (#15)
tuyen-vuduc Jun 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {}
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "4.0.0",
"commands": [
"dotnet-cake"
]
}
}
}
39 changes: 33 additions & 6 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ jobs:
if: ${{ inputs.SHOULD_RUN }}
steps:
- uses: actions/checkout@v3
- name: Set default Xamarin SDK versions
run: |
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --android=13.0


- name: Set .netrc
run: |
echo $NETRC >> ~/.netrc
Expand All @@ -26,18 +23,48 @@ jobs:
env:
NETRC : ${{secrets.NETRC}}

- name: Setup .NET Core SDK 7.0.306
- name: Setup .NET Core SDK 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.306'
dotnet-version: '8.0'

- name: Install ios workload
run: |
dotnet workload install ios android maui maui-ios maui-android

- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '17'

- name: Xcode Select Version
uses: mobiledevops/xcode-select-version-action@v1
with:
xcode-select-version: 15.1

- name: Set MAPBOX_DOWNLOADS_TOKEN
if: contains(${{ inputs.LIB_ARTIFACT }}, 'com.mapbox.maps')
run: |
echo "MAPBOX_DOWNLOADS_TOKEN=$MAPBOX_DOWNLOADS_TOKEN" >> ~/.gradle/gradle.properties
cat ~/.gradle/gradle.properties
shell: bash
env:
MAPBOX_DOWNLOADS_TOKEN : ${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}

- name: Create MauiProgram.dev.cs
run: |
cp src/qs/MapboxMauiQs/MauiProgram.dev.cs.example src/qs/MapboxMauiQs/MauiProgram.dev.cs

# - name: Create MapboxMauiQs.props
# run: |
# echo "${{ secrets.PROJECT_PROPS }}" > src/qs/MapboxMauiQs/MapboxMauiQs.props

- name: Build
run: |
sh build.sh
env:
MAPBOX_DOWNLOADS_TOKEN : ${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}

- name: Publish NuGet and symbols
id: nuget-push
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A dedicated library and starting sample for integrating Mapbox into your MAUI ap
# Installation

```
Install-Package Mapbox.Maui --version 10.11.1.1
Install-Package Mapbox.Maui --version 11.1.0-alpha01
```

## Integrate into your project
Expand Down
8 changes: 7 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
dotnet nuget locals -c all
dotnet pack -c Release -t:Clean,Rebuild src/libs/Mapbox.Maui/Mapbox.Maui.csproj --output $PWD/nugets

# Build to trigger gradle process
dotnet build -t:Clean,Rebuild src/qs/MapboxMauiQs/MapboxMauiQs.csproj \
-property:MAPBOX_DOWNLOADS_TOKEN=$MAPBOX_DOWNLOADS_TOKEN

dotnet pack -c Release -t:Clean,Rebuild src/libs/Mapbox.Maui/Mapbox.Maui.csproj \
--output $PWD/nugets
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.306",
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
2 changes: 1 addition & 1 deletion nuget.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="Mapbox-Local" value="nugets" />
<add key="Local" value="nugets" />
</packageSources>
</configuration>
10 changes: 8 additions & 2 deletions src/libs/Mapbox.Maui/IMapboxView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public partial interface IMapboxView : IView
{
CameraOptions CameraOptions { get; set; }
MapboxStyle MapboxStyle { get; set; }
Point? MapCenter { get; set; }
IPosition MapCenter { get; set; }
float? MapZoom { get; set; }

OrnamentVisibility ScaleBarVisibility { get; set; }
Expand Down Expand Up @@ -58,7 +58,13 @@ public interface IAnnotationController

public interface IMapFeatureQueryable
{
Task<IEnumerable<QueriedFeature>> QueryRenderedFeaturesWith(Point point, RenderedQueryOptions options);
Task<IEnumerable<QueriedRenderedFeature>> QueryRenderedFeaturesWith(ScreenPosition point, RenderedQueryOptions options);
}

public interface IMapboxController
{
IPosition GetMapPosition(ScreenPosition position);
CoordinateBounds GetCoordinateBoundsForCamera(CameraOptions cameraOptions);
}

public class MapTappedEventArgs : EventArgs
Expand Down
45 changes: 25 additions & 20 deletions src/libs/Mapbox.Maui/Mapbox.Maui.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Target Name="_CleanAarOutputPath" AfterTargets="_CreateAar" BeforeTargets="_IncludeAarInNuGetPackage">
<Delete Files="$(_AarOutputPath)" />
</Target>

<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;net7.0-android;net7.0-ios;</TargetFrameworks>
<TargetFrameworks>net8.0-android;net8.0-ios;</TargetFrameworks>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.4</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">26.0</SupportedOSPlatformVersion>
<RootNamespace>MapboxMaui</RootNamespace>
<SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences>
</PropertyGroup>
Expand All @@ -24,23 +27,20 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<LangVersion>latestmajor</LangVersion>
</PropertyGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-android')) != true">
<ItemGroup Condition=" $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'android' ">
<Compile Remove="**\**\*.Android.cs" />
</ItemGroup>

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

<!-- iOS -->
<ItemGroup Condition="$(TargetFramework.Contains('-ios')) != true">
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'ios'">
<Compile Remove="**\**\*.iOS.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-ios')) == true">
<Compile Include="**\**\*.iOS.cs" />
</ItemGroup>

<PropertyGroup>
<PackageId>Mapbox.Maui</PackageId>
Expand All @@ -53,32 +53,34 @@
<RepositoryUrl>https://github.com/tuyen-vuduc/mapbox-maui</RepositoryUrl>
<PackageProjectUrl>https://mapbox.tuyen-vuduc.tech</PackageProjectUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageVersion>10.11.1.1</PackageVersion>
<PackageVersion>11.3.0-alpha03</PackageVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>tv-mapbox.png</PackageIcon>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<ItemGroup>
<None Include="../../../assets/tv-mapbox.png" Pack="True" PackagePath="tv-mapbox.png" />
<None Include="../../../LICENSE" Pack="True" PackagePath="" />
<None Include="../../../README.md" Pack="True" PackagePath="README.md" />

<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Xamarin.Build.Download" Version="0.11.4" />
<PackageReference Include="GeoJSON.Text" Version="1.0.2" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<PackageReference Include="Com.Mapbox.Maps.Android" Version="10.11.1" />
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="1.9.0.1" />
<PackageReference Include="Square.OkHttp3" Version="4.10.0.1" />
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="1.9.0.1" />
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.6.0.4" />
<PackageReference Include="Com.Mapbox.Maps.Android" Version="11.3.1.7" />
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.6.1.8" />
<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.6.2.3" />
<PackageReference Include="Xamarin.Kotlin.StdLib" Version="1.9.23.1" PrivateAssets="none" />
<PackageReference Include="Xamarin.Kotlin.StdLib.Common" Version="1.9.23.1" PrivateAssets="none" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<PackageReference Include="MapboxMapsObjC.iOS" Version="10.11.1.1" />
<PackageReference Include="MapboxMobileEvents.iOS" Version="1.0.10.1" />
<PackageReference Include="MapboxMapsObjC.iOS" Version="11.3.0.3" />
<PackageReference Include="MapboxMaps.iOS" Version="11.3.0.2" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\Styles\" />
Expand All @@ -102,4 +104,7 @@
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup>
<PackageReference Update="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" />
</ItemGroup>
</Project>
32 changes: 23 additions & 9 deletions src/libs/Mapbox.Maui/MapboxView.Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
partial class MapboxView
{
public event EventHandler<MapTappedEventArgs> MapTapped;
public event EventHandler<MapTappedEventArgs> MapLongTapped;
internal void InvokeMapTapped(MapTappedPosition point)
{
MapTapped?.Invoke(this, new MapTappedEventArgs(point));
Expand All @@ -14,6 +15,27 @@ internal void InvokeMapTapped(MapTappedPosition point)
Command.Execute(point);
}
}

internal void InvokeMapLongTapped(MapTappedPosition position)
{
MapLongTapped?.Invoke(this, new MapTappedEventArgs(position));

if (LongTapCommand?.CanExecute(position) == true)
{
LongTapCommand.Execute(position);
}
}

public static readonly BindableProperty LongTapCommandProperty = BindableProperty.Create(
nameof(LongTapCommand),
typeof(ICommand),
typeof(MapboxView)
);
public ICommand LongTapCommand
{
get => (ICommand)GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}

public static readonly BindableProperty CommandProperty = BindableProperty.Create(
nameof(Command),
Expand Down Expand Up @@ -94,12 +116,4 @@ public ICommand MapLoadedCommand
get => (ICommand)GetValue(MapLoadedCommandProperty);
set => SetValue(MapLoadedCommandProperty, value);
}
}

public class MapTappedPosition
{
public Point ScreenPosition { get; set; }

public GeoJSON.Text.Geometry.Point Point { get; set; }
}

}
13 changes: 7 additions & 6 deletions src/libs/Mapbox.Maui/MapboxView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ public CameraOptions CameraOptions

public static readonly BindableProperty MapCenterProperty = BindableProperty.Create(
nameof(MapCenter),
typeof(Point?),
typeof(IPosition),
typeof(MapboxView),
default(Point?)
default(IPosition)
);
public Point? MapCenter
public IPosition MapCenter
{
get => CameraOptions.Center;
set => CameraOptions = CameraOptions with
Expand All @@ -149,11 +149,11 @@ public Thickness? MapPadding

public static readonly BindableProperty MapAnchorProperty = BindableProperty.Create(
nameof(MapAnchor),
typeof(Point?),
typeof(ScreenPosition?),
typeof(MapboxView),
default(Point?)
default(ScreenPosition?)
);
public Point? MapAnchor
public ScreenPosition? MapAnchor
{
get => CameraOptions.Anchor;
set => CameraOptions = CameraOptions with
Expand Down Expand Up @@ -221,4 +221,5 @@ public MapboxStyle MapboxStyle

public IAnnotationController AnnotationController { get; internal set; }
public IMapFeatureQueryable QueryManager { get; internal set; }
public IMapboxController MapboxController { get; internal set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ public interface IPointAnnotationManager : IAnnotationManager<PointAnnotation>
double? IconPadding { get; set; }
IconPitchAlignment? IconPitchAlignment { get; set; }
IconRotationAlignment? IconRotationAlignment { get; set; }
IconTextFit? IconTextFit { get; set; }
double[] IconTextFitPadding { get; set; }
bool? SymbolAvoidEdges { get; set; }
SymbolPlacement? SymbolPlacement { get; set; }
double? SymbolSpacing { get; set; }
Expand All @@ -30,7 +28,6 @@ public interface IPointAnnotationManager : IAnnotationManager<PointAnnotation>
IconTranslateAnchor? IconTranslateAnchor { get; set; }
double[] TextTranslate { get; set; }
TextTranslateAnchor? TextTranslateAnchor { get; set; }
double? TextLineHeight { get; set; }
}

public partial class PointAnnotationManager
Expand Down
5 changes: 1 addition & 4 deletions src/libs/Mapbox.Maui/Models/BaseKVContainer.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Collections.ObjectModel;
using System.Collections.Specialized;

namespace MapboxMaui;
namespace MapboxMaui;

public abstract class BaseKVContainer : INotifyCollectionChanged
{
Expand Down
4 changes: 2 additions & 2 deletions src/libs/Mapbox.Maui/Models/CameraOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

public record struct CameraOptions
{
public Point? Center { get; set; }
public IPosition Center { get; set; }
public Thickness? Padding { get; set; }
public Point? Anchor { get; set; }
public ScreenPosition? Anchor { get; set; }
public float? Zoom { get; set; }
public float? Bearing { get; set; }
public float? Pitch { get; set; }
Expand Down
6 changes: 6 additions & 0 deletions src/libs/Mapbox.Maui/Models/CoordinateBounds.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace MapboxMaui;

public record CoordinateBounds (
IPosition Southwest,
IPosition Northeast,
bool InfiniteBounds = false);
Loading