Skip to content

Commit edac504

Browse files
committed
- use latest iOS SDK v11.5.1
- use new functions to add/remove annotations for iOS
1 parent c196bbf commit edac504

7 files changed

+21
-60
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@
8989
<PackageReference Include="Dependencies.Gradle" Version="8.6.0.1" />
9090
</ItemGroup>
9191
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
92-
<PackageReference Include="MapboxMapsObjC.iOS" Version="11.4.0.2" />
93-
<PackageReference Include="MapboxMaps.iOS" Version="11.4.0.1" />
92+
<PackageReference Include="MapboxMapsObjC.iOS" Version="11.5.1" />
93+
<PackageReference Include="MapboxMaps.iOS" Version="11.5.1" />
9494
</ItemGroup>
9595
<ItemGroup>
9696
<Folder Include="Models\Styles\" />

src/libs/Mapbox.Maui/Platforms/iOS/Annotations/CircleAnnotationManager.cs

+4-14
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,21 @@ public override void AddAnnotations(params CircleAnnotation[] xitems)
4949
{
5050
var items = xitems
5151
.Select(x => x.ToPlatformValue())
52-
.ToList();
53-
54-
nativeManager.Annotations = nativeManager.Annotations
55-
.Union(items)
5652
.ToArray();
53+
54+
nativeManager.AddAnnotations(items);
5755
}
5856

5957
public override void RemoveAllAnnotations()
6058
{
61-
nativeManager.Annotations = Array.Empty<TMBCircleAnnotation>();
59+
nativeManager.RemoveAllAnnotations();
6260
}
6361

6462
public override void RemoveAnnotations(params string[] annotationIDs)
6563
{
6664
for (int i = 0; i < annotationIDs.Length; i++)
6765
{
68-
var item = nativeManager.Annotations.FirstOrDefault(
69-
x => x.Id == annotationIDs[i]
70-
);
71-
if (item == null) continue;
72-
73-
var annotations = new List<TMBCircleAnnotation>(nativeManager.Annotations);
74-
annotations.Remove(item);
75-
76-
nativeManager.Annotations = annotations.ToArray();
66+
nativeManager.RemoveAnnotationById(annotationIDs[i]);
7767
}
7868
}
7969
}

src/libs/Mapbox.Maui/Platforms/iOS/Annotations/PointAnnotationManager.cs

+4-14
Original file line numberDiff line numberDiff line change
@@ -170,31 +170,21 @@ public override void AddAnnotations(params PointAnnotation[] xitems)
170170
{
171171
var items = xitems
172172
.Select(x => x.ToPlatformValue())
173-
.ToList();
174-
175-
nativeManager.Annotations = nativeManager.Annotations
176-
.Union(items)
177173
.ToArray();
174+
175+
nativeManager.AddAnnotations(items);
178176
}
179177

180178
public override void RemoveAllAnnotations()
181179
{
182-
nativeManager.Annotations = Array.Empty<TMBPointAnnotation>();
180+
nativeManager.RemoveAllAnnotations();
183181
}
184182

185183
public override void RemoveAnnotations(params string[] annotationIDs)
186184
{
187185
for (int i = 0; i < annotationIDs.Length; i++)
188186
{
189-
var item = nativeManager.Annotations.FirstOrDefault(
190-
x => x.Id == annotationIDs[i]
191-
);
192-
if (item == null) continue;
193-
194-
var annotations = new List<TMBPointAnnotation>(nativeManager.Annotations);
195-
annotations.Remove(item);
196-
197-
nativeManager.Annotations = annotations.ToArray();
187+
nativeManager.RemoveAnnotationById(annotationIDs[i]);
198188
}
199189
}
200190
}

src/libs/Mapbox.Maui/Platforms/iOS/Annotations/PolygonAnnotationManager.cs

+4-14
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,21 @@ public override void AddAnnotations(params PolygonAnnotation[] xitems)
3939
{
4040
var items = xitems
4141
.Select(x => x.ToPlatformValue())
42-
.ToList();
43-
44-
nativeManager.Annotations = nativeManager.Annotations
45-
.Union(items)
4642
.ToArray();
43+
44+
nativeManager.AddAnnotations(items);
4745
}
4846

4947
public override void RemoveAllAnnotations()
5048
{
51-
nativeManager.Annotations = Array.Empty<TMBPolygonAnnotation>();
49+
nativeManager.RemoveAllAnnotations();
5250
}
5351

5452
public override void RemoveAnnotations(params string[] annotationIDs)
5553
{
5654
for (int i = 0; i < annotationIDs.Length; i++)
5755
{
58-
var item = nativeManager.Annotations.FirstOrDefault(
59-
x => x.Id == annotationIDs[i]
60-
);
61-
if (item == null) continue;
62-
63-
var annotations = new List<TMBPolygonAnnotation>(nativeManager.Annotations);
64-
annotations.Remove(item);
65-
66-
nativeManager.Annotations = annotations.ToArray();
56+
nativeManager.RemoveAnnotationById(annotationIDs[i]);
6757
}
6858
}
6959
}

src/libs/Mapbox.Maui/Platforms/iOS/Annotations/PolylineAnnotationManager.cs

+4-14
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,21 @@ public override void AddAnnotations(params PolylineAnnotation[] xitems)
5959
{
6060
var items = xitems
6161
.Select(x => x.ToPlatformValue())
62-
.ToList();
63-
64-
nativeManager.Annotations = nativeManager.Annotations
65-
.Union(items)
6662
.ToArray();
63+
64+
nativeManager.AddAnnotations(items);
6765
}
6866

6967
public override void RemoveAllAnnotations()
7068
{
71-
nativeManager.Annotations = Array.Empty<TMBPolylineAnnotation>();
69+
nativeManager.RemoveAllAnnotations();
7270
}
7371

7472
public override void RemoveAnnotations(params string[] annotationIDs)
7573
{
7674
for (int i = 0; i < annotationIDs.Length; i++)
7775
{
78-
var item = nativeManager.Annotations.FirstOrDefault(
79-
x => x.Id == annotationIDs[i]
80-
);
81-
if (item == null) continue;
82-
83-
var annotations = new List<TMBPolylineAnnotation>(nativeManager.Annotations);
84-
annotations.Remove(item);
85-
86-
nativeManager.Annotations = annotations.ToArray();
76+
nativeManager.RemoveAnnotationById(annotationIDs[i]);
8777
}
8878
}
8979
}

src/libs/Mapbox.Maui/Platforms/iOS/MapboxViewHandler.Annotations.cs

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public IPointAnnotationManager CreatePointAnnotationManager(
5858
clusterOptions.TextField?.ToTMBValue(),
5959
clusterOptions.ClusterRadius,
6060
clusterOptions.ClusterMaxZoom,
61+
clusterOptions.ClusterMinPoints,
6162
clusterOptions.ClusterProperties?.ToNative()
6263
);
6364
}

src/qs/MapboxMauiQs/MapboxMauiQs.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@
105105
</Compile>
106106
</ItemGroup>
107107
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
108-
<PackageReference Include="MapboxMapsObjC.iOS" Version="11.4.0.2" />
109-
<PackageReference Include="MapboxMaps.iOS" Version="11.4.0.1" />
108+
<PackageReference Include="MapboxMapsObjC.iOS" Version="11.5.1" />
109+
<PackageReference Include="MapboxMaps.iOS" Version="11.5.1" />
110110

111111
<Compile Include="..\..\libs\Mapbox.Maui\Platforms\iOS\**\**\*.cs">
112112
<Link>Platforms\iOS\Shared\%(RecursiveDir)%(Filename)%(Extension)</Link>

0 commit comments

Comments
 (0)