diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index d14aed711f..a14fe140e7 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -313,8 +313,12 @@ using namespace osm_auth_ios; - (void)updateApplicationIconBadgeNumber { auto const number = [self badgeNumber]; - UIApplication.sharedApplication.applicationIconBadgeNumber = number; - BottomTabBarViewController.controller.isApplicationBadgeHidden = number == 0; + + // Delay init because BottomTabBarViewController.controller is null here. + dispatch_async(dispatch_get_main_queue(), ^{ + [UIApplication.sharedApplication setApplicationIconBadgeNumber:number]; + BottomTabBarViewController.controller.isApplicationBadgeHidden = (number == 0); + }); } - (NSUInteger)badgeNumber { diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarPresenter.swift b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarPresenter.swift index 2a2be2c526..bccf18347d 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarPresenter.swift +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarPresenter.swift @@ -20,7 +20,6 @@ class BottomTabBarPresenter: NSObject { extension BottomTabBarPresenter: BottomTabBarPresenterProtocol { func configure() { - view?.isLayersBadgeHidden = true } func onSearchButtonPressed() { diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift index 254064878c..0d32e24356 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift @@ -1,7 +1,6 @@ protocol BottomTabBarViewProtocol: class { var presenter: BottomTabBarPresenterProtocol! { get set } var isHidden: Bool { get } - var isLayersBadgeHidden: Bool { get set } var isApplicationBadgeHidden: Bool { get set } } @@ -21,11 +20,6 @@ class BottomTabBarViewController: UIViewController { updateFrame(animated: true) } } - var isLayersBadgeHidden: Bool = true { - didSet { - updateBadge() - } - } @objc var isApplicationBadgeHidden: Bool = true { didSet { updateBadge() @@ -111,7 +105,7 @@ class BottomTabBarViewController: UIViewController { } private func updateBadge() { - downloadBadge.isHidden = isApplicationBadgeHidden && isLayersBadgeHidden + downloadBadge.isHidden = isApplicationBadgeHidden } }