From e7a74145ade07d6675920d364ea87654f159ad8b Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 2 Jan 2022 23:28:51 -0800 Subject: [PATCH] Implement various text circle sizes --- MeshtasticClient/Helpers/BLEManager.swift | 9 ++++++++- .../Views/Helpers/CircleText.swift | 4 ++-- .../Views/Messages/UserMessageList.swift | 13 ++++++++----- MeshtasticClient/Views/Nodes/NodeDetail.swift | 2 +- .../Views/Settings/AppSettings.swift | 19 ++++++++++--------- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/MeshtasticClient/Helpers/BLEManager.swift b/MeshtasticClient/Helpers/BLEManager.swift index 626fceef..f791b683 100644 --- a/MeshtasticClient/Helpers/BLEManager.swift +++ b/MeshtasticClient/Helpers/BLEManager.swift @@ -808,7 +808,14 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph print("💥 Error Fetching NodeInfoEntity for NODEINFO_APP") } - } else if decodedInfo.packet.decoded.portnum == PortNum.adminApp { + + // + } else if decodedInfo.packet.decoded.portnum == PortNum.storeForwardApp { + + if meshLoggingEnabled { MeshLogger.log("🚨 MESH PACKET received for Store Forward App UNHANDLED \(try decodedInfo.packet.jsonString())") } + print("🚨 MESH PACKET received for Admin App UNHANDLED \(try decodedInfo.packet.jsonString())") + + } else if decodedInfo.packet.decoded.portnum == PortNum.adminApp { if meshLoggingEnabled { MeshLogger.log("🚨 MESH PACKET received for Admin App UNHANDLED \(try decodedInfo.packet.jsonString())") } print("🚨 MESH PACKET received for Admin App UNHANDLED \(try decodedInfo.packet.jsonString())") diff --git a/MeshtasticClient/Views/Helpers/CircleText.swift b/MeshtasticClient/Views/Helpers/CircleText.swift index 021a0f02..814d508b 100644 --- a/MeshtasticClient/Views/Helpers/CircleText.swift +++ b/MeshtasticClient/Views/Helpers/CircleText.swift @@ -8,8 +8,8 @@ import SwiftUI struct CircleText: View { var text: String var color: Color - var circleSize: CGFloat? = 40 - var fontSize: CGFloat? = 16 + var circleSize: CGFloat? = 50 + var fontSize: CGFloat? = 24 var body: some View { diff --git a/MeshtasticClient/Views/Messages/UserMessageList.swift b/MeshtasticClient/Views/Messages/UserMessageList.swift index 24da3a26..17c046cb 100644 --- a/MeshtasticClient/Views/Messages/UserMessageList.swift +++ b/MeshtasticClient/Views/Messages/UserMessageList.swift @@ -42,7 +42,11 @@ struct UserMessageList: View { ScrollView { if allMessages.count > 0 { - + + HStack{ + // Padding at the top of the message list + }.padding(.bottom) + ForEach( allMessages ) { (message: MessageEntity) in let currentUser: Bool = (bleManager.connectedPeripheral == nil) ? false : ((bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.num == message.fromUser?.num) ? true : false ) @@ -54,8 +58,7 @@ struct UserMessageList: View { if currentUser { Spacer(minLength:50) } if !currentUser { - - CircleText(text: (message.fromUser?.shortName ?? "???"), color: currentUser ? .accentColor : Color(.darkGray)).padding(.all, 5) + CircleText(text: message.fromUser?.shortName ?? "???", color: currentUser ? .accentColor : Color(.darkGray), circleSize: 36, fontSize: 16).padding(.all, 5) } VStack(alignment: currentUser ? .trailing : .leading) { @@ -296,8 +299,8 @@ struct UserMessageList: View { HStack { - CircleText(text: user.shortName ?? "???", color: .blue).fixedSize() - Text(user.longName ?? "Unknown").foregroundColor(.gray).font(.caption2).fixedSize() + CircleText(text: user.shortName ?? "???", color: .blue, circleSize: 42, fontSize: 20).fixedSize() + Text(user.longName ?? "Unknown").font(.headline).fixedSize() } } ToolbarItem(placement: .navigationBarTrailing) { diff --git a/MeshtasticClient/Views/Nodes/NodeDetail.swift b/MeshtasticClient/Views/Nodes/NodeDetail.swift index 9cf57eb3..2d6f8086 100644 --- a/MeshtasticClient/Views/Nodes/NodeDetail.swift +++ b/MeshtasticClient/Views/Nodes/NodeDetail.swift @@ -42,7 +42,7 @@ struct NodeDetail: View { MapAnnotation( coordinate: location.coordinate, content: { - CircleText(text: node.user!.shortName ?? "???", color: .accentColor) + CircleText(text: node.user!.shortName ?? "???", color: .accentColor, circleSize: 33, fontSize: 16) } ) } diff --git a/MeshtasticClient/Views/Settings/AppSettings.swift b/MeshtasticClient/Views/Settings/AppSettings.swift index 98690e2a..c3ec7c64 100644 --- a/MeshtasticClient/Views/Settings/AppSettings.swift +++ b/MeshtasticClient/Views/Settings/AppSettings.swift @@ -157,7 +157,15 @@ struct AppSettings: View { } .pickerStyle(DefaultPickerStyle()) } - Section(header: Text("MESH NETWORK OPTIONS")) { + Section(header: Text("MAP OPTIONS")) { + Picker("Map Type", selection: $userSettings.meshMapType) { + ForEach(MeshMapType.allCases) { map in + Text(map.description) + } + } + .pickerStyle(DefaultPickerStyle()) + } + Section(header: Text("DEBUG")) { // Toggle(isOn: $userSettings.meshActivityLog) { // Label("Log all Mesh activity", systemImage: "network") @@ -170,14 +178,7 @@ struct AppSettings: View { .listRowSeparator(.visible) } } - Section(header: Text("MAP OPTIONS")) { - Picker("Map Type", selection: $userSettings.meshMapType) { - ForEach(MeshMapType.allCases) { map in - Text(map.description) - } - } - .pickerStyle(DefaultPickerStyle()) - } + } } .navigationTitle("App Settings")