Skip to content

MSFNotification can set a closure to run regardless of the source of the disimissal#2144

Merged
cbowdoin merged 4 commits intomicrosoft:mainfrom
cbowdoin:user/cbowdoin/NotificationHasSettableDismissBlock
May 6, 2025
Merged

MSFNotification can set a closure to run regardless of the source of the disimissal#2144
cbowdoin merged 4 commits intomicrosoft:mainfrom
cbowdoin:user/cbowdoin/NotificationHasSettableDismissBlock

Conversation

@cbowdoin
Copy link
Copy Markdown
Contributor

@cbowdoin cbowdoin commented Apr 29, 2025

Platforms Impacted

  • iOS
  • visionOS
  • macOS

Description of changes

Added a new onDismiss closure that will be called whenever the Notification View disappears. This allows for consumers to ensure that some action will always be taken whenever the notification is dismissed regardless of what the source of the notification being dismissed is.

Binary change

(how is our binary size impacted -- see https://github.com/microsoft/fluentui-apple/wiki/Size-Comparison)

Verification

Tested with closures in demo app.
Created notificatiosn from both swift and objective c code

Visual Verification
Before After
Consumers of MSFNotifications could only have a dimiss block if they have a custom dismiss button or if they explicity call hide on the notification Consumers can define a closure that will be called everytime the notification view will disappear

Pull request checklist

This PR has considered:

  • Light and Dark appearances
  • iOS supported versions (all major versions greater than or equal current target deployment version)
  • VoiceOver and Keyboard Accessibility
  • Internationalization and Right to Left layouts
  • Different resolutions (1x, 2x, 3x)
  • Size classes and window sizes (iPhone vs iPad, notched devices, multitasking, different window sizes, etc)
  • iPad Pointer interaction
  • SwiftUI consumption (validation or new demo scenarios needed)
  • Objective-C exposure (provide it only if needed)
Microsoft Reviewers: Open in CodeFlow

@cbowdoin cbowdoin requested a review from a team as a code owner April 29, 2025 23:21
@cbowdoin cbowdoin merged commit 6388db7 into microsoft:main May 6, 2025
7 checks passed
@mischreiber mischreiber mentioned this pull request Jun 13, 2025
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants