Add PostNotifications implementation for iOS#30132
Conversation
|
Hoping to test via the artifact, struggling to get the whole .sln to build locally |
There was a problem hiding this comment.
Pull Request Overview
Adds support for notification permissions on iOS and updates sample manifests to reflect the new permission.
- Implements the
PostNotificationspermission check and request on iOS. - Updates the iOS sample
Info.plistto include remote‐notification background mode. - Adds the Android
POST_NOTIFICATIONSpermission to the sample Android manifest.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Essentials/src/Permissions/Permissions.ios.cs | Adds PostNotifications permission implementation. |
| src/Essentials/samples/Samples/Platforms/iOS/Info.plist | Adds UIBackgroundModes key for remote notifications. |
| src/Essentials/samples/Samples/Platforms/Android/AndroidManifest.xml | Adds <uses-permission> for POST_NOTIFICATIONS. |
Comments suppressed due to low confidence (2)
src/Essentials/src/Permissions/Permissions.ios.cs:253
- There are no automated tests covering the new
PostNotificationspermission. Please add unit tests inTestCases.Shared.Testsand UI tests inTestCases.HostAppto verify bothCheckStatusAsyncandRequestAsyncbehaviors.
public partial class PostNotifications : BasePlatformPermission
src/Essentials/src/Permissions/Permissions.ios.cs:253
- The new
PostNotificationspermission should be documented in the public XML docs under/docs/to describe its behavior, required entitlements, and sample usage.
public partial class PostNotifications : BasePlatformPermission
|
/azp run MAUI-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| public partial class PostNotifications : BasePlatformPermission | ||
| { | ||
| /// <inheritdoc/> | ||
| #pragma warning disable RS0016 |
There was a problem hiding this comment.
We'll want to remove this and add the right entries to the API txt files. That will also mean we want to target this for .NET 10 as it adds new APIs
There was a problem hiding this comment.
@jfversluis sorry what does that mean, is there anything i need too do?
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 30132Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 30132" |
|
I've rebased and cleaned up this PR with the following changes: Addressing review feedback from @jfversluis:
Implementation improvements:
Rebased cleanly onto current Note: Per @jfversluis's comment about targeting .NET 10 since this adds new APIs, this PR may need its base branch changed to |
|
Changed base to net11 |
|
/rebase |
- Implement CheckStatusAsync using UNUserNotificationCenter.GetNotificationSettings - Implement RequestAsync using UNUserNotificationCenter.RequestAuthorizationAsync - Handle Provisional and Ephemeral authorization statuses as Granted - Check status before requesting to avoid unnecessary prompts - Add PublicAPI.Unshipped.txt entries for net-ios and net-maccatalyst - Remove #pragma warning disable RS0016 per review feedback - Add POST_NOTIFICATIONS permission to Android sample manifest - Add UIBackgroundModes to iOS sample Info.plist - Add device test for PostNotifications.CheckStatusAsync - Fix indentation consistency in sample files Fixes #23962 Co-authored-by: Ieuan Walker <ieuan.walker007@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8678368 to
0383751
Compare
|
/azp run maui-pr |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
🚨 API change(s) detected @davidortinau FYI |
Update the permissions article to reflect that Permissions.PostNotifications is now supported on iOS and Mac Catalyst, added in .NET 11 Preview 3 (dotnet/maui#30132). Changes include: - Update platform support table: PostNotifications iOS column ❌ → ✔️ - Add moniker-gated note explaining the new Apple platform support - Add code example for requesting notification permissions - Note that iOS uses UNUserNotificationCenter.RequestAuthorization and does not require an Info.plist usage description string Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…11) (#3280) Update the permissions article to reflect that Permissions.PostNotifications is now supported on iOS and Mac Catalyst, added in .NET 11 Preview 3 (dotnet/maui#30132). Changes include: - Update platform support table: PostNotifications iOS column ❌ → ✔️ - Add moniker-gated note explaining the new Apple platform support - Add code example for requesting notification permissions - Note that iOS uses UNUserNotificationCenter.RequestAuthorization and does not require an Info.plist usage description string Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Added PostNotifications implementation for iOS
Issues Fixed
Fixes #23962
Not sure why the issue was closed as
Not planned