From c1894d76b1595cf530ced281b2c5b42cec3b619f Mon Sep 17 00:00:00 2001 From: Aleksei Sapitskii <45671572+aleksproger@users.noreply.github.com> Date: Tue, 23 Apr 2024 17:23:41 +0300 Subject: [PATCH] [MAPSIOS-1403] Expose allSlotIdentifiers in StyleManager (#2125) --- MapboxMaps.podspec | 2 +- Package.swift | 2 +- Sources/MapboxMaps/Style/StyleManager.swift | 6 ++++++ Sources/MapboxMaps/Style/StyleManagerProtocol.swift | 1 + .../MapboxMapsTests/Foundation/Mocks/MockStyleManager.swift | 5 +++++ scripts/release/packager/versions.json | 2 +- 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/MapboxMaps.podspec b/MapboxMaps.podspec index c73df02778a7..0290b411e75a 100644 --- a/MapboxMaps.podspec +++ b/MapboxMaps.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |m| m.source_files = 'Sources/MapboxMaps/**/*.{swift,h}' m.resource_bundles = { 'MapboxMapsResources' => ['Sources/**/*.{xcassets,strings}', 'Sources/MapboxMaps/MapboxMaps.json', 'Sources/MapboxMaps/PrivacyInfo.xcprivacy'] } - m.dependency 'MapboxCoreMaps', '11.4.0-SNAPSHOT.0417T1228Z.b5204fc' + m.dependency 'MapboxCoreMaps', '11.4.0-SNAPSHOT.0422T0943Z.e5a8c75' m.dependency 'MapboxCommon', '24.3.1' m.dependency 'Turf', '2.8.0' diff --git a/Package.swift b/Package.swift index 569c81e30e09..bb3aee8cb230 100644 --- a/Package.swift +++ b/Package.swift @@ -4,7 +4,7 @@ import PackageDescription import Foundation -let coreMaps = MapsDependency.coreMaps(version: "11.4.0-SNAPSHOT.0417T1228Z.b5204fc", checksum: "5ad1d2c4f0e027bb23b149784dac08c14ac9d9f19f9e8a972e34fd809d188da9") +let coreMaps = MapsDependency.coreMaps(version: "11.4.0-SNAPSHOT.0422T0943Z.e5a8c75", checksum: "feb71b4e2d1d1da16fdf994fddbf2daf2eed92afad8047795fd10b5ce8a0f575") let common = MapsDependency.common(version: "24.3.1") let mapboxMapsPath: String? = nil diff --git a/Sources/MapboxMaps/Style/StyleManager.swift b/Sources/MapboxMaps/Style/StyleManager.swift index b95658940fd8..14a3db590681 100644 --- a/Sources/MapboxMaps/Style/StyleManager.swift +++ b/Sources/MapboxMaps/Style/StyleManager.swift @@ -766,6 +766,12 @@ public class StyleManager { return styleManager.styleLayerExists(forLayerId: id) } + /// The ordered list of the current style slots identifiers + @_spi(Experimental) + public var allSlotIdentifiers: [Slot] { + styleManager.getStyleSlots().compactMap(Slot.init) + } + /// The ordered list of the current style layers' identifiers and types public var allLayerIdentifiers: [LayerInfo] { styleManager.getStyleLayers().map { info in diff --git a/Sources/MapboxMaps/Style/StyleManagerProtocol.swift b/Sources/MapboxMaps/Style/StyleManagerProtocol.swift index 86a4fac6cb7a..5715665f5afe 100644 --- a/Sources/MapboxMaps/Style/StyleManagerProtocol.swift +++ b/Sources/MapboxMaps/Style/StyleManagerProtocol.swift @@ -45,6 +45,7 @@ internal protocol StyleManagerProtocol { func styleLayerExists(forLayerId layerId: String) -> Bool func getStyleLayers() -> [MapboxCoreMaps.StyleObjectInfo] + func getStyleSlots() -> [String] func getStyleLayerProperty(forLayerId layerId: String, property: String) -> MapboxCoreMaps.StylePropertyValue diff --git a/Tests/MapboxMapsTests/Foundation/Mocks/MockStyleManager.swift b/Tests/MapboxMapsTests/Foundation/Mocks/MockStyleManager.swift index 494620d9a397..92282ec42704 100644 --- a/Tests/MapboxMapsTests/Foundation/Mocks/MockStyleManager.swift +++ b/Tests/MapboxMapsTests/Foundation/Mocks/MockStyleManager.swift @@ -77,6 +77,11 @@ class MockStyleManager: StyleManagerProtocol { getStyleLayersStub.call() } + let getStyleSlotsStub = Stub(defaultReturnValue: []) + func getStyleSlots() -> [String] { + getStyleSlotsStub.call() + } + typealias GetStyleLayerPropertyParameters = (layerID: String, property: String) let getStyleLayerPropertyStub = Stub( defaultReturnValue: StylePropertyValue(value: "foo", kind: .undefined) diff --git a/scripts/release/packager/versions.json b/scripts/release/packager/versions.json index d5a539f8437b..a267ae67f5eb 100644 --- a/scripts/release/packager/versions.json +++ b/scripts/release/packager/versions.json @@ -1,5 +1,5 @@ { - "MapboxCoreMaps": "11.4.0-SNAPSHOT.0417T1228Z.b5204fc", + "MapboxCoreMaps": "11.4.0-SNAPSHOT.0422T0943Z.e5a8c75", "MapboxCommon": "24.3.1", "Turf": "2.8.0" }