Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions ios/main/StallionFileDownloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ import Foundation
import ZIPFoundation

class StallionFileDownloader: NSObject {
private lazy var urlSession = URLSession(configuration: .default,
delegate: self,
delegateQueue: nil)
private lazy var urlSession: URLSession = {
let configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = 540.0 // 9 minutes per request
configuration.timeoutIntervalForResource = 3600.0 // 1 hour total
configuration.waitsForConnectivity = true
return URLSession(configuration: configuration, delegate: self, delegateQueue: nil)
}()
private var downloadTask: URLSessionDownloadTask?
private var _resolve: RCTPromiseResolveBlock?
private var _reject: RCTPromiseRejectBlock?
Expand Down Expand Up @@ -65,9 +69,9 @@ class StallionFileDownloader: NSObject {
let downloadFolder = URL(fileURLWithPath: downloadDirectory, isDirectory: true)
let fileManager = FileManager.default

// Delete existing folder if it exists
// Delete existing folder if it exists (ignore errors - we'll create it anyway)
if fileManager.fileExists(atPath: downloadFolder.path) {
try fileManager.removeItem(at: downloadFolder)
try? fileManager.removeItem(at: downloadFolder)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Thor963 , Can you please explain the comment you have added here ?

}

// Create new download folder
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-stallion",
"version": "2.4.0-alpha.4",
"version": "2.4.0-alpha.6",
"description": "Offical React Native SDK for Stallion",
"main": "index",
"types": "types/index.d.ts",
Expand Down