@@ -55,7 +55,6 @@ class DownloadManager: NSObject, ObservableObject {
5555
5656 func getDownloadUrls( ) {
5757 results = [ ]
58- print ( " start of json fetch. results array count: \( results. count) " )
5958 guard let url = URL ( string: " https://api.github.com/repos/InfiniTimeOrg/InfiniTime/releases " ) else {
6059 return
6160 }
@@ -65,7 +64,6 @@ class DownloadManager: NSObject, ObservableObject {
6564 let res = try JSONDecoder ( ) . decode ( [ Result ] . self, from: data)
6665 DispatchQueue . main. async {
6766 for i in res {
68- print ( i. tag_name)
6967 if i. tag_name. first != " v " {
7068 if UserDefaults . standard. value ( forKey: " showNewDownloadsOnly " ) as? Bool ?? true {
7169 let comparison = BLEDeviceInfo . shared. firmware. compare ( i. tag_name, options: . numeric)
@@ -80,13 +78,10 @@ class DownloadManager: NSObject, ObservableObject {
8078 self . updateAvailable = self . checkForUpdates ( )
8179 }
8280 } catch {
83- print ( " urlsession catch " )
84- print ( error)
85-
81+ DebugLogManager . shared. debug ( error: " JSON Decoding Error: \( error) " , log: . app, date: Date ( ) )
8682 }
8783 }
8884 } . resume ( )
89- print ( " end of json fetch " )
9085 }
9186
9287 func chooseAsset( response: Result ) -> Asset {
@@ -117,8 +112,6 @@ class DownloadManager: NSObject, ObservableObject {
117112
118113extension DownloadManager : URLSessionDelegate , URLSessionDownloadDelegate {
119114 func urlSession( _: URLSession , downloadTask: URLSessionDownloadTask , didWriteData _: Int64 , totalBytesWritten _: Int64 , totalBytesExpectedToWrite _: Int64 ) {
120- // uncomment for progress updates in console
121- //print("Progress " + String(downloadTask.progress.fractionCompleted))
122115 }
123116
124117 func urlSession( _: URLSession , downloadTask: URLSessionDownloadTask , didFinishDownloadingTo location: URL ) {
@@ -131,15 +124,14 @@ extension DownloadManager: URLSessionDelegate, URLSessionDownloadDelegate {
131124 // check for existing file and delete it if there is anything.
132125 if FileManager . default. fileExists ( atPath: savedURL. path) {
133126 try ? FileManager . default. removeItem ( at: savedURL)
134- print ( " old file deleted " )
135127 }
136128
137129 // move downloaded file out of ephemeral storage and tell DFU where to look
138130 try FileManager . default. moveItem ( at: location, to: savedURL)
139131 DFU_Updater . shared. firmwareURL = savedURL
140132
141133 } catch let fmerror {
142- print ( " filesystem error : \( fmerror) " )
134+ DebugLogManager . shared . debug ( error : " Error saving downloaded firmware file : \( fmerror) " , log : . app , date : Date ( ) )
143135 // handle filesystem error
144136 }
145137 DispatchQueue . main. async {
@@ -149,10 +141,7 @@ extension DownloadManager: URLSessionDelegate, URLSessionDownloadDelegate {
149141
150142 func urlSession( _: URLSession , task: URLSessionTask , didCompleteWithError error: Error ? ) {
151143 if let error = error {
152- print ( " Download error: %@ " + String( describing: error) )
153- // uncomment to print that it finished
154- // } else {
155- // print("Task finished: %@" )//+ task)
144+ DebugLogManager . shared. debug ( error: " Download error: \( String ( describing: error) ) " , log: . app, date: Date ( ) )
156145 }
157146 }
158147}
0 commit comments