diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..0d08e261a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 12737985c..474d5a307 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -42,11 +42,11 @@ jobs: sudo xcode-select -s /Applications/Xcode_14.1.app - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -72,6 +72,6 @@ jobs: ./scripts/build_spm_sample.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 63bbd632e..18cb4ca58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ Guide: https://keepachangelog.com/en/1.0.0/ - [Discover] Add support for country, proximity, and origin parameters in Discover.Options search parameters. This fixes an issue when using search-along-route to query category results. +- [SearchUI] Add `distanceFormatter` field to Configuration to support changing the search suggestions distance format. Nil values will use the default behavior. + +- [Core] Add xcprivacy for MapboxSearch and MapboxSearchUI + - [SearchUI] Update Maki icons to all SVG, latest versions from https://github.com/mapbox/maki - [SearchUI] Remove all custom Maki icons - [Unit Tests] Update and correct tests for iOS 17 using all mocked data. diff --git a/Examples/SearchExamples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Examples/SearchExamples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 5c187f18f..397726ea0 100644 --- a/Examples/SearchExamples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Examples/SearchExamples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -28,15 +28,6 @@ "version": "10.2.0" } }, - { - "package": "MapboxMobileEvents", - "repositoryURL": "https://github.com/mapbox/mapbox-events-ios.git", - "state": { - "branch": null, - "revision": "e29f48d9ed02b31ef51f9774a9c45f1d7c2c2b78", - "version": "1.0.6" - } - }, { "package": "MapboxMaps", "repositoryURL": "git@github.com:mapbox/mapbox-maps-ios.git", diff --git a/Examples/SearchExamples/SimpleUISearchViewController.swift b/Examples/SearchExamples/SimpleUISearchViewController.swift index 9f7366353..c1b03ce83 100644 --- a/Examples/SearchExamples/SimpleUISearchViewController.swift +++ b/Examples/SearchExamples/SimpleUISearchViewController.swift @@ -1,12 +1,18 @@ import MapboxMaps import MapboxSearch import MapboxSearchUI +import MapKit import UIKit class SimpleUISearchViewController: MapsViewController { lazy var searchController: MapboxSearchController = { let locationProvider = PointLocationProvider(coordinate: .sanFrancisco) - var configuration = Configuration(locationProvider: locationProvider) + let formatter = MKDistanceFormatter() + formatter.unitStyle = .abbreviated + var configuration = Configuration( + locationProvider: locationProvider, + distanceFormatter: formatter + ) return MapboxSearchController(configuration: configuration) }() diff --git a/MapboxSearch.xcodeproj/project.pbxproj b/MapboxSearch.xcodeproj/project.pbxproj index 56e06475b..487cd7d9f 100644 --- a/MapboxSearch.xcodeproj/project.pbxproj +++ b/MapboxSearch.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 048823492B6B0A9D00C770AA /* category-hotel-search-along-route-jp.json in Resources */ = {isa = PBXBuildFile; fileRef = 04AB0B7C2B6B043C00FDE7D5 /* category-hotel-search-along-route-jp.json */; }; 0488234A2B6B0A9E00C770AA /* category-hotel-search-along-route-jp.json in Resources */ = {isa = PBXBuildFile; fileRef = 04AB0B7C2B6B043C00FDE7D5 /* category-hotel-search-along-route-jp.json */; }; 04AB0B7B2B6AF43E00FDE7D5 /* DiscoverIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AB0B792B6AF37800FDE7D5 /* DiscoverIntegrationTests.swift */; }; + 04970F8D2B7A97C900213763 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 04970F8C2B7A97C900213763 /* PrivacyInfo.xcprivacy */; }; 04AB0B4B2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json in Resources */ = {isa = PBXBuildFile; fileRef = 04AB0B4A2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json */; }; 04AB0B4C2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json in Resources */ = {isa = PBXBuildFile; fileRef = 04AB0B4A2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json */; }; 04AB0B4D2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json in Resources */ = {isa = PBXBuildFile; fileRef = 04AB0B4A2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json */; }; @@ -26,6 +27,8 @@ 04C127582B62FFDB00884325 /* ApiType+Core.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C127572B62FFDB00884325 /* ApiType+Core.swift */; }; 04E5FF962B48828500DADC18 /* SearchAddressCountry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E5FF952B48828500DADC18 /* SearchAddressCountry.swift */; }; 04E5FF992B48829200DADC18 /* SearchAddressRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E5FF982B48829200DADC18 /* SearchAddressRegion.swift */; }; + 04E84D122B76BA230056C269 /* Resources-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 04E84D112B76BA230056C269 /* Resources-Info.plist */; }; + 04E84D132B7A8F4D0056C269 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 04E84D072B7691610056C269 /* PrivacyInfo.xcprivacy */; }; 140D1BDC286DB479001A51C2 /* SearchResultAccuracy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140D1BDB286DB479001A51C2 /* SearchResultAccuracy.swift */; }; 140E47A2298BC90E00677E30 /* Discover.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140E47A1298BC90E00677E30 /* Discover.swift */; }; 140E47A5298BC94D00677E30 /* Discover+Options.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140E47A4298BC94D00677E30 /* Discover+Options.swift */; }; @@ -40,7 +43,6 @@ 141789BB2878AD9B0000AE79 /* AddressAutofill.Options+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 141789BA2878AD9B0000AE79 /* AddressAutofill.Options+Tests.swift */; }; 141789E7287C05060000AE79 /* AddressAutofill.Suggestion+SearchResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 141789E6287C05060000AE79 /* AddressAutofill.Suggestion+SearchResult.swift */; }; 141789EE287C125E0000AE79 /* AddressAutofill.Suggestion+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 141789E9287C115C0000AE79 /* AddressAutofill.Suggestion+Tests.swift */; }; - 1419EB6929670638009672CA /* Autofill.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1419EB6829670638009672CA /* Autofill.xcassets */; }; 1420F31C29A2800300D4A511 /* CoreSearchResultStub+Samples.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1420F31729A25B5800D4A511 /* CoreSearchResultStub+Samples.swift */; }; 1420F31D29A2800500D4A511 /* CoreSearchResultStub+Samples.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1420F31729A25B5800D4A511 /* CoreSearchResultStub+Samples.swift */; }; 1421416A2953450C00774439 /* PlaceAutocomplete.swift in Sources */ = {isa = PBXBuildFile; fileRef = 142141692953450C00774439 /* PlaceAutocomplete.swift */; }; @@ -498,6 +500,7 @@ 043A3D4C2B30F38300DB681B /* CoreAddress+AddressComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CoreAddress+AddressComponents.swift"; sourceTree = ""; }; 04AB0B792B6AF37800FDE7D5 /* DiscoverIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiscoverIntegrationTests.swift; sourceTree = ""; }; 04AB0B7C2B6B043C00FDE7D5 /* category-hotel-search-along-route-jp.json */ = {isa = PBXFileReference; explicitFileType = text.json; path = "category-hotel-search-along-route-jp.json"; sourceTree = ""; }; + 04970F8C2B7A97C900213763 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 04AB0B4A2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = mapbox.places.san.francisco.json; sourceTree = ""; }; 04BBC6332B61898F00E24E99 /* LocalhostMockServiceProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalhostMockServiceProvider.swift; sourceTree = ""; }; 04C0848C2B4C82F3002F9C69 /* SdkInformation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SdkInformation.swift; sourceTree = ""; }; @@ -505,6 +508,15 @@ 04C127572B62FFDB00884325 /* ApiType+Core.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ApiType+Core.swift"; sourceTree = ""; }; 04E5FF952B48828500DADC18 /* SearchAddressCountry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchAddressCountry.swift; sourceTree = ""; }; 04E5FF982B48829200DADC18 /* SearchAddressRegion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchAddressRegion.swift; sourceTree = ""; }; + 04E84CFD2B768EDA0056C269 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = ""; }; + 04E84CFE2B768EDA0056C269 /* Brewfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Brewfile; sourceTree = ""; }; + 04E84D012B768F210056C269 /* Pluginfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Pluginfile; sourceTree = ""; }; + 04E84D022B768F210056C269 /* Appfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Appfile; sourceTree = ""; }; + 04E84D032B768F210056C269 /* Fastfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Fastfile; sourceTree = ""; }; + 04E84D042B768F210056C269 /* .env */ = {isa = PBXFileReference; lastKnownFileType = text; path = .env; sourceTree = ""; }; + 04E84D052B768F210056C269 /* Matchfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Matchfile; sourceTree = ""; }; + 04E84D072B7691610056C269 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + 04E84D112B76BA230056C269 /* Resources-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Resources-Info.plist"; sourceTree = ""; }; 140D1BDB286DB479001A51C2 /* SearchResultAccuracy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultAccuracy.swift; sourceTree = ""; }; 140E47A1298BC90E00677E30 /* Discover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Discover.swift; sourceTree = ""; }; 140E47A4298BC94D00677E30 /* Discover+Options.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Discover+Options.swift"; sourceTree = ""; }; @@ -519,7 +531,6 @@ 141789BA2878AD9B0000AE79 /* AddressAutofill.Options+Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AddressAutofill.Options+Tests.swift"; sourceTree = ""; }; 141789E6287C05060000AE79 /* AddressAutofill.Suggestion+SearchResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AddressAutofill.Suggestion+SearchResult.swift"; sourceTree = ""; }; 141789E9287C115C0000AE79 /* AddressAutofill.Suggestion+Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AddressAutofill.Suggestion+Tests.swift"; sourceTree = ""; }; - 1419EB6829670638009672CA /* Autofill.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Autofill.xcassets; sourceTree = ""; }; 1420F31729A25B5800D4A511 /* CoreSearchResultStub+Samples.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CoreSearchResultStub+Samples.swift"; sourceTree = ""; }; 142141692953450C00774439 /* PlaceAutocomplete.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceAutocomplete.swift; sourceTree = ""; }; 143695F5289927FD00861F1A /* UIApplication+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+Extensions.swift"; sourceTree = ""; }; @@ -652,7 +663,6 @@ FE114D8824C1A86A001B2CE8 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; FE114D8924C1A86A001B2CE8 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = ""; }; FE114D8A24C1A86A001B2CE8 /* .swiftformat */ = {isa = PBXFileReference; lastKnownFileType = text; path = .swiftformat; sourceTree = ""; }; - FE114D8B24C1A86A001B2CE8 /* .travis.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .travis.yml; sourceTree = ""; }; FE114D8C24C1A873001B2CE8 /* MapboxSearchUI.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = MapboxSearchUI.podspec; sourceTree = ""; }; FE114D8D24C1A873001B2CE8 /* MapboxSearch.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = MapboxSearch.podspec; sourceTree = ""; }; FE114D8E24C1A880001B2CE8 /* Gemfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = Gemfile; sourceTree = ""; }; @@ -918,6 +928,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 04970F8B2B7A97C900213763 /* Resources */ = { + isa = PBXGroup; + children = ( + 04970F8C2B7A97C900213763 /* PrivacyInfo.xcprivacy */, + ); + path = Resources; + sourceTree = ""; + }; 04C127562B62FFD000884325 /* Engine */ = { isa = PBXGroup; children = ( @@ -934,6 +952,26 @@ path = Region; sourceTree = ""; }; + 04E84D002B768F210056C269 /* .fastlane */ = { + isa = PBXGroup; + children = ( + 04E84D012B768F210056C269 /* Pluginfile */, + 04E84D022B768F210056C269 /* Appfile */, + 04E84D032B768F210056C269 /* Fastfile */, + 04E84D042B768F210056C269 /* .env */, + 04E84D052B768F210056C269 /* Matchfile */, + ); + path = .fastlane; + sourceTree = ""; + }; + 04E84D062B7691420056C269 /* Resources */ = { + isa = PBXGroup; + children = ( + 04E84D072B7691610056C269 /* PrivacyInfo.xcprivacy */, + ); + path = Resources; + sourceTree = ""; + }; 140E47A0298BC8F800677E30 /* Discover API */ = { isa = PBXGroup; children = ( @@ -1071,7 +1109,6 @@ 1419EB6729670629009672CA /* Resources */ = { isa = PBXGroup; children = ( - 1419EB6829670638009672CA /* Autofill.xcassets */, ); name = Resources; sourceTree = ""; @@ -1510,12 +1547,14 @@ FE114D8524C1A857001B2CE8 /* Metadata */ = { isa = PBXGroup; children = ( + 04E84D002B768F210056C269 /* .fastlane */, + 04E84CFE2B768EDA0056C269 /* Brewfile */, + 04E84CFD2B768EDA0056C269 /* CHANGELOG.md */, FE529611253704F900F61A0F /* .circleci */, FE114D8824C1A86A001B2CE8 /* .gitignore */, FE114D8624C1A86A001B2CE8 /* .swift-version */, FE114D8A24C1A86A001B2CE8 /* .swiftformat */, FE114D8924C1A86A001B2CE8 /* .swiftlint.yml */, - FE114D8B24C1A86A001B2CE8 /* .travis.yml */, FE114D8724C1A86A001B2CE8 /* Cartfile */, FE114D8F24C1A880001B2CE8 /* CODEOWNERS */, FE114D8E24C1A880001B2CE8 /* Gemfile */, @@ -1573,6 +1612,7 @@ FEEDD2C02508DFE400DC0A98 /* MapboxSearch */ = { isa = PBXGroup; children = ( + 04E84D062B7691420056C269 /* Resources */, FEEDD2C12508DFE400DC0A98 /* InternalAPI */, FEEDD2D42508DFE400DC0A98 /* PublicAPI */, ); @@ -1674,6 +1714,8 @@ FEEDD31E2508E02700DC0A98 /* MapboxSearchUI */ = { isa = PBXGroup; children = ( + 04E84D112B76BA230056C269 /* Resources-Info.plist */, + 04970F8B2B7A97C900213763 /* Resources */, FEEDD34E2508E02700DC0A98 /* ActivityProgressView.swift */, FEEDD33F2508E02700DC0A98 /* ActivityProgressView.xib */, FE4F260525F8E8B700454BC5 /* AddToFavoritesCell.swift */, @@ -2053,7 +2095,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 1419EB6929670638009672CA /* Autofill.xcassets in Resources */, + 04E84D132B7A8F4D0056C269 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2178,6 +2220,8 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 04E84D122B76BA230056C269 /* Resources-Info.plist in Resources */, + 04970F8D2B7A97C900213763 /* PrivacyInfo.xcprivacy in Resources */, FEC6EEE5246BFBB30051732D /* MapboxSearchUIResources.bundle in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Package.swift b/Package.swift index f0254e1e5..446db8208 100644 --- a/Package.swift +++ b/Package.swift @@ -38,12 +38,18 @@ let package = Package( "MapboxCommon", ], exclude: ["Info.plist"], + resources: [ + .copy("Resources/PrivacyInfo.xcprivacy"), + ], linkerSettings: [.linkedLibrary("c++")] ), .target( name: "MapboxSearchUI", dependencies: ["MapboxSearch"], - exclude: ["Info.plist", "Resources-Info.plist"] + exclude: ["Info.plist", "Resources-Info.plist"], + resources: [ + .copy("Resources/PrivacyInfo.xcprivacy"), + ] ), coreSearchTarget( diff --git a/Sources/Demo/Autofill.xcassets/Contents.json b/Sources/Demo/Autofill.xcassets/Contents.json deleted file mode 100644 index 73c00596a..000000000 --- a/Sources/Demo/Autofill.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Sources/Demo/Autofill.xcassets/pin.imageset/Contents.json b/Sources/Demo/Autofill.xcassets/pin.imageset/Contents.json deleted file mode 100644 index b4cd0d632..000000000 --- a/Sources/Demo/Autofill.xcassets/pin.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "icons8-map-pin-48.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Sources/Demo/Autofill.xcassets/pin.imageset/icons8-map-pin-48.png b/Sources/Demo/Autofill.xcassets/pin.imageset/icons8-map-pin-48.png deleted file mode 100644 index f61e84a7e..000000000 Binary files a/Sources/Demo/Autofill.xcassets/pin.imageset/icons8-map-pin-48.png and /dev/null differ diff --git a/Sources/Demo/PlaceAutocompleteDetailsViewController.swift b/Sources/Demo/PlaceAutocompleteDetailsViewController.swift index abe69b313..4633deec7 100644 --- a/Sources/Demo/PlaceAutocompleteDetailsViewController.swift +++ b/Sources/Demo/PlaceAutocompleteDetailsViewController.swift @@ -101,7 +101,7 @@ extension PlaceAutocompleteResultViewController { } extension PlaceAutocomplete.Result { - static let measurumentFormatter: MeasurementFormatter = { + static let measurementFormatter: MeasurementFormatter = { let formatter = MeasurementFormatter() formatter.unitOptions = [.naturalScale] formatter.numberFormatter.roundingMode = .halfUp @@ -137,7 +137,7 @@ extension PlaceAutocomplete.Result { components.append( ( name: "Estimated time", - value: PlaceAutocomplete.Result.measurumentFormatter.string(from: estimatedTime) + value: PlaceAutocomplete.Result.measurementFormatter.string(from: estimatedTime) ) ) } diff --git a/Sources/Demo/PlaceAutocompleteMainViewController.swift b/Sources/Demo/PlaceAutocompleteMainViewController.swift index e107299c0..1c40039ba 100644 --- a/Sources/Demo/PlaceAutocompleteMainViewController.swift +++ b/Sources/Demo/PlaceAutocompleteMainViewController.swift @@ -79,7 +79,7 @@ extension PlaceAutocompleteMainViewController: UITableViewDataSource, UITableVie description += "\n\(PlaceAutocomplete.Result.distanceFormatter.string(fromDistance: distance))" } if let estimatedTime = suggestion.estimatedTime { - description += "\n\(PlaceAutocomplete.Result.measurumentFormatter.string(from: estimatedTime))" + description += "\n\(PlaceAutocomplete.Result.measurementFormatter.string(from: estimatedTime))" } tableViewCell.detailTextLabel?.text = description diff --git a/Sources/MapboxSearch/Resources/PrivacyInfo.xcprivacy b/Sources/MapboxSearch/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 000000000..a3686ebaa --- /dev/null +++ b/Sources/MapboxSearch/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,52 @@ + + + + + NSPrivacyAccessedAPITypes + + NSPrivacyTrackingDomains + + NSPrivacyCollectedDataTypes + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeOtherDiagnosticData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAnalytics + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeCoarseLocation + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypePreciseLocation + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyTracking + + + diff --git a/Sources/MapboxSearchUI/Configuration.swift b/Sources/MapboxSearchUI/Configuration.swift index 6cfb70409..caf03a679 100644 --- a/Sources/MapboxSearchUI/Configuration.swift +++ b/Sources/MapboxSearchUI/Configuration.swift @@ -1,4 +1,5 @@ import Foundation +import MapKit import UIKit /// General structure to configure MapboxSearchController UI and logic @@ -16,12 +17,14 @@ public struct Configuration { categoryDataProvider: CategoryDataProvider = DefaultCategoryDataProvider(), locationProvider: LocationProvider? = DefaultLocationProvider(), hideCategorySlots: Bool = false, - style: Style = .default + style: Style = .default, + distanceFormatter: MKDistanceFormatter? = nil ) { self.allowsFeedbackUI = allowsFeedbackUI self.categoryDataProvider = categoryDataProvider self.locationProvider = locationProvider self.hideCategorySlots = hideCategorySlots + self.distanceFormatter = distanceFormatter } /// Allow to show feedback related UI @@ -44,4 +47,9 @@ public struct Configuration { /// Style to be used for Search UI elements. /// It's possible to change style on the fly. Non-animatable. public var style = Style() + + /// Override the default ``MKDistanceFormatter`` behavior used by ``SearchSuggestionCell`` to display search + /// results in a specific unit system. A nil value will use the ``MKDistanceFormatter`` system behavior to infer + /// the unit system based on the device locale. + public var distanceFormatter: MKDistanceFormatter? } diff --git a/Sources/MapboxSearchUI/Resources/PrivacyInfo.xcprivacy b/Sources/MapboxSearchUI/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 000000000..90211906c --- /dev/null +++ b/Sources/MapboxSearchUI/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,14 @@ + + + + + NSPrivacyAccessedAPITypes + + NSPrivacyTrackingDomains + + NSPrivacyCollectedDataTypes + + NSPrivacyTracking + + + diff --git a/Sources/MapboxSearchUI/SearchHistoryTableViewSource.swift b/Sources/MapboxSearchUI/SearchHistoryTableViewSource.swift index 7423f43f2..ca43da667 100644 --- a/Sources/MapboxSearchUI/SearchHistoryTableViewSource.swift +++ b/Sources/MapboxSearchUI/SearchHistoryTableViewSource.swift @@ -1,4 +1,3 @@ -import CoreLocation import MapboxSearch import UIKit diff --git a/Sources/MapboxSearchUI/SearchSuggestionCell.swift b/Sources/MapboxSearchUI/SearchSuggestionCell.swift index d9021989a..75e3865a3 100644 --- a/Sources/MapboxSearchUI/SearchSuggestionCell.swift +++ b/Sources/MapboxSearchUI/SearchSuggestionCell.swift @@ -95,7 +95,12 @@ class SearchSuggestionCell: UITableViewCell { ) == .orderedSame populateSuggestionButton.isHidden = resultNameSameAsQuery - if let distanceString = suggestion.distance.map(SearchSuggestionCell.distanceFormatter.string) { + if let distanceFormatter = configuration.distanceFormatter, + let distanceString = suggestion.distance.map(distanceFormatter.string) + { + distanceLabel.text = distanceString + distanceLabel.isHidden = false + } else if let distanceString = suggestion.distance.map(SearchSuggestionCell.distanceFormatter.string) { distanceLabel.text = distanceString distanceLabel.isHidden = false } else {