diff --git a/Sources/MapboxMaps/Style/CustomSources/CustomRasterSource.swift b/Sources/MapboxMaps/Style/CustomSources/CustomRasterSource.swift index fb061bae44eb..fa6ab9228594 100644 --- a/Sources/MapboxMaps/Style/CustomSources/CustomRasterSource.swift +++ b/Sources/MapboxMaps/Style/CustomSources/CustomRasterSource.swift @@ -19,10 +19,6 @@ public struct CustomRasterSource: Source, Equatable { @_documentation(visibility: public) public let options: CustomRasterSourceOptions? - /// This property defines a source-specific resource budget, either in tile units or in megabytes. Whenever the tile cache goes over the defined limit, the least recently used tile will be evicted from the in-memory cache. Note that the current implementation does not take into account resources allocated by the visible tiles. - @_documentation(visibility: public) - public var tileCacheBudget: TileCacheBudgetSize? - @_documentation(visibility: public) public init(id: String, options: CustomRasterSourceOptions) { self.id = id @@ -34,33 +30,19 @@ extension CustomRasterSource { enum CodingKeys: String, CodingKey { case id case type - case tileCacheBudget = "tile-cache-budget" } /// Init from a decoder, note that the CustomRasterSourceOptions are not decodable and need to be set separately public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(String.self, forKey: .id) - tileCacheBudget = try container.decodeIfPresent(TileCacheBudgetSize.self, forKey: .tileCacheBudget) options = nil } /// Encode, note that options will not be included public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) - - if encoder.userInfo[.volatilePropertiesOnly] as? Bool == true { - try encodeVolatile(to: encoder, into: &container) - } else if encoder.userInfo[.nonVolatilePropertiesOnly] as? Bool == true { - try encodeNonVolatile(to: encoder, into: &container) - } else { - try encodeVolatile(to: encoder, into: &container) - try encodeNonVolatile(to: encoder, into: &container) - } - } - - private func encodeVolatile(to encoder: Encoder, into container: inout KeyedEncodingContainer) throws { - try container.encodeIfPresent(tileCacheBudget, forKey: .tileCacheBudget) + try encodeNonVolatile(to: encoder, into: &container) } private func encodeNonVolatile(to encoder: Encoder, into container: inout KeyedEncodingContainer) throws { diff --git a/Sources/MapboxMaps/Style/Generated/SourceWrapper.swift b/Sources/MapboxMaps/Style/Generated/SourceWrapper.swift index ecd388a646ca..86d9dff5adcb 100644 --- a/Sources/MapboxMaps/Style/Generated/SourceWrapper.swift +++ b/Sources/MapboxMaps/Style/Generated/SourceWrapper.swift @@ -147,11 +147,6 @@ extension CustomGeometrySource: UpdatableSource, MapStyleContent, PrimitiveMapCo extension CustomRasterSource: UpdatableSource, MapStyleContent, PrimitiveMapContent { func update(from old: CustomRasterSource, with manager: StyleSourceManagerProtocol) throws { assert(old.id == id) - var props = [String: Any]() - encodeUpdate(\.tileCacheBudget, old: old, new: self, container: &props, key: CustomRasterSource.CodingKeys.tileCacheBudget.rawValue) - if !props.isEmpty { - try manager.setSourceProperties(for: id, properties: props) - } } func visit(_ node: MapContentNode) { diff --git a/Tests/MapboxMapsTests/Style/CustomSourcesIntegrationTests.swift b/Tests/MapboxMapsTests/Style/CustomSourcesIntegrationTests.swift index d0cc7c00cb19..a04ad78b89ea 100644 --- a/Tests/MapboxMapsTests/Style/CustomSourcesIntegrationTests.swift +++ b/Tests/MapboxMapsTests/Style/CustomSourcesIntegrationTests.swift @@ -14,7 +14,6 @@ final class CustomSourcesIntegrationTests: MapViewIntegrationTestCase { didFinishLoadingStyle = { mapView in var source = CustomRasterSource(id: "test-source", options: CustomRasterSourceOptions(tileStatusChangedFunction: { _, _ in })) - source.tileCacheBudget = .testSourceValue(.megabytes(7)) // Add source do { @@ -27,7 +26,6 @@ final class CustomSourcesIntegrationTests: MapViewIntegrationTestCase { // Retrieve the source do { let retrievedSource = try mapView.mapboxMap.source(withId: "test-source", type: CustomRasterSource.self) - XCTAssertEqual(retrievedSource.tileCacheBudget, .testSourceValue(.megabytes(7))) successfullyRetrievedSourceExpectation.fulfill() } catch { diff --git a/Tests/MapboxMapsTests/Style/CustomSourcesTests.swift b/Tests/MapboxMapsTests/Style/CustomSourcesTests.swift index 3ff6931cf469..0736e5fe44f5 100644 --- a/Tests/MapboxMapsTests/Style/CustomSourcesTests.swift +++ b/Tests/MapboxMapsTests/Style/CustomSourcesTests.swift @@ -7,7 +7,6 @@ final class CustomSourcesSourceTests: XCTestCase { let testCustomRasterSourceOptions = CustomRasterSourceOptions(tileStatusChangedFunction: { _, _ in }) var source = CustomRasterSource(id: "test-source", options: testCustomRasterSourceOptions) - source.tileCacheBudget = TileCacheBudgetSize.testSourceValue(TileCacheBudgetSize.megabytes(7)) var data: Data? do { @@ -25,7 +24,6 @@ final class CustomSourcesSourceTests: XCTestCase { let decodedSource = try JSONDecoder().decode(CustomRasterSource.self, from: validData) XCTAssert(decodedSource.type == SourceType.customRaster) XCTAssert(decodedSource.id == "test-source") - XCTAssert(decodedSource.tileCacheBudget == TileCacheBudgetSize.testSourceValue(TileCacheBudgetSize.megabytes(7))) XCTAssertNil(decodedSource.options) } catch { XCTFail("Failed to decode CustomRasterSource.") diff --git a/scripts/api-compatibility-check/breakage_allowlist.txt b/scripts/api-compatibility-check/breakage_allowlist.txt index 4bc994ba08ce..d706935bc3bf 100644 --- a/scripts/api-compatibility-check/breakage_allowlist.txt +++ b/scripts/api-compatibility-check/breakage_allowlist.txt @@ -1437,3 +1437,4 @@ Func StyleManager.invalidateCustomRasterSourceRegion(forSourceId:bounds:) has be Func StyleManager.invalidateCustomRasterSourceTile(forSourceId:tileId:) has been removed Func StyleManager.setCustomRasterSourceTileData(forSourceId:tileId:image:) has been renamed to Func setCustomRasterSourceTileData(forSourceId:tiles:) Func StyleManager.setCustomRasterSourceTileData(forSourceId:tileId:image:) has parameter 1 type change from MapboxCoreMaps.CanonicalTileID to [MapboxCoreMaps.CustomRasterSourceTileData] +Var CustomRasterSource.tileCacheBudget has been removed