Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure the permissions controller is displayed if the camera permi… #142

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Sources/Gallery/GalleryController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class GalleryController: UIViewController, PermissionControllerDelegate {
}

public override var prefersStatusBarHidden : Bool {
return true
return Config.showStatusBar
}

// MARK: - Child view controller
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion Sources/Utils/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down