Skip to content

Commit 26e1987

Browse files
committed
Implemented toggle in settings to enable/disable HLS downloads
1 parent b30be39 commit 26e1987

File tree

2 files changed

+116
-15
lines changed

2 files changed

+116
-15
lines changed

WWDC/GeneralPreferencesViewController.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ final class GeneralPreferencesViewController: WWDCWindowContentViewController {
4848

4949
@IBOutlet weak var downloadsFolderLabel: NSTextField!
5050

51+
@IBOutlet weak var preferHLSDownloadsLabel: NSTextField!
52+
@IBOutlet weak var preferHLSDownloadsSwitch: NSSwitch!
53+
5154
@IBOutlet weak var downloadsFolderIntroLabel: NSTextField!
5255
@IBOutlet weak var searchIntroLabel: NSTextField!
5356
@IBOutlet weak var includeBookmarksLabel: NSTextField!
@@ -73,6 +76,7 @@ final class GeneralPreferencesViewController: WWDCWindowContentViewController {
7376

7477
downloadsFolderIntroLabel.textColor = .prefsPrimaryText
7578
searchIntroLabel.textColor = .prefsPrimaryText
79+
preferHLSDownloadsLabel.textColor = .prefsPrimaryText
7680
includeBookmarksLabel.textColor = .prefsPrimaryText
7781
includeTranscriptsLabel.textColor = .prefsPrimaryText
7882
refreshAutomaticallyLabel.textColor = .prefsPrimaryText
@@ -86,6 +90,7 @@ final class GeneralPreferencesViewController: WWDCWindowContentViewController {
8690
dividerC.fillColor = .separatorColor
8791
dividerE.fillColor = .separatorColor
8892

93+
preferHLSDownloadsSwitch.isOn = Preferences.shared.preferHLSVideoDownload
8994
searchInTranscriptsSwitch.isOn = Preferences.shared.searchInTranscripts
9095
searchInBookmarksSwitch.isOn = Preferences.shared.searchInBookmarks
9196
refreshPeriodicallySwitch.isOn = Preferences.shared.refreshPeriodically
@@ -251,6 +256,12 @@ final class GeneralPreferencesViewController: WWDCWindowContentViewController {
251256
return response == .alertSecondButtonReturn
252257
}
253258

259+
@IBAction func preferHLSDownloadsSwitchAction(_ sender: NSSwitch) {
260+
guard sender.isOn != Preferences.shared.preferHLSVideoDownload else { return }
261+
262+
Preferences.shared.preferHLSVideoDownload = sender.isOn
263+
}
264+
254265
// MARK: - Transcript languages
255266

256267
private lazy var languagesProvider = TranscriptLanguagesProvider()

0 commit comments

Comments
 (0)