diff --git a/Sources/Earthquake Network/Controllers/Alerts/AllerteViewController.m b/Sources/Earthquake Network/Controllers/Alerts/AllerteViewController.m index 82360d3..f2d27ee 100644 --- a/Sources/Earthquake Network/Controllers/Alerts/AllerteViewController.m +++ b/Sources/Earthquake Network/Controllers/Alerts/AllerteViewController.m @@ -149,7 +149,7 @@ typedef NS_ENUM(NSInteger, AllerteTableRow) { [self.tableItems addObject:@(AllerteTableRowReteSmartphone)]; } // check if locations is enabled - if (CLLocationManager.authorizationStatus != kCLAuthorizationStatusAuthorizedAlways) { + if (EQNUserData.sharedData.locationAuthorizationStatus != kCLAuthorizationStatusAuthorizedAlways) { [self.tableItems addObject:@(AllerteTableRowLocationPermission)]; } @@ -235,7 +235,7 @@ typedef NS_ENUM(NSInteger, AllerteTableRow) { - (void)actionTestPush { - CLAuthorizationStatus status = CLLocationManager.authorizationStatus; + CLAuthorizationStatus status = EQNUserData.sharedData.locationAuthorizationStatus; if (status != kCLAuthorizationStatusAuthorizedAlways && status != kCLAuthorizationStatusAuthorizedWhenInUse) { UIAlertController *alert = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"attention", nil) message:NSLocalizedString(@"liveview_unknown_location", nil) @@ -273,7 +273,7 @@ typedef NS_ENUM(NSInteger, AllerteTableRow) { if (tableRow == AllerteTableRowLocationPermission) { AlertsNoLocationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"NoLocationCell" forIndexPath:indexPath]; cell.selectionStyle = UITableViewCellSelectionStyleNone; - [cell updateWith:CLLocationManager.authorizationStatus]; + [cell updateWith:EQNUserData.sharedData.locationAuthorizationStatus]; return cell; } else if (tableRow == AllerteTableRowSismiRilevati) { diff --git a/Sources/Earthquake Network/Models/EQNUserData.swift b/Sources/Earthquake Network/Models/EQNUserData.swift index c36a96b..57222e7 100644 --- a/Sources/Earthquake Network/Models/EQNUserData.swift +++ b/Sources/Earthquake Network/Models/EQNUserData.swift @@ -23,6 +23,13 @@ import CoreLocation return !firstAppStartExecuted } + // MARK: - Permissions + + @objc + var locationAuthorizationStatus: CLAuthorizationStatus { + CLLocationManager().authorizationStatus + } + // MARK: - Firebase Token @objc