[FluentNotification] Enable showing an action button and a dismiss button#2154
Conversation
Sources/FluentUI_iOS/Components/Notification/FluentNotification.swift
Outdated
Show resolved
Hide resolved
Sources/FluentUI_iOS/Components/Notification/FluentNotification.swift
Outdated
Show resolved
Hide resolved
|
@huwilkes do you remember the history behind why there's this complicated logic of if we show dismiss button, action button, which one gets linked to which action, etc? why was it not just declarative with action button, dismiss button |
The design doesn't have an option with two buttons. |
IIRC most of the API logic was inherited from the previous maintainers of this codebase. But yeah like @huwilkes said, it was a safe assumption to say "if we have an action then show a button, and if we have a dismissal show an |
fdc3723 to
5b02252
Compare
|
The latest commit introduces the property |
…. Dismiss button will only show dismiss icon.
eda4651 to
8944682
Compare
Platforms Impacted
Description of changes
There is a use case where we need to be able to show an action button and a dismiss button on a single notification. Both show iff the
MSFNotificationState.showDefaultDismissActionButtonis true,actionButtonActionis notnil,andactionButtonTitleis notniland not empty.To implement this:
defaultDimissButtonActionblock property on theMSFNotificationState. If the value is not set by the consumer, we will give it a default value in theMSFNotificationinitializer.dismissButtonviewbuilder in the view implementation. This button will only show when the conditions in the first paragraph above are met.dismissButtonActionis non-nil. The code to determine thedismissButtonActionwas broken out into its own private function so that it could be more easily called from two places in the view.Binary change
(how is our binary size impacted -- see https://github.com/microsoft/fluentui-apple/wiki/Size-Comparison)
Verification
Visual Verification
Screen.Recording.2025-05-14.at.10.44.55.AM.mov
Pull request checklist
This PR has considered:
Microsoft Reviewers: Open in CodeFlow