mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Import working. Still need to check for file validity
This commit is contained in:
parent
4766873ad1
commit
b01272c814
5 changed files with 27 additions and 36 deletions
|
|
@ -142,12 +142,21 @@ public struct MapView: UIViewRepresentable {
|
|||
mapView.removeOverlays(mapView.overlays)
|
||||
if let customMapOverlay = self.customMapOverlay {
|
||||
|
||||
if let tilePath = Bundle.main.path(forResource: "offline_map", ofType: "mbtiles") {
|
||||
let fileManager = FileManager.default
|
||||
let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first!
|
||||
let tilePath = documentsDirectory.appendingPathComponent("offline_map.mbtiles", isDirectory: false).path
|
||||
if fileManager.fileExists(atPath: tilePath) {
|
||||
//if let tilePath = Bundle.main.path(forResource: "offline_map", ofType: "mbtiles") {
|
||||
|
||||
print("Loading local map file")
|
||||
|
||||
let overlay = LocalMBTileOverlay(mbTilePath: tilePath)
|
||||
|
||||
overlay.canReplaceMapContent = false//customMapOverlay.canReplaceMapContent
|
||||
|
||||
mapView.addOverlay(overlay)
|
||||
} else {
|
||||
print("Couldn't find a local map file to load")
|
||||
}
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue