ytakzk / Fusuma

Instagram-like photo browser and a camera feature with a few line of code in Swift.
MIT License
2.46k stars 340 forks source link

Check Camera Auth #201

Open Faydee1220 opened 7 years ago

Faydee1220 commented 7 years ago

How about to add func checkCameraAuth() like checkPhotoAuth() ?

For example, when user don't allow photo permission first time, there's a protocol FSAlbumViewDelegate has func albumViewCameraRollUnauthorized(), then I can show alert that user can go to setting and grant permission of taking photo.

But it seems like there's no similiar func for camera?

By the way, I still get warning when use example's way to preset, and I found the solution in stackoverflow:

// Utility function to avoid: // Warning: Attempt to present on whose view is not in the window hierarchy!

    func showAlertGlobally(_ alert: UIAlertController) {
        let alertWindow = UIWindow(frame: UIScreen.main.bounds)
        alertWindow.windowLevel = UIWindowLevelAlert
        alertWindow.rootViewController = UIViewController()
        alertWindow.makeKeyAndVisible()
        alertWindow.rootViewController?.present(alert, animated: true, completion: nil)
    }
ytakzk commented 7 years ago

@Faydee1220 Good suggestion, thanks! I will implement it soon 👍