Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

feat: 🎸 gif supported by SDWebImage #32

Merged

Conversation

ShadowTourist
Copy link
Contributor

@ShadowTourist ShadowTourist commented Aug 9, 2021

Support gif by SDWebImage

@ShadowTourist ShadowTourist force-pushed the change-urlimage-to-sdwebimage branch from 6779dac to d3d8c45 Compare August 9, 2021 09:19
@ShadowTourist
Copy link
Contributor Author

before after
Screen Shot 2021-08-09 at 4 59 59 PM Screen Shot 2021-08-09 at 5 05 22 PM

@MarcoEidinger MarcoEidinger added the wip work in progress label Aug 9, 2021
@MarcoEidinger MarcoEidinger changed the title refactor: 💡 SDWebImageSwiftUI Research wip: 💡 SDWebImageSwiftUI Research Aug 9, 2021
@ShadowTourist ShadowTourist force-pushed the change-urlimage-to-sdwebimage branch 5 times, most recently from f851191 to e0ceae7 Compare August 27, 2021 10:14
@ShadowTourist ShadowTourist force-pushed the change-urlimage-to-sdwebimage branch from e0ceae7 to 84ce935 Compare September 1, 2021 02:50
@ShadowTourist ShadowTourist changed the title wip: 💡 SDWebImageSwiftUI Research feat: 🎸 gif supported by SDWebImage Sep 1, 2021
@MarcoEidinger MarcoEidinger changed the base branch from dev to devBreaking September 1, 2021 22:32
Copy link
Member

@MarcoEidinger MarcoEidinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks really good!

I noticed that cache has a certain impact on memory. Lets add a section to the README to inform the app developer that app developer decides if/when image cache gets deleted. For example, for onDisappear for AssistantView the following is possible

SDImageCache.shared.clearMemory()
SDImageCache.shared.clearDisk()

Also the README file has to be updated in the following areas

.frame(width: 32, height: 32, alignment: .center)
.clipped()
} else {
Image(systemName: "icloud.slash")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this new?

}
}

struct ImageViewWrapper<Content>: View where Content: View {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a Preview for ImageViewWrapper


func updateUIView(_ uiView: UIImageViewWrapper, context: UIViewRepresentableContext<ImageViewRepresentable>) {
uiView.imageView.contentMode = self.imageManager.contentMode
/// retry strategy missed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this comment mean?

@ShadowTourist ShadowTourist force-pushed the change-urlimage-to-sdwebimage branch from 2275708 to c989908 Compare September 2, 2021 03:03
@ShadowTourist ShadowTourist force-pushed the change-urlimage-to-sdwebimage branch from c989908 to 9becf1a Compare September 2, 2021 03:19
Copy link
Member

@MarcoEidinger MarcoEidinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank yo so much @ShadowTourist , that looks really great!!

@justinguo I assume that is also fine from your side?

Here is my last-minute nit-picking feedback. Once incorporated I will merge the PR into a new branch devBreaking.

Just in case you or Justin wonder why a new branch: there are already changes in dev branch which were not yet published. I might want to roll those out as a patch release but the gif support through SDWebImage is a minor/major release worth due to the breaking changes of switching package dependencies.

@@ -1,4 +1,5 @@
import Combine
import SDWebImage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed here. If so please remove

README.md Outdated
@@ -87,7 +87,7 @@ curl -X POST "<BaseUrl>/connect/v1/channels" \

- [SAPCommon](https://help.sap.com/doc/978e4f6c968c4cc5a30f9d324aa4b1d7/Latest/en-US/Documents/Frameworks/SAPCommon/index.html) for Logging
- [SAPFoundation](https://help.sap.com/doc/978e4f6c968c4cc5a30f9d324aa4b1d7/Latest/en-US/Documents/Frameworks/SAPFoundation/index.html) for Network Connectivity and Authentication
- [URLImage](https://github.com/dmytro-anokhin/url-image) for asynchronous image loading in SwiftUI
- [SDWebImage](https://github.com/SDWebImage/SDWebImage) for asynchronous image loading in SwiftUI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [SDWebImage](https://github.com/SDWebImage/SDWebImage) for asynchronous image loading in SwiftUI
- [SDWebImage](https://github.com/SDWebImage/SDWebImage) for asynchronous image loading and gif animation in SwiftUI

README.md Outdated
@@ -146,6 +146,9 @@ AssistantView()
.onDisappear {
viewModel.cancelSubscriptions()
dataPublisher.resetConversation()
//Clear SDImage Cache
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//Clear SDImage Cache
// SAPCAI uses `SDWebImage` and its image caching capabilities but it is the app developers responsibility to clear the cache if that is desired

@justinguo
Copy link

Overall looks good to me. I tested and it works fine on device.

@justinguo
Copy link

@ShadowTourist Did you add the retry operation in updateUIView() method? Like if display failure view, can user tap the image again to retry the downloading and decoding?

@ShadowTourist
Copy link
Contributor Author

@ShadowTourist Did you add the retry operation in updateUIView() method? Like if display failure view, can user tap the image again to retry the downloading and decoding?

No, currently image view has no capability of interaction, so retry can be added by SDWebImage, there is a option called SDWebImageRetryFailed for image load failed. If we need add this for ImageViewWrapper?

@MarcoEidinger MarcoEidinger merged commit ba6cf23 into SAP:devBreaking Sep 3, 2021
MarcoEidinger pushed a commit that referenced this pull request Sep 30, 2021
* feat: 🎸 gif supported by SDWebImage.

* feat: 🎸 placeholder and failure support alse README updated

* docs: ✏️ update README
MarcoEidinger added a commit that referenced this pull request Sep 30, 2021
* feat: 🎸 gif supported by SDWebImage.

* feat: 🎸 placeholder and failure support alse README updated

* docs: ✏️ update README

Co-authored-by: XiaoYu <33440079+ShadowTourist@users.noreply.github.com>
MarcoEidinger added a commit to MarcoEidinger/cloud-sdk-ios-cai that referenced this pull request Nov 1, 2021
* feat: 🎸 gif supported by SDWebImage.

* feat: 🎸 placeholder and failure support alse README updated

* docs: ✏️ update README

Co-authored-by: XiaoYu <33440079+ShadowTourist@users.noreply.github.com>
MarcoEidinger added a commit that referenced this pull request Nov 1, 2021
* feat: 🎸 gif supported by SDWebImage.

* feat: 🎸 placeholder and failure support alse README updated

* docs: ✏️ update README

Co-authored-by: XiaoYu <33440079+ShadowTourist@users.noreply.github.com>
MarcoEidinger added a commit that referenced this pull request Nov 10, 2021
* feat: 🎸 gif supported by SDWebImage.

* feat: 🎸 placeholder and failure support alse README updated

* docs: ✏️ update README

Co-authored-by: XiaoYu <33440079+ShadowTourist@users.noreply.github.com>
MarcoEidinger added a commit that referenced this pull request Nov 10, 2021
* feat: 🎸 gif supported by SDWebImage.

* feat: 🎸 placeholder and failure support alse README updated

* docs: ✏️ update README

Co-authored-by: XiaoYu <33440079+ShadowTourist@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wip work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants