When a user has declined us system permissions to use Media Library, they can still dismiss the media picker and continue on with composing their post.
The media picker can't be dismissed, forcing users to either update the permission or abandon composing the post.
Photos permission to Never.Tested on iPhone 6S, iOS 11.0.2, 8.5 (still issue on develop)
I stumbled upon this while making sure my PR still works after rebasing on latest develop and I _think_ I know what's happening:
1) When it's first being shown on screen, WPMediaPicker internally checks if it has appropriate permissions. If not, it throws up the UIAlertController and calls mediaPickerControllerDidCancel: delegate method from WPMediaPickerViewControllerDelegate.
2) AztecViewController implements that method as follows:
func mediaPickerControllerDidCancel(_ picker: WPMediaPickerViewController) {
if picker != mediaPickerInputViewController?.mediaPicker {
dismiss(animated: true, completion: nil)
} else {
mediaPickerInputViewController = nil
}
}
in this particular case, the check evaluates to true and it zeroes out the reference.
3) When the user now taps the X button to close the picker, the following method is called:
private func toggleMediaPicker(fromButton button: UIButton) {
if mediaPickerInputViewController != nil {
closeMediaPickerInputViewController()
trackFormatBarAnalytics(stat: .editorMediaPickerTappedDismiss)
} else {
presentMediaPicker(fromButton: button, animated: true)
}
}
since we just niled out the reference to mediaPickerInputViewController, the app tries to present the media picker all over again — creating a loop in the process.
It seems to me that not niling out the reference in mediaPickerControllerDidCancel(_:) is enough of a fix for this — but I'm not sure why it was niled out in the first place, so I'm probably missing some context :)
Hope my investigation notes will prove useful :)
Pinging @SergioEstevao and @frosty for this one. Thanks a lot for the detailed report @jklausa
I will take care of this, thanks for the report @jklausa
@elibud you want this for 8.5.1 or 8.6?
Thanks @SergioEstevao, lets target 8.6 and we can cherry pick it on 8.5.1.
Good catch, @jklausa! And thanks for raising the detailed issue!