implement red dot support for UIBarButtonItem#1974
implement red dot support for UIBarButtonItem#1974kumarmohit5189 wants to merge 3 commits intomicrosoft:mainfrom
Conversation
ios/FluentUI.Demo/FluentUI.Demo/Demos/NavigationControllerDemoController.swift
Outdated
Show resolved
Hide resolved
laminesm
left a comment
There was a problem hiding this comment.
Also, how do these changes interact with the existing badge styles? Does the red dot override the badge label style?
|
|
||
| import UIKit | ||
|
|
||
| @objc public extension UIBarButtonItem { |
There was a problem hiding this comment.
We generally do not want to create public extensions to system classes in Fluent, as it forces all downstream consumers to deal with our extension in their namespace. Instead, either use a custom UIBarButtonItem subclass, or provide some form of helper class that can perform the mutation for you.
There was a problem hiding this comment.
But we are following same styling for Badge value as well. I am just adding one extra functionality on top of badge button by using same mechanism.
There was a problem hiding this comment.
The existence of technical debt does not automatically justify the addition of more. We should move the badge styling away from this pattern as well; adding more that needs to be changed will only increase future work, especially when it comes to public APIs that downstream partners expect to remain supported.
| updateAccessibilityLabel() | ||
| } | ||
|
|
||
| @objc private func redDotVisibilitDidChanged() { |
|
the concern i have is that this isn't a design paradigm in fluent design for navigation header. the small dot was only used for controls like pillbuttonbar or segmented control so far. why can't you use "1" to represent the unread notification? it follows most apple navigation standards .. |
showing 1 looks weird, Another option to show red dot is passing blank value, and expose Button style property to App. But passing blank value seems weird here, So I try to make separate path similar to tab bar. Let me know your input for this. |
its similar to Tab, If we set Badge and Red dot both, preference will be given to Badge and it will work as it was. |
|
|
||
| import UIKit | ||
|
|
||
| @objc public extension UIBarButtonItem { |
There was a problem hiding this comment.
The existence of technical debt does not automatically justify the addition of more. We should move the badge styling away from this pattern as well; adding more that needs to be changed will only increase future work, especially when it comes to public APIs that downstream partners expect to remain supported.
You can expose the style as a public property through the control that uses the BadgeLabel. For reference, see how we did it here for the tabbar https://github.com/microsoft/fluentui-apple/pull/1818/files |
|
Open another PR as suggested above, please help to review @laminesm @mischreiber @harrieshin PR link #1977 Closing it. |


Platforms Impacted
Description of changes
As part of this change, I have added red dot support for
UIBarButtonItem. CurrentlyUIBarButtonItemsupports only Badge label, to make it similar toTabBarItemin Fluent UI I introduced a property calledshouldShowRedDotin similar way as we are using for badge. It will work in similar approach toTabBarItemwhere:shouldShowRedDotandbadgeValueboth, it will show badge value and logic will run as it was before change.shouldShowRedDot, it will display red dotbadgeValue, it will show badge label as it was previously.Binary change
Full breakdown
Verification
(how the change was tested, including both manual and automated tests)
Visual Verification
| Before | After |


|-------
---------------------------------------|--------------------------------------------|


| |
|
Pull request checklist
This PR has considered:
Microsoft Reviewers: Open in CodeFlow