mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Supports downloading apps from locked Patreon posts
Uses cached Patreon session cookies to access post attachments despite no official API support.
This commit is contained in:
@@ -51,6 +51,10 @@ extension OperationError
|
||||
case serverNotFound = 1200
|
||||
case connectionFailed = 1201
|
||||
case connectionDropped = 1202
|
||||
|
||||
/* Pledges */
|
||||
case pledgeRequired = 1401
|
||||
case pledgeInactive = 1402
|
||||
}
|
||||
|
||||
static var cancelled: CancellationError { CancellationError() }
|
||||
@@ -125,6 +129,14 @@ extension OperationError
|
||||
static func forbidden(failureReason: String? = nil, file: String = #fileID, line: UInt = #line) -> OperationError {
|
||||
OperationError(code: .forbidden, failureReason: failureReason, sourceFile: file, sourceLine: line)
|
||||
}
|
||||
|
||||
static func pledgeRequired(appName: String, file: String = #fileID, line: UInt = #line) -> OperationError {
|
||||
OperationError(code: .pledgeRequired, appName: appName, sourceFile: file, sourceLine: line)
|
||||
}
|
||||
|
||||
static func pledgeInactive(appName: String, file: String = #fileID, line: UInt = #line) -> OperationError {
|
||||
OperationError(code: .pledgeInactive, appName: appName, sourceFile: file, sourceLine: line)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -205,6 +217,17 @@ struct OperationError: ALTLocalizedError {
|
||||
case .invalidParameters:
|
||||
let message = self._failureReason.map { ": \n\($0)" } ?? "."
|
||||
return String(format: NSLocalizedString("Invalid parameters%@", comment: ""), message)
|
||||
case .serverNotFound: return NSLocalizedString("AltServer could not be found.", comment: "")
|
||||
case .connectionFailed: return NSLocalizedString("A connection to AltServer could not be established.", comment: "")
|
||||
case .connectionDropped: return NSLocalizedString("The connection to AltServer was dropped.", comment: "")
|
||||
|
||||
case .pledgeRequired:
|
||||
let appName = self.appName ?? NSLocalizedString("This app", comment: "")
|
||||
return String(format: NSLocalizedString("%@ requires an active pledge in order to be installed.", comment: ""), appName)
|
||||
|
||||
case .pledgeInactive:
|
||||
let appName = self.appName ?? NSLocalizedString("this app", comment: "")
|
||||
return String(format: NSLocalizedString("Your pledge is no longer active. Please renew it to continue using %@ normally.", comment: ""), appName)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user