Skip to content

Commit c8320d4

Browse files
committed
Revert the wrong changes to fix the unit test
1 parent 3340ea4 commit c8320d4

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Example/SDWebImageSwiftUIDemo/ContentView.swift

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class UserSettings: ObservableObject {
1717
#endif
1818
}
1919

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

3133
// Test Switching nil url
3234
struct ContentView3: View {

SDWebImageSwiftUI/Classes/AnimatedImage.swift

+3-6
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,6 @@ public struct AnimatedImage : PlatformViewRepresentable {
309309
#endif
310310
context.coordinator.imageLoading.imageName = name
311311
view.wrapped.image = image
312-
// Finished loading, sync
313-
finishUpdateView(view, context: context, image: image)
314312
}
315313

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

331327
private func updateViewForURL(_ url: URL?, view: AnimatedImageViewWrapper, context: Context) {
@@ -350,8 +346,6 @@ public struct AnimatedImage : PlatformViewRepresentable {
350346
setupIndicator(view, context: context)
351347
loadImage(view, context: context)
352348
}
353-
// Finished loading, sync
354-
finishUpdateView(view, context: context, image: view.wrapped.image)
355349
}
356350

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

366+
// Finished loading, sync
367+
finishUpdateView(view, context: context, image: view.wrapped.image)
368+
372369
if let viewUpdateBlock = imageHandler.viewUpdateBlock {
373370
viewUpdateBlock(view.wrapped, context)
374371
}

0 commit comments

Comments
 (0)