Hook retry up to ack errors

This commit is contained in:
Garth Vander Houwen 2024-08-16 16:26:54 -07:00
parent 81084976db
commit 7d63a21418
3 changed files with 55 additions and 41 deletions

View file

@ -60,55 +60,30 @@ enum RoutingError: Int, CaseIterable, Identifiable {
}
}
var color: Color {
switch self {
case .none:
if self == .none {
return Color.secondary
case .noRoute:
return Color.red
case .gotNak:
return Color.red
case .timeout:
} else if self.canRetry {
return Color.orange
case .noInterface:
return Color.red
case .maxRetransmit:
return Color.orange
case .noChannel:
return Color.orange
case .tooLarge:
return Color.red
case .noResponse:
return Color.orange
case .dutyCycleLimit:
return Color.orange
case .badRequest:
return Color.red
case .notAuthorized:
return Color.red
case .pkiFailed:
return Color.red
case .pkiUnknownPubkey:
} else {
return Color.red
}
}
var canRetry: Bool {
switch self {
case .none:
return false
case .noRoute:
return false
return true
case .gotNak:
return false
return true
case .timeout:
return true
case .noInterface:
return false
return true
case .maxRetransmit:
return true
return false
case .noChannel:
return true
return false
case .tooLarge:
return false
case .noResponse:
@ -116,9 +91,9 @@ enum RoutingError: Int, CaseIterable, Identifiable {
case .dutyCycleLimit:
return true
case .badRequest:
return false
return true
case .notAuthorized:
return false
return true
case .pkiFailed:
return false
case .pkiUnknownPubkey:

View file

@ -243,9 +243,7 @@ struct UserList: View {
.tint(Color(UIColor.secondarySystemBackground))
.foregroundColor(.accentColor)
.buttonStyle(.borderedProminent)
Spacer()
Button(action: {
withAnimation {
editingFilters = !editingFilters

View file

@ -33,13 +33,27 @@ struct MeshMap: View {
@Namespace var mapScope
@State var mapStyle: MapStyle = MapStyle.standard(elevation: .flat, emphasis: MapStyle.StandardEmphasis.muted, pointsOfInterest: .excludingAll, showsTraffic: false)
@State var position = MapCameraPosition.automatic
@State var isEditingSettings = false
@State private var editingSettings = false
@State private var editingFilters = false
@State var selectedPosition: PositionEntity?
@State var editingWaypoint: WaypointEntity?
@State var selectedWaypoint: WaypointEntity?
@State var selectedWaypointId: String?
@State var newWaypointCoord: CLLocationCoordinate2D?
@State var isMeshMap = true
/// Filter
@State private var searchText = ""
@State private var viaLora = true
@State private var viaMqtt = true
@State private var isOnline = false
@State private var isPkiEncrypted = false
@State private var isFavorite = false
@State private var isEnvironment = false
@State private var distanceFilter = false
@State private var maxDistance: Double = 800000
@State private var hopsAway: Double = -1.0
@State private var roleFilter = false
@State private var deviceRoles: Set<Int> = []
var body: some View {
@ -106,7 +120,7 @@ struct MeshMap: View {
WaypointForm(waypoint: selection, editMode: true)
.padding()
}
.sheet(isPresented: $isEditingSettings) {
.sheet(isPresented: $editingSettings) {
MapSettingsForm(traffic: $showTraffic, pointsOfInterest: $showPointsOfInterest, mapLayer: $selectedMapLayer, meshMap: $isMeshMap)
}
.onChange(of: router.navigationState) {
@ -128,14 +142,41 @@ struct MeshMap: View {
return
}
}
.sheet(isPresented: $editingFilters) {
NodeListFilter(
viaLora: $viaLora,
viaMqtt: $viaMqtt,
isOnline: $isOnline,
isPkiEncrypted: $isPkiEncrypted,
isFavorite: $isFavorite,
isEnvironment: $isEnvironment,
distanceFilter: $distanceFilter,
maximumDistance: $maxDistance,
hopsAway: $hopsAway,
roleFilter: $roleFilter,
deviceRoles: $deviceRoles
)
}
.safeAreaInset(edge: .bottom, alignment: .trailing) {
HStack {
Button(action: {
withAnimation {
isEditingSettings = !isEditingSettings
editingSettings = !editingSettings
}
}) {
Image(systemName: isEditingSettings ? "info.circle.fill" : "info.circle")
Image(systemName: editingSettings ? "info.circle.fill" : "info.circle")
.padding(.vertical, 5)
}
.tint(Color(UIColor.secondarySystemBackground))
.foregroundColor(.accentColor)
.buttonStyle(.borderedProminent)
Spacer()
Button(action: {
withAnimation {
editingFilters = !editingFilters
}
}) {
Image(systemName: !editingFilters ? "line.3.horizontal.decrease.circle" : "line.3.horizontal.decrease.circle.fill")
.padding(.vertical, 5)
}
.tint(Color(UIColor.secondarySystemBackground))