Skip to content

Commit

Permalink
chore(ios): revert unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 authored and matinzd committed Dec 21, 2023
1 parent 9e001e8 commit 9174c29
Showing 1 changed file with 9 additions and 34 deletions.
43 changes: 9 additions & 34 deletions packages/core/ios/LottieReactNative/ContainerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,37 +166,21 @@ class ContainerView: RCTView {
return
}

var url = URL(string: uri)

if url?.scheme == nil {
// interpret raw URL paths as relative to the resource bundle
url = URL(fileURLWithPath: uri, relativeTo: Bundle.main.resourceURL)
}

guard let url = url else { return }

let completion: (LottieAnimationView, Error?) -> Void = { [weak self] view, error in
guard let self = self else { return }
if let error = error {
self.failureCallback(error.localizedDescription)
return
}
self.replaceAnimationView(next: view)
}

if (url.scheme == "file") {
_ = LottieAnimationView(
dotLottieFilePath: url.path,
configuration: lottieConfiguration,
completion: completion
)
guard let url = URL(string: uri) else {
return
}

_ = LottieAnimationView(
dotLottieUrl: url,
configuration: lottieConfiguration,
completion: completion
completion: { [weak self] view, error in
guard let self = self else { return }
if let error = error {
self.failureCallback(error.localizedDescription)
return
}
self.replaceAnimationView(next: view)
}
)
}

Expand All @@ -214,15 +198,6 @@ class ContainerView: RCTView {

guard let url = url else { return }

if (url.scheme == "file") {
let nextAnimationView = LottieAnimationView(
filePath: url.path,
configuration: lottieConfiguration
)
replaceAnimationView(next: nextAnimationView)
return
}

self.fetchRemoteAnimation(from: url)
}

Expand Down

0 comments on commit 9174c29

Please sign in to comment.