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 { ...@@ -21,7 +21,8 @@ class TodayViewModel: ViewModelProtocol {
public weak var delegate:TodayViewModelDelegate? public weak var delegate:TodayViewModelDelegate?
//Private //Private
private let locationManager: LocationManager! = LocationManager.shared private let locationManager: LocationManager
private let configManager: ConfigManager
private(set) var location:Location? private(set) var location:Location?
public lazy var todayCellFactory:TodayCellFactory = { public lazy var todayCellFactory:TodayCellFactory = {
...@@ -36,8 +37,10 @@ class TodayViewModel: ViewModelProtocol { ...@@ -36,8 +37,10 @@ class TodayViewModel: ViewModelProtocol {
NotificationCenter.default.removeObserver(self) NotificationCenter.default.removeObserver(self)
} }
public init() { public init(locationManager: LocationManager = LocationManager.shared, configManager: ConfigManager = ConfigManager.shared) {
self.location = LocationManager.shared.selectedLocation self.locationManager = locationManager
self.configManager = configManager
self.location = locationManager.selectedLocation
locationManager.add(delegate: self) locationManager.add(delegate: self)
Settings.shared.delegate.add(delegate: self) Settings.shared.delegate.add(delegate: self)
NotificationCenter.default.addObserver(self, selector: #selector(handlePremiumStateChange), name: Notification.Name(rawValue: kEventInAppPurchasedCompleted), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(handlePremiumStateChange), name: Notification.Name(rawValue: kEventInAppPurchasedCompleted), object: nil)
...@@ -99,7 +102,7 @@ class TodayViewModel: ViewModelProtocol { ...@@ -99,7 +102,7 @@ class TodayViewModel: ViewModelProtocol {
} }
else { else {
if #available(iOS 14.5, *) { 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 ATTrackingManager.requestTrackingAuthorization { result in
self.onboardingFlowCompleted() self.onboardingFlowCompleted()
if result == .authorized { 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