Skip to content

Commit

Permalink
Use implicit internal access control
Browse files Browse the repository at this point in the history
  • Loading branch information
delba committed Aug 17, 2019
1 parent ee6e61e commit f40be45
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions Source/Permission.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ open class Permission: NSObject {
return DisabledAlert(permission: self)
}()

internal var callback: Callback?
var callback: Callback?

internal var permissionSets: [PermissionSet] = []
var permissionSets: [PermissionSet] = []

/**
Creates and return a new permission for the specified domain.
Expand Down Expand Up @@ -258,7 +258,7 @@ open class Permission: NSObject {
}
}

internal func requestAuthorization(_ callback: @escaping Callback) {
func requestAuthorization(_ callback: @escaping Callback) {
switch type {
#if PERMISSION_CONTACTS
case .contacts: requestContacts(callback)
Expand Down Expand Up @@ -319,7 +319,7 @@ open class Permission: NSObject {
}
}

internal func callbacks(_ with: PermissionStatus) {
func callbacks(_ with: PermissionStatus) {
DispatchQueue.main.async {
self.callback?(self.status)
self.permissionSets.forEach { $0.didRequestPermission(self) }
Expand Down
10 changes: 5 additions & 5 deletions Source/PermissionAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ open class PermissionAlert {
return controller
}

internal init(permission: Permission) {
init(permission: Permission) {
self.permission = permission
}

internal func present() {
func present() {
DispatchQueue.main.async {
UIApplication.shared.presentViewController(self.controller)
}
Expand All @@ -85,7 +85,7 @@ open class PermissionAlert {
}
}

internal class DisabledAlert: PermissionAlert {
class DisabledAlert: PermissionAlert {
override init(permission: Permission) {
super.init(permission: permission)

Expand All @@ -95,7 +95,7 @@ internal class DisabledAlert: PermissionAlert {
}
}

internal class DeniedAlert: PermissionAlert {
class DeniedAlert: PermissionAlert {
override var controller: UIAlertController {
let controller = super.controller

Expand Down Expand Up @@ -132,7 +132,7 @@ internal class DeniedAlert: PermissionAlert {
}
}

internal class PrePermissionAlert: PermissionAlert {
class PrePermissionAlert: PermissionAlert {
override var controller: UIAlertController {
let controller = super.controller

Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ open class PermissionButton: UIButton {
}
}

internal extension PermissionButton {
extension PermissionButton {
@objc func highlight(_ button: PermissionButton) {
render(.highlighted)
}
Expand Down
4 changes: 2 additions & 2 deletions Source/PermissionSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ open class PermissionSet {
self.permissions.forEach { $0.permissionSets.append(self) }
}

internal func willRequestPermission(_ permission: Permission) {
func willRequestPermission(_ permission: Permission) {
delegate?.permissionSet(self, willRequestPermission: permission)
}

internal func didRequestPermission(_ permission: Permission) {
func didRequestPermission(_ permission: Permission) {
delegate?.permissionSet(self, didRequestPermission: permission)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public enum PermissionStatus: String {
case disabled = "Disabled"
case notDetermined = "Not Determined"

internal init?(string: String?) {
init?(string: String?) {
guard let string = string else { return nil }
self.init(rawValue: string)
}
Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/AddressBook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_ADDRESS_BOOK
import AddressBook

internal extension Permission {
extension Permission {
var statusAddressBook: PermissionStatus {
let status = ABAddressBookGetAuthorizationStatus()

Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/Bluetooth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_BLUETOOTH
import CoreBluetooth

internal let BluetoothManager = CBPeripheralManager(
let BluetoothManager = CBPeripheralManager(
delegate: Permission.bluetooth,
queue: nil,
options: [CBPeripheralManagerOptionShowPowerAlertKey: false]
Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/Camera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_CAMERA
import AVFoundation

internal extension Permission {
extension Permission {
var statusCamera: PermissionStatus {
let status = AVCaptureDevice.authorizationStatus(for: AVMediaType.video)

Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/Contacts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_CONTACTS
import Contacts

internal extension Permission {
extension Permission {
var statusContacts: PermissionStatus {
guard #available(iOS 9.0, *) else { fatalError() }

Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/Events.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_EVENTS
import EventKit

internal extension Permission {
extension Permission {
var statusEvents: PermissionStatus {
let status = EKEventStore.authorizationStatus(for: .event)

Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/Location.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_LOCATION
import CoreLocation

internal let LocationManager = CLLocationManager()
let LocationManager = CLLocationManager()

private var requestedLocation = false
private var triggerCallbacks = false
Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/LocationAlways.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_LOCATION
import CoreLocation

internal extension Permission {
extension Permission {
var statusLocationAlways: PermissionStatus {
guard CLLocationManager.locationServicesEnabled() else { return .disabled }

Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/LocationWhenInUse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_LOCATION
import CoreLocation

internal extension Permission {
extension Permission {
var statusLocationWhenInUse: PermissionStatus {
guard CLLocationManager.locationServicesEnabled() else { return .disabled }

Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/MediaLibrary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_MEDIA_LIBRARY
import MediaPlayer

internal extension Permission {
extension Permission {
var statusMediaLibrary: PermissionStatus {
guard #available(iOS 9.3, *) else { fatalError() }

Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/Microphone.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_MICROPHONE
import AVFoundation

internal extension Permission {
extension Permission {
var statusMicrophone: PermissionStatus {
let status = AVAudioSession.sharedInstance().recordPermission

Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/Notifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//

#if PERMISSION_NOTIFICATIONS
internal extension Permission {
extension Permission {
var statusNotifications: PermissionStatus {
if UIApplication.shared.currentUserNotificationSettings?.types.isEmpty == false {
return .authorized
Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/Photos.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_PHOTOS
import Photos

internal extension Permission {
extension Permission {
var statusPhotos: PermissionStatus {
let status = PHPhotoLibrary.authorizationStatus()

Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/Reminders.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_REMINDERS
import EventKit

internal extension Permission {
extension Permission {
var statusReminders: PermissionStatus {
let status = EKEventStore.authorizationStatus(for: .reminder)

Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/Siri.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_SIRI
import Intents

internal extension Permission {
extension Permission {
var statusSiri: PermissionStatus {
guard #available(iOS 10.0, *) else { fatalError() }
let status = INPreferences.siriAuthorizationStatus()
Expand Down
2 changes: 1 addition & 1 deletion Source/PermissionTypes/SpeechRecognizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#if PERMISSION_SPEECH_RECOGNIZER
import Speech

internal extension Permission {
extension Permission {
var statusSpeechRecognizer: PermissionStatus {
guard #available(iOS 10.0, *) else { fatalError() }

Expand Down
8 changes: 4 additions & 4 deletions Source/Supporting Files/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension UIApplication {
return vc
}

internal func presentViewController(_ viewController: UIViewController, animated: Bool = true, completion: (() -> Void)? = nil) {
func presentViewController(_ viewController: UIViewController, animated: Bool = true, completion: (() -> Void)? = nil) {
topViewController?.present(viewController, animated: animated, completion: completion)
}
}
Expand All @@ -48,7 +48,7 @@ extension UIControl.State: Hashable {
public var hashValue: Int { return Int(rawValue) }
}

internal extension String {
extension String {
static let locationWhenInUseUsageDescription = "NSLocationWhenInUseUsageDescription"
static let locationAlwaysUsageDescription = "NSLocationAlwaysUsageDescription"
static let microphoneUsageDescription = "NSMicrophoneUsageDescription"
Expand All @@ -66,7 +66,7 @@ internal extension String {
static let stateBluetoothManagerDetermined = "permission.stateBluetoothManagerDetermined"
}

internal extension Selector {
extension Selector {
static let tapped = #selector(PermissionButton.tapped(_:))
static let highlight = #selector(PermissionButton.highlight(_:))
static let settingsHandler = #selector(DeniedAlert.settingsHandler)
Expand Down Expand Up @@ -111,7 +111,7 @@ extension OperationQueue {
}
}

internal extension NotificationCenter {
extension NotificationCenter {
func addObserver(_ observer: AnyObject, selector: Selector, name: NSNotification.Name?) {
addObserver(observer, selector: selector, name: name!, object: nil)
}
Expand Down

0 comments on commit f40be45

Please sign in to comment.