mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
V 1.26.1 Fixed connectedNode not being set bug by matching via bluetooth device name and user.id, cleanup for app settings
This commit is contained in:
parent
5d12cca775
commit
ce4eec7900
11 changed files with 47 additions and 35 deletions
|
|
@ -660,7 +660,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.26.0;
|
||||
MARKETING_VERSION = 1.26.1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
|
|
@ -687,7 +687,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.26.0;
|
||||
MARKETING_VERSION = 1.26.1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
|
|
|
|||
|
|
@ -118,6 +118,11 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
|
||||
peripheral.delegate = self
|
||||
connectedPeripheral = peripherals.filter({ $0.peripheral.identifier == peripheral.identifier }).first
|
||||
let deviceName = peripheral.name ?? ""
|
||||
|
||||
let peripheralLast4: String = String(deviceName.suffix(4))
|
||||
|
||||
connectedNode = meshData.nodes.first(where: { $0.user.id.contains(peripheralLast4) })
|
||||
lastConnectedPeripheral = peripheral.identifier.uuidString
|
||||
peripheral.discoverServices([meshtasticServiceCBUUID])
|
||||
print("Peripheral connected: " + peripheral.name!)
|
||||
|
|
@ -339,10 +344,10 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
// Since the data is from the device itself we save all myInfo objects since they are always the most up to date
|
||||
if connectedNode != nil {
|
||||
connectedNode.myInfo = myInfoModel
|
||||
//connectedNode.update(from: connectedNode.data)
|
||||
let nodeIndex = meshData.nodes.firstIndex(where: { $0.id == decodedInfo.myInfo.myNodeNum })
|
||||
meshData.nodes.remove(at: nodeIndex!)
|
||||
meshData.nodes.append(connectedNode)
|
||||
connectedNode.update(from: connectedNode.data)
|
||||
// let nodeIndex = meshData.nodes.firstIndex(where: { $0.id == decodedInfo.myInfo.myNodeNum })
|
||||
// meshData.nodes.remove(at: nodeIndex!)
|
||||
// meshData.nodes.append(connectedNode)
|
||||
meshData.save()
|
||||
print("Saved a myInfo for \(decodedInfo.myInfo.myNodeNum)") // connectedNode.update(from: connectedNode.data)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ struct Connect: View {
|
|||
Text("Preferred").font(.caption2)
|
||||
Text("Radio").font(.caption2)
|
||||
Toggle("Preferred Radio", isOn: $isPreferredRadio)
|
||||
.toggleStyle(SwitchToggleStyle(tint: .green))
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.labelsHidden()
|
||||
.onChange(of: isPreferredRadio) { value in
|
||||
if value {
|
||||
|
|
@ -91,7 +91,7 @@ struct Connect: View {
|
|||
bleManager.disconnectDevice()
|
||||
}
|
||||
} label: {
|
||||
Label("Delete", systemImage: "antenna.radiowaves.left.and.right.slash")
|
||||
Label("Disconnect", systemImage: "antenna.radiowaves.left.and.right.slash")
|
||||
}
|
||||
}
|
||||
//.padding()
|
||||
|
|
|
|||
|
|
@ -54,15 +54,15 @@ struct BatteryIcon: View {
|
|||
|
||||
struct BatteryIcon_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
BatteryIcon(batteryLevel: 100, font: .title2, color: Color.blue)
|
||||
BatteryIcon(batteryLevel: 100, font: .title2, color: Color.accentColor)
|
||||
.previewLayout(.fixed(width: 75, height: 75))
|
||||
BatteryIcon(batteryLevel: 99, font: .title2, color: Color.blue)
|
||||
BatteryIcon(batteryLevel: 99, font: .title2, color: Color.accentColor)
|
||||
.previewLayout(.fixed(width: 75, height: 75))
|
||||
BatteryIcon(batteryLevel: 74, font: .title2, color: Color.blue)
|
||||
BatteryIcon(batteryLevel: 74, font: .title2, color: Color.accentColor)
|
||||
.previewLayout(.fixed(width: 75, height: 75))
|
||||
BatteryIcon(batteryLevel: 49, font: .title2, color: Color.blue)
|
||||
BatteryIcon(batteryLevel: 49, font: .title2, color: Color.accentColor)
|
||||
.previewLayout(.fixed(width: 75, height: 75))
|
||||
BatteryIcon(batteryLevel: 14, font: .title2, color: Color.blue)
|
||||
BatteryIcon(batteryLevel: 14, font: .title2, color: Color.accentColor)
|
||||
.previewLayout(.fixed(width: 75, height: 75))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ struct CircleText: View {
|
|||
|
||||
struct CircleText_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CircleText(text: "RDN", color: Color.blue)
|
||||
CircleText(text: "RDN", color: Color.accentColor)
|
||||
.previewLayout(.fixed(width: 300, height: 100))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ struct Channels: View {
|
|||
.font(.system(size: 62))
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.padding(.trailing)
|
||||
.foregroundColor(Color.blue)
|
||||
.foregroundColor(.accentColor)
|
||||
|
||||
Text("Primary")
|
||||
.font(.largeTitle)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ struct Messages: View {
|
|||
|
||||
HStack (alignment: .top) {
|
||||
|
||||
CircleText(text: message.fromUserShortName, color: currentUser ? Color.blue : Color(.darkGray)).padding(.all, 5)
|
||||
CircleText(text: message.fromUserShortName, color: currentUser ? .accentColor : Color(.darkGray)).padding(.all, 5)
|
||||
.gesture(LongPressGesture(minimumDuration: 2)
|
||||
.onEnded {_ in
|
||||
print("I want to delete message: \(message.messageId)")
|
||||
|
|
@ -150,7 +150,7 @@ struct Messages: View {
|
|||
.frame(width: 130)
|
||||
.padding(5)
|
||||
.font(.subheadline)
|
||||
.accentColor(Color.blue)
|
||||
.accentColor(.accentColor)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 8)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ struct NodeDetail: View {
|
|||
MapAnnotation(
|
||||
coordinate: location.coordinate,
|
||||
content: {
|
||||
CircleText(text: node.user.shortName, color: Color.blue)
|
||||
CircleText(text: node.user.shortName, color: .accentColor)
|
||||
}
|
||||
)
|
||||
}.frame(idealWidth: bounds.size.width, minHeight: bounds.size.height / 2)
|
||||
|
|
@ -57,7 +57,7 @@ struct NodeDetail: View {
|
|||
|
||||
VStack(alignment: .center) {
|
||||
Text("AKA").font(.title2).fixedSize()
|
||||
CircleText(text: node.user.shortName, color: Color.blue)
|
||||
CircleText(text: node.user.shortName, color: .accentColor)
|
||||
.offset(y:10)
|
||||
}
|
||||
.padding([.leading, .trailing, .bottom])
|
||||
|
|
@ -67,7 +67,7 @@ struct NodeDetail: View {
|
|||
|
||||
Image(systemName: "waveform.path")
|
||||
.font(.title)
|
||||
.foregroundColor(.blue)
|
||||
.foregroundColor(.accentColor)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
Text("SNR").font(.title2).fixedSize()
|
||||
Text(String(node.snr ?? 0))
|
||||
|
|
@ -77,7 +77,7 @@ struct NodeDetail: View {
|
|||
Divider()
|
||||
}
|
||||
VStack(alignment: .center) {
|
||||
BatteryIcon(batteryLevel: node.position.batteryLevel, font: .title, color: Color.blue)
|
||||
BatteryIcon(batteryLevel: node.position.batteryLevel, font: .title, color: .accentColor)
|
||||
if node.position.batteryLevel != nil && node.position.batteryLevel! > 0 {
|
||||
Text("Battery").font(.title2).fixedSize()
|
||||
Text(String(node.position.batteryLevel!) + "%")
|
||||
|
|
@ -109,7 +109,7 @@ struct NodeDetail: View {
|
|||
|
||||
HStack{
|
||||
|
||||
Image(systemName: "clock").font(.title2).foregroundColor(.blue)
|
||||
Image(systemName: "clock").font(.title2).foregroundColor(.accentColor)
|
||||
let lastHeard = Date(timeIntervalSince1970: TimeInterval(node.lastHeard))
|
||||
Text("Last Heard: \(lastHeard, style: .relative) ago").font(.title3)
|
||||
}.padding()
|
||||
|
|
@ -118,7 +118,7 @@ struct NodeDetail: View {
|
|||
|
||||
if node.position.coordinate != nil {
|
||||
HStack(alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/, spacing: 14) {
|
||||
Image(systemName: "mappin").font(.title).foregroundColor(.blue)
|
||||
Image(systemName: "mappin").font(.title).foregroundColor(.accentColor)
|
||||
VStack(alignment: .leading) {
|
||||
Text("Latitude").font(.headline)
|
||||
Text(String(node.position.latitude ?? 0)).font(.caption).foregroundColor(.gray)
|
||||
|
|
@ -139,7 +139,7 @@ struct NodeDetail: View {
|
|||
HStack (alignment: .center) {
|
||||
VStack {
|
||||
HStack{
|
||||
Image(systemName: "person").font(.title3).foregroundColor(.blue)
|
||||
Image(systemName: "person").font(.title3).foregroundColor(.accentColor)
|
||||
Text("Unique Id:").font(.title3)
|
||||
}
|
||||
Text(node.user.id).font(.headline).foregroundColor(.gray)
|
||||
|
|
@ -147,7 +147,7 @@ struct NodeDetail: View {
|
|||
Divider()
|
||||
VStack {
|
||||
HStack {
|
||||
Image(systemName: "number").font(.title3).foregroundColor(.blue)
|
||||
Image(systemName: "number").font(.title3).foregroundColor(.accentColor)
|
||||
Text("Node Number:").font(.title3)
|
||||
}
|
||||
Text(String(node.num)).font(.headline).foregroundColor(.gray)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ struct NodeMap: View {
|
|||
MapAnnotation(
|
||||
coordinate: location.position.coordinate!,
|
||||
content: {
|
||||
CircleText(text: location.user.shortName, color: Color.blue)
|
||||
CircleText(text: location.user.shortName, color: .accentColor)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ struct NodeRow: View {
|
|||
|
||||
HStack() {
|
||||
|
||||
CircleText(text: node.user.shortName, color: Color.blue).offset(y: 1).padding(.trailing, 5)
|
||||
CircleText(text: node.user.shortName, color: Color.accentColor).offset(y: 1).padding(.trailing, 5)
|
||||
.offset(x: -15)
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||
|
|
@ -25,7 +25,7 @@ struct NodeRow: View {
|
|||
|
||||
HStack (alignment: .bottom){
|
||||
|
||||
Image(systemName: "clock.badge.checkmark.fill").font(.headline).foregroundColor(.blue).symbolRenderingMode(.hierarchical)
|
||||
Image(systemName: "clock.badge.checkmark.fill").font(.headline).foregroundColor(.accentColor).symbolRenderingMode(.hierarchical)
|
||||
|
||||
|
||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||
|
|
|
|||
|
|
@ -78,29 +78,36 @@ struct AppSettings: View {
|
|||
|
||||
GeometryReader { bounds in
|
||||
|
||||
Form {
|
||||
List {
|
||||
Section(header: Text("USER DETAILS")) {
|
||||
|
||||
HStack{
|
||||
HStack {
|
||||
|
||||
Text("User Name")
|
||||
Label("Name", systemImage: "person.crop.rectangle.fill")
|
||||
TextField("Username", text: $userSettings.username)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
.listRowSeparator(.visible)
|
||||
Toggle(isOn: $userSettings.provideLocation) {
|
||||
|
||||
Text("Provide location to mesh")
|
||||
Label("Provide location to mesh", systemImage: "location.circle.fill")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.listRowSeparator(.visible)
|
||||
Text("Preferred Radio")
|
||||
Label("Preferred Radio", systemImage: "flipphone")
|
||||
.listRowSeparator(.hidden)
|
||||
Text(userSettings.preferredPeripheralName)
|
||||
.foregroundColor(.gray)
|
||||
Text("The preferred radio will automatically reconnect if it becomes disconnected and is still within range. This device is assumed to be the primary radio used for messaging.").font(.caption2).foregroundColor(.gray)
|
||||
Text("This option is set via the preferred radio toggle for the connected device on the bluetooth tab.")
|
||||
.font(.caption)
|
||||
.listRowSeparator(.hidden)
|
||||
Text("The preferred radio will automatically reconnect if it becomes disconnected and is still within range. This device is assumed to be the primary radio used for messaging.")
|
||||
.font(.caption2)
|
||||
.foregroundColor(.gray)
|
||||
|
||||
}
|
||||
Section(header: Text("MESSAGING OPTIONS")) {
|
||||
|
||||
|
||||
Picker("Keyboard Type", selection: $userSettings.keyboardType) {
|
||||
ForEach(KeyboardType.allCases) { kb in
|
||||
Text(kb.description)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue