Add a little logging for tile import process

This commit is contained in:
Garth Vander Houwen 2022-10-07 07:31:17 -07:00
parent e83af36337
commit 2cd3c33b89

View file

@ -40,13 +40,17 @@ struct MeshtasticAppleApp: App {
}
.onOpenURL(perform: { (url) in
print("QR Code URL received from the Camera \(url)")
print("Some sort of URL was received \(url)")
channelUrl = url
print("User wants to open URL: \(channelUrl?.absoluteString ?? "No QR Code Link")")
if url.absoluteString.lowercased().contains("https://meshtastic.org/e/#") {
saveQR = true
print("User wants to open a Channel Settings URL: \(channelUrl?.absoluteString ?? "No QR Code Link")")
} else {
print("User wants to import a MBTILES offline map file: \(channelUrl?.absoluteString ?? "No Tiles link")")
}
//we are expecting a .mbtiles map file that contains raster data
//save it to the documents directory, and name it offline_map.mbtiles
@ -60,7 +64,11 @@ struct MeshtasticAppleApp: App {
try? fileManager.removeItem(atPath: destination.path)
}
try? fileManager.copyItem(at: url, to: destination)
do {
try fileManager.copyItem(at: url, to: destination)
} catch {
print("Copy MB Tile file failed. Error: \(error)")
}
if (fileManager.fileExists(atPath: destination.path)) {
print(" Saved the map file")