Skip to content

Commit

Permalink
Solution for issue##1554
Browse files Browse the repository at this point in the history
  • Loading branch information
m-stephen committed Jul 16, 2018
1 parent e2b3f4a commit 34f90ac
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions MapboxNavigation.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
C5EF397520599120009A2C50 /* straight-line.json in Resources */ = {isa = PBXBuildFile; fileRef = C5EF397420599120009A2C50 /* straight-line.json */; };
C5F2DCA0206DBF5E002F99F6 /* Sequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5F2DC9F206DBF5E002F99F6 /* Sequence.swift */; };
C5F2DCA1206DBF5E002F99F6 /* Sequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5F2DC9F206DBF5E002F99F6 /* Sequence.swift */; };
CFD47D8C20FC7D5E00BC1E49 /* NetworkConfiguartion.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFD47D8B20FC7D5E00BC1E49 /* NetworkConfiguartion.swift */; };
DA23C9611F4FC05C00BA9522 /* MGLMapView+MGLNavigationAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35D825F91E6A2DBE0088F83B /* MGLMapView+MGLNavigationAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
DA3525702010A5210048DDFC /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DA35256E2010A5200048DDFC /* Localizable.stringsdict */; };
DAAE5F301EAE4C4700832871 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DAAE5F321EAE4C4700832871 /* Localizable.strings */; };
Expand Down Expand Up @@ -663,6 +664,7 @@
C5E7A31B1F4F6828001CB015 /* NavigationRouteOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationRouteOptions.swift; sourceTree = "<group>"; };
C5EF397420599120009A2C50 /* straight-line.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "straight-line.json"; sourceTree = "<group>"; };
C5F2DC9F206DBF5E002F99F6 /* Sequence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sequence.swift; sourceTree = "<group>"; };
CFD47D8B20FC7D5E00BC1E49 /* NetworkConfiguartion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkConfiguartion.swift; sourceTree = "<group>"; };
DA1811FD20128B0900C91918 /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Main.strings; sourceTree = "<group>"; };
DA1811FE20128B0900C91918 /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Navigation.strings; sourceTree = "<group>"; };
DA18120120128B7B00C91918 /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -915,6 +917,7 @@
356B7D8A1EE166E100FE5B89 /* scripts */,
351BEC201E5BD4DC006FE110 /* Supporting files */,
C51923B51EA55CD4002AF9E1 /* Views */,
CFD47D8B20FC7D5E00BC1E49 /* NetworkConfiguartion.swift */,
3EA93A10227A7DAF1861D9F5 /* Cache.swift */,
160D8278205996DA00D278D6 /* DataCache.swift */,
35726EE71F0856E900AFA1B6 /* DayStyle.swift */,
Expand Down Expand Up @@ -1856,6 +1859,7 @@
35ECAF2D2092275100DC3BC3 /* UIImage.swift in Sources */,
351BEC051E5BCC6C006FE110 /* LaneView.swift in Sources */,
C5A7EC5C1FD610A80008B9BA /* VisualInstructionComponent.swift in Sources */,
CFD47D8C20FC7D5E00BC1E49 /* NetworkConfiguartion.swift in Sources */,
351BEC0D1E5BCC72006FE110 /* Bundle.swift in Sources */,
8DF399B21FB257B30034904C /* UIGestureRecognizer.swift in Sources */,
35B7837E1F9547B300291F9A /* Transitioning.swift in Sources */,
Expand Down
4 changes: 4 additions & 0 deletions MapboxNavigation/NavigationMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,10 @@ open class NavigationMapView: MGLMapView, UIGestureRecognizerDelegate {
to call this method on the value of `NavigationViewController.mapView`.
*/
@objc public func localizeLabels() {
if(NetworkConfiguration.sharedConfiguration.isChinaMap()){
return
}

guard let style = style else {
return
}
Expand Down
31 changes: 31 additions & 0 deletions MapboxNavigation/NetworkConfiguartion.swift
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
}

}

0 comments on commit 34f90ac

Please sign in to comment.