mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
linter updates
This commit is contained in:
parent
a4d5aefca3
commit
3dcec505ff
7 changed files with 46 additions and 77 deletions
|
|
@ -65,14 +65,14 @@ struct WaypointForm: View {
|
|||
axis: .vertical
|
||||
)
|
||||
.foregroundColor(Color.gray)
|
||||
.onChange(of: name, perform: { _ in
|
||||
.onChange(of: name) {
|
||||
var totalBytes = name.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
while totalBytes > 30 {
|
||||
name = String(name.dropLast())
|
||||
totalBytes = name.utf8.count
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
HStack {
|
||||
Text("Description")
|
||||
|
|
@ -83,14 +83,14 @@ struct WaypointForm: View {
|
|||
axis: .vertical
|
||||
)
|
||||
.foregroundColor(Color.gray)
|
||||
.onChange(of: description, perform: { _ in
|
||||
.onChange(of: description) {
|
||||
var totalBytes = description.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
while totalBytes > 100 {
|
||||
description = String(description.dropLast())
|
||||
totalBytes = description.utf8.count
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
HStack {
|
||||
Text("Icon")
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ struct MeshMap: View {
|
|||
guard case .map = router.navigationState.selectedTab else { return }
|
||||
// TODO: handle deep link for waypoints
|
||||
}
|
||||
.onChange(of: selectedMapLayer) { newMapLayer in
|
||||
.onChange(of: selectedMapLayer) { _, newMapLayer in
|
||||
switch selectedMapLayer {
|
||||
case .standard:
|
||||
UserDefaults.mapLayer = newMapLayer
|
||||
|
|
@ -183,17 +183,6 @@ struct MeshMap: View {
|
|||
.tint(Color(UIColor.secondarySystemBackground))
|
||||
.foregroundColor(.accentColor)
|
||||
.buttonStyle(.borderedProminent)
|
||||
// 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))
|
||||
// .foregroundColor(.accentColor)
|
||||
// .buttonStyle(.borderedProminent)
|
||||
}
|
||||
.controlSize(.regular)
|
||||
.padding(5)
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ struct NodeMap: View {
|
|||
@State var selectedOverlayServer: MapOverlayServer = UserDefaults.mapOverlayServer
|
||||
@State var mapTilesAboveLabels: Bool = UserDefaults.mapTilesAboveLabels
|
||||
let fromDate: NSDate = Calendar.current.date(byAdding: .month, value: -1, to: Date())! as NSDate
|
||||
// @FetchRequest(sortDescriptors: [NSSortDescriptor(key: "time", ascending: true)],
|
||||
// predicate: NSPredicate(format: "time >= %@ && nodePosition != nil", Calendar.current.date(byAdding: .day, value: -7, to: Date())! as NSDate), animation: .none)
|
||||
@FetchRequest(sortDescriptors: [NSSortDescriptor(key: "time", ascending: true)],
|
||||
predicate: NSPredicate(format: "nodePosition != nil", Calendar.current.date(byAdding: .day, value: -7, to: Date())! as NSDate), animation: .none)
|
||||
private var positions: FetchedResults<PositionEntity>
|
||||
|
|
@ -97,7 +95,7 @@ struct NodeMap: View {
|
|||
}
|
||||
}
|
||||
.pickerStyle(SegmentedPickerStyle())
|
||||
.onChange(of: (selectedMapLayer)) { newMapLayer in
|
||||
.onChange(of: selectedMapLayer) { _, newMapLayer in
|
||||
UserDefaults.mapLayer = newMapLayer
|
||||
}
|
||||
.padding(.top, 5)
|
||||
|
|
@ -144,10 +142,10 @@ struct NodeMap: View {
|
|||
.font(.footnote)
|
||||
}
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
.onChange(of: (selectedOverlayServer)) { newSelectedOverlayServer in
|
||||
UserDefaults.mapOverlayServer = newSelectedOverlayServer
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
.onChange(of: (selectedOverlayServer)) { _, newSelectedOverlayServer in
|
||||
UserDefaults.mapOverlayServer = newSelectedOverlayServer
|
||||
}
|
||||
Text(LocalizedStringKey(selectedOverlayServer.attribution))
|
||||
.font(.footnote)
|
||||
.foregroundColor(.gray)
|
||||
|
|
@ -160,7 +158,7 @@ struct NodeMap: View {
|
|||
Text("Enable Offline Maps")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.onChange(of: enableOfflineMaps) { newEnableOfflineMaps in
|
||||
.onChange(of: enableOfflineMaps) { _, newEnableOfflineMaps in
|
||||
UserDefaults.enableOfflineMaps = newEnableOfflineMaps
|
||||
if !enableOfflineMaps {
|
||||
if self.selectedMapLayer == .offline {
|
||||
|
|
@ -176,10 +174,10 @@ struct NodeMap: View {
|
|||
Text(tsl.description)
|
||||
}
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
.onChange(of: (selectedTileServer)) { newSelectedTileServer in
|
||||
UserDefaults.mapTileServer = newSelectedTileServer
|
||||
}
|
||||
.pickerStyle(DefaultPickerStyle())
|
||||
.onChange(of: (selectedTileServer)) { _, newSelectedTileServer in
|
||||
UserDefaults.mapTileServer = newSelectedTileServer
|
||||
}
|
||||
Text("Attribution:")
|
||||
.fontWeight(.semibold)
|
||||
.font(.footnote)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue