Mac Specific disconnect button since swipe actions don't function on macOS

This commit is contained in:
Garth Vander Houwen 2022-02-25 18:13:12 -10:00
parent 285e314af9
commit 48d1b1d837
3 changed files with 37 additions and 10 deletions

View file

@ -738,7 +738,7 @@
CODE_SIGN_ENTITLEMENTS = MeshtasticClient/MeshtasticClient.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 12;
CURRENT_PROJECT_VERSION = 13;
DEVELOPMENT_ASSET_PATHS = "\"MeshtasticClient/Preview Content\"";
DEVELOPMENT_TEAM = GCH7VS5Y9R;
ENABLE_PREVIEWS = YES;
@ -769,7 +769,7 @@
CODE_SIGN_ENTITLEMENTS = MeshtasticClient/MeshtasticClient.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 12;
CURRENT_PROJECT_VERSION = 13;
DEVELOPMENT_ASSET_PATHS = "\"MeshtasticClient/Preview Content\"";
DEVELOPMENT_TEAM = GCH7VS5Y9R;
ENABLE_PREVIEWS = YES;

View file

@ -920,7 +920,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
print("💥 Error Saving ACK for message MessageID \(decodedInfo.packet.id) Error: \(nsError)")
}
}
if meshLoggingEnabled { MeshLogger.log(" MESH PACKET received for Routing App UNHANDLED \(try decodedInfo.packet.jsonString())") }
print(" MESH PACKET received for Routing App UNHANDLED \(try decodedInfo.packet.jsonString())")

View file

@ -85,7 +85,7 @@ struct Connect: View {
}
Spacer()
VStack(alignment: .center) {
VStack(alignment: .trailing) {
Text("Preferred").font(.caption2)
Text("Radio").font(.caption2)
@ -109,14 +109,15 @@ struct Connect: View {
} else {
if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.identifier.uuidString == userSettings.preferredPeripheralId {
if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.identifier.uuidString == userSettings.preferredPeripheralId {
userSettings.preferredPeripheralId = ""
userSettings.preferredPeripheralName = ""
}
userSettings.preferredPeripheralId = ""
userSettings.preferredPeripheralName = ""
}
}
}
}
}
.swipeActions {
@ -130,6 +131,8 @@ struct Connect: View {
}
}
.padding([.top, .bottom])
} else {
HStack {
Image(systemName: "antenna.radiowaves.left.and.right.slash")
@ -196,7 +199,6 @@ struct Connect: View {
.padding()
.background(Color(.systemGray6))
.clipShape(Capsule())
Spacer()
Button(action: {
self.bleManager.stopScanning()
@ -215,7 +217,33 @@ struct Connect: View {
.padding()
.background(Color(.systemGray6))
.clipShape(Capsule())
Spacer()
#if targetEnvironment(macCatalyst)
if bleManager.connectedPeripheral != nil {
Button(role: .destructive, action: {
if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == CBPeripheralState.connected {
bleManager.disconnectPeripheral()
isPreferredRadio = false
}
}) {
Image(systemName: "antenna.radiowaves.left.and.right.slash")
.symbolRenderingMode(.hierarchical)
.imageScale(.large)
.foregroundColor(.red)
Text("Disconnect").font(.caption)
.font(.caption)
}
.padding()
.background(Color(.systemGray6))
.clipShape(Capsule())
}
#endif
Spacer()
}
.padding(.bottom, 10)