fix sboard errors, and notification retain error

This commit is contained in:
Joe Mattiello
2023-03-02 01:49:38 -05:00
parent 478b30c8fd
commit 10f5ee1548
5 changed files with 33 additions and 14 deletions

View File

@@ -592,7 +592,7 @@ World</string>
<!--Browse-->
<scene sceneID="VHa-uP-bFU">
<objects>
<navigationController storyboardIdentifier="forwardingNavigationController" automaticallyAdjustsScrollViewInsets="NO" id="faz-B4-Sub" customClass="ForwardingNavigationController" customModule="SideStoreAppKit" sceneMemberID="viewController">
<navigationController storyboardIdentifier="forwardingNavigationControllerBrowse" automaticallyAdjustsScrollViewInsets="NO" useStoryboardIdentifierAsRestorationIdentifier="YES" id="faz-B4-Sub" customClass="ForwardingNavigationController" customModule="SideStoreAppKit" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Browse" image="Browse" id="Uwh-Bg-Ymq"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="dIv-qd-9L5" customClass="NavigationBar" customModule="SideStore" customModuleProvider="target">
@@ -620,7 +620,7 @@ World</string>
<!--My Apps-->
<scene sceneID="nhh-BJ-XiT">
<objects>
<navigationController storyboardIdentifier="forwardingNavigationController" automaticallyAdjustsScrollViewInsets="NO" useStoryboardIdentifierAsRestorationIdentifier="YES" id="3Ew-ox-i4n" customClass="ForwardingNavigationController" customModule="SideStoreAppKit" sceneMemberID="viewController">
<navigationController storyboardIdentifier="forwardingNavigationControllerNyApps" automaticallyAdjustsScrollViewInsets="NO" useStoryboardIdentifierAsRestorationIdentifier="YES" id="3Ew-ox-i4n" customClass="ForwardingNavigationController" customModule="SideStoreAppKit" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="My Apps" image="MyApps" id="4gT-9u-k7y">
<color key="badgeColor" name="Primary"/>
</tabBarItem>
@@ -905,7 +905,7 @@ World</string>
<!--News-->
<scene sceneID="BV8-6J-nIv">
<objects>
<navigationController storyboardIdentifier="forwardingNavigationController" automaticallyAdjustsScrollViewInsets="NO" useStoryboardIdentifierAsRestorationIdentifier="YES" id="kjR-gi-fgT" customClass="ForwardingNavigationController" customModule="SideStoreAppKit" sceneMemberID="viewController">
<navigationController storyboardIdentifier="forwardingNavigationControllerNews" automaticallyAdjustsScrollViewInsets="NO" useStoryboardIdentifierAsRestorationIdentifier="YES" id="kjR-gi-fgT" customClass="ForwardingNavigationController" customModule="SideStoreAppKit" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="News" image="News" id="fVN-ed-uO1"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="525-jF-uDK" customClass="NavigationBar" customModule="SideStore" customModuleProvider="target">

View File

@@ -12,7 +12,7 @@
<!--Navigation Controller-->
<scene sceneID="dx2-fp-qDX">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" useStoryboardIdentifierAsRestorationIdentifier="YES" id="WBb-E1-bN8" sceneMemberID="viewController">
<navigationController storyboardIdentifier="navigationController" automaticallyAdjustsScrollViewInsets="NO" useStoryboardIdentifierAsRestorationIdentifier="YES" id="WBb-E1-bN8" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" barStyle="black" id="cVa-8m-fW6" customClass="NavigationBar" customModule="SideStore" customModuleProvider="target">
<rect key="frame" x="0.0" y="48" width="414" height="44"/>

View File

@@ -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,

View File

@@ -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<Void> {
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<Void> {
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<Void, Error> ?? .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
}
}
}

View File

@@ -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))
}