Merge pull request #244 from meshtastic/2.0.3_Working_Changes

Node List Padding Fixes
This commit is contained in:
Garth Vander Houwen 2022-11-20 15:57:52 -08:00 committed by GitHub
commit c8058b6622
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 64 deletions

View file

@ -1056,12 +1056,9 @@ func positionPacket (packet: MeshPacket, context: NSManagedObjectContext) {
do {
if let positionMessage = try? Position(serializedData: packet.decoded.payload) {
// Don't save empty position packets
if positionMessage.longitudeI > 0 || positionMessage.latitudeI > 0 {
let fetchedNode = try context.fetch(fetchNodePositionRequest) as! [NodeInfoEntity]
if fetchedNode.count == 1 {
let position = PositionEntity(context: context)
@ -1103,13 +1100,10 @@ func positionPacket (packet: MeshPacket, context: NSManagedObjectContext) {
} else {
print("💥 Empty POSITION_APP Packet")
print(try! packet.jsonString())
if let dataMessage = try? DataMessage(serializedData: packet.decoded.payload) {
//print(dataMessage)
}
}
}
} catch {
print("💥 Error Fetching NodeInfoEntity for POSITION_APP")
print("💥 Error Deserializing POSITION_APP packet.")
}
}

View file

@ -17,48 +17,33 @@ struct InvalidVersion: View {
VStack {
Text("Update your firmware")
Text("Update Firmware")
.font(.largeTitle)
.foregroundColor(.orange)
Divider()
VStack {
Text("The Meshtastic Apple apps support firmware version \(minimumVersion) and above.")
.font(.title2)
.padding(.bottom)
Link("Firmware update docs", destination: URL(string: "https://meshtastic.org/docs/getting-started/flashing-firmware/")!)
.font(.title)
.padding()
Link("Additional help", destination: URL(string: "https://meshtastic.org/docs/faq")!)
.font(.title)
.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])
Text("There is a build for 1.2 EOL under Other Versions in TestFlight that will be available until the end of November 2022.")
.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)

View file

@ -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")) {

View file

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