Additional accent color cleanup

This commit is contained in:
Garth Vander Houwen 2022-11-17 21:44:07 -08:00
parent 27ff70a0af
commit cf9e66626e
4 changed files with 50 additions and 46 deletions

View file

@ -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:

View file

@ -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
}
}

View file

@ -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()
)

View file

@ -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])