mirror of
https://github.com/SideStore/SideStore.git
synced 2026-04-04 01:35:39 +02:00
[debug]: enabled back appropriate preprocessor debug blocks as before wherever applicable
This commit is contained in:
@@ -82,7 +82,7 @@ class ViewController: UIViewController
|
|||||||
self.activityIndicatorView.color = .altstoreText
|
self.activityIndicatorView.color = .altstoreText
|
||||||
self.activityIndicatorView.startAnimating()
|
self.activityIndicatorView.startAnimating()
|
||||||
|
|
||||||
// TODO: @mahee96: Disabled this buttons which were present for debugging purpose.
|
// TODO: @mahee96: Disabled these backup/restore buttons in altbackup.app screen which were present for debugging purpose.
|
||||||
// Can find something useful for these later, but these are not required by this backup/restore app
|
// Can find something useful for these later, but these are not required by this backup/restore app
|
||||||
// #if DEBUG
|
// #if DEBUG
|
||||||
// let button1 = UIButton(type: .system)
|
// let button1 = UIButton(type: .system)
|
||||||
|
|||||||
@@ -294,9 +294,9 @@ extension AppDelegate
|
|||||||
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (success, error) in
|
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (success, error) in
|
||||||
}
|
}
|
||||||
|
|
||||||
// #if DEBUG
|
#if DEBUG && targetEnvironment(simulator)
|
||||||
// UIApplication.shared.registerForRemoteNotifications()
|
UIApplication.shared.registerForRemoteNotifications()
|
||||||
// #endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
|
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
|
||||||
|
|||||||
@@ -1930,11 +1930,12 @@ extension MyAppsViewController
|
|||||||
var outError: NSError? = nil
|
var outError: NSError? = nil
|
||||||
|
|
||||||
self.coordinator.coordinate(readingItemAt: backupDirectoryURL, options: [.withoutChanges], error: &outError) { (backupDirectoryURL) in
|
self.coordinator.coordinate(readingItemAt: backupDirectoryURL, options: [.withoutChanges], error: &outError) { (backupDirectoryURL) in
|
||||||
// #if DEBUG
|
|
||||||
// backupExists = true
|
#if DEBUG && targetEnvironment(simulator)
|
||||||
// #else
|
backupExists = true
|
||||||
|
#else
|
||||||
backupExists = FileManager.default.fileExists(atPath: backupDirectoryURL.path)
|
backupExists = FileManager.default.fileExists(atPath: backupDirectoryURL.path)
|
||||||
// #endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if backupExists
|
if backupExists
|
||||||
@@ -1965,13 +1966,12 @@ extension MyAppsViewController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #if DEBUG
|
#if DEBUG && targetEnvironment(simulator)
|
||||||
// if installedApp.bundleIdentifier != StoreApp.altstoreAppID
|
if installedApp.bundleIdentifier != StoreApp.altstoreAppID
|
||||||
// {
|
{
|
||||||
// actions.append(removeAction)
|
actions.append(removeAction)
|
||||||
// }
|
}
|
||||||
//
|
#else
|
||||||
// #else
|
|
||||||
|
|
||||||
if (UserDefaults.standard.legacySideloadedApps ?? []).contains(installedApp.bundleIdentifier)
|
if (UserDefaults.standard.legacySideloadedApps ?? []).contains(installedApp.bundleIdentifier)
|
||||||
{
|
{
|
||||||
@@ -1985,7 +1985,7 @@ extension MyAppsViewController
|
|||||||
actions.append(removeAction)
|
actions.append(removeAction)
|
||||||
}
|
}
|
||||||
|
|
||||||
// #endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the order of entries to make changes to how the context menu is displayed
|
// Change the order of entries to make changes to how the context menu is displayed
|
||||||
|
|||||||
@@ -715,9 +715,10 @@ private extension AuthenticationOperation
|
|||||||
// If we're not using the same certificate used to install AltStore, warn user that they need to refresh.
|
// If we're not using the same certificate used to install AltStore, warn user that they need to refresh.
|
||||||
guard !provisioningProfile.certificates.contains(signer.certificate) else { return completionHandler(false) }
|
guard !provisioningProfile.certificates.contains(signer.certificate) else { return completionHandler(false) }
|
||||||
|
|
||||||
//#if DEBUG
|
// #if DEBUG && targetEnvironment(simulator)
|
||||||
// completionHandler(false)
|
// completionHandler(false)
|
||||||
//#else
|
// #else
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
let context = AuthenticatedOperationContext(context: self.context)
|
let context = AuthenticatedOperationContext(context: self.context)
|
||||||
context.operations.removeAllObjects() // Prevent deadlock due to endless waiting on previous operations to finish.
|
context.operations.removeAllObjects() // Prevent deadlock due to endless waiting on previous operations to finish.
|
||||||
@@ -733,7 +734,7 @@ private extension AuthenticationOperation
|
|||||||
completionHandler(false)
|
completionHandler(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#endif
|
// #endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,19 +134,21 @@ extension FetchProvisioningProfilesOperation
|
|||||||
// or if installedApp.team is nil but resignedBundleIdentifier contains the team's identifier.
|
// or if installedApp.team is nil but resignedBundleIdentifier contains the team's identifier.
|
||||||
let teamsMatch = installedApp.team?.identifier == team.identifier || (installedApp.team == nil && installedApp.resignedBundleIdentifier.contains(team.identifier))
|
let teamsMatch = installedApp.team?.identifier == team.identifier || (installedApp.team == nil && installedApp.resignedBundleIdentifier.contains(team.identifier))
|
||||||
|
|
||||||
// #if DEBUG
|
// TODO: @mahee96: Try to keep the debug build and release build operations similar, refactor later with proper reasoning
|
||||||
//
|
// for now, restricted it to debug on simulator only
|
||||||
// if app.isAltStoreApp
|
#if DEBUG && targetEnvironment(simulator)
|
||||||
// {
|
|
||||||
// // Use legacy bundle ID format for AltStore.
|
if app.isAltStoreApp
|
||||||
// preferredBundleID = teamsMatch ? installedApp.resignedBundleIdentifier : nil
|
{
|
||||||
// }
|
// Use legacy bundle ID format for AltStore.
|
||||||
// else
|
preferredBundleID = teamsMatch ? installedApp.resignedBundleIdentifier : nil
|
||||||
// {
|
}
|
||||||
// preferredBundleID = teamsMatch ? installedApp.resignedBundleIdentifier : nil
|
else
|
||||||
// }
|
{
|
||||||
//
|
preferredBundleID = teamsMatch ? installedApp.resignedBundleIdentifier : nil
|
||||||
// #else
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
if teamsMatch
|
if teamsMatch
|
||||||
{
|
{
|
||||||
@@ -160,7 +162,7 @@ extension FetchProvisioningProfilesOperation
|
|||||||
preferredBundleID = nil
|
preferredBundleID = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// #endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ final class RemoveAppBackupOperation: ResultOperation<Void>
|
|||||||
}
|
}
|
||||||
catch let error as CocoaError where error.code == CocoaError.Code.fileNoSuchFile
|
catch let error as CocoaError where error.code == CocoaError.Code.fileNoSuchFile
|
||||||
{
|
{
|
||||||
|
// TODO: @mahee96: Find out why should in debug builds the app-groups is not expected to match
|
||||||
// #if DEBUG
|
// #if DEBUG
|
||||||
//
|
//
|
||||||
// // When debugging, it's expected that app groups don't match, so ignore.
|
// // When debugging, it's expected that app groups don't match, so ignore.
|
||||||
|
|||||||
@@ -244,13 +244,14 @@ private extension ResignAppOperation
|
|||||||
{
|
{
|
||||||
for case let fileURL as URL in enumerator
|
for case let fileURL as URL in enumerator
|
||||||
{
|
{
|
||||||
// #if DEBUG
|
// for both sim and device, in debug mode builds, remove the tests bundles (if any)
|
||||||
// guard !fileURL.lastPathComponent.lowercased().contains(".xctest") else {
|
#if DEBUG
|
||||||
// // Remove embedded XCTest (+ dSYM) bundle from copied app bundle.
|
guard !fileURL.lastPathComponent.lowercased().contains(".xctest") else {
|
||||||
// try FileManager.default.removeItem(at: fileURL)
|
// Remove embedded XCTest (+ dSYM) bundle from copied app bundle.
|
||||||
// continue
|
try FileManager.default.removeItem(at: fileURL)
|
||||||
// }
|
continue
|
||||||
// #endif
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
guard let appExtension = Bundle(url: fileURL) else { throw ALTError(.missingAppBundle) }
|
guard let appExtension = Bundle(url: fileURL) else { throw ALTError(.missingAppBundle) }
|
||||||
try prepare(appExtension)
|
try prepare(appExtension)
|
||||||
|
|||||||
@@ -318,11 +318,12 @@ extension PatreonViewController
|
|||||||
case .none: footerView.button.isIndicatingActivity = true
|
case .none: footerView.button.isIndicatingActivity = true
|
||||||
case .success?: footerView.button.isHidden = true
|
case .success?: footerView.button.isHidden = true
|
||||||
case .failure?:
|
case .failure?:
|
||||||
// #if DEBUG
|
// In simulator debug builds only enable debug mode flag
|
||||||
// let debug = true
|
#if DEBUG && targetEnvironment(simulator)
|
||||||
// #else
|
let debug = true
|
||||||
|
#else
|
||||||
let debug = false
|
let debug = false
|
||||||
// #endif
|
#endif
|
||||||
|
|
||||||
if self.patronsDataSource.itemCount == 0 || debug
|
if self.patronsDataSource.itemCount == 0 || debug
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ public extension UserDefaults
|
|||||||
(ProcessInfo.processInfo.isOperatingSystemAtLeast(ios14) && !ProcessInfo.processInfo.isOperatingSystemAtLeast(ios15_7_2)) ||
|
(ProcessInfo.processInfo.isOperatingSystemAtLeast(ios14) && !ProcessInfo.processInfo.isOperatingSystemAtLeast(ios15_7_2)) ||
|
||||||
(ProcessInfo.processInfo.isOperatingSystemAtLeast(ios16) && !ProcessInfo.processInfo.isOperatingSystemAtLeast(ios16_2))
|
(ProcessInfo.processInfo.isOperatingSystemAtLeast(ios16) && !ProcessInfo.processInfo.isOperatingSystemAtLeast(ios16_2))
|
||||||
|
|
||||||
|
// TODO: @mahee96: why should the permissions checking be any different, for now, it shouldn't so commented debug mode code
|
||||||
// #if DEBUG
|
// #if DEBUG
|
||||||
// let permissionCheckingDisabled = true
|
// let permissionCheckingDisabled = true
|
||||||
// #else
|
// #else
|
||||||
|
|||||||
@@ -87,21 +87,22 @@ public extension DatabaseManager
|
|||||||
|
|
||||||
guard !self.isStarted else { return finish(nil) }
|
guard !self.isStarted else { return finish(nil) }
|
||||||
|
|
||||||
// #if DEBUG
|
// In simulator, when previews are generated, it initializes the db, in doing so this removal may be required
|
||||||
// // Wrap in #if DEBUG to *ensure* we never accidentally delete production databases.
|
#if DEBUG && targetEnvironment(simulator)
|
||||||
// if ProcessInfo.processInfo.isPreview
|
// Wrap in #if DEBUG to *ensure* we never accidentally delete production databases.
|
||||||
// {
|
if ProcessInfo.processInfo.isPreview
|
||||||
// do
|
{
|
||||||
// {
|
do
|
||||||
// print("!!! Purging database for preview...")
|
{
|
||||||
// try FileManager.default.removeItem(at: PersistentContainer.defaultDirectoryURL())
|
print("!!! Purging database for preview...")
|
||||||
// }
|
try FileManager.default.removeItem(at: PersistentContainer.defaultDirectoryURL())
|
||||||
// catch
|
}
|
||||||
// {
|
catch
|
||||||
// print("Failed to remove database directory for preview.", error)
|
{
|
||||||
// }
|
print("Failed to remove database directory for preview.", error)
|
||||||
// }
|
}
|
||||||
// #endif
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if self.persistentContainer.isMigrationRequired
|
if self.persistentContainer.isMigrationRequired
|
||||||
{
|
{
|
||||||
@@ -354,11 +355,12 @@ private extension DatabaseManager
|
|||||||
|
|
||||||
let fileURL = installedApp.fileURL
|
let fileURL = installedApp.fileURL
|
||||||
|
|
||||||
// #if DEBUG
|
// @mahee96: it shouldn't matter if it is debug/release, the file is expected to be in its place (except for simulator probably coz it doesn't suppor app installs anyway)
|
||||||
// let replaceCachedApp = true
|
#if DEBUG && targetEnvironment(simulator)
|
||||||
// #else
|
let replaceCachedApp = true
|
||||||
|
#else
|
||||||
let replaceCachedApp = !FileManager.default.fileExists(atPath: fileURL.path) || installedApp.version != localApp.version || installedApp.buildVersion != localApp.buildVersion
|
let replaceCachedApp = !FileManager.default.fileExists(atPath: fileURL.path) || installedApp.version != localApp.version || installedApp.buildVersion != localApp.buildVersion
|
||||||
// #endif
|
#endif
|
||||||
|
|
||||||
if replaceCachedApp
|
if replaceCachedApp
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user