From bd92aae2eb2124bb05c49600502aa99ebee7e032 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 5 Sep 2022 18:32:27 -0700 Subject: [PATCH] * Add unknown time logic to pins on node details view * send current position if fixed position is enabled on position config * check for nil loRaConfig on share channel view --- Meshtastic/Views/Helpers/NodeAnnotation.swift | 29 ++++++++++++++----- .../Settings/Config/PositionConfig.swift | 10 ++++--- Meshtastic/Views/Settings/ShareChannel.swift | 2 +- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Meshtastic/Views/Helpers/NodeAnnotation.swift b/Meshtastic/Views/Helpers/NodeAnnotation.swift index a8c47579..817448f1 100644 --- a/Meshtastic/Views/Helpers/NodeAnnotation.swift +++ b/Meshtastic/Views/Helpers/NodeAnnotation.swift @@ -3,15 +3,31 @@ import SwiftUI struct NodeAnnotation: View { let time: Date + + let sixMonthsAgo = Calendar.current.date(byAdding: .month, value: -6, to: Date()) var body: some View { - VStack(spacing: 0) { - Text(time, style: .offset) - .font(.callout).foregroundColor(.accentColor) - .padding(5) - .background(Color(.white)) - .cornerRadius(10) + if (time >= sixMonthsAgo!) { + + VStack(spacing: 0) { + Text(time, style: .offset) + .font(.caption2).foregroundColor(.accentColor) + .padding(5) + .background(Color(.white)) + .cornerRadius(10) + } + + } else { + + VStack(spacing: 0) { + Text("Unknown Time") + .font(.caption2).foregroundColor(.accentColor) + .padding(5) + .background(Color(.white)) + .cornerRadius(10) + } + } Image(systemName: "mappin.circle.fill") .font(.largeTitle) @@ -21,6 +37,5 @@ struct NodeAnnotation: View { .font(.caption) .foregroundColor(.accentColor) .offset(x: 0, y: -5) - } } } diff --git a/Meshtastic/Views/Settings/Config/PositionConfig.swift b/Meshtastic/Views/Settings/Config/PositionConfig.swift index 5fcaa854..f703fcf0 100644 --- a/Meshtastic/Views/Settings/Config/PositionConfig.swift +++ b/Meshtastic/Views/Settings/Config/PositionConfig.swift @@ -113,12 +113,9 @@ struct PositionConfig: View { Label("Fixed Position", systemImage: "location.square.fill") } .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - if fixedPosition { - - Text("Set to current location here") + Text("If enabled your current location will be set as a fixed position.") .font(.caption) .listRowSeparator(.visible) - } } } @@ -255,6 +252,11 @@ struct PositionConfig: View { if includePosHeading { pf.insert(.posHeading) } pc.positionFlags = UInt32(pf.rawValue) + + if fixedPosition { + + let sendPosition = bleManager.sendPosition(destNum: bleManager.connectedPeripheral.num, wantAck: true) + } let adminMessageId = bleManager.savePositionConfig(config: pc, fromUser: node!.user!, toUser: node!.user!) diff --git a/Meshtastic/Views/Settings/ShareChannel.swift b/Meshtastic/Views/Settings/ShareChannel.swift index b9e0ae82..1b1768bf 100644 --- a/Meshtastic/Views/Settings/ShareChannel.swift +++ b/Meshtastic/Views/Settings/ShareChannel.swift @@ -69,7 +69,7 @@ struct ShareChannel: View { alignment: .center ) - if node?.loRaConfig != nil { + if node!.loRaConfig != nil { HStack {