From 56a297f76af9d6dd7c19b892b65343e255298782 Mon Sep 17 00:00:00 2001 From: vincentborko Date: Wed, 29 Jul 2026 08:10:42 +0200 Subject: [PATCH] Add bridgeable UIApplication.shouldShowPermissionRationale(_:) --- Sources/SkipUI/SkipUI/UIKit/UIApplication.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Sources/SkipUI/SkipUI/UIKit/UIApplication.swift b/Sources/SkipUI/SkipUI/UIKit/UIApplication.swift index a9f5c80a..9b44f5c1 100644 --- a/Sources/SkipUI/SkipUI/UIKit/UIApplication.swift +++ b/Sources/SkipUI/SkipUI/UIKit/UIApplication.swift @@ -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)