From 338e88ab26d6652bd994cbf7a98da03e049e1e6b Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Tue, 26 Feb 2019 16:15:14 +1300 Subject: [PATCH 1/2] Make sure the permissions controller is displayed if the camera permissions are not determined. https://github.com/hyperoslo/Gallery/issues/141 --- Sources/Gallery/GalleryController.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/Gallery/GalleryController.swift b/Sources/Gallery/GalleryController.swift index f442b066..08dbf5cc 100644 --- a/Sources/Gallery/GalleryController.swift +++ b/Sources/Gallery/GalleryController.swift @@ -75,6 +75,9 @@ public class GalleryController: UIViewController, PermissionControllerDelegate { 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 { From b5db7321667b00b7441cbdbe834cdc6f30073583 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Thu, 28 Feb 2019 14:26:30 +1300 Subject: [PATCH 2/2] Make the hiding of the status bar configurable. --- Sources/Gallery/GalleryController.swift | 2 +- Sources/Utils/Config.swift | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/Gallery/GalleryController.swift b/Sources/Gallery/GalleryController.swift index 08dbf5cc..de536edf 100644 --- a/Sources/Gallery/GalleryController.swift +++ b/Sources/Gallery/GalleryController.swift @@ -41,7 +41,7 @@ public class GalleryController: UIViewController, PermissionControllerDelegate { } public override var prefersStatusBarHidden : Bool { - return true + return Config.showStatusBar } // MARK: - Child view controller diff --git a/Sources/Utils/Config.swift b/Sources/Utils/Config.swift index 07dbc955..dfda421b 100644 --- a/Sources/Utils/Config.swift +++ b/Sources/Utils/Config.swift @@ -22,7 +22,8 @@ public struct Config { public static var tabsToShow: [GalleryTab] = [.imageTab, .cameraTab, .videoTab] // Defaults to cameraTab if present, or whatever tab is first if cameraTab isn't present. public static var initialTab: GalleryTab? - + public static var showStatusBar: Bool = false + public enum GalleryTab { case imageTab case cameraTab