Skip to content

Commit

Permalink
Revert the wrong changes to fix the unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dreampiggy committed Jun 27, 2024
1 parent 3340ea4 commit c8320d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Example/SDWebImageSwiftUIDemo/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class UserSettings: ObservableObject {
#endif
}

#if !os(watchOS)
struct ContentView4: View {
var url = URL(string: "https://github.com/SDWebImage/SDWebImageSwiftUI/assets/97430818/72d27f90-e9d8-48d7-b144-82ada828a027")!
var body: some View {
Expand All @@ -27,6 +28,7 @@ struct ContentView4: View {
.clipShape(RoundedRectangle(cornerRadius: 50, style: .continuous))
}
}
#endif

// Test Switching nil url
struct ContentView3: View {
Expand Down
9 changes: 3 additions & 6 deletions SDWebImageSwiftUI/Classes/AnimatedImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,6 @@ public struct AnimatedImage : PlatformViewRepresentable {
#endif
context.coordinator.imageLoading.imageName = name
view.wrapped.image = image
// Finished loading, sync
finishUpdateView(view, context: context, image: image)
}

private func updateViewForData(_ data: Data?, view: AnimatedImageViewWrapper, context: Context) {
Expand All @@ -324,8 +322,6 @@ public struct AnimatedImage : PlatformViewRepresentable {
}
context.coordinator.imageLoading.imageData = data
view.wrapped.image = image
// Finished loading, sync
finishUpdateView(view, context: context, image: image)
}

private func updateViewForURL(_ url: URL?, view: AnimatedImageViewWrapper, context: Context) {
Expand All @@ -350,8 +346,6 @@ public struct AnimatedImage : PlatformViewRepresentable {
setupIndicator(view, context: context)
loadImage(view, context: context)
}
// Finished loading, sync
finishUpdateView(view, context: context, image: view.wrapped.image)
}

func updateView(_ view: AnimatedImageViewWrapper, context: Context) {
Expand All @@ -369,6 +363,9 @@ public struct AnimatedImage : PlatformViewRepresentable {
break // impossible
}

// Finished loading, sync
finishUpdateView(view, context: context, image: view.wrapped.image)

if let viewUpdateBlock = imageHandler.viewUpdateBlock {
viewUpdateBlock(view.wrapped, context)
}
Expand Down

0 comments on commit c8320d4

Please sign in to comment.