-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] Refactor selection limit handling in MediaPicker #32571
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
Replaces direct access to options.SelectionLimit with a local variable that defaults to 1 if options is null. Updates all relevant checks and method calls to use the new variable, improving null safety and code clarity.
|
Hey there @@kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
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 improves null safety in the Android MediaPicker implementation by refactoring how SelectionLimit is accessed in the PickMultipleUsingPhotoPicker method. The changes align the Android implementation with the existing iOS pattern, ensuring consistent behavior across platforms when options is null.
Key Changes:
- Introduced a local
selectionLimitvariable that safely handles null options with a default value of 1 - Replaced direct
options.SelectionLimitaccesses with the null-safe local variable throughout the method
|
/azp run MAUI-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/backport to release/10.0.1xx-sr1 |
|
Started backporting to |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [Microsoft.Maui.Controls](https://github.com/dotnet/maui) | nuget | patch | `10.0.10` -> `10.0.11` | --- ### Release Notes <details> <summary>dotnet/maui (Microsoft.Maui.Controls)</summary> ### [`v10.0.11`](https://github.com/dotnet/maui/releases/tag/10.0.11): SR1.1 [Compare Source](dotnet/maui@10.0.10...10.0.11) ##### What's Changed .NET MAUI 10.0.11 introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 11 commits with various improvements, bug fixes, and enhancements. ##### .NET MAUI Product Fixes ##### Android - Fix content page title clipping on Android API < 30 with window insets compatibility by [@​Copilot](https://github.com/Copilot) in dotnet/maui#32738 <details> <summary>🔧 Fixes</summary> - [Shell content page title position incorrect/clipped](dotnet/maui#32526) </details> ##### Button - \[release/10.0.1xx-sr1] Removed Value property coercion in RadioButton by [@​github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32604 <details> <summary>🔧 Fixes</summary> - [Removed Value property coercion in RadioButton](dotnet/maui#32489) </details> ##### DateTimePicker - Fix crash when TimePicker.Time is set to null (backport from PR [#​32660](dotnet/maui#32660)) by [@​Copilot](https://github.com/Copilot) in dotnet/maui#32715 <details> <summary>🔧 Fixes</summary> - [Fix crash when TimePicker.Time is set to null](dotnet/maui#32660) </details> ##### Gestures - \[release/10.0.1xx-sr1] predictive back gesture support for Android 13+ by [@​github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32635 <details> <summary>🔧 Fixes</summary> - [predictive back gesture support for Android 13+](dotnet/maui#32461) </details> ##### Infrastructure - \[release/10.0.1xx-sr1] \[ci] Revert changes setting Creator by [@​github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32803 <details> <summary>🔧 Fixes</summary> - [\[ci\] Revert changes setting Creator](dotnet/maui#32743) </details> ##### Mediapicker - \[release/10.0.1xx-sr1] \[Android] Refactor selection limit handling in MediaPicker by [@​github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32628 <details> <summary>🔧 Fixes</summary> - [\[Android\] Refactor selection limit handling in MediaPicker](dotnet/maui#32571) ...
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
I think we should add a null check and a default value on Android - similar to how it’s already handled on iOS.
maui/src/Essentials/src/MediaPicker/MediaPicker.ios.cs
Line 211 in 73ae2c9
Replaces direct access to options.SelectionLimit with a local variable that defaults to 1 if options is null. Updates all relevant checks and method calls to use the new variable, improving null safety and code clarity.
Issues Fixed
Fixes #32535