Adds “Disable Response Caching” debug setting

When enabled, AltStore will ignore cached responses for certain requests and will always make a new request to the server. This is useful for development when repeatedly testing changes to remote files.

Limited to UpdateKnownSourcesOperation for now, but will eventually affect fetching sources as well.
This commit is contained in:
Riley Testut
2023-05-29 12:10:44 -05:00
parent c3721ba209
commit 0db5e3caab
4 changed files with 68 additions and 3 deletions

View File

@@ -30,11 +30,26 @@ extension UpdateKnownSourcesOperation
class UpdateKnownSourcesOperation: ResultOperation<([KnownSource], [KnownSource])>
{
private let session: URLSession
override init()
{
let configuration = URLSessionConfiguration.default
if UserDefaults.standard.responseCachingDisabled
{
configuration.requestCachePolicy = .reloadIgnoringLocalCacheData
configuration.urlCache = nil
}
self.session = URLSession(configuration: configuration)
}
override func main()
{
super.main()
let dataTask = URLSession.shared.dataTask(with: .sources) { (data, response, error) in
let dataTask = self.session.dataTask(with: .sources) { (data, response, error) in
do
{
if let response = response as? HTTPURLResponse