//
//  PermissionAlertView.swift
//  LeCountdown
//
//  Created by Laurent Morvillier on 02/02/2023.
//

import SwiftUI

struct PermissionAlertView: View {

    var body: some View {
        Button("Show permissions") {
            self._showPermissionSettings()
        }
        Button("OK", role: .cancel) { }
    }

    fileprivate func _showPermissionSettings() {
        if let url = URL(string: UIApplication.openNotificationSettingsURLString) {
            UIApplication.shared.open(url)
        }
    }
    
}

struct PermissionAlertView_Previews: PreviewProvider {
    static var previews: some View {
        PermissionAlertView()
    }
}
