mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge pull request #615 from meshtastic/2.3.6_Working_Changes
2.3.6 working changes
This commit is contained in:
commit
eb05dae274
4 changed files with 42 additions and 23 deletions
|
|
@ -86,8 +86,8 @@ struct DeviceMetricsLog: View {
|
|||
}
|
||||
.frame(minHeight: 250)
|
||||
}
|
||||
let localeDateFormat = DateFormatter.dateFormat(fromTemplate: "yyMMddjmma", options: 0, locale: Locale.current)
|
||||
let dateFormatString = (localeDateFormat ?? "MM/dd/YY j:mma").replacingOccurrences(of: ",", with: "")
|
||||
let localeDateFormat = DateFormatter.dateFormat(fromTemplate: "yyMdjmma", options: 0, locale: Locale.current)
|
||||
let dateFormatString = (localeDateFormat ?? "M/d/YY j:mma").replacingOccurrences(of: ",", with: "")
|
||||
if UIScreen.main.bounds.size.width > 768 && (UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac) {
|
||||
// Add a table for mac and ipad
|
||||
// Table(Array(deviceMetrics),id: \.self) {
|
||||
|
|
@ -111,7 +111,7 @@ struct DeviceMetricsLog: View {
|
|||
TableColumn("uptime") { dm in
|
||||
let now = Date.now
|
||||
let later = now + TimeInterval(dm.uptimeSeconds)
|
||||
let components = (now..<later).formatted(.components(style: .condensedAbbreviated))
|
||||
let components = (now..<later).formatted(.components(style: .narrow))
|
||||
Text(components)
|
||||
}
|
||||
TableColumn("timestamp") { dm in
|
||||
|
|
@ -122,12 +122,11 @@ struct DeviceMetricsLog: View {
|
|||
} else {
|
||||
ScrollView {
|
||||
let columns = [
|
||||
GridItem(.flexible(minimum: 25, maximum: 50), spacing: 0.1),
|
||||
GridItem(.flexible(minimum: 25, maximum: 50), spacing: 0.1),
|
||||
GridItem(.flexible(minimum: 25, maximum: 60), spacing: 0.1),
|
||||
GridItem(.flexible(minimum: 25, maximum: 60), spacing: 0.1),
|
||||
GridItem(.flexible(minimum: 25, maximum: 50), spacing: 0.1),
|
||||
GridItem(.flexible(minimum: 130, maximum: 175), spacing: 0.1)
|
||||
GridItem(.flexible(minimum: 20, maximum: 60), spacing: 0.1),
|
||||
GridItem(.flexible(minimum: 20, maximum: 60), spacing: 0.1),
|
||||
GridItem(.flexible(minimum: 20, maximum: 60), spacing: 0.1),
|
||||
GridItem(.flexible(minimum: 20, maximum: 60), spacing: 0.1),
|
||||
GridItem(.flexible(minimum: 100, maximum: .infinity), spacing: 0.1)
|
||||
]
|
||||
LazyVGrid(columns: columns, alignment: .leading, spacing: 1) {
|
||||
GridRow {
|
||||
|
|
@ -143,9 +142,6 @@ struct DeviceMetricsLog: View {
|
|||
Text("AirTm")
|
||||
.font(.caption)
|
||||
.fontWeight(.bold)
|
||||
Text("uptime")
|
||||
.font(.caption)
|
||||
.fontWeight(.bold)
|
||||
Text("timestamp")
|
||||
.font(.caption)
|
||||
.fontWeight(.bold)
|
||||
|
|
@ -165,11 +161,6 @@ struct DeviceMetricsLog: View {
|
|||
.font(.caption)
|
||||
Text("\(String(format: "%.2f", dm.airUtilTx))%")
|
||||
.font(.caption)
|
||||
let now = Date.now
|
||||
let later = now + TimeInterval(dm.uptimeSeconds)
|
||||
let components = (now..<later).formatted(.components(style: .condensedAbbreviated))
|
||||
Text(components)
|
||||
.font(.caption)
|
||||
Text(dm.time?.formattedDate(format: dateFormatString) ?? "unknown.age".localized)
|
||||
.font(.caption)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,34 @@ struct NodeDetail: View {
|
|||
VStack {
|
||||
ScrollView {
|
||||
NodeInfoItem(node: node)
|
||||
let dm = node.telemetries?.filtered(using: NSPredicate(format: "metricsType == 0")).lastObject as? TelemetryEntity
|
||||
if dm?.uptimeSeconds ?? 0 > 0 {
|
||||
HStack(alignment: .center) {
|
||||
let now = Date.now
|
||||
let later = now + TimeInterval(dm!.uptimeSeconds)
|
||||
let components = (now..<later).formatted(.components(style: .narrow))
|
||||
Label(
|
||||
title: {
|
||||
Text("\("uptime".localized)")
|
||||
.font(.title2)+Text(": \(components)")
|
||||
.font(.title3)
|
||||
.foregroundColor(Color.gray)
|
||||
},
|
||||
icon: {
|
||||
Image(systemName: "checkmark.circle.fill")
|
||||
.foregroundColor(.green)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.font(.title)
|
||||
}
|
||||
)
|
||||
}
|
||||
Divider()
|
||||
}
|
||||
if node.metadata != nil {
|
||||
HStack(alignment: .center) {
|
||||
Text("firmware.version").font(.title2)+Text(": \(node.metadata?.firmwareVersion ?? "unknown".localized)")
|
||||
.font(.title3).foregroundColor(Color.gray)
|
||||
.font(.title3)
|
||||
.foregroundColor(Color.gray)
|
||||
if connectedNode != nil && connectedNode?.myInfo?.hasAdmin ?? false && node.metadata?.time != nil && !Calendar.current.isDateInToday(node.metadata!.time!) {
|
||||
Button {
|
||||
let adminMessageId = bleManager.requestDeviceMetadata(fromUser: connectedNode!.user!, toUser: node.user!, adminIndex: connectedNode!.myInfo!.adminIndex, context: context)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,10 @@ struct NodeInfoItem: View {
|
|||
.symbolRenderingMode(.hierarchical)
|
||||
Text("Node Number:").font(.title2)
|
||||
}
|
||||
Text(String(node.num)).font(.title3).foregroundColor(.gray)
|
||||
Text(String(node.num))
|
||||
.font(.title3)
|
||||
.foregroundColor(.gray)
|
||||
.textSelection(.enabled)
|
||||
}
|
||||
Divider()
|
||||
VStack {
|
||||
|
|
@ -75,7 +78,10 @@ struct NodeInfoItem: View {
|
|||
.symbolRenderingMode(.hierarchical)
|
||||
Text("User Id:").font(.title2)
|
||||
}
|
||||
Text(node.user?.userId ?? "?").font(.title3).foregroundColor(.gray)
|
||||
Text(node.user?.userId ?? "?")
|
||||
.font(.title3)
|
||||
.foregroundColor(.gray)
|
||||
.textSelection(.enabled)
|
||||
}
|
||||
}
|
||||
Divider()
|
||||
|
|
|
|||
|
|
@ -39,9 +39,7 @@ struct AboutMeshtastic: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
Link("Sponsor App Development", destination: URL(string: "https://github.com/sponsors/garthvh")!)
|
||||
.font(.title2)
|
||||
Link("GitHub Repository", destination: URL(string: "https://github.com/meshtastic/Meshtastic-Apple")!)
|
||||
Link("Help with App Development", destination: URL(string: "https://github.com/meshtastic/Meshtastic-Apple")!)
|
||||
.font(.title2)
|
||||
Button("Review the app") {
|
||||
if let scene = UIApplication.shared.connectedScenes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue