Supports remotely disabling workaround for downloading Patreon attachments

In case our workaround for downloading Patreon post attachments breaks, we can remotely disable it and force AltStore to use its fallback instead (taking user to post directly).
This commit is contained in:
Riley Testut
2023-11-30 14:33:08 -06:00
parent bd0220ea35
commit 2377ada199
5 changed files with 14 additions and 0 deletions

View File

@@ -301,6 +301,11 @@ private extension DownloadAppOperation
func downloadPatreonApp(from patreonURL: URL) async throws -> URL
{
guard !UserDefaults.shared.skipPatreonDownloads else {
// Skip all hacks, take user straight to Patreon post.
return try await downloadFromPatreonPost()
}
do
{
// User is pledged to this app, attempt to download.

View File

@@ -153,6 +153,11 @@ 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 self.verifyPledges(for: source, in: childContext)

View File

@@ -39,6 +39,8 @@ public extension UserDefaults
@NSManaged var patronsRefreshID: String?
@NSManaged var skipPatreonDownloads: Bool
@nonobjc
var activeAppsLimit: Int? {
get {

View File

@@ -10,3 +10,4 @@
typedef NSString *ALTSourceUserInfoKey NS_TYPED_EXTENSIBLE_ENUM;
extern ALTSourceUserInfoKey const ALTSourceUserInfoKeyPatreonAccessToken;
extern ALTSourceUserInfoKey const ALTSourceUserInfoKeySkipPatreonDownloads;

View File

@@ -9,3 +9,4 @@
#import "ALTSourceUserInfoKey.h"
ALTSourceUserInfoKey const ALTSourceUserInfoKeyPatreonAccessToken = @"patreonAccessToken";
ALTSourceUserInfoKey const ALTSourceUserInfoKeySkipPatreonDownloads = @"skipPatreonDownloads";