mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-13 16:53:29 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user