You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-ios/SessionUtilitiesKit/Utilities/Permissions.swift

40 lines
1.1 KiB
Swift

// Copyright © 2025 Rangeproof Pty Ltd. All rights reserved.
import AVFAudio
public enum Permissions {
public enum MicrophonePermisson {
case denied
case granted
case undetermined
case unknown
}
public static var microphone: MicrophonePermisson {
if #available(iOSApplicationExtension 17.0, *) {
switch AVAudioApplication.shared.recordPermission {
case .undetermined:
return .undetermined
case .denied:
return .denied
case .granted:
return .granted
@unknown default:
return .unknown
}
} else {
switch AVAudioSession.sharedInstance().recordPermission {
case .undetermined:
return .undetermined
case .denied:
return .denied
case .granted:
return .granted
@unknown default:
return .unknown
}
}
}
}