mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Move confirmation dialog
This commit is contained in:
parent
221314dbc1
commit
de10f159a7
1 changed files with 19 additions and 18 deletions
|
|
@ -181,7 +181,25 @@ struct Connect: View {
|
|||
}
|
||||
}.padding([.bottom, .top])
|
||||
}
|
||||
}.textCase(nil)
|
||||
}
|
||||
.confirmationDialog("Connecting to a new radio will clear all local app data on the phone.", isPresented: $presentingSwitchPreferredPeripheral, titleVisibility: .visible) {
|
||||
|
||||
Button("Connect to new radio?", role: .destructive) {
|
||||
bleManager.stopScanning()
|
||||
bleManager.connectedPeripheral = nil
|
||||
userSettings.preferredPeripheralId = ""
|
||||
if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == CBPeripheralState.connected {
|
||||
bleManager.disconnectPeripheral()
|
||||
}
|
||||
|
||||
clearCoreDataDatabase(context: context)
|
||||
let radio = bleManager.peripherals.first(where: { $0.peripheral.identifier.uuidString == selectedPeripherialId} )
|
||||
bleManager.connectTo(peripheral: radio!.peripheral)
|
||||
presentingSwitchPreferredPeripheral = false
|
||||
selectedPeripherialId = ""
|
||||
}
|
||||
}
|
||||
.textCase(nil)
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -190,23 +208,6 @@ struct Connect: View {
|
|||
.font(.title)
|
||||
}
|
||||
}
|
||||
.confirmationDialog("Connecting to a new radio will clear all local app data on the phone.", isPresented: $presentingSwitchPreferredPeripheral, titleVisibility: .visible) {
|
||||
|
||||
Button("Connect to new radio?", role: .destructive) {
|
||||
bleManager.stopScanning()
|
||||
bleManager.connectedPeripheral = nil
|
||||
userSettings.preferredPeripheralId = ""
|
||||
if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == CBPeripheralState.connected {
|
||||
bleManager.disconnectPeripheral()
|
||||
}
|
||||
|
||||
clearCoreDataDatabase(context: context)
|
||||
let radio = bleManager.peripherals.first(where: { $0.peripheral.identifier.uuidString == selectedPeripherialId} )
|
||||
bleManager.connectTo(peripheral: radio!.peripheral)
|
||||
presentingSwitchPreferredPeripheral = false
|
||||
selectedPeripherialId = ""
|
||||
}
|
||||
}
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Spacer()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue