Commit 77d8bbf8 by Demid Merzlyakov

IOS-129: ATT prompt respects the Config's ios_show_att_prompt variable.

parent 39f2111a
......@@ -21,7 +21,8 @@ class TodayViewModel: ViewModelProtocol {
public weak var delegate:TodayViewModelDelegate?
//Private
private let locationManager: LocationManager! = LocationManager.shared
private let locationManager: LocationManager
private let configManager: ConfigManager
private(set) var location:Location?
public lazy var todayCellFactory:TodayCellFactory = {
......@@ -36,8 +37,10 @@ class TodayViewModel: ViewModelProtocol {
NotificationCenter.default.removeObserver(self)
}
public init() {
self.location = LocationManager.shared.selectedLocation
public init(locationManager: LocationManager = LocationManager.shared, configManager: ConfigManager = ConfigManager.shared) {
self.locationManager = locationManager
self.configManager = configManager
self.location = locationManager.selectedLocation
locationManager.add(delegate: self)
Settings.shared.delegate.add(delegate: self)
NotificationCenter.default.addObserver(self, selector: #selector(handlePremiumStateChange), name: Notification.Name(rawValue: kEventInAppPurchasedCompleted), object: nil)
......@@ -99,7 +102,7 @@ class TodayViewModel: ViewModelProtocol {
}
else {
if #available(iOS 14.5, *) {
if !CCPAHelper.shared.isNewUser && ATTrackingManager.trackingAuthorizationStatus == .notDetermined {
if self.configManager.config.showAttPrompt && !CCPAHelper.shared.isNewUser && ATTrackingManager.trackingAuthorizationStatus == .notDetermined {
ATTrackingManager.requestTrackingAuthorization { result in
self.onboardingFlowCompleted()
if result == .authorized {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment