Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Refactor setup of array controllers
  • Loading branch information
Michal Matoga committed Aug 26, 2019
commit 43e4447ff81a5fd15b2a98f4439b38359aa97f06
55 changes: 34 additions & 21 deletions Source/View Controllers/TCCProfileViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,28 @@ class TCCProfileViewController: NSViewController {
super.viewDidLoad()

// Setup policy pop up
addressBookPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
photosPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
remindersPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
calendarPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
accessibilityPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
postEventsPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
adminFilesPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
allFilesPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
cameraPopUpAC.add(contentsOf: [ "-" , "Deny" ])
microphonePopUpAC.add(contentsOf: [ "-" , "Deny" ])
fileProviderPresencePopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
listenEventPopUpAC.add(contentsOf: [ "-" , "Deny" ])
mediaLibraryPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
screenCapturePopUpAC.add(contentsOf: [ "-" , "Deny" ])
speechRecognitionPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
dekstopFolderPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
documentsFolderPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
downloadsFolderPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
networkVolumesPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
removableVolumesPopUpAC.add(contentsOf: [ "-" , "Allow" , "Deny" ])
setupAllowDeny(policies: [addressBookPopUpAC,
photosPopUpAC,
remindersPopUpAC,
calendarPopUpAC,
accessibilityPopUpAC,
postEventsPopUpAC,
adminFilesPopUpAC,
allFilesPopUpAC,
fileProviderPresencePopUpAC,
mediaLibraryPopUpAC,
speechRecognitionPopUpAC,
dekstopFolderPopUpAC,
documentsFolderPopUpAC,
downloadsFolderPopUpAC,
networkVolumesPopUpAC,
removableVolumesPopUpAC])

setupDenyOnly(policies: [cameraPopUpAC,
microphonePopUpAC,
listenEventPopUpAC,
screenCapturePopUpAC])


// Setup table views
executablesTable.registerForDraggedTypes([.fileURL])
Expand All @@ -169,7 +171,18 @@ class TCCProfileViewController: NSViewController {

// Record button
}


private func setupAllowDeny(policies: [NSArrayController]) {
for policy in policies {
policy.add(contentsOf: ["-", "Allow", "Deny"])
}
}

private func setupDenyOnly(policies: [NSArrayController]) {
for policy in policies {
policy.add(contentsOf: ["-", "Deny"])
}
}
override func prepare(for segue: NSStoryboardSegue, sender: Any?) {
super.prepare(for: segue, sender: sender)
guard let openVC = segue.destinationController as? OpenViewController else { return }
Expand Down