From ddf981b4d04ec49acfb31a881e648e7167d35a50 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 20 Nov 2022 15:55:46 -0800 Subject: [PATCH] Add padding to node list items. --- .../Views/Bluetooth/InvalidVersion.swift | 7 +- Meshtastic/Views/Messages/Contacts.swift | 73 +++++++++---------- Meshtastic/Views/Nodes/NodeList.swift | 4 +- 3 files changed, 37 insertions(+), 47 deletions(-) diff --git a/Meshtastic/Views/Bluetooth/InvalidVersion.swift b/Meshtastic/Views/Bluetooth/InvalidVersion.swift index 5f19887a..d4539b54 100644 --- a/Meshtastic/Views/Bluetooth/InvalidVersion.swift +++ b/Meshtastic/Views/Bluetooth/InvalidVersion.swift @@ -17,7 +17,7 @@ struct InvalidVersion: View { VStack { - Text("Firmware Update Required") + Text("Update Firmware") .font(.largeTitle) .foregroundColor(.orange) @@ -34,21 +34,16 @@ struct InvalidVersion: View { .padding() } .padding() - Divider() .padding(.top) - VStack{ - Text("🦕 End of life Version 🦖 ☄️") .font(.title3) .foregroundColor(.orange) .padding(.bottom) - Text("Version \(minimumVersion) includes breaking changes to devices and the client apps. Only nodes version \(minimumVersion) and above are supported.") .font(.callout) .padding([.leading, .trailing, .bottom]) - Link("Version 1.2 End of life (EOL) Info", destination: URL(string: "https://meshtastic.org/docs/1.2-End-of-life/")!) .font(.callout) diff --git a/Meshtastic/Views/Messages/Contacts.swift b/Meshtastic/Views/Messages/Contacts.swift index 0832e3eb..1d4f814c 100644 --- a/Meshtastic/Views/Messages/Contacts.swift +++ b/Meshtastic/Views/Messages/Contacts.swift @@ -39,55 +39,52 @@ struct Contacts: View { let lastMessageTime = Date(timeIntervalSince1970: TimeInterval(Int64((mostRecent?.messageTimestamp ?? 0 )))) let lastMessageDay = Calendar.current.dateComponents([.day], from: lastMessageTime).day ?? 0 let currentDay = Calendar.current.dateComponents([.day], from: Date()).day ?? 0 - //HStack { - VStack(alignment: .leading) { - HStack { - CircleText(text: String(channel.index), color: .gray, circleSize: 52, fontSize: 40) - .padding(.trailing, 5) - VStack { - HStack { - Text(String(channel.name ?? "Channel \(channel.index)").camelCaseToWords()).font(.headline) - Spacer() - if channel.allPrivateMessages.count > 0 { - VStack (alignment: .trailing) { - if lastMessageDay == currentDay { - Text(lastMessageTime, style: .time ) - .font(.subheadline) - } else if lastMessageDay == (currentDay - 1) { - Text("Yesterday") - .font(.subheadline) - } else if lastMessageDay < (currentDay - 1) && lastMessageDay > (currentDay - 5) { - Text(lastMessageTime.formattedDate(format: "MM/dd/yy")) - .font(.subheadline) - } else if lastMessageDay < (currentDay - 1800) { - Text(lastMessageTime.formattedDate(format: "MM/dd/yy")) - .font(.subheadline) - } - } - .brightness(-0.20) - } - } + VStack(alignment: .leading) { + HStack { + CircleText(text: String(channel.index), color: .gray, circleSize: 52, fontSize: 40) + .padding(.trailing, 5) + VStack { + HStack { + Text(String(channel.name ?? "Channel \(channel.index)").camelCaseToWords()).font(.headline) + Spacer() if channel.allPrivateMessages.count > 0 { - HStack(alignment: .top) { - Text("\(mostRecent != nil ? mostRecent!.messagePayload! : " ")") - .truncationMode(.tail) - .frame(maxWidth: .infinity, alignment: .leading) - .brightness(-0.20) - .font(.body) + VStack (alignment: .trailing) { + if lastMessageDay == currentDay { + Text(lastMessageTime, style: .time ) + .font(.subheadline) + } else if lastMessageDay == (currentDay - 1) { + Text("Yesterday") + .font(.subheadline) + } else if lastMessageDay < (currentDay - 1) && lastMessageDay > (currentDay - 5) { + Text(lastMessageTime.formattedDate(format: "MM/dd/yy")) + .font(.subheadline) + } else if lastMessageDay < (currentDay - 1800) { + Text(lastMessageTime.formattedDate(format: "MM/dd/yy")) + .font(.subheadline) + } } + .brightness(-0.20) + } + } + if channel.allPrivateMessages.count > 0 { + HStack(alignment: .top) { + Text("\(mostRecent != nil ? mostRecent!.messagePayload! : " ")") + .truncationMode(.tail) + .frame(maxWidth: .infinity, alignment: .leading) + .brightness(-0.20) + .font(.body) } } - .frame(maxWidth: .infinity, alignment: .leading) } + .frame(maxWidth: .infinity, alignment: .leading) } - // } + } } } .frame(maxWidth: .infinity, maxHeight: 80, alignment: .leading) } } - .padding(.top, 10) - .padding(.bottom, 10) + .padding([.top, .bottom]) } } Section(header: Text("Direct Messages")) { diff --git a/Meshtastic/Views/Nodes/NodeList.swift b/Meshtastic/Views/Nodes/NodeList.swift index f15a2202..b27b4462 100644 --- a/Meshtastic/Views/Nodes/NodeList.swift +++ b/Meshtastic/Views/Nodes/NodeList.swift @@ -46,7 +46,6 @@ struct NodeList: View { .padding(.trailing, 5) VStack(alignment: .leading) { Text(node.user?.longName ?? "Unknown").font(.headline) - .padding(.bottom, 2) if connected { HStack(alignment: .bottom) { Image(systemName: "repeat.circle.fill") @@ -54,7 +53,6 @@ struct NodeList: View { .symbolRenderingMode(.hierarchical) Text("Currently Connected").font(.callout) } - .padding(.bottom, 2) } if node.positions?.count ?? 0 > 0 && (bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.num != node.num) { HStack(alignment: .bottom) { @@ -70,7 +68,6 @@ struct NodeList: View { DistanceText(meters: metersAway).font(.subheadline) } } - .padding(.bottom, 2) } HStack(alignment: .bottom) { Image(systemName: "clock.badge.checkmark.fill") @@ -84,6 +81,7 @@ struct NodeList: View { } } } + .padding([.top, .bottom]) } } .navigationTitle("All Nodes")