Explicitly list all Enum cases to get compile-time errors

This commit is contained in:
islam
2025-10-15 17:37:19 +01:00
parent 8481e1552d
commit 6cbfe8ecfb
6 changed files with 16 additions and 14 deletions
+1 -1
View File
@@ -767,7 +767,7 @@ final class NoiseHandshakeState {
let shared = try localStatic.sharedSecretFromKeyAgreement(with: remoteStatic) let shared = try localStatic.sharedSecretFromKeyAgreement(with: remoteStatic)
symmetricState.mixKey(shared.withUnsafeBytes { Data($0) }) symmetricState.mixKey(shared.withUnsafeBytes { Data($0) })
default: case .e, .s:
break break
} }
} }
+4 -4
View File
@@ -728,7 +728,7 @@ final class BLEService: NSObject {
switch MessageType(rawValue: type) { switch MessageType(rawValue: type) {
case .noiseEncrypted, .noiseHandshake: case .noiseEncrypted, .noiseHandshake:
return true return true
default: case .none, .announce, .message, .leave, .requestSync, .fragment, .fileTransfer:
return false return false
} }
} }
@@ -1271,7 +1271,7 @@ final class BLEService: NSObject {
case .leave: case .leave:
handleLeave(packet, from: PeerID(str: senderID)) handleLeave(packet, from: PeerID(str: senderID))
default: case .none:
SecureLogger.warning("⚠️ Unknown message type: \(packet.type)", category: .session) SecureLogger.warning("⚠️ Unknown message type: \(packet.type)", category: .session)
break break
} }
@@ -3536,7 +3536,7 @@ extension BLEService {
case .leave: case .leave:
handleLeave(packet, from: senderID) handleLeave(packet, from: senderID)
default: case .none:
SecureLogger.warning("⚠️ Unknown message type: \(packet.type)", category: .session) SecureLogger.warning("⚠️ Unknown message type: \(packet.type)", category: .session)
break break
} }
@@ -3964,7 +3964,7 @@ extension BLEService {
notifyUI { [weak self] in notifyUI { [weak self] in
self?.delegate?.didReceiveNoisePayload(from: peerID, type: .verifyResponse, payload: Data(payloadData), timestamp: ts) self?.delegate?.didReceiveNoisePayload(from: peerID, type: .verifyResponse, payload: Data(payloadData), timestamp: ts)
} }
default: case .none:
SecureLogger.warning("⚠️ Unknown noise payload type: \(payloadType)") SecureLogger.warning("⚠️ Unknown noise payload type: \(payloadType)")
} }
} catch NoiseEncryptionError.sessionNotEstablished { } catch NoiseEncryptionError.sessionNotEstablished {
@@ -64,7 +64,9 @@ final class LocationChannelManager: NSObject, CLLocationManagerDelegate, Observa
switch status { switch status {
case .authorizedAlways, .authorizedWhenInUse, .authorized: case .authorizedAlways, .authorizedWhenInUse, .authorized:
break // will compute from location break // will compute from location
default: case .notDetermined, .restricted, .denied:
fallthrough
@unknown default:
if case .location(let ch) = selectedChannel { if case .location(let ch) = selectedChannel {
teleported = teleportedSet.contains(ch.geohash) teleported = teleportedSet.contains(ch.geohash)
} }
+6 -6
View File
@@ -1996,7 +1996,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
} }
return false return false
} }
default: case .mesh:
break break
} }
} }
@@ -3095,7 +3095,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
switch sessionState { switch sessionState {
case .none, .failed: case .none, .failed:
meshService.triggerHandshake(with: peerID) meshService.triggerHandshake(with: peerID)
default: case .handshakeQueued, .handshaking, .established:
break break
} }
} else { } else {
@@ -3115,7 +3115,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
case .read, .delivered: case .read, .delivered:
sentReadReceipts.insert(message.id) sentReadReceipts.insert(message.id)
privateChatManager.sentReadReceipts.insert(message.id) privateChatManager.sentReadReceipts.insert(message.id)
default: case .failed, .partiallyDelivered, .sending, .sent:
break break
} }
} }
@@ -3345,7 +3345,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
case .established: case .established:
// Send the message directly without going through sendPrivateMessage to avoid local echo // Send the message directly without going through sendPrivateMessage to avoid local echo
messageRouter.sendPrivate(screenshotMessage, to: peerID, recipientNickname: peerNickname, messageID: UUID().uuidString) messageRouter.sendPrivate(screenshotMessage, to: peerID, recipientNickname: peerNickname, messageID: UUID().uuidString)
default: case .none, .failed, .handshakeQueued, .handshaking:
// Don't send screenshot notification if no session exists // Don't send screenshot notification if no session exists
SecureLogger.debug("Skipping screenshot notification to \(peerID) - no established session", category: .security) SecureLogger.debug("Skipping screenshot notification to \(peerID) - no established session", category: .security)
} }
@@ -3608,7 +3608,7 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
nostrKeyMapping[convKey] = pub nostrKeyMapping[convKey] = pub
return convKey return convKey
} }
default: case .mesh:
break break
} }
// Fallback to mesh nickname resolution // Fallback to mesh nickname resolution
@@ -6709,7 +6709,7 @@ private func checkForMentions(_ message: BitchatMessage) {
let d = String(id.publicKeyHex.suffix(4)) let d = String(id.publicKeyHex.suffix(4))
tokens.append(nickname + "#" + d) tokens.append(nickname + "#" + d)
} }
default: case .mesh:
break break
} }
#endif #endif
+1 -1
View File
@@ -1646,7 +1646,7 @@ private extension ContentView {
isSending = true isSending = true
progress = Double(reached) / Double(total) progress = Double(reached) / Double(total)
} }
default: case .sent, .read, .delivered, .failed:
break break
} }
} }
+1 -1
View File
@@ -599,7 +599,7 @@ extension LocationChannelsSheet {
switch level { switch level {
case .region: case .region:
return "" return ""
default: case .building, .block, .neighborhood, .city, .province:
return "~" return "~"
} }
} }