diff --git a/Package.swift b/Package.swift index 3e99be57..7472feda 100644 --- a/Package.swift +++ b/Package.swift @@ -72,6 +72,7 @@ let package = Package( .executableTarget( name: "SideStore", dependencies: [ + "SideStoreAppKit", "SidePatcher", "EmotionalDamage", "MiniMuxerSwift", @@ -83,7 +84,6 @@ let package = Package( "SideKit", "KeychainAccess", "SemanticVersion", -// .product(name: "CrashReporter", package: "PLCrashReporter"), .product(name: "libimobiledevice", package: "iMobileDevice.swift"), .product(name: "Roxas", package: "Roxas"), .product(name: "RoxasUI", package: "Roxas"), @@ -166,6 +166,10 @@ let package = Package( .linkedFramework("UserNotifications", .when(platforms: [.iOS, .macCatalyst])), .linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .macCatalyst])), .linkedLibrary("AppleArchive") + ], + plugins: [ + .plugin(name: "IntentBuilderPlugin", package: "SwiftPMPlugins"), + .plugin(name: "LoggerPlugin", package: "SwiftPMPlugins") ] ), diff --git a/Sources/SideStore/AppDelegate.swift b/Sources/SideStore/AppDelegate.swift index 2fd165a4..0aad8000 100644 --- a/Sources/SideStore/AppDelegate.swift +++ b/Sources/SideStore/AppDelegate.swift @@ -13,23 +13,12 @@ import UserNotifications import AltSign import SideStoreCore +import SideStoreAppKit import EmotionalDamage import RoxasUIKit -extension AppDelegate { - static let openPatreonSettingsDeepLinkNotification = Notification.Name(Bundle.Info.appbundleIdentifier + ".OpenPatreonSettingsDeepLinkNotification") - static let importAppDeepLinkNotification = Notification.Name(Bundle.Info.appbundleIdentifier + ".ImportAppDeepLinkNotification") - static let addSourceDeepLinkNotification = Notification.Name(Bundle.Info.appbundleIdentifier + ".AddSourceDeepLinkNotification") - - static let appBackupDidFinish = Notification.Name(Bundle.Info.appbundleIdentifier + ".AppBackupDidFinish") - - static let importAppDeepLinkURLKey = "fileURL" - static let appBackupResultKey = "result" - static let addSourceDeepLinkURLKey = "sourceURL" -} - @UIApplicationMain -final class AppDelegate: UIResponder, UIApplicationDelegate { +final class AppDelegate: SideStoreAppDelegate { var window: UIWindow? @available(iOS 14, *) diff --git a/Sources/SideStore/Consts/Consts+Proxy.swift b/Sources/SideStore/Consts/Consts+Proxy.swift deleted file mode 100644 index 318344b0..00000000 --- a/Sources/SideStore/Consts/Consts+Proxy.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// Proxy.swift -// SideStore -// -// Created by Joseph Mattiello on 11/7/22. -// Copyright © 2022 Riley Testut. All rights reserved. -// - -import Foundation - -public extension Consts { - enum Proxy { - static let address = "127.0.0.1" - static let port = "51820" - static let serverURL = "\(address):\(port)" - } -} diff --git a/Sources/SideStore/LaunchViewController.swift b/Sources/SideStore/LaunchViewController.swift index 918a6a4b..81dca647 100644 --- a/Sources/SideStore/LaunchViewController.swift +++ b/Sources/SideStore/LaunchViewController.swift @@ -9,6 +9,7 @@ import EmotionalDamage import minimuxer import MiniMuxerSwift +import SideStoreAppKit import RoxasUIKit import UIKit diff --git a/Sources/SideStore/SceneDelegate.swift b/Sources/SideStore/SceneDelegate.swift index 18ac10fb..c10529b6 100644 --- a/Sources/SideStore/SceneDelegate.swift +++ b/Sources/SideStore/SceneDelegate.swift @@ -8,6 +8,7 @@ import SideStoreCore import EmotionalDamage +import SideStoreAppKit import UIKit @available(iOS 13, *) diff --git a/Sources/SideStore/ALTApplication+AltStoreApp.swift b/Sources/SideStoreAppKit/ALTApplication+AltStoreApp.swift similarity index 100% rename from Sources/SideStore/ALTApplication+AltStoreApp.swift rename to Sources/SideStoreAppKit/ALTApplication+AltStoreApp.swift diff --git a/Sources/SideStore/Analytics/AnalyticsManager.swift b/Sources/SideStoreAppKit/Analytics/AnalyticsManager.swift similarity index 90% rename from Sources/SideStore/Analytics/AnalyticsManager.swift rename to Sources/SideStoreAppKit/Analytics/AnalyticsManager.swift index f7b8bf0e..df0454a5 100644 --- a/Sources/SideStore/Analytics/AnalyticsManager.swift +++ b/Sources/SideStoreAppKit/Analytics/AnalyticsManager.swift @@ -16,7 +16,7 @@ import AppCenterCrashes private let appCenterAppSecret = "73532d3e-e573-4693-99a4-9f85840bbb44" -extension AnalyticsManager { +public extension AnalyticsManager { enum EventProperty: String { case name case bundleIdentifier @@ -33,7 +33,7 @@ extension AnalyticsManager { case updatedApp(InstalledApp) case refreshedApp(InstalledApp) - var name: String { + public var name: String { switch self { case .installedApp: return "installed_app" case .updatedApp: return "updated_app" @@ -41,7 +41,7 @@ extension AnalyticsManager { } } - var properties: [EventProperty: String] { + public var properties: [EventProperty: String] { let properties: [EventProperty: String?] switch self { @@ -66,13 +66,13 @@ extension AnalyticsManager { } } -final class AnalyticsManager { - static let shared = AnalyticsManager() +public final class AnalyticsManager { + public static let shared = AnalyticsManager() private init() {} } -extension AnalyticsManager { +public extension AnalyticsManager { func start() { AppCenter.start(withAppSecret: appCenterAppSecret, services: [ Analytics.self, diff --git a/Sources/SideStore/App Detail/AppContentViewController.swift b/Sources/SideStoreAppKit/App Detail/AppContentViewController.swift similarity index 100% rename from Sources/SideStore/App Detail/AppContentViewController.swift rename to Sources/SideStoreAppKit/App Detail/AppContentViewController.swift diff --git a/Sources/SideStore/App Detail/AppContentViewControllerCells.swift b/Sources/SideStoreAppKit/App Detail/AppContentViewControllerCells.swift similarity index 100% rename from Sources/SideStore/App Detail/AppContentViewControllerCells.swift rename to Sources/SideStoreAppKit/App Detail/AppContentViewControllerCells.swift diff --git a/Sources/SideStore/App Detail/AppViewController.swift b/Sources/SideStoreAppKit/App Detail/AppViewController.swift similarity index 100% rename from Sources/SideStore/App Detail/AppViewController.swift rename to Sources/SideStoreAppKit/App Detail/AppViewController.swift diff --git a/Sources/SideStore/App Detail/PermissionPopoverViewController.swift b/Sources/SideStoreAppKit/App Detail/PermissionPopoverViewController.swift similarity index 100% rename from Sources/SideStore/App Detail/PermissionPopoverViewController.swift rename to Sources/SideStoreAppKit/App Detail/PermissionPopoverViewController.swift diff --git a/Sources/SideStore/App IDs/AppIDsViewController.swift b/Sources/SideStoreAppKit/App IDs/AppIDsViewController.swift similarity index 100% rename from Sources/SideStore/App IDs/AppIDsViewController.swift rename to Sources/SideStoreAppKit/App IDs/AppIDsViewController.swift diff --git a/Sources/SideStore/Authentication/AuthenticationViewController.swift b/Sources/SideStoreAppKit/Authentication/AuthenticationViewController.swift similarity index 100% rename from Sources/SideStore/Authentication/AuthenticationViewController.swift rename to Sources/SideStoreAppKit/Authentication/AuthenticationViewController.swift diff --git a/Sources/SideStore/Authentication/InstructionsViewController.swift b/Sources/SideStoreAppKit/Authentication/InstructionsViewController.swift similarity index 100% rename from Sources/SideStore/Authentication/InstructionsViewController.swift rename to Sources/SideStoreAppKit/Authentication/InstructionsViewController.swift diff --git a/Sources/SideStore/Authentication/Intents/IntentHandler.swift b/Sources/SideStoreAppKit/Authentication/Intents/IntentHandler.swift similarity index 94% rename from Sources/SideStore/Authentication/Intents/IntentHandler.swift rename to Sources/SideStoreAppKit/Authentication/Intents/IntentHandler.swift index ca86eec1..3e1d1398 100644 --- a/Sources/SideStore/Authentication/Intents/IntentHandler.swift +++ b/Sources/SideStoreAppKit/Authentication/Intents/IntentHandler.swift @@ -11,7 +11,7 @@ import SideStoreCore import Intents @available(iOS 14, *) -final class IntentHandler: NSObject, RefreshAllIntentHandling { +public final class IntentHandler: NSObject, RefreshAllIntentHandling { private let queue = DispatchQueue(label: "io.altstore.IntentHandler") private var completionHandlers = [RefreshAllIntent: (RefreshAllIntentResponse) -> Void]() @@ -19,7 +19,7 @@ final class IntentHandler: NSObject, RefreshAllIntentHandling { private var operations = [RefreshAllIntent: BackgroundRefreshAppsOperation]() - func confirm(intent: RefreshAllIntent, completion: @escaping (RefreshAllIntentResponse) -> Void) { + public func confirm(intent: RefreshAllIntent, completion: @escaping (RefreshAllIntentResponse) -> Void) { // Refreshing apps usually, but not always, completes within alotted time. // As a workaround, we'll start refreshing apps in confirm() so we can // take advantage of some extra time before starting handle() timeout timer. @@ -53,7 +53,7 @@ final class IntentHandler: NSObject, RefreshAllIntentHandling { } } - func handle(intent: RefreshAllIntent, completion: @escaping (RefreshAllIntentResponse) -> Void) { + public func handle(intent: RefreshAllIntent, completion: @escaping (RefreshAllIntentResponse) -> Void) { completionHandlers[intent] = { response in // Ignore .ready response from confirm() timeout. guard response.code != .ready else { return } diff --git a/Sources/SideStore/Authentication/Intents/Intents.intentdefinition b/Sources/SideStoreAppKit/Authentication/Intents/Intents.intentdefinition similarity index 100% rename from Sources/SideStore/Authentication/Intents/Intents.intentdefinition rename to Sources/SideStoreAppKit/Authentication/Intents/Intents.intentdefinition diff --git a/Sources/SideStore/Authentication/Intents/ViewApp.intentdefinition b/Sources/SideStoreAppKit/Authentication/Intents/ViewApp.intentdefinition similarity index 100% rename from Sources/SideStore/Authentication/Intents/ViewApp.intentdefinition rename to Sources/SideStoreAppKit/Authentication/Intents/ViewApp.intentdefinition diff --git a/Sources/SideStore/Authentication/Intents/ViewAppIntentHandler.swift b/Sources/SideStoreAppKit/Authentication/Intents/ViewAppIntentHandler.swift similarity index 100% rename from Sources/SideStore/Authentication/Intents/ViewAppIntentHandler.swift rename to Sources/SideStoreAppKit/Authentication/Intents/ViewAppIntentHandler.swift diff --git a/Sources/SideStore/Authentication/RefreshAltStoreViewController.swift b/Sources/SideStoreAppKit/Authentication/RefreshAltStoreViewController.swift similarity index 100% rename from Sources/SideStore/Authentication/RefreshAltStoreViewController.swift rename to Sources/SideStoreAppKit/Authentication/RefreshAltStoreViewController.swift diff --git a/Sources/SideStore/Authentication/SelectTeamViewController.swift b/Sources/SideStoreAppKit/Authentication/SelectTeamViewController.swift similarity index 100% rename from Sources/SideStore/Authentication/SelectTeamViewController.swift rename to Sources/SideStoreAppKit/Authentication/SelectTeamViewController.swift diff --git a/Sources/SideStore/Browse/BrowseCollectionViewCell.swift b/Sources/SideStoreAppKit/Browse/BrowseCollectionViewCell.swift similarity index 100% rename from Sources/SideStore/Browse/BrowseCollectionViewCell.swift rename to Sources/SideStoreAppKit/Browse/BrowseCollectionViewCell.swift diff --git a/Sources/SideStore/Browse/BrowseViewController.swift b/Sources/SideStoreAppKit/Browse/BrowseViewController.swift similarity index 100% rename from Sources/SideStore/Browse/BrowseViewController.swift rename to Sources/SideStoreAppKit/Browse/BrowseViewController.swift diff --git a/Sources/SideStore/Browse/ScreenshotCollectionViewCell.swift b/Sources/SideStoreAppKit/Browse/ScreenshotCollectionViewCell.swift similarity index 100% rename from Sources/SideStore/Browse/ScreenshotCollectionViewCell.swift rename to Sources/SideStoreAppKit/Browse/ScreenshotCollectionViewCell.swift diff --git a/Sources/SideStore/Components/AppBannerView.swift b/Sources/SideStoreAppKit/Components/AppBannerView.swift similarity index 100% rename from Sources/SideStore/Components/AppBannerView.swift rename to Sources/SideStoreAppKit/Components/AppBannerView.swift diff --git a/Sources/SideStore/Components/AppIconImageView.swift b/Sources/SideStoreAppKit/Components/AppIconImageView.swift similarity index 100% rename from Sources/SideStore/Components/AppIconImageView.swift rename to Sources/SideStoreAppKit/Components/AppIconImageView.swift diff --git a/Sources/SideStore/Components/BackgroundTaskManager.swift b/Sources/SideStoreAppKit/Components/BackgroundTaskManager.swift similarity index 94% rename from Sources/SideStore/Components/BackgroundTaskManager.swift rename to Sources/SideStoreAppKit/Components/BackgroundTaskManager.swift index 84b7bac3..b2d224d1 100644 --- a/Sources/SideStore/Components/BackgroundTaskManager.swift +++ b/Sources/SideStoreAppKit/Components/BackgroundTaskManager.swift @@ -8,8 +8,8 @@ import AVFoundation -final class BackgroundTaskManager { - static let shared = BackgroundTaskManager() +public final class BackgroundTaskManager { + public static let shared = BackgroundTaskManager() private var isPlaying = false @@ -39,7 +39,7 @@ final class BackgroundTaskManager { } } -extension BackgroundTaskManager { +public extension BackgroundTaskManager { func performExtendedBackgroundTask(taskHandler: @escaping ((Result, @escaping () -> Void) -> Void)) { func finish() { player.stop() diff --git a/Sources/SideStore/Components/BannerCollectionViewCell.swift b/Sources/SideStoreAppKit/Components/BannerCollectionViewCell.swift similarity index 100% rename from Sources/SideStore/Components/BannerCollectionViewCell.swift rename to Sources/SideStoreAppKit/Components/BannerCollectionViewCell.swift diff --git a/Sources/SideStore/Components/Button.swift b/Sources/SideStoreAppKit/Components/Button.swift similarity index 100% rename from Sources/SideStore/Components/Button.swift rename to Sources/SideStoreAppKit/Components/Button.swift diff --git a/Sources/SideStore/Components/CollapsingTextView.swift b/Sources/SideStoreAppKit/Components/CollapsingTextView.swift similarity index 100% rename from Sources/SideStore/Components/CollapsingTextView.swift rename to Sources/SideStoreAppKit/Components/CollapsingTextView.swift diff --git a/Sources/SideStore/Components/ForwardingNavigationController.swift b/Sources/SideStoreAppKit/Components/ForwardingNavigationController.swift similarity index 100% rename from Sources/SideStore/Components/ForwardingNavigationController.swift rename to Sources/SideStoreAppKit/Components/ForwardingNavigationController.swift diff --git a/Sources/SideStore/Components/NavigationBar.swift b/Sources/SideStoreAppKit/Components/NavigationBar.swift similarity index 100% rename from Sources/SideStore/Components/NavigationBar.swift rename to Sources/SideStoreAppKit/Components/NavigationBar.swift diff --git a/Sources/SideStore/Components/PillButton.swift b/Sources/SideStoreAppKit/Components/PillButton.swift similarity index 100% rename from Sources/SideStore/Components/PillButton.swift rename to Sources/SideStoreAppKit/Components/PillButton.swift diff --git a/Sources/SideStore/Components/TextCollectionReusableView.swift b/Sources/SideStoreAppKit/Components/TextCollectionReusableView.swift similarity index 100% rename from Sources/SideStore/Components/TextCollectionReusableView.swift rename to Sources/SideStoreAppKit/Components/TextCollectionReusableView.swift diff --git a/Sources/SideStore/Components/ToastView.swift b/Sources/SideStoreAppKit/Components/ToastView.swift similarity index 100% rename from Sources/SideStore/Components/ToastView.swift rename to Sources/SideStoreAppKit/Components/ToastView.swift diff --git a/Sources/SideStoreAppKit/Consts/Consts+Proxy.swift b/Sources/SideStoreAppKit/Consts/Consts+Proxy.swift new file mode 100644 index 00000000..aaffe4cb --- /dev/null +++ b/Sources/SideStoreAppKit/Consts/Consts+Proxy.swift @@ -0,0 +1,17 @@ +// +// Proxy.swift +// SideStore +// +// Created by Joseph Mattiello on 11/7/22. +// Copyright © 2022 Joseph Mattiello. All rights reserved. +// + +import Foundation + +public extension Consts { + enum Proxy { + public static let address = "127.0.0.1" + public static let port = "51820" + public static let serverURL = "\(address):\(port)" + } +} diff --git a/Sources/SideStore/Consts/Consts.swift b/Sources/SideStoreAppKit/Consts/Consts.swift similarity index 100% rename from Sources/SideStore/Consts/Consts.swift rename to Sources/SideStoreAppKit/Consts/Consts.swift diff --git a/Sources/SideStore/Extensions/FileManager+DirectorySize.swift b/Sources/SideStoreAppKit/Extensions/FileManager+DirectorySize.swift similarity index 100% rename from Sources/SideStore/Extensions/FileManager+DirectorySize.swift rename to Sources/SideStoreAppKit/Extensions/FileManager+DirectorySize.swift diff --git a/Sources/SideStore/Extensions/INInteraction+AltStore.swift b/Sources/SideStoreAppKit/Extensions/INInteraction+AltStore.swift similarity index 100% rename from Sources/SideStore/Extensions/INInteraction+AltStore.swift rename to Sources/SideStoreAppKit/Extensions/INInteraction+AltStore.swift diff --git a/Sources/SideStore/Extensions/OSLog+SideStore.swift b/Sources/SideStoreAppKit/Extensions/OSLog+SideStore.swift similarity index 100% rename from Sources/SideStore/Extensions/OSLog+SideStore.swift rename to Sources/SideStoreAppKit/Extensions/OSLog+SideStore.swift diff --git a/Sources/SideStore/Extensions/UIDevice+Jailbreak.swift b/Sources/SideStoreAppKit/Extensions/UIDevice+Jailbreak.swift similarity index 100% rename from Sources/SideStore/Extensions/UIDevice+Jailbreak.swift rename to Sources/SideStoreAppKit/Extensions/UIDevice+Jailbreak.swift diff --git a/Sources/SideStore/Extensions/UIDevice+Vibration.swift b/Sources/SideStoreAppKit/Extensions/UIDevice+Vibration.swift similarity index 100% rename from Sources/SideStore/Extensions/UIDevice+Vibration.swift rename to Sources/SideStoreAppKit/Extensions/UIDevice+Vibration.swift diff --git a/Sources/SideStore/Extensions/UIScreen+CompactHeight.swift b/Sources/SideStoreAppKit/Extensions/UIScreen+CompactHeight.swift similarity index 100% rename from Sources/SideStore/Extensions/UIScreen+CompactHeight.swift rename to Sources/SideStoreAppKit/Extensions/UIScreen+CompactHeight.swift diff --git a/Sources/SideStore/Managing Apps/AppManager.swift b/Sources/SideStoreAppKit/Managing Apps/AppManager.swift similarity index 99% rename from Sources/SideStore/Managing Apps/AppManager.swift rename to Sources/SideStoreAppKit/Managing Apps/AppManager.swift index e822a219..6bd311aa 100644 --- a/Sources/SideStore/Managing Apps/AppManager.swift +++ b/Sources/SideStoreAppKit/Managing Apps/AppManager.swift @@ -20,7 +20,7 @@ import SideKit import SideStoreCore import RoxasUIKit -extension AppManager { +public extension AppManager { static let didFetchSourceNotification = Notification.Name("io.altstore.AppManager.didFetchSource") static let didUpdatePatronsNotification = Notification.Name("io.altstore.AppManager.didUpdatePatrons") @@ -29,7 +29,7 @@ extension AppManager { } @available(iOS 13, *) -final class AppManagerPublisher: ObservableObject { +public final class AppManagerPublisher: ObservableObject { @Published fileprivate(set) var installationProgress = [String: Progress]() @@ -41,8 +41,8 @@ private func == (lhs: OperatingSystemVersion, rhs: OperatingSystemVersion) -> Bo lhs.majorVersion == rhs.majorVersion && lhs.minorVersion == rhs.minorVersion && lhs.patchVersion == rhs.patchVersion } -final class AppManager { - static let shared = AppManager() +public final class AppManager { + public static let shared = AppManager() private(set) var updatePatronsResult: Result? @@ -116,7 +116,7 @@ final class AppManager { } } -extension AppManager { +public extension AppManager { func update() { DatabaseManager.shared.persistentContainer.performBackgroundTask { context in #if targetEnvironment(simulator) @@ -275,7 +275,7 @@ extension AppManager { } } -extension AppManager { +public extension AppManager { func fetchSource(sourceURL: URL, managedObjectContext: NSManagedObjectContext = DatabaseManager.shared.persistentContainer.newBackgroundContext(), dependencies: [Foundation.Operation] = [], @@ -662,9 +662,9 @@ extension AppManager { } } -extension AppManager { +public extension AppManager { @discardableResult - func backgroundRefresh(_ installedApps: [InstalledApp], presentsNotifications: Bool = false, completionHandler: @escaping (Result<[String: Result], Error>) -> Void) -> BackgroundRefreshAppsOperation { + public func backgroundRefresh(_ installedApps: [InstalledApp], presentsNotifications: Bool = false, completionHandler: @escaping (Result<[String: Result], Error>) -> Void) -> BackgroundRefreshAppsOperation { let backgroundRefreshAppsOperation = BackgroundRefreshAppsOperation(installedApps: installedApps) backgroundRefreshAppsOperation.resultHandler = completionHandler backgroundRefreshAppsOperation.presentsFinishedNotification = presentsNotifications diff --git a/Sources/SideStore/Managing Apps/AppManagerErrors.swift b/Sources/SideStoreAppKit/Managing Apps/AppManagerErrors.swift similarity index 78% rename from Sources/SideStore/Managing Apps/AppManagerErrors.swift rename to Sources/SideStoreAppKit/Managing Apps/AppManagerErrors.swift index 30242a15..ba308186 100644 --- a/Sources/SideStore/Managing Apps/AppManagerErrors.swift +++ b/Sources/SideStoreAppKit/Managing Apps/AppManagerErrors.swift @@ -11,16 +11,16 @@ import Foundation import SideStoreCore -extension AppManager { +public extension AppManager { struct FetchSourcesError: LocalizedError, CustomNSError { - var primaryError: Error? + public private(set) var primaryError: Error? - var sources: Set? - var errors = [Source: Error]() + public private(set) var sources: Set? + public private(set) var errors = [Source: Error]() - var managedObjectContext: NSManagedObjectContext? + public private(set) var managedObjectContext: NSManagedObjectContext? - var errorDescription: String? { + public var errorDescription: String? { if let error = primaryError { return error.localizedDescription } else { @@ -41,7 +41,7 @@ extension AppManager { } } - var recoverySuggestion: String? { + public var recoverySuggestion: String? { if let error = primaryError as NSError? { return error.localizedRecoverySuggestion } else if errors.count == 1 { @@ -51,16 +51,16 @@ extension AppManager { } } - var errorUserInfo: [String: Any] { + public var errorUserInfo: [String: Any] { guard let error = errors.values.first, errors.count == 1 else { return [:] } return [NSUnderlyingErrorKey: error] } - init(_ error: Error) { + public init(_ error: Error) { primaryError = error } - init(sources: Set, errors: [Source: Error], context: NSManagedObjectContext) { + public init(sources: Set, errors: [Source: Error], context: NSManagedObjectContext) { self.sources = sources self.errors = errors managedObjectContext = context diff --git a/Sources/SideStore/My Apps/InstalledAppsCollectionHeaderView.swift b/Sources/SideStoreAppKit/My Apps/InstalledAppsCollectionHeaderView.swift similarity index 100% rename from Sources/SideStore/My Apps/InstalledAppsCollectionHeaderView.swift rename to Sources/SideStoreAppKit/My Apps/InstalledAppsCollectionHeaderView.swift diff --git a/Sources/SideStore/My Apps/MyAppsComponents.swift b/Sources/SideStoreAppKit/My Apps/MyAppsComponents.swift similarity index 100% rename from Sources/SideStore/My Apps/MyAppsComponents.swift rename to Sources/SideStoreAppKit/My Apps/MyAppsComponents.swift diff --git a/Sources/SideStore/My Apps/MyAppsViewController.swift b/Sources/SideStoreAppKit/My Apps/MyAppsViewController.swift similarity index 99% rename from Sources/SideStore/My Apps/MyAppsViewController.swift rename to Sources/SideStoreAppKit/My Apps/MyAppsViewController.swift index 406369a9..9eaaeab3 100644 --- a/Sources/SideStore/My Apps/MyAppsViewController.swift +++ b/Sources/SideStoreAppKit/My Apps/MyAppsViewController.swift @@ -65,7 +65,7 @@ final class MyAppsViewController: UICollectionViewController { super.init(coder: aDecoder) NotificationCenter.default.addObserver(self, selector: #selector(MyAppsViewController.didFetchSource(_:)), name: AppManager.didFetchSourceNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(MyAppsViewController.importApp(_:)), name: AppDelegate.importAppDeepLinkNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(MyAppsViewController.importApp(_:)), name: SideStoreAppDelegate.importAppDeepLinkNotification, object: nil) } override func viewDidLoad() { @@ -1171,7 +1171,7 @@ private extension MyAppsViewController { // Make sure left UIBarButtonItem has been set. loadViewIfNeeded() - guard let url = notification.userInfo?[AppDelegate.importAppDeepLinkURLKey] as? URL else { return } + guard let url = notification.userInfo?[SideStoreAppDelegate.importAppDeepLinkURLKey] as? URL else { return } sideloadApp(at: url) { _ in guard url.isFileURL else { return } diff --git a/Sources/SideStore/My Apps/UpdateCollectionViewCell.swift b/Sources/SideStoreAppKit/My Apps/UpdateCollectionViewCell.swift similarity index 100% rename from Sources/SideStore/My Apps/UpdateCollectionViewCell.swift rename to Sources/SideStoreAppKit/My Apps/UpdateCollectionViewCell.swift diff --git a/Sources/SideStore/News/NewsCollectionViewCell.swift b/Sources/SideStoreAppKit/News/NewsCollectionViewCell.swift similarity index 100% rename from Sources/SideStore/News/NewsCollectionViewCell.swift rename to Sources/SideStoreAppKit/News/NewsCollectionViewCell.swift diff --git a/Sources/SideStore/News/NewsViewController.swift b/Sources/SideStoreAppKit/News/NewsViewController.swift similarity index 99% rename from Sources/SideStore/News/NewsViewController.swift rename to Sources/SideStoreAppKit/News/NewsViewController.swift index cf69a359..98bd3715 100644 --- a/Sources/SideStore/News/NewsViewController.swift +++ b/Sources/SideStoreAppKit/News/NewsViewController.swift @@ -58,7 +58,7 @@ final class NewsViewController: UICollectionViewController { required init?(coder: NSCoder) { super.init(coder: coder) - NotificationCenter.default.addObserver(self, selector: #selector(NewsViewController.importApp(_:)), name: AppDelegate.importAppDeepLinkNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(NewsViewController.importApp(_:)), name: SideStoreAppDelegate.importAppDeepLinkNotification, object: nil) } override func viewDidLoad() { diff --git a/Sources/SideStore/Operations/AuthenticationOperation.swift b/Sources/SideStoreAppKit/Operations/AuthenticationOperation.swift similarity index 98% rename from Sources/SideStore/Operations/AuthenticationOperation.swift rename to Sources/SideStoreAppKit/Operations/AuthenticationOperation.swift index 54a7fbe0..5e9a8df8 100644 --- a/Sources/SideStore/Operations/AuthenticationOperation.swift +++ b/Sources/SideStoreAppKit/Operations/AuthenticationOperation.swift @@ -33,8 +33,8 @@ enum AuthenticationError: LocalizedError { } @objc(AuthenticationOperation) -final class AuthenticationOperation: ResultOperation<(ALTTeam, ALTCertificate, ALTAppleAPISession)> { - let context: AuthenticatedOperationContext +public final class AuthenticationOperation: ResultOperation<(ALTTeam, ALTCertificate, ALTAppleAPISession)> { + public let context: AuthenticatedOperationContext private weak var presentingViewController: UIViewController? @@ -56,7 +56,7 @@ final class AuthenticationOperation: ResultOperation<(ALTTeam, ALTCertificate, A private var submitCodeAction: UIAlertAction? - init(context: AuthenticatedOperationContext, presentingViewController: UIViewController?) { + public init(context: AuthenticatedOperationContext, presentingViewController: UIViewController?) { self.context = context self.presentingViewController = presentingViewController @@ -67,7 +67,7 @@ final class AuthenticationOperation: ResultOperation<(ALTTeam, ALTCertificate, A progress.totalUnitCount = 4 } - override func main() { + public override func main() { super.main() if let error = context.error { diff --git a/Sources/SideStore/Operations/BackgroundRefreshAppsOperation.swift b/Sources/SideStoreAppKit/Operations/BackgroundRefreshAppsOperation.swift similarity index 96% rename from Sources/SideStore/Operations/BackgroundRefreshAppsOperation.swift rename to Sources/SideStoreAppKit/Operations/BackgroundRefreshAppsOperation.swift index 5bf1975c..d86b5a84 100644 --- a/Sources/SideStore/Operations/BackgroundRefreshAppsOperation.swift +++ b/Sources/SideStoreAppKit/Operations/BackgroundRefreshAppsOperation.swift @@ -45,23 +45,23 @@ private let ReceivedApplicationState: @convention(c) (CFNotificationCenter?, Uns } @objc(BackgroundRefreshAppsOperation) -final class BackgroundRefreshAppsOperation: ResultOperation<[String: Result]> { - let installedApps: [InstalledApp] +public final class BackgroundRefreshAppsOperation: ResultOperation<[String: Result]> { + public let installedApps: [InstalledApp] private let managedObjectContext: NSManagedObjectContext - var presentsFinishedNotification: Bool = false + public var presentsFinishedNotification: Bool = false private let refreshIdentifier: String = UUID().uuidString private var runningApplications: Set = [] - init(installedApps: [InstalledApp]) { + public init(installedApps: [InstalledApp]) { self.installedApps = installedApps managedObjectContext = installedApps.compactMap { $0.managedObjectContext }.first ?? DatabaseManager.shared.persistentContainer.newBackgroundContext() super.init() } - override func finish(_ result: Result<[String: Result], Error>) { + public override func finish(_ result: Result<[String: Result], Error>) { super.finish(result) scheduleFinishedRefreshingNotification(for: result, delay: 0) @@ -75,7 +75,7 @@ final class BackgroundRefreshAppsOperation: ResultOperation<[String: Result ?? .failure(OperationError.unknownResult) + let result = notification.userInfo?[SideStoreAppDelegate.appBackupResultKey] as? Result ?? .failure(OperationError.unknownResult) self?.finish(result) NotificationCenter.default.removeObserver(backupResponseObserver!) diff --git a/Sources/SideStore/Operations/DeactivateAppOperation.swift b/Sources/SideStoreAppKit/Operations/DeactivateAppOperation.swift similarity index 100% rename from Sources/SideStore/Operations/DeactivateAppOperation.swift rename to Sources/SideStoreAppKit/Operations/DeactivateAppOperation.swift diff --git a/Sources/SideStore/Operations/DownloadAppOperation.swift b/Sources/SideStoreAppKit/Operations/DownloadAppOperation.swift similarity index 100% rename from Sources/SideStore/Operations/DownloadAppOperation.swift rename to Sources/SideStoreAppKit/Operations/DownloadAppOperation.swift diff --git a/Sources/SideStore/Operations/EnableJITOperation.swift b/Sources/SideStoreAppKit/Operations/EnableJITOperation.swift similarity index 100% rename from Sources/SideStore/Operations/EnableJITOperation.swift rename to Sources/SideStoreAppKit/Operations/EnableJITOperation.swift diff --git a/Sources/SideStore/Operations/FetchAnisetteDataOperation.swift b/Sources/SideStoreAppKit/Operations/FetchAnisetteDataOperation.swift similarity index 100% rename from Sources/SideStore/Operations/FetchAnisetteDataOperation.swift rename to Sources/SideStoreAppKit/Operations/FetchAnisetteDataOperation.swift diff --git a/Sources/SideStore/Operations/FetchAppIDsOperation.swift b/Sources/SideStoreAppKit/Operations/FetchAppIDsOperation.swift similarity index 100% rename from Sources/SideStore/Operations/FetchAppIDsOperation.swift rename to Sources/SideStoreAppKit/Operations/FetchAppIDsOperation.swift diff --git a/Sources/SideStore/Operations/FetchProvisioningProfilesOperation.swift b/Sources/SideStoreAppKit/Operations/FetchProvisioningProfilesOperation.swift similarity index 100% rename from Sources/SideStore/Operations/FetchProvisioningProfilesOperation.swift rename to Sources/SideStoreAppKit/Operations/FetchProvisioningProfilesOperation.swift diff --git a/Sources/SideStore/Operations/FetchSourceOperation.swift b/Sources/SideStoreAppKit/Operations/FetchSourceOperation.swift similarity index 100% rename from Sources/SideStore/Operations/FetchSourceOperation.swift rename to Sources/SideStoreAppKit/Operations/FetchSourceOperation.swift diff --git a/Sources/SideStore/Operations/FetchTrustedSourcesOperation.swift b/Sources/SideStoreAppKit/Operations/FetchTrustedSourcesOperation.swift similarity index 83% rename from Sources/SideStore/Operations/FetchTrustedSourcesOperation.swift rename to Sources/SideStoreAppKit/Operations/FetchTrustedSourcesOperation.swift index 9bc05413..b578bbb4 100644 --- a/Sources/SideStore/Operations/FetchTrustedSourcesOperation.swift +++ b/Sources/SideStoreAppKit/Operations/FetchTrustedSourcesOperation.swift @@ -16,10 +16,10 @@ private extension URL { #endif } -extension FetchTrustedSourcesOperation { - struct TrustedSource: Decodable { - var identifier: String - var sourceURL: URL? +public extension FetchTrustedSourcesOperation { + public struct TrustedSource: Decodable { + public var identifier: String + public var sourceURL: URL? } private struct Response: Decodable { @@ -28,8 +28,8 @@ extension FetchTrustedSourcesOperation { } } -final class FetchTrustedSourcesOperation: ResultOperation<[FetchTrustedSourcesOperation.TrustedSource]> { - override func main() { +public final class FetchTrustedSourcesOperation: ResultOperation<[FetchTrustedSourcesOperation.TrustedSource]> { + public override func main() { super.main() let dataTask = URLSession.shared.dataTask(with: .trustedSources) { data, response, error in diff --git a/Sources/SideStore/Operations/InstallAppOperation.swift b/Sources/SideStoreAppKit/Operations/InstallAppOperation.swift similarity index 100% rename from Sources/SideStore/Operations/InstallAppOperation.swift rename to Sources/SideStoreAppKit/Operations/InstallAppOperation.swift diff --git a/Sources/SideStore/Operations/Operation.swift b/Sources/SideStoreAppKit/Operations/Operation.swift similarity index 81% rename from Sources/SideStore/Operations/Operation.swift rename to Sources/SideStoreAppKit/Operations/Operation.swift index b2719fbd..c160466e 100644 --- a/Sources/SideStore/Operations/Operation.swift +++ b/Sources/SideStoreAppKit/Operations/Operation.swift @@ -9,11 +9,11 @@ import Foundation import RoxasUIKit -class ResultOperation: Operation { +public class ResultOperation: Operation { var resultHandler: ((Result) -> Void)? @available(*, unavailable) - override func finish() { + public override func finish() { super.finish() } @@ -30,12 +30,12 @@ class ResultOperation: Operation { } } -class Operation: RSTOperation, ProgressReporting { - let progress = Progress.discreteProgress(totalUnitCount: 1) +public class Operation: RSTOperation, ProgressReporting { + public let progress = Progress.discreteProgress(totalUnitCount: 1) private var backgroundTaskID: UIBackgroundTaskIdentifier? - override var isAsynchronous: Bool { + public override var isAsynchronous: Bool { true } @@ -45,7 +45,7 @@ class Operation: RSTOperation, ProgressReporting { progress.cancellationHandler = { [weak self] in self?.cancel() } } - override func cancel() { + public override func cancel() { super.cancel() if !progress.isCancelled { @@ -53,7 +53,7 @@ class Operation: RSTOperation, ProgressReporting { } } - override func main() { + public override func main() { super.main() let name = "com.altstore." + NSStringFromClass(type(of: self)) @@ -67,7 +67,7 @@ class Operation: RSTOperation, ProgressReporting { } } - override func finish() { + public override func finish() { guard !isFinished else { return } super.finish() diff --git a/Sources/SideStore/Operations/OperationContexts.swift b/Sources/SideStoreAppKit/Operations/OperationContexts.swift similarity index 89% rename from Sources/SideStore/Operations/OperationContexts.swift rename to Sources/SideStoreAppKit/Operations/OperationContexts.swift index 83f85617..2035fad0 100644 --- a/Sources/SideStore/Operations/OperationContexts.swift +++ b/Sources/SideStoreAppKit/Operations/OperationContexts.swift @@ -13,14 +13,14 @@ import Network import AltSign import SideStoreCore -class OperationContext { +public class OperationContext { var error: Error? var presentingViewController: UIViewController? let operations: NSHashTable - init(error: Error? = nil, operations: [Foundation.Operation] = []) { + public init(error: Error? = nil, operations: [Foundation.Operation] = []) { self.error = error self.operations = NSHashTable.weakObjects() @@ -29,12 +29,12 @@ class OperationContext { } } - convenience init(context: OperationContext) { + public convenience init(context: OperationContext) { self.init(error: context.error, operations: context.operations.allObjects) } } -final class AuthenticatedOperationContext: OperationContext { +public final class AuthenticatedOperationContext: OperationContext { var session: ALTAppleAPISession? var team: ALTTeam? @@ -42,7 +42,7 @@ final class AuthenticatedOperationContext: OperationContext { weak var authenticationOperation: AuthenticationOperation? - convenience init(context: AuthenticatedOperationContext) { + public convenience init(context: AuthenticatedOperationContext) { self.init(error: context.error, operations: context.operations.allObjects) session = context.session diff --git a/Sources/SideStore/Operations/OperationError.swift b/Sources/SideStoreAppKit/Operations/OperationError.swift similarity index 100% rename from Sources/SideStore/Operations/OperationError.swift rename to Sources/SideStoreAppKit/Operations/OperationError.swift diff --git a/Sources/SideStore/Operations/Patch App/PatchAppOperation.swift b/Sources/SideStoreAppKit/Operations/Patch App/PatchAppOperation.swift similarity index 98% rename from Sources/SideStore/Operations/Patch App/PatchAppOperation.swift rename to Sources/SideStoreAppKit/Operations/Patch App/PatchAppOperation.swift index 41d96e54..ebb19052 100644 --- a/Sources/SideStore/Operations/Patch App/PatchAppOperation.swift +++ b/Sources/SideStoreAppKit/Operations/Patch App/PatchAppOperation.swift @@ -48,7 +48,7 @@ private struct OTAUpdate { } @available(iOS 14, *) -final class PatchAppOperation: ResultOperation { +public final class PatchAppOperation: ResultOperation { let context: PatchAppContext var progressHandler: ((Progress, String) -> Void)? @@ -66,7 +66,7 @@ final class PatchAppOperation: ResultOperation { progress.totalUnitCount = 100 } - override func main() { + public override func main() { super.main() if let error = context.error { @@ -98,7 +98,7 @@ final class PatchAppOperation: ResultOperation { } receiveValue: { _ in } } - override func cancel() { + public override func cancel() { super.cancel() cancellable?.cancel() diff --git a/Sources/SideStore/Operations/Patch App/PatchViewController.swift b/Sources/SideStoreAppKit/Operations/Patch App/PatchViewController.swift similarity index 99% rename from Sources/SideStore/Operations/Patch App/PatchViewController.swift rename to Sources/SideStoreAppKit/Operations/Patch App/PatchViewController.swift index 9feddfbd..c7da6498 100644 --- a/Sources/SideStore/Operations/Patch App/PatchViewController.swift +++ b/Sources/SideStoreAppKit/Operations/Patch App/PatchViewController.swift @@ -27,7 +27,7 @@ extension PatchViewController { } @available(iOS 14.0, *) -final class PatchViewController: UIViewController { +public final class PatchViewController: UIViewController { var patchApp: AnyApp? var installedApp: InstalledApp? @@ -57,7 +57,7 @@ final class PatchViewController: UIViewController { @IBOutlet private var cancelBarButtonItem: UIBarButtonItem! @IBOutlet private var cancelButton: UIButton! - override func viewDidLoad() { + public override func viewDidLoad() { super.viewDidLoad() isModalInPresentation = true @@ -81,7 +81,7 @@ final class PatchViewController: UIViewController { update() } - override func viewWillAppear(_ animated: Bool) { + public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) if installedApp != nil { diff --git a/Sources/SideStore/Operations/RefreshAppOperation.swift b/Sources/SideStoreAppKit/Operations/RefreshAppOperation.swift similarity index 100% rename from Sources/SideStore/Operations/RefreshAppOperation.swift rename to Sources/SideStoreAppKit/Operations/RefreshAppOperation.swift diff --git a/Sources/SideStore/Operations/RefreshGroup.swift b/Sources/SideStoreAppKit/Operations/RefreshGroup.swift similarity index 85% rename from Sources/SideStore/Operations/RefreshGroup.swift rename to Sources/SideStoreAppKit/Operations/RefreshGroup.swift index df5fa948..73d5f99f 100644 --- a/Sources/SideStore/Operations/RefreshGroup.swift +++ b/Sources/SideStoreAppKit/Operations/RefreshGroup.swift @@ -12,7 +12,7 @@ import Foundation import AltSign import SideStoreCore -final class RefreshGroup: NSObject { +public final class RefreshGroup: NSObject { let context: AuthenticatedOperationContext let progress = Progress.discreteProgress(totalUnitCount: 0) @@ -30,7 +30,7 @@ final class RefreshGroup: NSObject { private let dispatchGroup = DispatchGroup() private var operations: [Foundation.Operation] = [] - init(context: AuthenticatedOperationContext = AuthenticatedOperationContext()) { + public init(context: AuthenticatedOperationContext = AuthenticatedOperationContext()) { self.context = context super.init() @@ -38,7 +38,7 @@ final class RefreshGroup: NSObject { /// Used to keep track of which operations belong to this group. /// This does _not_ add them to any operation queue. - func add(_ operations: [Foundation.Operation]) { + public func add(_ operations: [Foundation.Operation]) { for operation in operations { dispatchGroup.enter() @@ -56,7 +56,7 @@ final class RefreshGroup: NSObject { self.operations.append(contentsOf: operations) } - func set(_ result: Result, forAppWithBundleIdentifier bundleIdentifier: String) { + public func set(_ result: Result, forAppWithBundleIdentifier bundleIdentifier: String) { results[bundleIdentifier] = result switch result { @@ -67,7 +67,7 @@ final class RefreshGroup: NSObject { } } - func cancel() { + public func cancel() { operations.forEach { $0.cancel() } } } diff --git a/Sources/SideStore/Operations/RemoveAppBackupOperation.swift b/Sources/SideStoreAppKit/Operations/RemoveAppBackupOperation.swift similarity index 100% rename from Sources/SideStore/Operations/RemoveAppBackupOperation.swift rename to Sources/SideStoreAppKit/Operations/RemoveAppBackupOperation.swift diff --git a/Sources/SideStore/Operations/RemoveAppOperation.swift b/Sources/SideStoreAppKit/Operations/RemoveAppOperation.swift similarity index 100% rename from Sources/SideStore/Operations/RemoveAppOperation.swift rename to Sources/SideStoreAppKit/Operations/RemoveAppOperation.swift diff --git a/Sources/SideStore/Operations/ResignAppOperation.swift b/Sources/SideStoreAppKit/Operations/ResignAppOperation.swift similarity index 99% rename from Sources/SideStore/Operations/ResignAppOperation.swift rename to Sources/SideStoreAppKit/Operations/ResignAppOperation.swift index 8b46ba7f..67e4cb18 100644 --- a/Sources/SideStore/Operations/ResignAppOperation.swift +++ b/Sources/SideStoreAppKit/Operations/ResignAppOperation.swift @@ -12,6 +12,7 @@ import RoxasUIKit import AltSign import SideStoreCore + @objc(ResignAppOperation) final class ResignAppOperation: ResultOperation { let context: InstallAppOperationContext diff --git a/Sources/SideStore/Operations/SendAppOperation.swift b/Sources/SideStoreAppKit/Operations/SendAppOperation.swift similarity index 100% rename from Sources/SideStore/Operations/SendAppOperation.swift rename to Sources/SideStoreAppKit/Operations/SendAppOperation.swift diff --git a/Sources/SideStore/Operations/UpdatePatronsOperation.swift b/Sources/SideStoreAppKit/Operations/UpdatePatronsOperation.swift similarity index 100% rename from Sources/SideStore/Operations/UpdatePatronsOperation.swift rename to Sources/SideStoreAppKit/Operations/UpdatePatronsOperation.swift diff --git a/Sources/SideStore/Operations/VerifyAppOperation.swift b/Sources/SideStoreAppKit/Operations/VerifyAppOperation.swift similarity index 100% rename from Sources/SideStore/Operations/VerifyAppOperation.swift rename to Sources/SideStoreAppKit/Operations/VerifyAppOperation.swift diff --git a/Sources/SideStore/Settings/AnisetteManager.swift b/Sources/SideStoreAppKit/Settings/AnisetteManager.swift similarity index 100% rename from Sources/SideStore/Settings/AnisetteManager.swift rename to Sources/SideStoreAppKit/Settings/AnisetteManager.swift diff --git a/Sources/SideStore/Settings/Error Log/ErrorLogTableViewCell.swift b/Sources/SideStoreAppKit/Settings/Error Log/ErrorLogTableViewCell.swift similarity index 100% rename from Sources/SideStore/Settings/Error Log/ErrorLogTableViewCell.swift rename to Sources/SideStoreAppKit/Settings/Error Log/ErrorLogTableViewCell.swift diff --git a/Sources/SideStore/Settings/Error Log/ErrorLogViewController.swift b/Sources/SideStoreAppKit/Settings/Error Log/ErrorLogViewController.swift similarity index 100% rename from Sources/SideStore/Settings/Error Log/ErrorLogViewController.swift rename to Sources/SideStoreAppKit/Settings/Error Log/ErrorLogViewController.swift diff --git a/Sources/SideStore/Settings/InsetGroupTableViewCell.swift b/Sources/SideStoreAppKit/Settings/InsetGroupTableViewCell.swift similarity index 100% rename from Sources/SideStore/Settings/InsetGroupTableViewCell.swift rename to Sources/SideStoreAppKit/Settings/InsetGroupTableViewCell.swift diff --git a/Sources/SideStore/Settings/LicensesViewController.swift b/Sources/SideStoreAppKit/Settings/LicensesViewController.swift similarity index 100% rename from Sources/SideStore/Settings/LicensesViewController.swift rename to Sources/SideStoreAppKit/Settings/LicensesViewController.swift diff --git a/Sources/SideStore/Settings/PatreonComponents.swift b/Sources/SideStoreAppKit/Settings/PatreonComponents.swift similarity index 100% rename from Sources/SideStore/Settings/PatreonComponents.swift rename to Sources/SideStoreAppKit/Settings/PatreonComponents.swift diff --git a/Sources/SideStore/Settings/PatreonViewController.swift b/Sources/SideStoreAppKit/Settings/PatreonViewController.swift similarity index 100% rename from Sources/SideStore/Settings/PatreonViewController.swift rename to Sources/SideStoreAppKit/Settings/PatreonViewController.swift diff --git a/Sources/SideStore/Settings/RefreshAttemptsViewController.swift b/Sources/SideStoreAppKit/Settings/RefreshAttemptsViewController.swift similarity index 100% rename from Sources/SideStore/Settings/RefreshAttemptsViewController.swift rename to Sources/SideStoreAppKit/Settings/RefreshAttemptsViewController.swift diff --git a/Sources/SideStore/Settings/SettingsHeaderFooterView.swift b/Sources/SideStoreAppKit/Settings/SettingsHeaderFooterView.swift similarity index 100% rename from Sources/SideStore/Settings/SettingsHeaderFooterView.swift rename to Sources/SideStoreAppKit/Settings/SettingsHeaderFooterView.swift diff --git a/Sources/SideStore/Settings/SettingsViewController.swift b/Sources/SideStoreAppKit/Settings/SettingsViewController.swift similarity index 99% rename from Sources/SideStore/Settings/SettingsViewController.swift rename to Sources/SideStoreAppKit/Settings/SettingsViewController.swift index b805cdb4..abfd363e 100644 --- a/Sources/SideStore/Settings/SettingsViewController.swift +++ b/Sources/SideStoreAppKit/Settings/SettingsViewController.swift @@ -76,7 +76,7 @@ final class SettingsViewController: UITableViewController { required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) - NotificationCenter.default.addObserver(self, selector: #selector(SettingsViewController.openPatreonSettings(_:)), name: AppDelegate.openPatreonSettingsDeepLinkNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(SettingsViewController.openPatreonSettings(_:)), name: SideStoreAppDelegate.openPatreonSettingsDeepLinkNotification, object: nil) } override func viewDidLoad() { diff --git a/Sources/SideStoreAppKit/SideStoreAppDelegate.swift b/Sources/SideStoreAppKit/SideStoreAppDelegate.swift new file mode 100644 index 00000000..0a4d6dff --- /dev/null +++ b/Sources/SideStoreAppKit/SideStoreAppDelegate.swift @@ -0,0 +1,33 @@ +// +// SideStoreAppDelegate.swift +// AltStore +// +// Created by Riley Testut on 5/9/19. +// Copyright © 2019 Riley Testut. All rights reserved. +// + +import AVFoundation +import Intents +import UIKit +import UserNotifications + +import AltSign +import SideStoreCore +import EmotionalDamage +import RoxasUIKit + +open class SideStoreAppDelegate: UIResponder, UIApplicationDelegate { + +} + +public extension SideStoreAppDelegate { + static let openPatreonSettingsDeepLinkNotification = Notification.Name(Bundle.Info.appbundleIdentifier + ".OpenPatreonSettingsDeepLinkNotification") + static let importAppDeepLinkNotification = Notification.Name(Bundle.Info.appbundleIdentifier + ".ImportAppDeepLinkNotification") + static let addSourceDeepLinkNotification = Notification.Name(Bundle.Info.appbundleIdentifier + ".AddSourceDeepLinkNotification") + + static let appBackupDidFinish = Notification.Name(Bundle.Info.appbundleIdentifier + ".AppBackupDidFinish") + + static let importAppDeepLinkURLKey = "fileURL" + static let appBackupResultKey = "result" + static let addSourceDeepLinkURLKey = "sourceURL" +} diff --git a/Sources/SideStoreAppKit/SideStoreAppKit.swift b/Sources/SideStoreAppKit/SideStoreAppKit.swift deleted file mode 100644 index 50df85dc..00000000 --- a/Sources/SideStoreAppKit/SideStoreAppKit.swift +++ /dev/null @@ -1,4 +0,0 @@ -import Foundation -import UIKit - -public final class SideStoreAppKit { } diff --git a/Sources/SideStore/Sources/SourcesViewController.swift b/Sources/SideStoreAppKit/Sources/SourcesViewController.swift similarity index 100% rename from Sources/SideStore/Sources/SourcesViewController.swift rename to Sources/SideStoreAppKit/Sources/SourcesViewController.swift diff --git a/Sources/SideStore/TabBarController.swift b/Sources/SideStoreAppKit/TabBarController.swift similarity index 81% rename from Sources/SideStore/TabBarController.swift rename to Sources/SideStoreAppKit/TabBarController.swift index 79f3e1bf..515f4fbb 100644 --- a/Sources/SideStore/TabBarController.swift +++ b/Sources/SideStoreAppKit/TabBarController.swift @@ -18,7 +18,7 @@ extension TabBarController { } } -final class TabBarController: UITabBarController { +public final class TabBarController: UITabBarController { private var initialSegue: (identifier: String, sender: Any?)? private var _viewDidAppear = false @@ -26,12 +26,12 @@ final class TabBarController: UITabBarController { required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) - NotificationCenter.default.addObserver(self, selector: #selector(TabBarController.openPatreonSettings(_:)), name: AppDelegate.openPatreonSettingsDeepLinkNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(TabBarController.importApp(_:)), name: AppDelegate.importAppDeepLinkNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(TabBarController.presentSources(_:)), name: AppDelegate.addSourceDeepLinkNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(TabBarController.openPatreonSettings(_:)), name: SideStoreAppDelegate.openPatreonSettingsDeepLinkNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(TabBarController.importApp(_:)), name: SideStoreAppDelegate.importAppDeepLinkNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(TabBarController.presentSources(_:)), name: SideStoreAppDelegate.addSourceDeepLinkNotification, object: nil) } - override func viewDidAppear(_ animated: Bool) { + public override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) _viewDidAppear = true @@ -48,13 +48,13 @@ final class TabBarController: UITabBarController { } } - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + public override func prepare(for segue: UIStoryboardSegue, sender: Any?) { guard let identifier = segue.identifier else { return } switch identifier { case "presentSources": guard let notification = sender as? Notification, - let sourceURL = notification.userInfo?[AppDelegate.addSourceDeepLinkURLKey] as? URL + let sourceURL = notification.userInfo?[SideStoreAppDelegate.addSourceDeepLinkURLKey] as? URL else { return } let navigationController = segue.destination as! UINavigationController @@ -76,7 +76,7 @@ final class TabBarController: UITabBarController { } } - override func performSegue(withIdentifier identifier: String, sender: Any?) { + public override func performSegue(withIdentifier identifier: String, sender: Any?) { guard _viewDidAppear else { initialSegue = (identifier, sender) return @@ -92,7 +92,7 @@ extension TabBarController { if let navigationController = presentedViewController as? UINavigationController, let sourcesViewController = navigationController.viewControllers.first as? SourcesViewController { if let notification = (sender as? Notification), - let sourceURL = notification.userInfo?[AppDelegate.addSourceDeepLinkURLKey] as? URL { + let sourceURL = notification.userInfo?[SideStoreAppDelegate.addSourceDeepLinkURLKey] as? URL { sourcesViewController.deepLinkSourceURL = sourceURL } else { // Don't dismiss SourcesViewController if it's already presented. diff --git a/Sources/SideStore/Types/LoadingState.swift b/Sources/SideStoreAppKit/Types/LoadingState.swift similarity index 100% rename from Sources/SideStore/Types/LoadingState.swift rename to Sources/SideStoreAppKit/Types/LoadingState.swift diff --git a/Sources/SideStore/Types/Managed.swift b/Sources/SideStoreAppKit/Types/Managed.swift similarity index 100% rename from Sources/SideStore/Types/Managed.swift rename to Sources/SideStoreAppKit/Types/Managed.swift diff --git a/Sources/SideStore/Types/ScreenshotProcessor.swift b/Sources/SideStoreAppKit/Types/ScreenshotProcessor.swift similarity index 100% rename from Sources/SideStore/Types/ScreenshotProcessor.swift rename to Sources/SideStoreAppKit/Types/ScreenshotProcessor.swift