Allow the services that are configured by secrets to be disabled. (#3961)

* Make the map tiler key optional.

* Make the bug report URL optional.

* Make the sentry URL optional.

* Make the analytics configuration optional and handle consent taking Sentry into account.

* Stop prompting users to report crashes when Sentry is disabled.
This commit is contained in:
Doug
2025-04-01 09:24:12 +01:00
committed by GitHub
parent e75ea701fd
commit 2a146ca022
71 changed files with 321 additions and 134 deletions

View File

@@ -51,4 +51,24 @@ final class MapTilerURLBuilderTests: XCTestCase {
let expectedURL: URL = "http://www.foo.com/dea61faf-292b-4774-9660-58fcef89a7f3/style.json?key=some_key"
XCTAssertEqual(url, expectedURL)
}
func testNilAPIKey() {
let configuration = MapTilerConfiguration(baseURL: Self.baseURL,
apiKey: nil,
lightStyleID: Self.lightStyleID,
darkStyleID: Self.darkStyleID)
XCTAssertFalse(configuration.isEnabled)
builder = configuration
let staticMapURL = builder.staticMapURL(for: .dark,
coordinates: .init(latitude: 1, longitude: 2),
zoomLevel: 5,
size: .init(width: 300, height: 200),
attribution: .topLeft)
XCTAssertNil(staticMapURL)
let dynamicMapURL = builder.dynamicMapURL(for: .light)
XCTAssertNil(dynamicMapURL)
}
}