-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 187-xcode-cloud-support-for-version-200+
- Loading branch information
Showing
41 changed files
with
247 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
binary "https://api.mapbox.com/downloads/v2/carthage/search-core-sdk/MapboxCoreSearch.xcframework.json" == 2.0.0-alpha.14 | ||
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" == 24.2.0 | ||
binary "https://api.mapbox.com/downloads/v2/carthage/search-core-sdk/MapboxCoreSearch.xcframework.json" == 2.0.0-alpha.16 | ||
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" == 24.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
binary "https://api.mapbox.com/downloads/v2/carthage/mapbox-common/MapboxCommon.json" "24.2.0" | ||
binary "https://api.mapbox.com/downloads/v2/carthage/search-core-sdk/MapboxCoreSearch.xcframework.json" "2.0.0-alpha.14" | ||
binary "https://api.mapbox.com/downloads/v2/carthage/search-core-sdk/MapboxCoreSearch.xcframework.json" "2.0.0-alpha.16" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 53 additions & 4 deletions
57
Sources/MapboxSearch/InternalAPI/CoreSearchEngineStatics.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,60 @@ | ||
import Foundation | ||
|
||
enum CoreSearchEngineStatics { | ||
static func createTilesetDescriptor(dataset: String, version: String) -> MapboxCommon.TilesetDescriptor { | ||
CoreSearchEngine.createTilesetDescriptor(forDataset: dataset, version: version) | ||
enum Constants { | ||
static let delimiter = "_" | ||
} | ||
|
||
static func createPlacesTilesetDescriptor(dataset: String, version: String) -> MapboxCommon.TilesetDescriptor { | ||
CoreSearchEngine.createPlacesTilesetDescriptor(forDataset: dataset, version: version) | ||
static func createTilesetDescriptor(dataset: String, version: String, language: String? = nil) -> MapboxCommon | ||
.TilesetDescriptor { | ||
let identifier: String | ||
if let language { | ||
if ISOLanguages.contains(language: language) { | ||
identifier = dataset + Constants.delimiter + language | ||
} else { | ||
_Logger.searchSDK | ||
.warning( | ||
"Provided language code '\(language)' for tileset is non-ISO. Dataset '\(dataset)' without language will be used." | ||
) | ||
identifier = dataset | ||
} | ||
} else { | ||
identifier = dataset | ||
} | ||
return CoreSearchEngine.createTilesetDescriptor(forDataset: identifier, version: version) | ||
} | ||
|
||
static func createPlacesTilesetDescriptor(dataset: String, version: String, language: String? = nil) -> MapboxCommon | ||
.TilesetDescriptor { | ||
let identifier: String | ||
if let language { | ||
if ISOLanguages.contains(language: language) { | ||
identifier = dataset + Constants.delimiter + language | ||
} else { | ||
_Logger.searchSDK | ||
.warning( | ||
"Provided language code '\(language)' for places tileset is non-ISO. Dataset '\(dataset)' without language will be used." | ||
) | ||
identifier = dataset | ||
} | ||
} else { | ||
identifier = dataset | ||
} | ||
return CoreSearchEngine.createPlacesTilesetDescriptor(forDataset: identifier, version: version) | ||
} | ||
} | ||
|
||
enum ISOLanguages { | ||
static func contains(language: String) -> Bool { | ||
var validLanguage: Bool | ||
if #available(iOS 16, *) { | ||
validLanguage = Locale.LanguageCode.isoLanguageCodes | ||
.map(\.identifier) | ||
.contains(language) | ||
} else { | ||
validLanguage = Locale.isoLanguageCodes | ||
.contains(language) | ||
} | ||
return validLanguage | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.