48 lines
1.2 KiB
Swift
48 lines
1.2 KiB
Swift
//
|
|
// AlertsNoLocationTableViewCell.swift
|
|
// Earthquake Network
|
|
//
|
|
// Created by Busi Andrea on 06/10/2020.
|
|
// Copyright © 2020 Earthquake Network. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import CoreLocation
|
|
|
|
class AlertsNoLocationTableViewCell: EQNBaseTableViewCell {
|
|
|
|
@objc var status: CLAuthorizationStatus = .notDetermined {
|
|
didSet {
|
|
updateUI()
|
|
}
|
|
}
|
|
|
|
@IBOutlet private weak var messageLabel: UILabel!
|
|
|
|
// MARK: - Private
|
|
|
|
private func updateUI() {
|
|
var message = ""
|
|
switch status {
|
|
case .authorizedAlways:
|
|
message = ""
|
|
case .authorizedWhenInUse:
|
|
message = NSLocalizedString("permission_location_no_background", comment: "")
|
|
default:
|
|
message = NSLocalizedString("permission_location_no", comment: "")
|
|
}
|
|
messageLabel.text = message
|
|
}
|
|
|
|
// MARK: - Actions
|
|
|
|
@IBAction private func solveTapped(_ sender: UIButton) {
|
|
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
|
|
return
|
|
}
|
|
|
|
UIApplication.shared.open(settingsUrl, options: [:], completionHandler: nil)
|
|
}
|
|
|
|
}
|