Skip to content

Commit

Permalink
Use Preference wrapper of UserDefaults
Browse files Browse the repository at this point in the history
  • Loading branch information
uiryuu committed Apr 5, 2019
1 parent 091d4e7 commit 00d18c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions iina/KeyMapping.swift
Expand Up @@ -19,7 +19,7 @@ class KeyMapping: NSObject {

@objc var keyForDisplay: String {
get {
return UserDefaults.standard.bool(forKey: "displayKeyBindingRawValues") ? key : prettyKey
return Preference.bool(for: .displayKeyBindingRawValues) ? key : prettyKey
}
set {
key = newValue
Expand All @@ -29,7 +29,7 @@ class KeyMapping: NSObject {

@objc var actionForDisplay: String {
get {
return UserDefaults.standard.bool(forKey: "displayKeyBindingRawValues") ? readableAction : prettyCommand
return Preference.bool(for: .displayKeyBindingRawValues) ? readableAction : prettyCommand
}
set {
rawAction = newValue
Expand Down
6 changes: 3 additions & 3 deletions iina/PrefKeyBindingViewController.swift
Expand Up @@ -61,7 +61,7 @@ class PrefKeyBindingViewController: NSViewController, PreferenceWindowEmbeddable
super.viewDidLoad()

kbTableView.delegate = self
kbTableView.doubleAction = UserDefaults.standard.bool(forKey: "displayKeyBindingRawValues") ? nil : #selector(editRow)
kbTableView.doubleAction = Preference.bool(for: .displayKeyBindingRawValues) ? nil : #selector(editRow)
confTableView.dataSource = self
confTableView.delegate = self

Expand Down Expand Up @@ -302,7 +302,7 @@ class PrefKeyBindingViewController: NSViewController, PreferenceWindowEmbeddable
}

@IBAction func displayRawValueAction(_ sender: NSButton) {
kbTableView.doubleAction = UserDefaults.standard.bool(forKey: "displayKeyBindingRawValues") ? nil : #selector(editRow)
kbTableView.doubleAction = Preference.bool(for: .displayKeyBindingRawValues) ? nil : #selector(editRow)
kbTableView.reloadData()
}

Expand Down Expand Up @@ -403,7 +403,7 @@ extension PrefKeyBindingViewController: NSTableViewDelegate, NSTableViewDataSour

func tableView(_ tableView: NSTableView, shouldEdit tableColumn: NSTableColumn?, row: Int) -> Bool {
if tableView == kbTableView {
return UserDefaults.standard.bool(forKey: "displayKeyBindingRawValues")
return Preference.bool(for: .displayKeyBindingRawValues)
} else {
return false
}
Expand Down

0 comments on commit 00d18c2

Please sign in to comment.