forked from organicmaps/organicmaps
[iOS] Fixed discovery button behaviour
https://jira.mail.ru/browse/MAPSME-12642 https://jira.mail.ru/browse/MAPSME-12641
This commit is contained in:
parent
cb8b8898b8
commit
4b1ce29dc0
3 changed files with 14 additions and 9 deletions
|
@ -278,7 +278,7 @@ NSString * const kMapToCategorySelectorSegue = @"MapToCategorySelectorSegue";
|
|||
[self.navigationManager onRouteStop];
|
||||
self.disableStandbyOnRouteFollowing = NO;
|
||||
self.trafficButtonHidden = NO;
|
||||
self.promoButton.hidden = NO;
|
||||
self.promoButton.hidden = _promoDiscoveryCampaign.hasBeenActivated;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,12 @@ import UIKit
|
|||
@objc init(coordinator: PromoCoordinator) {
|
||||
self.coordinator = coordinator
|
||||
super.init(frame: CGRect(x: 0, y: 0, width: buttonSize.width, height: buttonSize.height))
|
||||
|
||||
let view = UIView(frame: CGRect(x: buttonSize.width - 14, y: 0, width: 12, height: 12))
|
||||
view.layer.cornerRadius = view.size.width/2
|
||||
view.backgroundColor = UIColor.red
|
||||
addSubview(view)
|
||||
|
||||
configure()
|
||||
}
|
||||
|
||||
|
@ -17,8 +23,6 @@ import UIKit
|
|||
|
||||
private func configure() {
|
||||
removeTarget(self, action: nil, for: .touchUpInside)
|
||||
self.subviews.forEach({ $0.removeFromSuperview() })
|
||||
|
||||
configureDiscovery()
|
||||
}
|
||||
|
||||
|
@ -30,11 +34,6 @@ import UIKit
|
|||
}
|
||||
addTarget(self, action: #selector(onButtonPress), for: .touchUpInside)
|
||||
|
||||
let view = UIView(frame: CGRect(x: buttonSize.width - 14, y: 0, width: 12, height: 12))
|
||||
view.layer.cornerRadius = view.size.width/2
|
||||
view.backgroundColor = UIColor.red
|
||||
addSubview(view)
|
||||
|
||||
imageView?.clipsToBounds = false
|
||||
imageView?.contentMode = .center
|
||||
|
||||
|
@ -56,6 +55,7 @@ import UIKit
|
|||
|
||||
@objc private func onButtonPress(sender: UIButton) {
|
||||
coordinator.onPromoButtonPress(completion: { [weak self] in
|
||||
PromoCampaignManager.manager().promoDiscoveryCampaign.onActivate();
|
||||
self?.isHidden = true;
|
||||
})
|
||||
}
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
|
||||
let group: Group
|
||||
let url: URL?
|
||||
@objc private(set) var hasBeenActivated: Bool = false
|
||||
|
||||
var enabled: Bool {
|
||||
return adapter.canShowTipButton() && Alohalytics.isFirstSession();
|
||||
return adapter.canShowTipButton() && Alohalytics.isFirstSession() && !hasBeenActivated;
|
||||
}
|
||||
|
||||
required override init() {
|
||||
|
@ -19,4 +20,8 @@
|
|||
group = Group(rawValue: adapter.type) ?? .discoverCatalog
|
||||
url = adapter.url
|
||||
}
|
||||
|
||||
func onActivate() {
|
||||
hasBeenActivated = true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue