Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Sources/SkipUI/SkipUI/UIKit/UIApplication.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,21 @@ let logger: Logger = Logger(subsystem: "skip.ui", category: "SkipUI") // adb log
// We can't bridge the `showRationale` parameter async closure
return await requestPermission(permission, showRationale: nil)
}

/// Whether the system recommends showing a rationale before requesting the given permission.
///
/// This is `false` both when the permission has never been requested and when it has been
/// permanently denied, so callers that need to distinguish those cases must combine it with
/// their own record of having asked.
/// - Parameter permission: the name of the permission, such as `android.permission.RECORD_AUDIO`
/// - Returns: true if a rationale should be shown before requesting the permission
// SKIP @bridge
public func shouldShowPermissionRationale(_ permission: String) -> Bool {
guard let activity = self.androidActivity else {
return false
}
return ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)
}
#endif

@available(*, unavailable)
Expand Down
Loading