diff --git a/SideStoreApp/Sources/SideStore/Resources/Base.lproj/Main.storyboard b/SideStoreApp/Sources/SideStore/Resources/Base.lproj/Main.storyboard index 4afe9371..2fa4d3c1 100644 --- a/SideStoreApp/Sources/SideStore/Resources/Base.lproj/Main.storyboard +++ b/SideStoreApp/Sources/SideStore/Resources/Base.lproj/Main.storyboard @@ -592,7 +592,7 @@ World - + @@ -620,7 +620,7 @@ World - + @@ -905,7 +905,7 @@ World - + diff --git a/SideStoreApp/Sources/SideStore/Resources/Storyboards/PatchApp.storyboard b/SideStoreApp/Sources/SideStore/Resources/Storyboards/PatchApp.storyboard index 18d42bb3..1250d647 100644 --- a/SideStoreApp/Sources/SideStore/Resources/Storyboards/PatchApp.storyboard +++ b/SideStoreApp/Sources/SideStore/Resources/Storyboards/PatchApp.storyboard @@ -12,7 +12,7 @@ - + diff --git a/SideStoreApp/Sources/SideStoreAppKit/Operations/BackgroundRefreshAppsOperation.swift b/SideStoreApp/Sources/SideStoreAppKit/Operations/BackgroundRefreshAppsOperation.swift index 9b33e067..c6d3ae2d 100644 --- a/SideStoreApp/Sources/SideStoreAppKit/Operations/BackgroundRefreshAppsOperation.swift +++ b/SideStoreApp/Sources/SideStoreAppKit/Operations/BackgroundRefreshAppsOperation.swift @@ -100,7 +100,10 @@ public final class BackgroundRefreshAppsOperation: ResultOperation<[String: Resu let group = AppManager.shared.refresh(filteredApps, presentingViewController: nil) group.beginInstallationHandler = { installedApp in - guard installedApp.bundleIdentifier == StoreApp.altstoreAppID else { return } + guard installedApp.bundleIdentifier == StoreApp.altstoreAppID else { + os_log("Skipping app with bundleID == `altstoreAppID` : %@", type: .debug, StoreApp.altstoreAppID) + return + } // We're starting to install AltStore, which means the app is about to quit. // So, we schedule a "refresh successful" local notification to be displayed after a delay, diff --git a/SideStoreApp/Sources/SideStoreAppKit/Operations/BackupAppOperation.swift b/SideStoreApp/Sources/SideStoreAppKit/Operations/BackupAppOperation.swift index 21ddf928..b5296dd8 100644 --- a/SideStoreApp/Sources/SideStoreAppKit/Operations/BackupAppOperation.swift +++ b/SideStoreApp/Sources/SideStoreAppKit/Operations/BackupAppOperation.swift @@ -10,6 +10,7 @@ import Foundation import AltSign import SideStoreCore +import os.log extension BackupAppOperation { enum Action: String { @@ -26,6 +27,9 @@ class BackupAppOperation: ResultOperation { private var appName: String? private var timeoutTimer: Timer? + private var applicationWillReturnObserver: NSObjectProtocol? + private var backupResponseObserver: NSObjectProtocol? + init(action: Action, context: InstallAppOperationContext) { self.action = action self.context = context @@ -128,9 +132,11 @@ class BackupAppOperation: ResultOperation { private extension BackupAppOperation { func registerObservers() { - var applicationWillReturnObserver: NSObjectProtocol! applicationWillReturnObserver = NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: .main) { [weak self] _ in - guard let self = self, !self.isFinished else { return } + guard let self = self, !self.isFinished else { + os_log("nil self", type: .error) + return + } self.timeoutTimer = Timer.scheduledTimer(withTimeInterval: 5, repeats: false) { [weak self] _ in // Final delay to ensure we don't prematurely return failure @@ -142,17 +148,27 @@ private extension BackupAppOperation { } } - NotificationCenter.default.removeObserver(applicationWillReturnObserver!) + if let applicationWillReturnObserver = self.applicationWillReturnObserver { + NotificationCenter.default.removeObserver(applicationWillReturnObserver) + } + self.applicationWillReturnObserver = nil } - var backupResponseObserver: NSObjectProtocol! - backupResponseObserver = NotificationCenter.default.addObserver(forName: SideStoreAppDelegate.appBackupDidFinish, object: nil, queue: nil) { [weak self] notification in - self?.timeoutTimer?.invalidate() + backupResponseObserver = NotificationCenter.default.addObserver(forName: SideStoreAppDelegate.appBackupDidFinish, object: nil, queue: nil) { [weak self] notification in + guard let self = self else { + os_log("nil self", type: .error) + return + } + + self.timeoutTimer?.invalidate() let result = notification.userInfo?[SideStoreAppDelegate.appBackupResultKey] as? Result ?? .failure(OperationError.unknownResult) - self?.finish(result) + self.finish(result) - NotificationCenter.default.removeObserver(backupResponseObserver!) + if let backupResponseObserver = self.backupResponseObserver { + NotificationCenter.default.removeObserver(backupResponseObserver) + } + self.backupResponseObserver = nil } } } diff --git a/SideStoreApp/Sources/SideStoreAppKit/Sources/SourcesViewController.swift b/SideStoreApp/Sources/SideStoreAppKit/Sources/SourcesViewController.swift index d15e1df3..cfc79723 100644 --- a/SideStoreApp/Sources/SideStoreAppKit/Sources/SourcesViewController.swift +++ b/SideStoreApp/Sources/SideStoreAppKit/Sources/SourcesViewController.swift @@ -336,7 +336,7 @@ private extension SourcesViewController { dispatchGroup.notify(queue: .main) { if let error = fetchError { - print(error) + os_log("fetch error: %@", type: .error, error.localizedErrorCode) // 1 error doesn't mean all trusted sources failed to load! Riley, why did you do this??????? // finish(.failure(error)) }