1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-11 09:28:38 +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 "inputsource": { _ in
( (
item: .inputsource(), item: .inputsource,
action: .none, action: .none,
longAction: .none, longAction: .none,
parameters: [:] parameters: [:]
@ -237,14 +237,14 @@ class SupportedTypesHolder {
let container = try decoder.container(keyedBy: CodingKeys.self) let container = try decoder.container(keyedBy: CodingKeys.self)
if var img = try container.decodeIfPresent(Source.self, forKey: .image) { if var img = try container.decodeIfPresent(Source.self, forKey: .image) {
return ( return (
item: .volume(), item: .volume,
action: .none, action: .none,
longAction: .none, longAction: .none,
parameters: [.image: .image(source: img)] parameters: [.image: .image(source: img)]
) )
} else { } else {
return ( return (
item: .volume(), item: .volume,
action: .none, action: .none,
longAction: .none, longAction: .none,
parameters: [:] parameters: [:]
@ -345,21 +345,21 @@ enum ItemType: Decodable {
case appleScriptTitledButton(source: SourceProtocol, refreshInterval: Double) case appleScriptTitledButton(source: SourceProtocol, refreshInterval: Double)
case shellScriptTitledButton(source: SourceProtocol, refreshInterval: Double) case shellScriptTitledButton(source: SourceProtocol, refreshInterval: Double)
case timeButton(formatTemplate: String, timeZone: String?, locale: String?) case timeButton(formatTemplate: String, timeZone: String?, locale: String?)
case battery() case battery
case dock(autoResize: Bool) case dock(autoResize: Bool)
case volume() case volume
case brightness(refreshInterval: Double) case brightness(refreshInterval: Double)
case weather(interval: Double, units: String, api_key: String, icon_type: String) case weather(interval: Double, units: String, api_key: String, icon_type: String)
case yandexWeather(interval: Double) case yandexWeather(interval: Double)
case currency(interval: Double, from: String, to: String, full: Bool) case currency(interval: Double, from: String, to: String, full: Bool)
case inputsource() case inputsource
case music(interval: Double, disableMarquee: Bool) case music(interval: Double, disableMarquee: Bool)
case groupBar(items: [BarItemDefinition]) case groupBar(items: [BarItemDefinition])
case nightShift() case nightShift
case dnd() case dnd
case pomodoro(workTime: Double, restTime: Double) case pomodoro(workTime: Double, restTime: Double)
case network(flip: Bool) case network(flip: Bool)
case darkMode() case darkMode
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case type case type
@ -433,14 +433,14 @@ enum ItemType: Decodable {
self = .timeButton(formatTemplate: template, timeZone: timeZone, locale: locale) self = .timeButton(formatTemplate: template, timeZone: timeZone, locale: locale)
case .battery: case .battery:
self = .battery() self = .battery
case .dock: case .dock:
let autoResize = try container.decodeIfPresent(Bool.self, forKey: .autoResize) ?? false let autoResize = try container.decodeIfPresent(Bool.self, forKey: .autoResize) ?? false
self = .dock(autoResize: autoResize) self = .dock(autoResize: autoResize)
case .volume: case .volume:
self = .volume() self = .volume
case .brightness: case .brightness:
let interval = try container.decodeIfPresent(Double.self, forKey: .refreshInterval) ?? 0.5 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) self = .currency(interval: interval, from: from, to: to, full: full)
case .inputsource: case .inputsource:
self = .inputsource() self = .inputsource
case .music: case .music:
let interval = try container.decodeIfPresent(Double.self, forKey: .refreshInterval) ?? 5.0 let interval = try container.decodeIfPresent(Double.self, forKey: .refreshInterval) ?? 5.0
@ -477,10 +477,10 @@ enum ItemType: Decodable {
self = .groupBar(items: items) self = .groupBar(items: items)
case .nightShift: case .nightShift:
self = .nightShift() self = .nightShift
case .dnd: case .dnd:
self = .dnd() self = .dnd
case .pomodoro: case .pomodoro:
let workTime = try container.decodeIfPresent(Double.self, forKey: .workTime) ?? 1500.0 let workTime = try container.decodeIfPresent(Double.self, forKey: .workTime) ?? 1500.0
@ -492,7 +492,7 @@ enum ItemType: Decodable {
self = .network(flip: flip) self = .network(flip: flip)
case .darkMode: case .darkMode:
self = .darkMode() self = .darkMode
} }
} }
} }

View File

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

View File

@ -47,7 +47,7 @@ struct DarkMode {
static func toggle(force: Bool? = nil) { static func toggle(force: Bool? = nil) {
let value = force.map(String.init) ?? "not dark mode" 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 iconUpdated = false
var titleUpdated = false var titleUpdated = false
for var ident in playerBundleIdentifiers { for ident in playerBundleIdentifiers {
if let musicPlayer = SBApplication(bundleIdentifier: ident.rawValue) { if let musicPlayer = SBApplication(bundleIdentifier: ident.rawValue) {
if musicPlayer.isRunning { if musicPlayer.isRunning {
var tempTitle = "" var tempTitle = ""