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.
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:And it works.