Lint fixes

This commit is contained in:
Garth Vander Houwen 2023-03-14 13:01:35 -07:00
parent 93006b258d
commit 59d05a533b
5 changed files with 7 additions and 8 deletions

View file

@ -1902,10 +1902,10 @@ class BLEManager: NSObject, CBPeripheralDelegate, ObservableObject {
fetchMyInfoRequest.predicate = NSPredicate(format: "myNodeNum == %lld", Int64(connectedPeripheral.num))
do {
let fetchedMyInfo = try context!.fetch(fetchMyInfoRequest) as! [MyInfoEntity]
let fetchedMyInfo = try context?.fetch(fetchMyInfoRequest) as? [MyInfoEntity] ?? []
if fetchedMyInfo.count == 1 {
let mutableChannels = fetchedMyInfo[0].channels!.mutableCopy() as! NSMutableOrderedSet
mutableChannels.removeAllObjects()
let mutableChannels = fetchedMyInfo[0].channels?.mutableCopy() as? NSMutableOrderedSet
mutableChannels?.removeAllObjects()
fetchedMyInfo[0].channels = mutableChannels
do {
try context!.save()

View file

@ -561,7 +561,7 @@ func routingPacket (packet: MeshPacket, connectedNodeNum: Int64, context: NSMana
let fetchedMyInfo = try context.fetch(fetchMyInfoRequest) as? [MyInfoEntity]
if fetchedMyInfo?.count ?? 0 > 0 {
for ch in fetchedMyInfo![0].channels!.array as! [ChannelEntity] {
for ch in fetchedMyInfo![0].channels!.array as? [ChannelEntity] ?? [] {
if ch.index == packet.channel {
ch.objectWillChange.send()

View file

@ -289,13 +289,13 @@ struct Connect: View {
liveActivityStarted = true
let timerSeconds = 60
let mostRecent = node?.telemetries?.lastObject as! TelemetryEntity
let mostRecent = node?.telemetries?.lastObject as? TelemetryEntity
let activityAttributes = MeshActivityAttributes(nodeNum: Int(node?.num ?? 0), name: node?.user?.longName ?? "unknown")
let future = Date(timeIntervalSinceNow: Double(timerSeconds))
let initialContentState = MeshActivityAttributes.ContentState(timerRange: Date.now...future, connected: true, channelUtilization: mostRecent.channelUtilization, airtime: mostRecent.airUtilTx, batteryLevel: UInt32(mostRecent.batteryLevel))
let initialContentState = MeshActivityAttributes.ContentState(timerRange: Date.now...future, connected: true, channelUtilization: mostRecent?.channelUtilization ?? 0.0, airtime: mostRecent?.airUtilTx ?? 0.0, batteryLevel: UInt32(mostRecent?.batteryLevel ?? 0))
let activityContent = ActivityContent(state: initialContentState, staleDate: Calendar.current.date(byAdding: .minute, value: 2, to: Date())!)

View file

@ -82,7 +82,6 @@ struct MapViewSwiftUI: UIViewRepresentable {
#else
#if os(iOS)
mapView.showsPointsOfInterest = false
// Hide the default compass that only appears when you are not going north and instead always show the compass in the bottom right corner of the map
mapView.showsCompass = false
let compassButton = MKCompassButton(mapView: mapView) // Make a new compass

View file

@ -40,7 +40,7 @@ struct Channels: View {
NavigationStack {
List {
if node != nil && node?.myInfo != nil {
ForEach(node!.myInfo!.channels?.array as! [ChannelEntity], id: \.self) { (channel: ChannelEntity) in
ForEach(node?.myInfo?.channels?.array as? [ChannelEntity] ?? [], id: \.self) { (channel: ChannelEntity) in
Button(action: {
channelIndex = channel.index
channelRole = Int(channel.role)