Add missing permissions message in Video SDK#1638
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
WalkthroughThese changes enhance error handling for denied call permissions by explicitly computing missing permissions and reporting them via the error callback instead of silently returning without notification. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ❌ 3❌ Failed checks (3 warnings)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/StreamCallActivity.kt (1)
889-902: Improve missing-permission message readability and empty-list fallback.At Line 894-900, the current message is built from raw manifest constants, which produces low-readability text. It’s better to format user-facing permission labels and guarantee a non-empty fallback message.
💡 Proposed refinement
if (!permissionsNowGranted) { val missingPermissions = PermissionManager.getMissingPermission( this@StreamCallActivity, call, ) - val exceptionText = - missingPermissions.map { it.capitalize(Locale.getDefault()) } - .joinToString(separator = ",") { it } + val exceptionText = missingPermissions + .map { permission -> + permission.substringAfterLast('.') + .replace('_', ' ') + .lowercase(Locale.getDefault()) + .replaceFirstChar { firstChar -> + firstChar.titlecase(Locale.getDefault()) + } + } + .ifEmpty { listOf("Required permission") } + .joinToString(separator = ", ") onError?.invoke( StreamCallActivityException( call, - "$exceptionText Permission(s) not granted.", + "$exceptionText not granted.", null, ), ) return@launch }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/StreamCallActivity.kt` around lines 889 - 902, The missing-permission message is built from raw manifest constants; update the logic around PermissionManager.getMissingPermission in StreamCallActivity (where StreamCallActivityException is created) to map each permission constant to a human-friendly label (e.g., "Camera", "Microphone", "Storage"), capitalize with Locale.getDefault(), join with ", " for readability, and if the missingPermissions list is empty produce a clear fallback string like "Required permissions not granted" before constructing the StreamCallActivityException so the user-facing message is always readable and non-empty.stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/permission/PermissionManager.kt (1)
131-150: Consider centralizing capability→permission mapping to avoid drift.Line 135-148 duplicates the permission checks already present in Line 114-127. Extracting a shared helper for required/missing permissions would keep behavior aligned and reduce future regression risk.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/permission/PermissionManager.kt` around lines 131 - 150, The duplicate capability→permission logic should be centralized: create a single helper (e.g., requiredPermissionsForCapabilities or a PERMISSION_MAP) that maps OwnCapability values (OwnCapability.SendAudio, OwnCapability.SendVideo) to Android permission strings (Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA) and use it from getMissingPermission and the earlier permission-check block; then implement getMissingPermission to iterate the required permissions for call.state.ownCapabilities.value and add any not granted (via ContextCompat.checkSelfPermission) to the returned list so both places share the same source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/permission/PermissionManager.kt`:
- Around line 131-150: The duplicate capability→permission logic should be
centralized: create a single helper (e.g., requiredPermissionsForCapabilities or
a PERMISSION_MAP) that maps OwnCapability values (OwnCapability.SendAudio,
OwnCapability.SendVideo) to Android permission strings
(Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA) and use it from
getMissingPermission and the earlier permission-check block; then implement
getMissingPermission to iterate the required permissions for
call.state.ownCapabilities.value and add any not granted (via
ContextCompat.checkSelfPermission) to the returned list so both places share the
same source of truth.
In
`@stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/StreamCallActivity.kt`:
- Around line 889-902: The missing-permission message is built from raw manifest
constants; update the logic around PermissionManager.getMissingPermission in
StreamCallActivity (where StreamCallActivityException is created) to map each
permission constant to a human-friendly label (e.g., "Camera", "Microphone",
"Storage"), capitalize with Locale.getDefault(), join with ", " for readability,
and if the missingPermissions list is empty produce a clear fallback string like
"Required permissions not granted" before constructing the
StreamCallActivityException so the user-facing message is always readable and
non-empty.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 93c1acdf-27ce-4b8d-9dcc-dc465f814f8c
📒 Files selected for processing (2)
stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/StreamCallActivity.ktstream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/permission/PermissionManager.kt
|
CallService
CallService|
🚀 Available in v1.21.0 |



Goal
Add Missing commit for #1627
Implementation
Add missing permission message
🎨 UI Changes
Refer #1627
Testing
Refer #1627
Summary by CodeRabbit