diff --git a/Meshtastic Client.xcodeproj/project.pbxproj b/Meshtastic Client.xcodeproj/project.pbxproj index aa9ee08a..924e8806 100644 --- a/Meshtastic Client.xcodeproj/project.pbxproj +++ b/Meshtastic Client.xcodeproj/project.pbxproj @@ -15,7 +15,6 @@ DD47E3DB26F3901B00029299 /* Channels.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3DA26F3901A00029299 /* Channels.swift */; }; DD47E3DD26F390A000029299 /* Messages.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD47E3DC26F390A000029299 /* Messages.swift */; }; DD4A911E2708C65400501B7E /* AppSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4A911D2708C65400501B7E /* AppSettings.swift */; }; - DD4A91202708C66600501B7E /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD4A911F2708C66600501B7E /* Configuration.swift */; }; DD5394FC276993AD00AD86B1 /* SwiftProtobuf in Frameworks */ = {isa = PBXBuildFile; productRef = DD5394FB276993AD00AD86B1 /* SwiftProtobuf */; }; DD5394FE276BA0EF00AD86B1 /* PositionEntityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5394FD276BA0EF00AD86B1 /* PositionEntityExtension.swift */; }; DD539500276C452400AD86B1 /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5394FF276C452400AD86B1 /* Preferences.swift */; }; @@ -76,7 +75,6 @@ DD47E3DA26F3901A00029299 /* Channels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Channels.swift; sourceTree = ""; }; DD47E3DC26F390A000029299 /* Messages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Messages.swift; sourceTree = ""; }; DD4A911D2708C65400501B7E /* AppSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSettings.swift; sourceTree = ""; }; - DD4A911F2708C66600501B7E /* Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = ""; }; DD5394FD276BA0EF00AD86B1 /* PositionEntityExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PositionEntityExtension.swift; sourceTree = ""; }; DD5394FF276C452400AD86B1 /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = ""; }; DD539501276DAA6A00AD86B1 /* MapLocation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapLocation.swift; sourceTree = ""; }; @@ -165,7 +163,6 @@ isa = PBXGroup; children = ( DD4A911D2708C65400501B7E /* AppSettings.swift */, - DD4A911F2708C66600501B7E /* Configuration.swift */, DD8169FA271F1F3A00F4AB02 /* MeshLog.swift */, DD8169FE272476C700F4AB02 /* LogDocument.swift */, ); @@ -503,7 +500,6 @@ DDAF8C6926ED0D070058C060 /* deviceonly.pb.swift in Sources */, DDAF8C6B26ED0DD80058C060 /* environmental_measurement.pb.swift in Sources */, DD90860C26F684AF00DC5189 /* BatteryIcon.swift in Sources */, - DD4A91202708C66600501B7E /* Configuration.swift in Sources */, DD4A911E2708C65400501B7E /* AppSettings.swift in Sources */, DDAF8C6226ED0A230058C060 /* mqtt.pb.swift in Sources */, DDF924CA26FBB953009FE055 /* ConnectedDevice.swift in Sources */, @@ -695,7 +691,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.28.3; + MARKETING_VERSION = 1.31; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -722,7 +718,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.28.3; + MARKETING_VERSION = 1.31; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; diff --git a/Meshtastic Client.xcodeproj/xcuserdata/garthvanderhouwen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Meshtastic Client.xcodeproj/xcuserdata/garthvanderhouwen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 14488c79..8801dbca 100644 --- a/Meshtastic Client.xcodeproj/xcuserdata/garthvanderhouwen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Meshtastic Client.xcodeproj/xcuserdata/garthvanderhouwen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -64,38 +64,6 @@ landmarkType = "14"> - - - - - - - - - - - - - - - - - - - - diff --git a/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/Contents.json b/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/Contents.json index a19a5492..d72038af 100644 --- a/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/Contents.json +++ b/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/Contents.json @@ -1,14 +1,17 @@ { "images" : [ { + "filename" : "tlora-2.jpeg", "idiom" : "universal", "scale" : "1x" }, { + "filename" : "tlora-3.jpeg", "idiom" : "universal", "scale" : "2x" }, { + "filename" : "tlora-4.jpeg", "idiom" : "universal", "scale" : "3x" } diff --git a/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/tlora-2.jpeg b/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/tlora-2.jpeg new file mode 100644 index 00000000..450bbb05 Binary files /dev/null and b/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/tlora-2.jpeg differ diff --git a/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/tlora-3.jpeg b/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/tlora-3.jpeg new file mode 100644 index 00000000..450bbb05 Binary files /dev/null and b/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/tlora-3.jpeg differ diff --git a/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/tlora-4.jpeg b/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/tlora-4.jpeg new file mode 100644 index 00000000..450bbb05 Binary files /dev/null and b/MeshtasticClient/Assets.xcassets/TLORAV2.imageset/tlora-4.jpeg differ diff --git a/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/Contents.json b/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/Contents.json index a19a5492..d72038af 100644 --- a/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/Contents.json +++ b/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/Contents.json @@ -1,14 +1,17 @@ { "images" : [ { + "filename" : "tlora-2.jpeg", "idiom" : "universal", "scale" : "1x" }, { + "filename" : "tlora-3.jpeg", "idiom" : "universal", "scale" : "2x" }, { + "filename" : "tlora-4.jpeg", "idiom" : "universal", "scale" : "3x" } diff --git a/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/tlora-2.jpeg b/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/tlora-2.jpeg new file mode 100644 index 00000000..450bbb05 Binary files /dev/null and b/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/tlora-2.jpeg differ diff --git a/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/tlora-3.jpeg b/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/tlora-3.jpeg new file mode 100644 index 00000000..450bbb05 Binary files /dev/null and b/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/tlora-3.jpeg differ diff --git a/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/tlora-4.jpeg b/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/tlora-4.jpeg new file mode 100644 index 00000000..450bbb05 Binary files /dev/null and b/MeshtasticClient/Assets.xcassets/TLORAV211p6.imageset/tlora-4.jpeg differ diff --git a/MeshtasticClient/Helpers/BLEManager.swift b/MeshtasticClient/Helpers/BLEManager.swift index 125baa0b..79043425 100644 --- a/MeshtasticClient/Helpers/BLEManager.swift +++ b/MeshtasticClient/Helpers/BLEManager.swift @@ -25,7 +25,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph @Published var peripherals = [Peripheral]() @Published var connectedPeripheral: Peripheral! - @Published var connectedNode: NodeInfoEntity! + //@Published var connectedNode: NodeInfoEntity! @Published var lastConnectedPeripheral: String @Published var lastConnectionError: String @@ -37,6 +37,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph var timeoutTimerCount = 0 private var broadcastNodeId: UInt32 = 4294967295 + var nextSentMessageId: Int64 = 1 /* Meshtastic Service Details */ var TORADIO_characteristic: CBCharacteristic! @@ -211,6 +212,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph if fetchedNode.count == 1 { + connectedPeripheral.num = fetchedNode[0].user!.num connectedPeripheral.shortName = fetchedNode[0].user!.shortName! connectedPeripheral.longName = fetchedNode[0].user!.longName! connectedPeripheral.firmwareVersion = (fetchedNode[0].myInfo?.firmwareVersion ?? "Unknown") @@ -480,19 +482,17 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph newNode.user = newUser } - //if decodedInfo.nodeInfo.hasPosition && decodedInfo.nodeInfo.position.latitudeI != 0 { - let position = PositionEntity(context: context!) - position.latitudeI = decodedInfo.nodeInfo.position.latitudeI - position.longitudeI = decodedInfo.nodeInfo.position.longitudeI - position.altitude = decodedInfo.nodeInfo.position.altitude - position.batteryLevel = decodedInfo.nodeInfo.position.batteryLevel - position.time = Date(timeIntervalSince1970: TimeInterval(Int64(decodedInfo.nodeInfo.position.time))) + let position = PositionEntity(context: context!) + position.latitudeI = decodedInfo.nodeInfo.position.latitudeI + position.longitudeI = decodedInfo.nodeInfo.position.longitudeI + position.altitude = decodedInfo.nodeInfo.position.altitude + position.batteryLevel = decodedInfo.nodeInfo.position.batteryLevel + position.time = Date(timeIntervalSince1970: TimeInterval(Int64(decodedInfo.nodeInfo.position.time))) - var newPostions = [PositionEntity]() - newPostions.append(position) - newNode.positions? = NSOrderedSet(array : newPostions) - //} + var newPostions = [PositionEntity]() + newPostions.append(position) + newNode.positions? = NSOrderedSet(array : newPostions) // Look for a MyInfo let fetchMyInfoRequest:NSFetchRequest = NSFetchRequest.init(entityName: "MyInfoEntity") @@ -524,21 +524,18 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph fetchedNode[0].user!.shortName = decodedInfo.nodeInfo.user.shortName fetchedNode[0].user!.hwModel = String(describing: decodedInfo.nodeInfo.user.hwModel).uppercased() } - if decodedInfo.nodeInfo.hasPosition && decodedInfo.nodeInfo.position.latitudeI != 0 && decodedInfo.nodeInfo.position.longitudeI != 0 { - let position = PositionEntity(context: context!) - position.latitudeI = decodedInfo.nodeInfo.position.latitudeI - position.longitudeI = decodedInfo.nodeInfo.position.longitudeI - position.altitude = decodedInfo.nodeInfo.position.altitude - position.batteryLevel = decodedInfo.nodeInfo.position.batteryLevel - position.time = Date(timeIntervalSince1970: TimeInterval(Int64(decodedInfo.nodeInfo.position.time))) + let position = PositionEntity(context: context!) + position.latitudeI = decodedInfo.nodeInfo.position.latitudeI + position.longitudeI = decodedInfo.nodeInfo.position.longitudeI + position.altitude = decodedInfo.nodeInfo.position.altitude + position.batteryLevel = decodedInfo.nodeInfo.position.batteryLevel + position.time = Date(timeIntervalSince1970: TimeInterval(Int64(decodedInfo.nodeInfo.position.time))) - if position.latitudeI != 0 { - let mutablePositions = fetchedNode[0].positions!.mutableCopy() as! NSMutableOrderedSet - mutablePositions.add(position) - fetchedNode[0].positions = mutablePositions.copy() as? NSOrderedSet - } - } + let mutablePositions = fetchedNode[0].positions!.mutableCopy() as! NSMutableOrderedSet + mutablePositions.add(position) + fetchedNode[0].positions = mutablePositions.copy() as? NSOrderedSet + // Look for a MyInfo let fetchMyInfoRequest:NSFetchRequest = NSFetchRequest.init(entityName: "MyInfoEntity") fetchMyInfoRequest.predicate = NSPredicate(format: "myNodeNum == %lld", Int64(decodedInfo.nodeInfo.num)) @@ -611,20 +608,21 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph newMessage.messageTimestamp = Int32(bitPattern: decodedInfo.packet.rxTime) newMessage.receivedACK = false newMessage.direction = "IN" + newMessage.toUser = Int64(decodedInfo.packet.to) if decodedInfo.packet.to == broadcastNodeId && fetchedUsers.count == 1 { - let bcu: UserEntity = UserEntity(context: context!) - bcu.shortName = "BC" - bcu.longName = "Broadcast" - bcu.hwModel = "UNSET" - bcu.num = Int64(broadcastNodeId) - bcu.userId = "BROADCASTNODE" - newMessage.toUser = bcu + //let bcu: UserEntity = UserEntity(context: context!) + //bcu.shortName = "BC" + //bcu.longName = "Broadcast" + //bcu.hwModel = "UNSET" + //bcu.num = Int64(broadcastNodeId) + //bcu.userId = "BROADCASTNODE" + //newMessage.toUser = bcu } else { - - newMessage.toUser = fetchedUsers.first(where: { $0.num == decodedInfo.packet.to }) + //return + //newMessage.toUser = fetchedUsers.first(where: { $0.num == decodedInfo.packet.to }) } newMessage.fromUser = fetchedUsers.first(where: { $0.num == decodedInfo.packet.from }) @@ -806,58 +804,70 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph // Don's send an empty message success = false } else { - - let newMessage = MessageEntity(context: context!) - newMessage.messageId = Int64(bitPattern: 0) - newMessage.messageTimestamp = Int32(Date().timeIntervalSince1970) - newMessage.receivedACK = false - newMessage.direction = "IN" - - - let bcu: UserEntity = UserEntity(context: context!) - bcu.shortName = "BC" - bcu.longName = "Broadcast" - bcu.hwModel = "UNSET" - bcu.num = Int64(broadcastNodeId) - bcu.userId = "BROADCASTNODE" - newMessage.toUser = bcu // Set from user from query here - - newMessage.messagePayload = message + let fetchFromUser:NSFetchRequest = NSFetchRequest.init(entityName: "UserEntity") + fetchFromUser.predicate = NSPredicate(format: "num == %lld", Int64(self.connectedPeripheral.num)) - let dataType = PortNum.textMessageApp - let payloadData: Data = message.data(using: String.Encoding.utf8)! - - var dataMessage = DataMessage() - dataMessage.payload = payloadData - dataMessage.portnum = dataType - - var meshPacket = MeshPacket() - meshPacket.to = broadcastNodeId - meshPacket.decoded = dataMessage - meshPacket.wantAck = true - - var toRadio: ToRadio! - toRadio = ToRadio() - toRadio.packet = meshPacket - - let binaryData: Data = try! toRadio.serializedData() - if connectedPeripheral!.peripheral.state == CBPeripheralState.connected { - connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse) - do { + do { + + let fetchedUser = try context?.fetch(fetchFromUser) as! [UserEntity] + + if fetchedUser.isEmpty { - try context!.save() - print("Saved a new message for \(0)") - success = true - - } catch { - - context!.rollback() - - let nsError = error as NSError - print("Unresolved error \(nsError)") + print("Connected User Not Found, Fail") + success = false } + else { + + let newMessage = MessageEntity(context: context!) + newMessage.messageId = nextSentMessageId + newMessage.messageTimestamp = Int32(Date().timeIntervalSince1970) + newMessage.receivedACK = false + newMessage.direction = "IN" + newMessage.toUser = Int64(broadcastNodeId) + + newMessage.fromUser = fetchedUser[0] + newMessage.messagePayload = message + + let dataType = PortNum.textMessageApp + let payloadData: Data = message.data(using: String.Encoding.utf8)! + + var dataMessage = DataMessage() + dataMessage.payload = payloadData + dataMessage.portnum = dataType + + var meshPacket = MeshPacket() + meshPacket.to = broadcastNodeId + meshPacket.decoded = dataMessage + meshPacket.wantAck = true + + var toRadio: ToRadio! + toRadio = ToRadio() + toRadio.packet = meshPacket + + let binaryData: Data = try! toRadio.serializedData() + if connectedPeripheral!.peripheral.state == CBPeripheralState.connected { + connectedPeripheral.peripheral.writeValue(binaryData, for: TORADIO_characteristic, type: .withResponse) + do { + + try context!.save() + print("Saved a new sent message from \(connectedPeripheral.num)") + success = true + nextSentMessageId+=1 + + } catch { + + context!.rollback() + + let nsError = error as NSError + print("Unresolved error \(nsError)") + } + } + } + + } catch { + } } return success diff --git a/MeshtasticClient/Persistence/PositionEntityExtension.swift b/MeshtasticClient/Persistence/PositionEntityExtension.swift index ec5ccd6e..b842f82c 100644 --- a/MeshtasticClient/Persistence/PositionEntityExtension.swift +++ b/MeshtasticClient/Persistence/PositionEntityExtension.swift @@ -9,7 +9,7 @@ extension PositionEntity { let d = Double(latitudeI) if d == 0 { - return nil + return 0 } return d / 1e7 } @@ -18,7 +18,7 @@ extension PositionEntity { let d = Double(longitudeI) if d == 0 { - return nil + return 0 } return d / 1e7 } diff --git a/MeshtasticClient/Views/ContentView.swift b/MeshtasticClient/Views/ContentView.swift index 7f4a422b..f950a0fc 100644 --- a/MeshtasticClient/Views/ContentView.swift +++ b/MeshtasticClient/Views/ContentView.swift @@ -60,6 +60,5 @@ struct ContentView: View { struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() - // .environmentObject(MeshData()) } } diff --git a/MeshtasticClient/Views/Helpers/MessageBubble.swift b/MeshtasticClient/Views/Helpers/MessageBubble.swift index ae626620..3950d1b1 100644 --- a/MeshtasticClient/Views/Helpers/MessageBubble.swift +++ b/MeshtasticClient/Views/Helpers/MessageBubble.swift @@ -43,12 +43,10 @@ struct MessageBubble: View { Spacer() } .alert(isPresented: $showAlert) { + Alert(title: Text("Are you sure you want to delete this message?"), message: Text("This action is permanent."), primaryButton: .destructive(Text("OK")) { print("OK button tapped") - // let messageIndex = meshData.nodes.firstIndex(where: { $0.id == node.id }) - // meshData.nodes.remove(at: nodeIndex!) - // meshData.save() }, secondaryButton: .cancel() ) diff --git a/MeshtasticClient/Views/Messages/Messages.swift b/MeshtasticClient/Views/Messages/Messages.swift index 97159fe3..ce9eb818 100644 --- a/MeshtasticClient/Views/Messages/Messages.swift +++ b/MeshtasticClient/Views/Messages/Messages.swift @@ -48,12 +48,13 @@ struct Messages: View { ForEach(messages) { message in HStack(alignment: .top) { - let currentUser: Bool = false// (message.fromUser != nil && bleManager.connectedPeripheral.num == message.fromUser!.num) - + let currentUser: Bool = (bleManager.connectedPeripheral == nil) ? false : ((bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.num == message.fromUser?.num) ? true : false ) + //let currentUser: (Bool = message.fromUser == nil : false : (message.fromUser != nil && bleManager.connectedPeripheral.num == message.fromUser!.num : true) - CircleText(text: (message.fromUser?.longName ?? "???"), color: currentUser ? .accentColor : Color(.darkGray)).padding(.all, 5) + CircleText(text: (message.fromUser?.shortName ?? "???"), color: currentUser ? .accentColor : Color(.darkGray)).padding(.all, 5) .gesture(LongPressGesture(minimumDuration: 2) .onEnded {_ in + print(messages) print("I want to delete message: \(message.messageId)") self.showDeleteMessageAlert = true self.deleteMessageId = message.messageId @@ -94,8 +95,8 @@ struct Messages: View { context.delete(message!) do { - try context.save() + deleteMessageId = 0 messageCount = messages.count @@ -182,6 +183,7 @@ struct Messages: View { Button(action: { if bleManager.sendMessage(message: typingMessage) { typingMessage = "" + focusedField = nil } else { _ = Timer.scheduledTimer(withTimeInterval: 3.0, repeats: false) { (_) in @@ -204,14 +206,14 @@ struct Messages: View { .navigationBarTitleDisplayMode(.inline) .navigationBarItems(trailing: - ZStack { + ZStack { - ConnectedDevice( - bluetoothOn: bleManager.isSwitchedOn, - deviceConnected: bleManager.connectedPeripheral != nil, - name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : - "???") - }) + ConnectedDevice( + bluetoothOn: bleManager.isSwitchedOn, + deviceConnected: bleManager.connectedPeripheral != nil, + name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "???") + } + ) .onAppear(perform: { self.bleManager.context = context diff --git a/MeshtasticClient/Views/Nodes/NodeDetail.swift b/MeshtasticClient/Views/Nodes/NodeDetail.swift index f646a6b3..b8f24f78 100644 --- a/MeshtasticClient/Views/Nodes/NodeDetail.swift +++ b/MeshtasticClient/Views/Nodes/NodeDetail.swift @@ -58,7 +58,10 @@ struct NodeDetail: View { HStack { - Image(systemName: "clock").font(.title).foregroundColor(.accentColor) + Image(systemName: "clock.badge.checkmark.fill") + .font(.title) + .foregroundColor(.accentColor) + .symbolRenderingMode(.hierarchical) Text("Last Heard: \(node.lastHeard!, style: .relative) ago").font(.title3) } .padding() @@ -117,7 +120,10 @@ struct NodeDetail: View { .padding(.bottom) if mostRecent.batteryLevel > 0 { - Text("Battery").font(.title2).fixedSize() + Text("Battery") + .font(.title2) + .fixedSize() + .textCase(.uppercase) Text(String(mostRecent.batteryLevel) + "%") .font(.title2) .foregroundColor(.gray) @@ -127,6 +133,7 @@ struct NodeDetail: View { Text("Powered") .font(.callout) .fixedSize() + .textCase(.uppercase) } } .padding(5) @@ -139,7 +146,10 @@ struct NodeDetail: View { HStack(alignment: .center) { VStack { HStack { - Image(systemName: "person").font(.title2).foregroundColor(.accentColor) + Image(systemName: "person") + .font(.title2) + .foregroundColor(.accentColor) + .symbolRenderingMode(.hierarchical) Text("Unique Id:").font(.title2) } Text(node.user?.userId ?? "??????").font(.title3).foregroundColor(.gray) @@ -147,7 +157,10 @@ struct NodeDetail: View { Divider() VStack { HStack { - Image(systemName: "number").font(.title2).foregroundColor(.accentColor) + Image(systemName: "number") + .font(.title2) + .foregroundColor(.accentColor) + .symbolRenderingMode(.hierarchical) Text("Node Number:").font(.title2) } Text(String(node.num)).font(.title3).foregroundColor(.gray) @@ -160,7 +173,10 @@ struct NodeDetail: View { HStack { - Image(systemName: "map.circle.fill").font(.title).foregroundColor(.accentColor) + Image(systemName: "map.circle.fill") + .font(.title) + .foregroundColor(.accentColor) + .symbolRenderingMode(.hierarchical) Text("Position History (\(node.positions?.count ?? 0) Points)").font(.title2) } .padding() @@ -206,23 +222,26 @@ struct NodeDetail: View { .symbolRenderingMode(.hierarchical) } } - .padding([.top, .bottom]) + .padding(1) Divider() } + .padding(.bottom, 5) // Without some padding here there is a transparent contentview bug } + } - }.navigationTitle(node.user!.longName ?? "Unknown") + } + .navigationTitle(node.user!.longName ?? "Unknown") .navigationBarTitleDisplayMode(.inline) .navigationBarItems(trailing: - ZStack { + ZStack { - ConnectedDevice( - bluetoothOn: bleManager.isSwitchedOn, - deviceConnected: bleManager.connectedPeripheral != nil, - name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : - "???") - }) + ConnectedDevice( + bluetoothOn: bleManager.isSwitchedOn, + deviceConnected: bleManager.connectedPeripheral != nil, + name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "???") + } + ) .onAppear(perform: { self.bleManager.context = context diff --git a/MeshtasticClient/Views/Settings/Configuration.swift b/MeshtasticClient/Views/Settings/Configuration.swift deleted file mode 100644 index 3d811925..00000000 --- a/MeshtasticClient/Views/Settings/Configuration.swift +++ /dev/null @@ -1,8 +0,0 @@ -// -// Configuration.swift -// MeshtasticClient -// -// Created by Garth Vander Houwen on 10/2/21. -// - -import Foundation