debloat: removed more patreon stuff carried over from altstore 2.0

This commit is contained in:
mahee96
2026-02-22 15:18:51 +05:30
parent f16651040f
commit d670618cbe
10 changed files with 11 additions and 126 deletions

View File

@@ -392,7 +392,6 @@ private extension AppViewController
{
var buttonAction: AppBannerView.AppAction?
// if let installedApp = self.app.installedApp, let latestVersion = self.app.latestAvailableVersion, !installedApp.matches(latestVersion), !self.app.isPledgeRequired || self.app.isPledged
if let installedApp = self.app.installedApp, installedApp.hasUpdate
{
// Explicitly set button action to .update if there is an update available, even if it's not supported.
@@ -543,7 +542,6 @@ extension AppViewController
{
if let installedApp = self.app.installedApp
{
// if let latestVersion = self.app.latestAvailableVersion, !installedApp.matches(latestVersion), !self.app.isPledgeRequired || self.app.isPledged
if let latestVersion = self.app.latestAvailableVersion, installedApp.hasUpdate
{
self.updateApp(installedApp, to: latestVersion)

View File

@@ -363,13 +363,13 @@ private extension FeaturedViewController
let sourceHasRemainingAppsPredicate = NSPredicate(format:
"""
SUBQUERY(%K, $app,
($app.%K != %@) AND ($app.%K == nil) AND (($app.%K == NO) OR ($app.%K == NO) OR ($app.%K == YES))
($app.%K != %@) AND ($app.%K == nil)
).@count > 0
""",
#keyPath(StoreApp._source._apps),
#keyPath(StoreApp.bundleIdentifier), StoreApp.altstoreAppID,
#keyPath(StoreApp.installedApp),
#keyPath(StoreApp.isPledgeRequired), #keyPath(StoreApp.isHiddenWithoutPledge), #keyPath(StoreApp.isPledged)
#keyPath(StoreApp._source._apps),
#keyPath(StoreApp.bundleIdentifier),
StoreApp.altstoreAppID,
#keyPath(StoreApp.installedApp),
)
let primaryFetchRequest = fetchRequest.copy() as! NSFetchRequest<StoreApp>

View File

@@ -167,29 +167,7 @@ extension AppBannerView
self.subtitleLabel.text = NSLocalizedString("Sideloaded", comment: "")
self.accessibilityLabel = values.name
}
if let storeApp = app.storeApp, storeApp.isPledgeRequired
{
// Always show button label for Patreon apps.
self.buttonLabel.isHidden = false
if storeApp.isPledged
{
self.buttonLabel.text = NSLocalizedString("Pledged", comment: "")
}
else if storeApp.installedApp != nil
{
self.buttonLabel.text = NSLocalizedString("Pledge Expired", comment: "")
}
else
{
self.buttonLabel.text = NSLocalizedString("Join Patreon", comment: "")
}
}
else
{
self.buttonLabel.isHidden = true
}
self.buttonLabel.isHidden = true
if let source = app.storeApp?.source, showSourceIcon
{
@@ -294,15 +272,6 @@ extension AppBannerView
self.button.accessibilityLabel = String(format: NSLocalizedString("Install %@", comment: ""), app.name)
self.button.accessibilityValue = buttonTitle
}
else if let amount = storeApp.pledgeAmount, let currencyCode = storeApp.pledgeCurrency, !storeApp.prefersCustomPledge, #available(iOS 15, *)
{
let price = amount.formatted(.currency(code: currencyCode).presentation(.narrow).precision(.fractionLength(0...2)))
let buttonTitle = String(format: NSLocalizedString("%@/mo", comment: ""), price)
self.button.setTitle(buttonTitle, for: .normal)
self.button.accessibilityLabel = String(format: NSLocalizedString("Pledge %@ a month", comment: ""), price)
self.button.accessibilityValue = String(format: NSLocalizedString("%@ a month", comment: ""), price)
}
else
{
let buttonTitle = NSLocalizedString("Pledge", comment: "")

View File

@@ -1562,8 +1562,6 @@ private extension AppManager
if let storeApp = downloadingApp.storeApp, storeApp.isPledgeRequired
{
// Patreon apps may require authenticating with WebViewController,
// so make sure to run DownloadAppOperation serially.
self.run([downloadOperation], context: group.context, requiresSerialQueue: true)
if let index = operations.firstIndex(of: downloadOperation)

View File

@@ -120,7 +120,6 @@ class MyAppsViewController: UICollectionViewController, PeekPopPreviewing
{
super.viewIsAppearing(animated)
// Ensure the button for each app reflects correct Patreon status.
self.collectionView.reloadData()
self.update()
@@ -1990,8 +1989,6 @@ extension MyAppsViewController
for action in actions where !allowedActions.contains(action)
{
// Disable options for Patreon apps that we are no longer pledged to.
if let action = action as? UIAction
{
action.attributes = .disabled

View File

@@ -30,8 +30,6 @@ final class DownloadAppOperation: ResultOperation<ALTApplication>
private let session = URLSession(configuration: .default)
private let temporaryDirectory = FileManager.default.uniqueTemporaryURL()
private var downloadPatreonAppContinuation: CheckedContinuation<URL, Error>?
init(app: AppProtocol, destinationURL: URL, context: InstallAppOperationContext)
{
self.app = app
@@ -320,61 +318,6 @@ private extension DownloadAppOperation
}
}
extension DownloadAppOperation: WebViewControllerDelegate
{
func webViewControllerDidFinish(_ webViewController: WebViewController)
{
guard let continuation = self.downloadPatreonAppContinuation else { return }
self.downloadPatreonAppContinuation = nil
continuation.resume(throwing: CancellationError())
}
}
extension DownloadAppOperation: WKNavigationDelegate
{
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy
{
guard #available(iOS 14.5, *), navigationAction.shouldPerformDownload else { return .allow }
guard let continuation = self.downloadPatreonAppContinuation else { return .allow }
self.downloadPatreonAppContinuation = nil
if let downloadURL = navigationAction.request.url
{
continuation.resume(returning: downloadURL)
}
else
{
continuation.resume(throwing: URLError(.badURL))
}
return .cancel
}
func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse) async -> WKNavigationResponsePolicy
{
// Called for Patreon attachments
guard !navigationResponse.canShowMIMEType else { return .allow }
guard let continuation = self.downloadPatreonAppContinuation else { return .allow }
self.downloadPatreonAppContinuation = nil
guard let response = navigationResponse.response as? HTTPURLResponse, let responseURL = response.url,
let mimeType = response.mimeType, let type = UTType(mimeType: mimeType),
type.conforms(to: .ipa) || type.conforms(to: .zip) || type.conforms(to: .application)
else {
continuation.resume(throwing: OperationError.invalidApp)
return .cancel
}
continuation.resume(returning: responseURL)
return .cancel
}
}
private extension DownloadAppOperation
{
struct AltStorePlist: Decodable

View File

@@ -171,11 +171,6 @@ final class FetchSourceOperation: ResultOperation<Source>
let identifier = source.identifier
if identifier == Source.altStoreIdentifier, let skipPatreonDownloads = source.userInfo?[.skipPatreonDownloads]
{
UserDefaults.shared.skipPatreonDownloads = (skipPatreonDownloads == "true")
}
try self.verify(source, response: response)
try childContext.save()

View File

@@ -8,10 +8,10 @@
import UIKit
final class PatronCollectionViewCell: UICollectionViewCell
{
@IBOutlet var textLabel: UILabel!
}
//final class PatronCollectionViewCell: UICollectionViewCell
//{
// @IBOutlet var textLabel: UILabel!
//}
final class AboutPatreonHeaderView: UICollectionReusableView
@@ -45,7 +45,7 @@ final class AboutPatreonHeaderView: UICollectionReusableView
button.clipsToBounds = true
button.layer.cornerRadius = 16
}
}
}
override func layoutMarginsDidChange()
{

View File

@@ -71,18 +71,6 @@ public class Keychain
@KeychainItem(key: "signingCertificatePassword")
public var signingCertificatePassword: String?
@KeychainItem(key: "patreonAccessToken")
public var patreonAccessToken: String?
@KeychainItem(key: "patreonRefreshToken")
public var patreonRefreshToken: String?
@KeychainItem(key: "patreonCreatorAccessToken")
public var patreonCreatorAccessToken: String?
@KeychainItem(key: "patreonAccountID")
public var patreonAccountID: String?
@KeychainItem(key: "identifier")
public var identifier: String?

View File

@@ -54,11 +54,8 @@ public extension UserDefaults
@NSManaged var patchedApps: [String]?
@NSManaged var patronsRefreshID: String?
@NSManaged var trustedSourceIDs: [String]?
@NSManaged var trustedServerURL: String?
@NSManaged var skipPatreonDownloads: Bool
@NSManaged var betaUdpatesTrack: String?