Skip to content

Commit

Permalink
Make sure the permissions controller is displayed if the camera permi…
Browse files Browse the repository at this point in the history
…ssions are not determined. hyperoslo#141
  • Loading branch information
onato committed Feb 26, 2019
1 parent 11183c1 commit 8787b2a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/Gallery/GalleryController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@ public class GalleryController: UIViewController, PermissionControllerDelegate {

func makePagesController() -> PagesController? {
guard Permission.Photos.status == .authorized else {
return nil
return nil
}

let useCamera = Permission.Camera.needsPermission && Permission.Camera.status == .authorized

let tabsToShow = Config.tabsToShow.compactMap { $0 != .cameraTab ? $0 : (useCamera ? $0 : nil) }
if useCamera, Permission.Camera.status == .notDetermined {
return nil
}

let controllers: [UIViewController] = tabsToShow.compactMap { tab in
if tab == .imageTab {
Expand Down

0 comments on commit 8787b2a

Please sign in to comment.