mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-11 09:28:38 +00:00
YandexWeatherBarItem: fixes in parsing
This commit is contained in:
parent
5e609c2446
commit
9bdaf5478b
@ -13,13 +13,15 @@ class HapticFeedback {
|
|||||||
// Here we have list of possible IDs for Haptic Generator Device. They are not constant
|
// Here we have list of possible IDs for Haptic Generator Device. They are not constant
|
||||||
// To find deviceID, you will need IORegistryExplorer app from Additional Tools for Xcode dmg
|
// To find deviceID, you will need IORegistryExplorer app from Additional Tools for Xcode dmg
|
||||||
// which you can download from https://developer.apple.com/download/more/?=Additional%20Tools
|
// which you can download from https://developer.apple.com/download/more/?=Additional%20Tools
|
||||||
// Open IORegistryExplorer app, search for AppleMultitouchDevice and get "Multitouch ID"
|
// Open IORegistryExplorer app, search for "AppleMultitouchDevice" and get "Multitouch ID"
|
||||||
|
// or "AppleMultitouchTrackpadHIDEventDriver" and get "mt-device-id"
|
||||||
// There should be programmatic way to get it but I can't find, no docs for macOS :(
|
// There should be programmatic way to get it but I can't find, no docs for macOS :(
|
||||||
private let possibleDeviceIDs: [UInt64] = [
|
private let possibleDeviceIDs: [UInt64] = [
|
||||||
0x200_0000_0100_0000, // MacBook Pro 2016/2017
|
0x200_0000_0100_0000, // MacBook Pro 2016/2017
|
||||||
0x300_0000_8050_0000, // MacBook Pro 2019/2018
|
0x300_0000_8050_0000, // MacBook Pro 2019/2018
|
||||||
0x200_0000_0000_0024, // MacBook Pro (13-inch, M1, 2020)
|
0x200_0000_0000_0024, // MacBook Pro (13-inch, M1, 2020)
|
||||||
0x200_0000_0000_0023 // MacBook Pro M1 13-Inch 2020 with 1tb
|
0x200_0000_0000_0023 // MacBook Pro M1 13-Inch 2020 with 1tb
|
||||||
|
// 0x300000080500000,
|
||||||
]
|
]
|
||||||
|
|
||||||
// you can get a plist `otool -s __TEXT __tpad_act_plist /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/Current/MultitouchSupport|tail -n +3|awk -F'\t' '{print $2}'|xxd -r -p`
|
// you can get a plist `otool -s __TEXT __tpad_act_plist /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/Current/MultitouchSupport|tail -n +3|awk -F'\t' '{print $2}'|xxd -r -p`
|
||||||
|
|||||||
@ -13,35 +13,21 @@ class YandexWeatherBarItem: CustomButtonTouchBarItem, CLLocationManagerDelegate
|
|||||||
private let activity: NSBackgroundActivityScheduler
|
private let activity: NSBackgroundActivityScheduler
|
||||||
private let unitsStr = "°C"
|
private let unitsStr = "°C"
|
||||||
private let iconsSource = [
|
private let iconsSource = [
|
||||||
"Ясно": "☀️",
|
"clear": "☀️",
|
||||||
"Малооблачно": "🌤",
|
"mostly-clear": "🌤",
|
||||||
"Облачно с прояснениями": "⛅️",
|
"partly-cloudy": "⛅️",
|
||||||
"Пасмурно": "☁️",
|
"overcast": "☁️",
|
||||||
"Небольшой дождь": "🌦",
|
"cloudy": "☁️",
|
||||||
"Морось": "💦",
|
"light-rain": "🌦",
|
||||||
"Дождь": "🌧",
|
"drizzle": "💦",
|
||||||
"Ливень": "⛈",
|
"rain": "🌧",
|
||||||
"Гроза": "🌩",
|
"heavy-rain": "⛈",
|
||||||
"Дождь с грозой": "⛈",
|
"storm": "🌩",
|
||||||
"Дождь со снегом": "☔️",
|
"thunderstorm-with-rain": "⛈",
|
||||||
"Небольшой снег": "❄️",
|
"sleet": "☔️",
|
||||||
"Снег": "🌨",
|
"light-snow": "❄️",
|
||||||
"Туман": "🌫",
|
"snow": "🌨",
|
||||||
|
"fog": "🌫"
|
||||||
"Clear": "☀️",
|
|
||||||
"Mostly clear": "🌤",
|
|
||||||
"Partly cloudy": "⛅️",
|
|
||||||
"Overcast": "☁️",
|
|
||||||
"Light rain": "🌦",
|
|
||||||
"Drizzle": "💦",
|
|
||||||
"Rain": "🌧",
|
|
||||||
"Heavy rain": "⛈",
|
|
||||||
"Storm": "🌩",
|
|
||||||
"Thunderstorm with rain": "⛈",
|
|
||||||
"Sleet": "☔️",
|
|
||||||
"Light snow": "❄️",
|
|
||||||
"Snow": "🌨",
|
|
||||||
"Fog": "🌫"
|
|
||||||
]
|
]
|
||||||
private var location: CLLocation!
|
private var location: CLLocation!
|
||||||
private var prevLocation: CLLocation!
|
private var prevLocation: CLLocation!
|
||||||
@ -107,7 +93,7 @@ class YandexWeatherBarItem: CustomButtonTouchBarItem, CLLocationManagerDelegate
|
|||||||
temperature = matches.first?.item(at: 1)
|
temperature = matches.first?.item(at: 1)
|
||||||
|
|
||||||
var icon: String?
|
var icon: String?
|
||||||
matches = response.matchingStrings(regex: "link__condition.*?>(.*?)<")
|
matches = response.matchingStrings(regex: "\"condition\":\"(.*?)\"")
|
||||||
icon = matches.first?.item(at: 1)
|
icon = matches.first?.item(at: 1)
|
||||||
if let _ = icon, let test = self.iconsSource[icon!] {
|
if let _ = icon, let test = self.iconsSource[icon!] {
|
||||||
icon = test
|
icon = test
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user