Skip to content

change wallpaper failed in macos 10.14 #2

@xmsec

Description

@xmsec

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions