Skip to content

Commit

Permalink
Updated the file implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
vanlooverenkoen committed Sep 20, 2022
1 parent a182231 commit 1e1981b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ios/Classes/FCPExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension UIImage {
func fromCorrectSource(name: String) -> UIImage {
if (name.starts(with: "http")) {
return fromUrl(url: name)
} else if (name.starts(with: "//")) {
} else if (name.starts(with: "file://")) {
return fromFile(path: name)
}
return fromFlutterAsset(name: name)
Expand All @@ -31,7 +31,8 @@ extension UIImage {

@available(iOS 14.0, *)
func fromFile(path: String) -> UIImage {
let image: UIImage? = UIImage(contentsOfFile: path)
let cleanPath = path.replacingOccurrences(of: "file://", with: "")
let image: UIImage? = UIImage(contentsOfFile: cleanPath)
return image ?? UIImage(systemName: "questionmark")!
}

Expand Down

0 comments on commit 1e1981b

Please sign in to comment.