Skip to content

Commit

Permalink
Allow users to refresh data through commands (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
robbevp authored May 14, 2023
1 parent 3db0446 commit 958c639
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions accentor/accentorApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,17 @@ struct accentorApp: App {
ContentView()
.environment(\.managedObjectContext, persistenceController.container.viewContext)
}
.commands {
CommandMenu("Data") {
Button(action: {
AlbumService.shared.index(context: persistenceController.container.viewContext)
ArtistService.shared.index(context: persistenceController.container.viewContext)
TrackService.shared.index(context: persistenceController.container.viewContext)
UserDefaults.standard.set(Date().timeIntervalSince1970, forKey: "last_sync_finished")
}, label: {
Text("Refresh")
})
}
}
}
}

0 comments on commit 958c639

Please sign in to comment.