This commit is contained in:
Alin
2023-11-20 10:28:18 -07:00
parent 78c3a2b0cf
commit 33494e87b0
8 changed files with 94 additions and 39 deletions
+9 -5
View File
@@ -15,6 +15,7 @@ struct PearcleanerApp: App {
@AppStorage("settings.updater.updateTimeframe") private var updateTimeframe: Int = 1
@AppStorage("settings.permissions.disk") private var diskP: Bool = false
@AppStorage("settings.permissions.events") private var diskE: Bool = false
@AppStorage("settings.permissions.hasLaunched") private var hasLaunched: Bool = false
@AppStorage("displayMode") var displayMode: DisplayMode = .system
@AppStorage("settings.general.mini") private var mini: Bool = false
@State private var search = ""
@@ -53,13 +54,16 @@ struct PearcleanerApp: App {
// Make sure App Support folder exists in the future if needed for storage
ensureApplicationSupportFolderExists(appState: appState)
// Check for updates
if diskP && diskE {
// Check for updates 1 minute after app launch
if diskP {
loadGithubReleases(appState: appState)
}
// Check for disk/accessibility permissions
_ = checkAndRequestFullDiskAccess(appState: appState)
// Check for disk/accessibility permissions just once on initial app launch
if !hasLaunched {
_ = checkAndRequestFullDiskAccess(appState: appState)
hasLaunched = true
}
// TIMERS ////////////////////////////////////////////////////////////////////////////////////