diff --git a/Meshtastic Client.xcodeproj/project.pbxproj b/Meshtastic Client.xcodeproj/project.pbxproj index 8279af3b..3767c7dc 100644 --- a/Meshtastic Client.xcodeproj/project.pbxproj +++ b/Meshtastic Client.xcodeproj/project.pbxproj @@ -59,6 +59,7 @@ DDC3B274283F411B00AC321C /* LastHeardText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC3B273283F411B00AC321C /* LastHeardText.swift */; }; DDC4D568275499A500A4208E /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC4D567275499A500A4208E /* Persistence.swift */; }; DDCA31322826009C00207175 /* PassKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDCA31312826009C00207175 /* PassKit.framework */; }; + DDD94A502845C8F5004A87A0 /* DateTimeText.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDD94A4F2845C8F5004A87A0 /* DateTimeText.swift */; }; DDF924CA26FBB953009FE055 /* ConnectedDevice.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDF924C926FBB953009FE055 /* ConnectedDevice.swift */; }; /* End PBXBuildFile section */ @@ -139,6 +140,7 @@ DDC3B273283F411B00AC321C /* LastHeardText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LastHeardText.swift; sourceTree = ""; }; DDC4D567275499A500A4208E /* Persistence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = ""; }; DDCA31312826009C00207175 /* PassKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PassKit.framework; path = System/Library/Frameworks/PassKit.framework; sourceTree = SDKROOT; }; + DDD94A4F2845C8F5004A87A0 /* DateTimeText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateTimeText.swift; sourceTree = ""; }; DDF924C926FBB953009FE055 /* ConnectedDevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectedDevice.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -361,6 +363,7 @@ DDF924C926FBB953009FE055 /* ConnectedDevice.swift */, DDC3B273283F411B00AC321C /* LastHeardText.swift */, DDA6B2EA28420A7B003E8C16 /* NodeAnnotation.swift */, + DDD94A4F2845C8F5004A87A0 /* DateTimeText.swift */, ); path = Helpers; sourceTree = ""; @@ -583,6 +586,7 @@ DDC3B274283F411B00AC321C /* LastHeardText.swift in Sources */, DD2E65262767A01F00E45FC5 /* NodeDetail.swift in Sources */, DDA6B2E928419CF2003E8C16 /* MeshPackets.swift in Sources */, + DDD94A502845C8F5004A87A0 /* DateTimeText.swift in Sources */, C9A88B57278B559900BD810A /* apponly.pb.swift in Sources */, DD4C158E2824AA7E0032668E /* config.pb.swift in Sources */, DD47E3D926F3093800029299 /* MessageBubble.swift in Sources */, diff --git a/Meshtastic Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Meshtastic Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 6685f05b..bccfe8c9 100644 --- a/Meshtastic Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Meshtastic Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,25 +1,23 @@ { - "object": { - "pins": [ - { - "package": "SQLite.swift", - "repositoryURL": "https://github.com/stephencelis/SQLite.swift.git", - "state": { - "branch": null, - "revision": "60a65015f6402b7c34b9a924f755ca0a73afeeaa", - "version": "0.13.1" - } - }, - { - "package": "SwiftProtobuf", - "repositoryURL": "https://github.com/apple/swift-protobuf.git", - "state": { - "branch": null, - "revision": "e1499bc69b9040b29184f7f2996f7bab467c1639", - "version": "1.19.0" - } + "pins" : [ + { + "identity" : "sqlite.swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/stephencelis/SQLite.swift.git", + "state" : { + "revision" : "60a65015f6402b7c34b9a924f755ca0a73afeeaa", + "version" : "0.13.1" } - ] - }, - "version": 1 + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "e1499bc69b9040b29184f7f2996f7bab467c1639", + "version" : "1.19.0" + } + } + ], + "version" : 2 } diff --git a/MeshtasticClient/Helpers/BLEManager.swift b/MeshtasticClient/Helpers/BLEManager.swift index 9e18b01e..937a0c39 100644 --- a/MeshtasticClient/Helpers/BLEManager.swift +++ b/MeshtasticClient/Helpers/BLEManager.swift @@ -884,7 +884,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph var meshPacket = MeshPacket() meshPacket.to = UInt32(destNum) - meshPacket.from = 0 //UInt32(connectedPeripheral.num) + meshPacket.from = 0 // Send 0 as from from phone to device to avoid warning about client trying to set node num meshPacket.wantAck = wantResponse var dataMessage = DataMessage() @@ -933,41 +933,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph } } - // MARK: Device Settings - public func getSettings() -> Bool { - - var adminPacket = AdminMessage() - - var meshPacket: MeshPacket = MeshPacket() - meshPacket.to = UInt32(connectedPeripheral.num) - meshPacket.from = UInt32(connectedPeripheral.num) - meshPacket.id = UInt32.random(in: UInt32(UInt8.max).. Bool { var adminPacket = AdminMessage() @@ -1001,7 +966,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph } return false - } public func sendReboot(destNum: Int64, wantResponse: Bool) -> Bool { @@ -1037,6 +1001,5 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph } return false - } } diff --git a/MeshtasticClient/Views/Helpers/DateTimeText.swift b/MeshtasticClient/Views/Helpers/DateTimeText.swift new file mode 100644 index 00000000..523f6445 --- /dev/null +++ b/MeshtasticClient/Views/Helpers/DateTimeText.swift @@ -0,0 +1,30 @@ +// +// DateTimeText.swift +// MeshtasticClient +// +// Created by Garth Vander Houwen on 5/30/22. +// + +import SwiftUI +// +// LastHeardText.swift +// Meshtastic Apple +// +// Created by Garth Vander Houwen on 5/25/22. +// +struct DateTimeText: View { + var dateTime: Date? + + let sixMonthsAgo = Calendar.current.date(byAdding: .month, value: -6, to: Date()) + + var body: some View { + if (dateTime != nil && dateTime! >= sixMonthsAgo!){ + + Text("\(dateTime!, style: .date) \(dateTime!, style: .time)") + + } else { + + Text("Unknown Age") + } + } +} diff --git a/MeshtasticClient/Views/Helpers/NodeAnnotation.swift b/MeshtasticClient/Views/Helpers/NodeAnnotation.swift index 37050bdb..a8c47579 100644 --- a/MeshtasticClient/Views/Helpers/NodeAnnotation.swift +++ b/MeshtasticClient/Views/Helpers/NodeAnnotation.swift @@ -14,12 +14,12 @@ struct NodeAnnotation: View { .cornerRadius(10) Image(systemName: "mappin.circle.fill") - .font(.title) - .foregroundColor(.red) + .font(.largeTitle) + .foregroundColor(.accentColor) Image(systemName: "arrowtriangle.down.fill") .font(.caption) - .foregroundColor(.red) + .foregroundColor(.accentColor) .offset(x: 0, y: -5) } } diff --git a/MeshtasticClient/Views/Nodes/NodeDetail.swift b/MeshtasticClient/Views/Nodes/NodeDetail.swift index 5191d05b..db5a979e 100644 --- a/MeshtasticClient/Views/Nodes/NodeDetail.swift +++ b/MeshtasticClient/Views/Nodes/NodeDetail.swift @@ -85,7 +85,7 @@ struct NodeDetail: View { ScrollView { HStack { - if self.bleManager.connectedPeripheral != nil && self.bleManager.connectedPeripheral.num == node.num { + if self.bleManager.connectedPeripheral != nil && self.bleManager.connectedPeripheral.num == node.num && self.bleManager.connectedPeripheral.num == node.num { Button(action: { @@ -315,7 +315,7 @@ struct NodeDetail: View { .symbolRenderingMode(.hierarchical) Text("Time:") .font(.caption) - Text("\(mappin.time!, style: .date) \(mappin.time!, style: .time)") + DateTimeText(dateTime: mappin.time) .foregroundColor(.gray) .font(.caption) Divider()