-
Notifications
You must be signed in to change notification settings - Fork 466
Allow Developers to Manually Request Permissions when using CameraView, FileSaver, FolderPicker and SpeechToText
#2934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes automatic permission checking from internal implementation methods and shifts responsibility for permission handling to the consuming application layer. This architectural change allows developers to have more control over when and how they request permissions from users.
Key changes:
- Removed automatic permission checks from
StartListenAsyncmethods in speech-to-text implementations - Removed internal
IsSpeechPermissionAuthorizedhelper methods - Removed automatic permission checks from file system operations (FileSaver, FolderPicker) on Android and Tizen
- Removed
ArePermissionsGrantedmethod from CameraManager - Updated sample apps to explicitly request permissions before using these features
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| SpeechToTextImplementation.shared.cs | Removed automatic microphone permission check from StartListenAsync and deleted IsSpeechPermissionAuthorized helper method |
| SharedSpeechToTextImplementation.macios.cs | Removed macOS/iOS-specific IsSpeechPermissionAuthorized helper method |
| OfflineSpeechToTextImplementation.shared.cs | Removed automatic microphone permission check from offline speech recognition's StartListenAsync |
| FolderPickerImplementation.tizen.cs | Removed automatic storage permission request from Tizen folder picker |
| FolderPickerImplementation.android.cs | Removed automatic storage permission request for Android versions below 33 |
| FileSaverImplementation.tizen.cs | Removed automatic storage permission request from Tizen file saver |
| FileSaverImplementation.android.cs | Removed automatic storage permission request for Android versions below 33 |
| CameraViewHandler.shared.cs | Removed automatic permission check before connecting camera |
| CameraManager.shared.cs | Removed ArePermissionsGranted public method entirely |
| SpeechToTextViewModel.cs | Added RequestPermissions method to request both microphone and speech recognition permissions |
| OfflineSpeechToTextViewModel.cs | Added RequestPermissions method to request both microphone and speech recognition permissions |
| FolderPickerViewModel.cs | Added RequestPermissions method to request storage permissions before each operation |
| FileSaverViewModel.cs | Added RequestPermissions method to request storage permissions before each operation |
| CameraViewPage.xaml.cs | Added permission requests in OnAppearing and SaveVideo methods |
samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/OfflineSpeechToTextViewModel.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FolderPickerViewModel.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FileSaverViewModel.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 14 comments.
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/SpeechToTextViewModel.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FolderPickerViewModel.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FolderPickerViewModel.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FolderPickerViewModel.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FolderPickerViewModel.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FolderPickerViewModel.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FileSaverViewModel.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FileSaverViewModel.cs
Outdated
Show resolved
Hide resolved
samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
TheCodeTraveler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Vlad!! Could you please open a Docs PR updating users that they need to manually request permissions on the following platforms and provide examples in the docs:
- CameraView
- FileSaver
- FolderPicker
- SpeechToText
CameraView, FileSaver, FolderPicker and SpeechToText
Description of Change
Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRBreaking Changes
Permissions.CameraandPermissions.Microphone:Permissions.StorageReadandPermissions.StorageWrite:Permissions.StorageReadandPermissions.StorageWrite:Permissions.Microphoneand manually callISpeechToText.RequestPermissions():