1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-10 00:58:37 +00:00

resolve existing varnings

This commit is contained in:
Serg 2019-10-13 13:48:04 +07:00
parent 0b39795bd7
commit 92975cb8e4
4 changed files with 28 additions and 28 deletions

View File

@ -225,7 +225,7 @@ class SupportedTypesHolder {
"inputsource": { _ in
(
item: .inputsource(),
item: .inputsource,
action: .none,
longAction: .none,
parameters: [:]
@ -237,14 +237,14 @@ class SupportedTypesHolder {
let container = try decoder.container(keyedBy: CodingKeys.self)
if var img = try container.decodeIfPresent(Source.self, forKey: .image) {
return (
item: .volume(),
item: .volume,
action: .none,
longAction: .none,
parameters: [.image: .image(source: img)]
)
} else {
return (
item: .volume(),
item: .volume,
action: .none,
longAction: .none,
parameters: [:]
@ -345,21 +345,21 @@ enum ItemType: Decodable {
case appleScriptTitledButton(source: SourceProtocol, refreshInterval: Double)
case shellScriptTitledButton(source: SourceProtocol, refreshInterval: Double)
case timeButton(formatTemplate: String, timeZone: String?, locale: String?)
case battery()
case battery
case dock(autoResize: Bool)
case volume()
case volume
case brightness(refreshInterval: Double)
case weather(interval: Double, units: String, api_key: String, icon_type: String)
case yandexWeather(interval: Double)
case currency(interval: Double, from: String, to: String, full: Bool)
case inputsource()
case inputsource
case music(interval: Double, disableMarquee: Bool)
case groupBar(items: [BarItemDefinition])
case nightShift()
case dnd()
case nightShift
case dnd
case pomodoro(workTime: Double, restTime: Double)
case network(flip: Bool)
case darkMode()
case darkMode
private enum CodingKeys: String, CodingKey {
case type
@ -433,14 +433,14 @@ enum ItemType: Decodable {
self = .timeButton(formatTemplate: template, timeZone: timeZone, locale: locale)
case .battery:
self = .battery()
self = .battery
case .dock:
let autoResize = try container.decodeIfPresent(Bool.self, forKey: .autoResize) ?? false
self = .dock(autoResize: autoResize)
case .volume:
self = .volume()
self = .volume
case .brightness:
let interval = try container.decodeIfPresent(Double.self, forKey: .refreshInterval) ?? 0.5
@ -465,7 +465,7 @@ enum ItemType: Decodable {
self = .currency(interval: interval, from: from, to: to, full: full)
case .inputsource:
self = .inputsource()
self = .inputsource
case .music:
let interval = try container.decodeIfPresent(Double.self, forKey: .refreshInterval) ?? 5.0
@ -477,10 +477,10 @@ enum ItemType: Decodable {
self = .groupBar(items: items)
case .nightShift:
self = .nightShift()
self = .nightShift
case .dnd:
self = .dnd()
self = .dnd
case .pomodoro:
let workTime = try container.decodeIfPresent(Double.self, forKey: .workTime) ?? 1500.0
@ -492,7 +492,7 @@ enum ItemType: Decodable {
self = .network(flip: flip)
case .darkMode:
self = .darkMode()
self = .darkMode
}
}
}

View File

@ -27,11 +27,11 @@ extension ItemType {
return "com.toxblh.mtmr.shellScriptButton."
case .timeButton(formatTemplate: _, timeZone: _, locale: _):
return "com.toxblh.mtmr.timeButton."
case .battery():
case .battery:
return "com.toxblh.mtmr.battery."
case .dock(autoResize: _):
return "com.toxblh.mtmr.dock"
case .volume():
case .volume:
return "com.toxblh.mtmr.volume"
case .brightness(refreshInterval: _):
return "com.toxblh.mtmr.brightness"
@ -41,21 +41,21 @@ extension ItemType {
return "com.toxblh.mtmr.yandexWeather"
case .currency(interval: _, from: _, to: _, full: _):
return "com.toxblh.mtmr.currency"
case .inputsource():
case .inputsource:
return "com.toxblh.mtmr.inputsource."
case .music(interval: _):
return "com.toxblh.mtmr.music."
case .groupBar(items: _):
return "com.toxblh.mtmr.groupBar."
case .nightShift(items: _):
case .nightShift:
return "com.toxblh.mtmr.nightShift."
case .dnd(items: _):
case .dnd:
return "com.toxblh.mtmr.dnd."
case .pomodoro(interval: _):
return PomodoroBarItem.identifier
case .network(flip: _):
return NetworkBarItem.identifier
case .darkMode(items: _):
case .darkMode:
return DarkModeBarItem.identifier
}
}
@ -266,7 +266,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
barItem = ShellScriptTouchBarItem(identifier: identifier, source: source, interval: interval)
case let .timeButton(formatTemplate: template, timeZone: timeZone, locale: locale):
barItem = TimeTouchBarItem(identifier: identifier, formatTemplate: template, timeZone: timeZone, locale: locale)
case .battery():
case .battery:
barItem = BatteryBarItem(identifier: identifier)
case let .dock(autoResize: autoResize):
barItem = AppScrubberTouchBarItem(identifier: identifier, autoResize: autoResize)
@ -288,21 +288,21 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
barItem = YandexWeatherBarItem(identifier: identifier, interval: interval)
case let .currency(interval: interval, from: from, to: to, full: full):
barItem = CurrencyBarItem(identifier: identifier, interval: interval, from: from, to: to, full: full)
case .inputsource():
case .inputsource:
barItem = InputSourceBarItem(identifier: identifier)
case let .music(interval: interval, disableMarquee: disableMarquee):
barItem = MusicBarItem(identifier: identifier, interval: interval, disableMarquee: disableMarquee)
case let .groupBar(items: items):
barItem = GroupBarItem(identifier: identifier, items: items)
case .nightShift():
case .nightShift:
barItem = NightShiftBarItem(identifier: identifier)
case .dnd():
case .dnd:
barItem = DnDBarItem(identifier: identifier)
case let .pomodoro(workTime: workTime, restTime: restTime):
barItem = PomodoroBarItem(identifier: identifier, workTime: workTime, restTime: restTime)
case let .network(flip: flip):
barItem = NetworkBarItem(identifier: identifier, flip: flip)
case .darkMode():
case .darkMode:
barItem = DarkModeBarItem(identifier: identifier)
}

View File

@ -47,7 +47,7 @@ struct DarkMode {
static func toggle(force: Bool? = nil) {
let value = force.map(String.init) ?? "not dark mode"
runAppleScript("\(prefix) set dark mode to \(value)")
_ = runAppleScript("\(prefix) set dark mode to \(value)")
}
}

View File

@ -180,7 +180,7 @@ class MusicBarItem: CustomButtonTouchBarItem {
var iconUpdated = false
var titleUpdated = false
for var ident in playerBundleIdentifiers {
for ident in playerBundleIdentifiers {
if let musicPlayer = SBApplication(bundleIdentifier: ident.rawValue) {
if musicPlayer.isRunning {
var tempTitle = ""