-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Foundation | ||
|
||
class NetworkConfiguration : NSObject{ | ||
@objc static let sharedConfiguration = NetworkConfiguration() | ||
|
||
// The current API base URL of map | ||
private var apiBaseURL : String? | ||
|
||
// The PRC base URL for Mapbox APIs other than the telemetry API. | ||
private let mapboxChinaBaseAPIURL = "https://api.mapbox.cn" | ||
|
||
// The base URL host for Mapbox China | ||
public let mapboxChinaBaseURLHost = "api.mapbox.cn" | ||
|
||
// The URL String of China map style. | ||
public let mapboxChinaStyleURL = "mapbox://styles/mapbox/streets-zh-v1" | ||
|
||
private override init() { | ||
super.init() | ||
apiBaseURL = Bundle.main.object(forInfoDictionaryKey:"MGLMapboxAPIBaseURL") as? String | ||
} | ||
|
||
// Return of whether the map is China map or not | ||
public func isChinaMap() -> Bool{ | ||
guard apiBaseURL != nil, apiBaseURL == mapboxChinaBaseAPIURL else { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
} |