sparrowcode / PermissionsKit

Universal API for request permission and get its statuses.
https://x.com/sparrowcode_ios
MIT License
5.64k stars 462 forks source link

Ios 13 problem #136

Closed alxrguz closed 5 years ago

alxrguz commented 5 years ago

Hi Ivan, first of all I want to say thanks for your work. While developing the application, I found a bug on ios 13 (maybe I did something wrong). I invoke a request at the click of a button, with the nabigationBar remaining on top of the BlurView. On ios 11 and 12, this problem is not observed You can see example on yandex disk - https://yadi.sk/i/h6grgosSFZDUGw

ivanvorobei commented 5 years ago

On which controller you present SPPermission?

alxrguz commented 5 years ago

In viewDidLoad I set up navigationController, set the buttons, title, color, then in viewDidAppear I present SPPermission

override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        documentTableView.reloadData()
        DispatchQueue.main.asyncAfter(deadline: .now() + 2){
            if UserDefaults.standard.bool(forKey: "com.permission") == false {
                SPPermission.Dialog.request(
                    with: [.photoLibrary, .camera, .notification],
                    on: self,
                    delegate: self,
                    dataSource: self
                )
                //interim solution
                self.navigationController?.setNavigationBarHidden(true, animated: true)
                UserDefaults.standard.set(true, forKey: "com.permission")
            }
        }
    }

and when button tapped I'm doing a check again and present SPPermission (if user denied permissions)

@objc private func createScanTapped(_ sender: UIButton){
        if !SPPermission.isAllowed(.camera) || !SPPermission.isAllowed(.photoLibrary){
            SPPermission.Dialog.request(
                with: [.photoLibrary, .camera],
                on: self,
                delegate: self,
                dataSource: self
            )
    }
}
ivanvorobei commented 5 years ago

You need present SPPermission on navigation controller. If you present of child - blur only child. Need pass top controller for blur full size of it controller. I think it help for you.

alxrguz commented 5 years ago

Thank you very much for your help, I will leave my solution for the rest

let view = self.navigationController ?? self
SPPermission.Dialog.request(
                with: [.photoLibrary, .camera],
                on: view,
                dataSource: self)