change wallpaper failed in macos 10.14
xmsec opened this issue · comments
xmsec commented
When launch the first time, it may download last day pic without current one (Maybe download with error). So I could not click the left or right buttons to change wallpaper.
in StatusBarViewController.swift
, I modified the function jumpToToday as follow:
func jumpToToday() {
DispatchQueue.global().async {
self.todayButton.isEnabled = false
self.todayButton.title = NSLocalizedString("Fetching...", comment: "N/A")
if let currentRegion = SharedPreferences.string(forKey: SharedPreferences.Key.CurrentSelectedBingRegion) {
self.bingPictureManager.fetchLastWallpaper(atRegin: currentRegion)
}
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
var validDate = Date()
if self.jumpToDate(formatter.string(from: validDate)) == false {
let lastTime: TimeInterval = -(24*60*60)
validDate = validDate.addingTimeInterval(lastTime)
let _ = self.jumpToDate(formatter.string(from: validDate))
}
self.todayButton.isEnabled = true
self.todayButton.title = NSLocalizedString("Today !", comment: "N/A")
}
}
And it works.
Jingwen Peng commented
Hi, this issue was fixed, thanks for your feedback.