@@ -14,7 +14,6 @@ private enum Constants {
1414/// base protocol for NUX view controllers
1515public protocol NUXViewControllerBase {
1616 var sourceTag : WordPressSupportSourceTag { get }
17- var helpNotificationIndicator : WPHelpIndicatorView { get }
1817 var helpButton : UIButton { get }
1918 var loginFields : LoginFields { get }
2019 var dismissBlock : ( ( _ cancelled: Bool ) -> Void ) ? { get }
@@ -106,15 +105,6 @@ extension NUXViewControllerBase where Self: UIViewController, Self: UIViewContro
106105 self . dismiss ( animated: true , completion: nil )
107106 }
108107
109- // MARK: - Notifications
110-
111- /// Updates the notification indicatorand its visibility.
112- ///
113- func refreshSupportNotificationIndicator( ) {
114- let showIndicator = WordPressAuthenticator . shared. delegate? . showSupportNotificationIndicator ?? false
115- helpNotificationIndicator. isHidden = !showIndicator
116- }
117-
118108 // MARK: - Actions
119109
120110 func handleBackgroundTapGesture( ) {
@@ -142,48 +132,6 @@ extension NUXViewControllerBase where Self: UIViewController, Self: UIViewContro
142132 displaySupportViewController ( from: sourceTag)
143133 }
144134
145- // MARK: - Navbar Help and App Logo methods
146-
147- func styleNavigationBar( forUnified: Bool = false ) {
148- var backgroundColor : UIColor
149- var buttonTextColor : UIColor
150- var titleTextColor : UIColor
151- var hideBottomBorder : Bool
152-
153- if forUnified {
154- // Unified nav bar style
155- backgroundColor = WordPressAuthenticator . shared. unifiedStyle? . navBarBackgroundColor ??
156- WordPressAuthenticator . shared. style. navBarBackgroundColor
157- buttonTextColor = WordPressAuthenticator . shared. unifiedStyle? . navButtonTextColor ??
158- WordPressAuthenticator . shared. style. navButtonTextColor
159- titleTextColor = WordPressAuthenticator . shared. unifiedStyle? . navTitleTextColor ??
160- WordPressAuthenticator . shared. style. primaryTitleColor
161- hideBottomBorder = true
162- } else {
163- // Original nav bar style
164- backgroundColor = WordPressAuthenticator . shared. style. navBarBackgroundColor
165- buttonTextColor = WordPressAuthenticator . shared. style. navButtonTextColor
166- titleTextColor = WordPressAuthenticator . shared. style. primaryTitleColor
167- hideBottomBorder = false
168- }
169-
170- setupNavBarIcon ( showIcon: !forUnified)
171- setHelpButtonTextColor ( forUnified: forUnified)
172-
173- let buttonItemAppearance = UIBarButtonItem . appearance ( whenContainedInInstancesOf: [ LoginNavigationController . self] )
174- buttonItemAppearance. tintColor = buttonTextColor
175- buttonItemAppearance. setTitleTextAttributes ( [ . foregroundColor: buttonTextColor] , for: . normal)
176-
177- let appearance = UINavigationBarAppearance ( )
178- appearance. shadowColor = hideBottomBorder ? . clear : . separator
179- appearance. backgroundColor = backgroundColor
180- appearance. titleTextAttributes = [ . foregroundColor: titleTextColor]
181-
182- UINavigationBar . appearance ( whenContainedInInstancesOf: [ LoginNavigationController . self] ) . standardAppearance = appearance
183- UINavigationBar . appearance ( whenContainedInInstancesOf: [ LoginNavigationController . self] ) . compactAppearance = appearance
184- UINavigationBar . appearance ( whenContainedInInstancesOf: [ LoginNavigationController . self] ) . scrollEdgeAppearance = appearance
185- }
186-
187135 /// Add/remove the nav bar app logo.
188136 ///
189137 func setupNavBarIcon( showIcon: Bool = true ) {
@@ -213,24 +161,6 @@ extension NUXViewControllerBase where Self: UIViewController, Self: UIViewContro
213161 }
214162
215163 addHelpButtonToNavController ( )
216- refreshSupportNotificationIndicator ( )
217- }
218-
219- /// Sets the Help button text color.
220- ///
221- /// - Parameters:
222- /// - forUnified: Indicates whether to use text color for the unified auth flows or the original auth flows.
223- ///
224- func setHelpButtonTextColor( forUnified: Bool ) {
225- let navButtonTextColor : UIColor = {
226- if forUnified {
227- return WordPressAuthenticator . shared. unifiedStyle? . navButtonTextColor ?? WordPressAuthenticator . shared. style. navButtonTextColor
228- }
229- return WordPressAuthenticator . shared. style. navButtonTextColor
230- } ( )
231-
232- helpButton. setTitleColor ( navButtonTextColor, for: . normal)
233- helpButton. setTitleColor ( navButtonTextColor. withAlphaComponent ( 0.4 ) , for: . highlighted)
234164 }
235165
236166 // MARK: - Helpers
@@ -240,7 +170,6 @@ extension NUXViewControllerBase where Self: UIViewController, Self: UIViewContro
240170 private func addHelpButtonToNavController( ) {
241171 let barButtonView = createBarButtonView ( )
242172 addHelpButton ( to: barButtonView)
243- addNotificationIndicatorView ( to: barButtonView)
244173 addRightBarButtonItem ( with: barButtonView)
245174 }
246175
@@ -263,7 +192,7 @@ extension NUXViewControllerBase where Self: UIViewController, Self: UIViewContro
263192
264193 private func addHelpButton( to superView: UIView ) {
265194 helpButton. setTitle ( NSLocalizedString ( " Help " , comment: " Help button " ) , for: . normal)
266- setHelpButtonTextColor ( forUnified : false )
195+ helpButton . setTitleColor ( . label , for : [ ] )
267196 helpButton. accessibilityIdentifier = " authenticator-help-button "
268197
269198 helpButton. on ( . touchUpInside) { [ weak self] control in
@@ -279,45 +208,6 @@ extension NUXViewControllerBase where Self: UIViewController, Self: UIViewContro
279208 helpButton. bottomAnchor. constraint ( equalTo: superView. bottomAnchor) . isActive = true
280209 }
281210
282- // MARK: Notification Indicator settings
283-
284- private func addNotificationIndicatorView( to superView: UIView ) {
285- setupNotificationsIndicator ( )
286- layoutNotificationIndicatorView ( helpNotificationIndicator, to: superView)
287- }
288-
289- private func setupNotificationsIndicator( ) {
290- helpNotificationIndicator. isHidden = true
291-
292- addNotificationObserver (
293- NotificationCenter . default. addObserver ( forName: . wordpressSupportNotificationReceived, object: nil , queue: nil ) { [ weak self] _ in
294- self ? . refreshSupportNotificationIndicator ( )
295- }
296- )
297-
298- addNotificationObserver (
299- NotificationCenter . default. addObserver ( forName: . wordpressSupportNotificationCleared, object: nil , queue: nil ) { [ weak self] _ in
300- self ? . refreshSupportNotificationIndicator ( )
301- }
302- )
303- }
304-
305- private func layoutNotificationIndicatorView( _ view: UIView , to superView: UIView ) {
306- superView. addSubview ( view)
307- view. translatesAutoresizingMaskIntoConstraints = false
308-
309- let centerOffset = Constants . notificationIndicatorCenterOffset
310- let xConstant = helpButton. contentEdgeInsets. top + centerOffset. x
311- let yConstant = helpButton. contentEdgeInsets. top + centerOffset. y
312-
313- NSLayoutConstraint . activate ( [
314- view. centerXAnchor. constraint ( equalTo: helpButton. trailingAnchor, constant: xConstant) ,
315- view. centerYAnchor. constraint ( equalTo: helpButton. topAnchor, constant: yConstant) ,
316- view. widthAnchor. constraint ( equalToConstant: Constants . notificationIndicatorSize. width) ,
317- view. heightAnchor. constraint ( equalToConstant: Constants . notificationIndicatorSize. height)
318- ] )
319- }
320-
321211 // MARK: - UIViewControllerTransitioningDelegate
322212
323213 /// Displays the support vc.
0 commit comments