Skip to content

Commit

Permalink
Reapply changes
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed Jun 10, 2024
1 parent b701edd commit 7856e0f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Sources/SwiftUI/ImageBinder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ extension KFImage {
/// Restores the download task priority to default if it is in progress.
func restorePriorityOnAppear() {
guard let downloadTask = downloadTask, loading == true else { return }
downloadTask.sessionTask.task.priority = URLSessionTask.defaultPriority
downloadTask.sessionTask?.task.priority = URLSessionTask.defaultPriority
}

/// Reduce the download task priority if it is in progress.
func reducePriorityOnDisappear() {
guard let downloadTask = downloadTask, loading == true else { return }
downloadTask.sessionTask.task.priority = URLSessionTask.lowPriority
downloadTask.sessionTask?.task.priority = URLSessionTask.lowPriority
}
}
}
Expand Down
15 changes: 8 additions & 7 deletions Sources/Utility/String+SHA256.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ extension KingfisherWrapper where Base == String {
}

var ext: String? {
var ext = ""
if let index = base.lastIndex(of: ".") {
let extRange = base.index(index, offsetBy: 1)..<base.endIndex
ext = String(base[extRange])
}
guard let firstSeg = ext.split(separator: "@").first else {
guard let firstSeg = base.split(separator: "@").first else {
return nil
}
return firstSeg.count > 0 ? String(firstSeg) : nil

var ext = ""
if let index = firstSeg.lastIndex(of: ".") {
let extRange = firstSeg.index(index, offsetBy: 1)..<firstSeg.endIndex
ext = String(firstSeg[extRange])
}
return ext.count > 0 ? ext : nil
}
}

0 comments on commit 7856e0f

Please sign in to comment.