Skip to content

Commit

Permalink
tidied syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
bryce-b committed Nov 21, 2024
1 parent df96519 commit eda5b4d
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions Sources/Instrumentation/URLSession/URLSessionInstrumentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ public class URLSessionInstrumentation {

static let AVTaskClassList : [AnyClass] = {
let names = ["__NSCFBackgroundAVAggregateAssetDownloadTask", "__NSCFBackgroundAVAssetDownloadTask", "__NSCFBackgroundAVAggregateAssetDownloadTaskNoChildTask" ]
var classes : [AnyClass] = []
for name in names {
if let aClass = NSClassFromString(name) {
classes.append(aClass)
}
}
let classes : [AnyClass] = names.compactMap { NSClassFromString($0) }
return classes
}()

Expand Down Expand Up @@ -601,11 +596,7 @@ public class URLSessionInstrumentation {

private func urlSessionTaskWillResume(_ task: URLSessionTask) {
// AV Asset Tasks cannot be auto instrumented, they dont include request attributes, skip them
for aClass in Self.AVTaskClassList {
if task.isKind(of: aClass) {
return
}
}
guard !Self.AVTaskClassList.contains(where: {task.isKind(of:$0)}) else { return }

// We cannot instrument async background tasks because they crash if you assign a delegate
if #available(OSX 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) {
Expand Down

0 comments on commit eda5b4d

Please sign in to comment.