From 2ef2e2f26b9c4f9bdbf22831e2ef566e1b0dabc7 Mon Sep 17 00:00:00 2001 From: junepark678 <40409848+junepark678@users.noreply.github.com> Date: Tue, 28 Nov 2023 00:44:47 +0900 Subject: [PATCH] bugfix: make it able to be toggled, fix bug in crash on installation --- AltStore/Managing Apps/AppManager.swift | 6 ++ AltStore/Operations/InstallAppOperation.swift | 3 +- AltStore/Settings/Settings.storyboard | 72 ++++++++++++++----- .../Settings/SettingsViewController.swift | 35 ++++++--- .../Extensions/UserDefaults+AltStore.swift | 2 + 5 files changed, 90 insertions(+), 28 deletions(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 05e9c8d5..97a7816a 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -948,7 +948,13 @@ private extension AppManager } else { + DispatchQueue.main.schedule { + UIApplication.shared.isIdleTimerDisabled = UserDefaults.standard.isIdleTimeoutDisableEnabled + } performAppOperations() + DispatchQueue.main.schedule { + UIApplication.shared.isIdleTimerDisabled = false + } } return group diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index 378d9a6d..e7a44c1b 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -47,7 +47,7 @@ final class InstallAppOperation: ResultOperation let backgroundContext = DatabaseManager.shared.persistentContainer.newBackgroundContext() backgroundContext.perform { - UIApplication.shared.isIdleTimerDisabled = true + /* App */ let installedApp: InstalledApp @@ -202,7 +202,6 @@ final class InstallAppOperation: ResultOperation do { try install_ipa(installedApp.bundleIdentifier) installing = false - UIApplication.shared.isIdleTimerDisabled = false installedApp.refreshedDate = Date() self.finish(.success(installedApp)) } catch let error { diff --git a/AltStore/Settings/Settings.storyboard b/AltStore/Settings/Settings.storyboard index 315b9086..6885dbe0 100644 --- a/AltStore/Settings/Settings.storyboard +++ b/AltStore/Settings/Settings.storyboard @@ -21,7 +21,7 @@