mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Standardize buttons
This commit is contained in:
parent
6fad9b646a
commit
fd5683f397
3 changed files with 62 additions and 70 deletions
|
|
@ -688,8 +688,13 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
positionPacket.longitudeI = Int32(LocationHelper.currentLocation.longitude * 1e7)
|
||||
positionPacket.time = UInt32(LocationHelper.currentTimestamp.timeIntervalSince1970)
|
||||
positionPacket.altitude = Int32(LocationHelper.currentAltitude)
|
||||
positionPacket.groundSpeed = UInt32(LocationHelper.currentSpeed)
|
||||
positionPacket.groundTrack = UInt32(LocationHelper.currentHeading)
|
||||
|
||||
// Get Errors without some speed
|
||||
if LocationHelper.currentSpeed >= 5 {
|
||||
|
||||
positionPacket.groundSpeed = UInt32(LocationHelper.currentSpeed)
|
||||
positionPacket.groundTrack = UInt32(LocationHelper.currentHeading)
|
||||
}
|
||||
|
||||
var meshPacket = MeshPacket()
|
||||
meshPacket.to = UInt32(destNum)
|
||||
|
|
|
|||
|
|
@ -184,69 +184,66 @@ struct Connect: View {
|
|||
}
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Spacer()
|
||||
Button(action: {
|
||||
|
||||
Spacer()
|
||||
|
||||
if !bleManager.isScanning {
|
||||
|
||||
Button(action: {
|
||||
|
||||
self.bleManager.startScanning()
|
||||
self.bleManager.startScanning()
|
||||
|
||||
}) {
|
||||
}) {
|
||||
|
||||
Image(systemName: "play.circle")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.imageScale(.large)
|
||||
.foregroundColor(self.bleManager.isScanning ? .gray : .accentColor)
|
||||
Text("Start Scanning").font(.caption)
|
||||
.font(.caption)
|
||||
Label("Start Scanning", systemImage: "play.fill")
|
||||
|
||||
}
|
||||
.disabled(self.bleManager.isScanning)
|
||||
.padding()
|
||||
.background(Color(.systemGray6))
|
||||
.clipShape(Capsule())
|
||||
Button(action: {
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.buttonBorderShape(.capsule)
|
||||
.controlSize(.large)
|
||||
.padding()
|
||||
|
||||
} else {
|
||||
|
||||
Button(action: {
|
||||
|
||||
self.bleManager.stopScanning()
|
||||
self.bleManager.stopScanning()
|
||||
|
||||
}) {
|
||||
}) {
|
||||
|
||||
Image(systemName: "stop.circle")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.imageScale(.large)
|
||||
.foregroundColor(!self.bleManager.isScanning ? .gray : .accentColor)
|
||||
Text("Stop Scanning")
|
||||
.font(.caption)
|
||||
Label("Stop Scanning", systemImage: "stop.fill")
|
||||
|
||||
}
|
||||
.disabled(!self.bleManager.isScanning)
|
||||
.padding()
|
||||
.background(Color(.systemGray6))
|
||||
.clipShape(Capsule())
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.buttonBorderShape(.capsule)
|
||||
.controlSize(.large)
|
||||
.padding()
|
||||
}
|
||||
|
||||
#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)
|
||||
|
||||
if bleManager.connectedPeripheral != nil {
|
||||
|
||||
Button(role: .destructive, action: {
|
||||
|
||||
if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == CBPeripheralState.connected {
|
||||
bleManager.disconnectPeripheral()
|
||||
isPreferredRadio = false
|
||||
}
|
||||
.padding()
|
||||
.background(Color(.systemGray6))
|
||||
.clipShape(Capsule())
|
||||
|
||||
}) {
|
||||
|
||||
Label("Disconnect", systemImage: "antenna.radiowaves.left.and.right.slash")
|
||||
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.buttonBorderShape(.capsule)
|
||||
.controlSize(.large)
|
||||
.padding()
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.bottom, 10)
|
||||
|
|
|
|||
|
|
@ -96,17 +96,12 @@ struct NodeDetail: View {
|
|||
isPresentingShutdownConfirm = true
|
||||
}) {
|
||||
|
||||
Image(systemName: "power")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.imageScale(.small)
|
||||
.foregroundColor(Color.accentColor)
|
||||
Text("Power Off")
|
||||
.font(.caption)
|
||||
|
||||
Label("Power Off", systemImage: "power")
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.buttonBorderShape(.capsule)
|
||||
.controlSize(.large)
|
||||
.padding()
|
||||
.background(Color(.systemGray6))
|
||||
.clipShape(Capsule())
|
||||
.confirmationDialog(
|
||||
"Are you sure?",
|
||||
isPresented: $isPresentingShutdownConfirm
|
||||
|
|
@ -126,18 +121,13 @@ struct NodeDetail: View {
|
|||
isPresentingRebootConfirm = true
|
||||
|
||||
}) {
|
||||
|
||||
Image(systemName: "arrow.triangle.2.circlepath")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
.imageScale(.small)
|
||||
.foregroundColor(Color.accentColor)
|
||||
Text("Reboot")
|
||||
.font(.caption)
|
||||
|
||||
|
||||
Label("Reboot", systemImage: "arrow.triangle.2.circlepath")
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.buttonBorderShape(.capsule)
|
||||
.controlSize(.large)
|
||||
.padding()
|
||||
.background(Color(.systemGray6))
|
||||
.clipShape(Capsule())
|
||||
.confirmationDialog(
|
||||
"Are you sure?",
|
||||
isPresented: $isPresentingRebootConfirm
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue