Skip to content

Add missing permissions message in Video SDK#1638

Merged
aleksandar-apostolov merged 1 commit intodevelopfrom
chore/rahullohra/ougoing-call-fg-service-remaining-commit
Apr 1, 2026
Merged

Add missing permissions message in Video SDK#1638
aleksandar-apostolov merged 1 commit intodevelopfrom
chore/rahullohra/ougoing-call-fg-service-remaining-commit

Conversation

@rahul-lohra
Copy link
Copy Markdown
Contributor

@rahul-lohra rahul-lohra commented Apr 1, 2026

Goal

Add Missing commit for #1627

Implementation

Add missing permission message

🎨 UI Changes

Refer #1627

Testing

Refer #1627

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error handling for call permission denials. When required permissions remain ungranted after the permission request flow, the app now generates and displays a detailed error message identifying the specific permissions missing instead of failing silently.

@rahul-lohra rahul-lohra self-assigned this Apr 1, 2026
@rahul-lohra rahul-lohra requested a review from a team as a code owner April 1, 2026 09:29
@rahul-lohra rahul-lohra added the pr:internal Internal or infra-only changes label Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.02 MB 12.02 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.68 MB 5.68 MB 0.00 MB 🟢
stream-video-android-ui-compose 6.28 MB 6.28 MB 0.00 MB 🟢

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Walkthrough

These 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

Cohort / File(s) Summary
Error Handling for Permissions
stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/StreamCallActivity.kt
When required call permissions remain ungranted after the permission flow, the activity now computes the specific missing permissions, formats them into a user-readable message, and invokes the onError callback with a descriptive StreamCallActivityException instead of returning silently.
Permission Detection Helper
stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/permission/PermissionManager.kt
Added internal getMissingPermission(context, call) companion-object function that derives required permissions from call capabilities and returns only those not currently granted via ContextCompat.checkSelfPermission.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 When permissions slip through the cracks,
We hop right up with detailed reports,
No silent fails in our tracks—
Each missing grant gets its just desserts,
Error messages bloom, bright and clear! 🌸

🚥 Pre-merge checks | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete, omitting most required template sections including detailed Goal, Implementation, Testing methodology, and all checklist items. Expand the description with detailed Goal and Implementation sections, provide specific Testing steps, and complete the Contributor Checklist items required for this repository.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ⚠️ Warning The title mentions 'CallService' but the actual changes are in StreamCallActivity and PermissionManager, with no direct involvement of CallService. Update the title to reflect the actual changes, such as 'Add missing permissions error message to StreamCallActivity' or 'Notify user of missing call permissions via onError callback'.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/rahullohra/ougoing-call-fg-service-remaining-commit

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4470754 and 2a2d1fa.

📒 Files selected for processing (2)
  • stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/StreamCallActivity.kt
  • stream-video-android-ui-core/src/main/kotlin/io/getstream/video/android/ui/common/permission/PermissionManager.kt

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 1, 2026

@aleksandar-apostolov aleksandar-apostolov changed the title fix: add missing permissions message Add missing permissions message Apr 1, 2026
@aleksandar-apostolov aleksandar-apostolov changed the title Add missing permissions message Add missing permissions message for the CallService Apr 1, 2026
@aleksandar-apostolov aleksandar-apostolov merged commit be67b73 into develop Apr 1, 2026
14 of 16 checks passed
@aleksandar-apostolov aleksandar-apostolov deleted the chore/rahullohra/ougoing-call-fg-service-remaining-commit branch April 1, 2026 10:00
@rahul-lohra rahul-lohra changed the title Add missing permissions message for the CallService Add missing permissions message in Video SDK Apr 1, 2026
@stream-public-bot stream-public-bot added the released Included in a release label Apr 1, 2026
@stream-public-bot
Copy link
Copy Markdown
Collaborator

🚀 Available in v1.21.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:internal Internal or infra-only changes released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants