diff --git a/MTMR/ItemsParsing.swift b/MTMR/ItemsParsing.swift index a946090..1ef4a2f 100644 --- a/MTMR/ItemsParsing.swift +++ b/MTMR/ItemsParsing.swift @@ -62,13 +62,6 @@ class SupportedTypesHolder { let item = ItemType.appleScriptTitledButton(source: try! String(contentsOf: scriptURL), refreshInterval: interval ?? 1800.0) return (item: item, action: .none) }, - "time": { decoder in - enum CodingKeys: String, CodingKey { case formatTemplate } - let container = try decoder.container(keyedBy: CodingKeys.self) - let template = try container.decodeIfPresent(String.self, forKey: .formatTemplate) - let item = ItemType.timeButton(formatTemplate: template ?? "HH:mm" ) - return (item: item, action: .none) - }, ] static let sharedInstance = SupportedTypesHolder() @@ -121,7 +114,7 @@ enum ItemType: Decodable { let title = try container.decode(String.self, forKey: .title) self = .staticButton(title: title) case .timeButton: - let template = try container.decode(String.self, forKey: .formatTemplate) + let template = try container.decodeIfPresent(String.self, forKey: .formatTemplate) ?? "HH:mm" self = .timeButton(formatTemplate: template) } } diff --git a/MTMR/defaultPreset.json b/MTMR/defaultPreset.json index 3f388a0..97abb44 100644 --- a/MTMR/defaultPreset.json +++ b/MTMR/defaultPreset.json @@ -8,7 +8,6 @@ { "type": "previous" }, { "type": "play" }, { "type": "next" }, - { "type": "volumeUp" }, - { "type": "volumeUp" }, - { "type": "weather", "refreshInterval": 1800 } + { "type": "weather", "refreshInterval": 1800 }, + { "type": "timeButton" }, ]