@@ -143,10 +143,12 @@ final class MainTabBarController: UITabBarController {
143143
144144 /// Switches the TabBarcController to the specified Tab
145145 ///
146- func navigateTo( _ tab: WooTab , animated: Bool = false ) {
146+ func navigateTo( _ tab: WooTab , animated: Bool = false , completion : ( ( ) -> Void ) ? = nil ) {
147147 selectedIndex = tab. visibleIndex ( )
148148 if let navController = selectedViewController as? UINavigationController {
149- navController. popToRootViewController ( animated: animated)
149+ navController. popToRootViewController ( animated: animated) {
150+ completion ? ( )
151+ }
150152 }
151153 }
152154}
@@ -249,18 +251,17 @@ extension MainTabBarController {
249251
250252 /// Switches to the Reviews tab and pops to the root view controller
251253 ///
252- static func switchToReviewsTab( ) {
253- navigateTo ( . reviews)
254+ static func switchToReviewsTab( completion : ( ( ) -> Void ) ? = nil ) {
255+ navigateTo ( . reviews, completion : completion )
254256 }
255257
256258 /// Switches the TabBarController to the specified Tab
257259 ///
258- private static func navigateTo( _ tab: WooTab , animated: Bool = false ) {
260+ private static func navigateTo( _ tab: WooTab , animated: Bool = false , completion : ( ( ) -> Void ) ? = nil ) {
259261 guard let tabBar = AppDelegate . shared. tabBarController else {
260262 return
261263 }
262-
263- tabBar. navigateTo ( tab, animated: animated)
264+ tabBar. navigateTo ( tab, animated: animated, completion: completion)
264265 }
265266
266267 /// Returns the "Top Visible Child" of the specified type
@@ -295,13 +296,12 @@ extension MainTabBarController {
295296 /// Switches to the Notifications Tab, and displays the details for the specified Notification ID.
296297 ///
297298 static func presentNotificationDetails( for noteID: Int ) {
298- switchToReviewsTab ( )
299-
300- guard let reviewsViewController: ReviewsViewController = childViewController ( ) else {
301- return
299+ switchToReviewsTab {
300+ guard let reviewsViewController: ReviewsViewController = childViewController ( ) else {
301+ return
302+ }
303+ reviewsViewController. presentDetails ( for: noteID)
302304 }
303-
304- reviewsViewController. presentDetails ( for: noteID)
305305 }
306306
307307 /// Switches to the My Store Tab, and presents the Settings .
0 commit comments