diff --git a/Meshtastic/MeshtasticApp.swift b/Meshtastic/MeshtasticApp.swift index aa567280..87a218c5 100644 --- a/Meshtastic/MeshtasticApp.swift +++ b/Meshtastic/MeshtasticApp.swift @@ -29,35 +29,34 @@ struct MeshtasticAppleApp: App { .onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { userActivity in print("URL received \(userActivity)") - incomingUrl = userActivity.webpageURL + self.incomingUrl = userActivity.webpageURL - if incomingUrl!.absoluteString.lowercased().contains("meshtastic.org/e/#") { + if self.incomingUrl!.absoluteString.lowercased().contains("meshtastic.org/e/#") { - if let components = incomingUrl?.absoluteString.components(separatedBy: "#") { - channelSettings = components.last! + if let components = self.incomingUrl?.absoluteString.components(separatedBy: "#") { + self.channelSettings = components.last! } - saveChannels = true - print("User wants to open a Channel Settings URL: \(incomingUrl?.absoluteString ?? "No QR Code Link")") + self.saveChannels = true + print("User wants to open a Channel Settings URL: \(self.incomingUrl?.absoluteString ?? "No QR Code Link")") } - if saveChannels { - print("User wants to open Channel Settings URL: \(String(describing: incomingUrl!.relativeString))") + if self.saveChannels { + print("User wants to open Channel Settings URL: \(String(describing: self.incomingUrl!.relativeString))") } } - .onOpenURL(perform: { (url) in print("Some sort of URL was received \(url)") - incomingUrl = url + self.incomingUrl = url if url.absoluteString.lowercased().contains("meshtastic.org/e/#") { - if let components = incomingUrl?.absoluteString.components(separatedBy: "#") { - channelSettings = components.last! + if let components = self.incomingUrl?.absoluteString.components(separatedBy: "#") { + self.channelSettings = components.last! } - saveChannels = true - print("User wants to open a Channel Settings URL: \(incomingUrl?.absoluteString ?? "No QR Code Link")") + self.saveChannels = true + print("User wants to open a Channel Settings URL: \(self.incomingUrl?.absoluteString ?? "No QR Code Link")") } else { saveChannels = false - print("User wants to import a MBTILES offline map file: \(incomingUrl?.absoluteString ?? "No Tiles link")") + print("User wants to import a MBTILES offline map file: \(self.incomingUrl?.absoluteString ?? "No Tiles link")") } //we are expecting a .mbtiles map file that contains raster data @@ -66,7 +65,7 @@ struct MeshtasticAppleApp: App { let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first! let destination = documentsDirectory.appendingPathComponent("offline_map.mbtiles", isDirectory: false) - if !saveChannels { + if !self.saveChannels { //do we need to delete an old one? if (fileManager.fileExists(atPath: destination.path)) { print("ℹ️ Found an old map file. Deleting it") @@ -91,7 +90,6 @@ struct MeshtasticAppleApp: App { } }) } - .onChange(of: scenePhase) { (newScenePhase) in switch newScenePhase { case .background: diff --git a/Meshtastic/Views/Helpers/MeshtasticLogo.swift b/Meshtastic/Views/Helpers/MeshtasticLogo.swift index 52713591..a790e13a 100644 --- a/Meshtastic/Views/Helpers/MeshtasticLogo.swift +++ b/Meshtastic/Views/Helpers/MeshtasticLogo.swift @@ -11,12 +11,27 @@ struct MeshtasticLogo: View { @Environment(\.colorScheme) var colorScheme var body: some View { - VStack { - Image(colorScheme == .dark ? "logo-white" : "logo-black") - .resizable() - .scaledToFit() - } - .padding(.bottom, 5) - .offset(x: -15) + + #if targetEnvironment(macCatalyst) + VStack { + Image("logo-white") + .resizable() + .renderingMode(.template) + .foregroundColor(.accentColor) + .scaledToFit() + } + .padding(.bottom, 5) + .padding(.top, 5) + .offset(x: -15) + #else + VStack { + Image(colorScheme == .dark ? "logo-white" : "logo-black") + .resizable() + .renderingMode(.template) + .scaledToFit() + } + .padding(.bottom, 5) + .offset(x: -15) + #endif } } diff --git a/Meshtastic/Views/Messages/Contacts.swift b/Meshtastic/Views/Messages/Contacts.swift index f8493933..d85ac897 100644 --- a/Meshtastic/Views/Messages/Contacts.swift +++ b/Meshtastic/Views/Messages/Contacts.swift @@ -54,19 +54,15 @@ struct Contacts: View { if lastMessageDay == currentDay { Text(lastMessageTime, style: .time ) .font(.callout) - .foregroundColor(.gray) } else if lastMessageDay == (currentDay - 1) { Text("Yesterday") .font(.callout) - .foregroundColor(.gray) } else if lastMessageDay < (currentDay - 1) && lastMessageDay > (currentDay - 5) { Text(lastMessageTime.formattedDate(format: "MM/dd/yy")) .font(.callout) - .foregroundColor(.gray) } else if lastMessageDay < (currentDay - 1800) { Text(lastMessageTime.formattedDate(format: "MM/dd/yy")) .font(.callout) - .foregroundColor(.gray) } } } @@ -75,7 +71,6 @@ struct Contacts: View { HStack(alignment: .top) { Text("\(mostRecent != nil ? mostRecent!.messagePayload! : " ")") .truncationMode(.tail) - .foregroundColor(Color.gray) .frame(maxWidth: .infinity, alignment: .leading) } } @@ -113,19 +108,15 @@ struct Contacts: View { if lastMessageDay == currentDay { Text(lastMessageTime, style: .time ) .font(.callout) - .foregroundColor(.gray) } else if lastMessageDay == (currentDay - 1) { Text("Yesterday") .font(.callout) - .foregroundColor(.gray) } else if lastMessageDay < (currentDay - 1) && lastMessageDay > (currentDay - 5) { Text(lastMessageTime.formattedDate(format: "MM/dd/yy")) .font(.callout) - .foregroundColor(.gray) } else if lastMessageDay < (currentDay - 1800) { Text(lastMessageTime.formattedDate(format: "MM/dd/yy")) .font(.callout) - .foregroundColor(.gray) } } } @@ -134,7 +125,6 @@ struct Contacts: View { HStack(alignment: .top) { Text("\(mostRecent != nil ? mostRecent!.messagePayload! : " ")") .truncationMode(.tail) - .foregroundColor(Color.gray) .frame(maxWidth: .infinity, alignment: .leading) } } @@ -147,10 +137,7 @@ struct Contacts: View { } } } - - .navigationSplitViewStyle(.automatic) .navigationTitle("Contacts") - .navigationBarTitleDisplayMode(.inline) .navigationBarItems(leading: MeshtasticLogo() ) diff --git a/Meshtastic/Views/Nodes/NodeList.swift b/Meshtastic/Views/Nodes/NodeList.swift index 0e9645a8..cfb81235 100644 --- a/Meshtastic/Views/Nodes/NodeList.swift +++ b/Meshtastic/Views/Nodes/NodeList.swift @@ -50,9 +50,10 @@ struct NodeList: View { .padding(.bottom, 5) if connected { HStack(alignment: .bottom) { - Image(systemName: "repeat.circle.fill").font(.title2) - .foregroundColor(.accentColor).symbolRenderingMode(.hierarchical) - Text("Currently Connected").font(.callout).foregroundColor(Color.accentColor) + Image(systemName: "repeat.circle.fill") + .font(.title2) + .symbolRenderingMode(.hierarchical) + Text("Currently Connected").font(.callout) } .padding(.bottom, 2) } @@ -63,18 +64,21 @@ struct NodeList: View { if lastPostion.coordinate != nil { let nodeCoord = CLLocation(latitude: lastPostion.coordinate!.latitude, longitude: lastPostion.coordinate!.longitude) let metersAway = nodeCoord.distance(from: myCoord) - Image(systemName: "lines.measurement.horizontal").font(.title3) - .foregroundColor(.gray).symbolRenderingMode(.hierarchical) + Image(systemName: "lines.measurement.horizontal") + .font(.title3) + .symbolRenderingMode(.hierarchical) - DistanceText(meters: metersAway).font(.subheadline).foregroundColor(.gray) + DistanceText(meters: metersAway).font(.subheadline) } } .padding(.bottom, 2) } HStack(alignment: .bottom) { - Image(systemName: "clock.badge.checkmark.fill").font(.headline) - .foregroundColor(.gray).symbolRenderingMode(.hierarchical) - LastHeardText(lastHeard: node.lastHeard).font(.subheadline).foregroundColor(.gray) + Image(systemName: "clock.badge.checkmark.fill") + .font(.headline) + .symbolRenderingMode(.hierarchical) + LastHeardText(lastHeard: node.lastHeard) + .font(.subheadline) } } .padding([.leading, .top, .bottom])