Skip to content

Commit

Permalink
Removed Nuke from the demo app (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmitrevski authored Oct 26, 2023
1 parent e83d8ac commit 6ad6a5c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 51 deletions.
9 changes: 1 addition & 8 deletions DemoAppSwiftUI/CustomChannelHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright © 2023 Stream.io Inc. All rights reserved.
//

import NukeUI
import StreamChat
import StreamChatSwiftUI
import SwiftUI
Expand Down Expand Up @@ -42,13 +41,7 @@ public struct CustomChannelHeader: ToolbarContent {
Button {
logoutAlertShown = true
} label: {
LazyImage(url: currentUserController.currentUser?.imageURL)
.onDisappear(.cancel)
.clipShape(Circle())
.frame(
width: 30,
height: 30
)
StreamLazyImage(url: currentUserController.currentUser?.imageURL)
}
}
}
Expand Down
12 changes: 4 additions & 8 deletions DemoAppSwiftUI/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright © 2023 Stream.io Inc. All rights reserved.
//

import NukeUI
import StreamChatSwiftUI
import SwiftUI

Expand Down Expand Up @@ -57,13 +56,10 @@ struct DemoUserView: View {

var body: some View {
HStack {
LazyImage(url: user.avatarURL)
.onDisappear(.cancel)
.clipShape(Circle())
.frame(
width: imageSize,
height: imageSize
)
StreamLazyImage(
url: user.avatarURL,
size: CGSize(width: imageSize, height: imageSize)
)

VStack(alignment: .leading, spacing: 4) {
Text(user.name)
Expand Down
4 changes: 2 additions & 2 deletions Sources/StreamChatSwiftUI/Utils/LazyImageExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import SwiftUI

extension LazyImage {

public init(imageURL: URL?) where Content == NukeImage {
init(imageURL: URL?) where Content == NukeImage {
let imageCDN = InjectedValues[\.utils].imageCDN
guard let imageURL = imageURL else {
#if COCOAPODS
Expand All @@ -25,7 +25,7 @@ extension LazyImage {
#endif
}

public init(imageURL: URL?, @ViewBuilder content: @escaping (LazyImageState) -> Content) {
init(imageURL: URL?, @ViewBuilder content: @escaping (LazyImageState) -> Content) {
let imageCDN = InjectedValues[\.utils].imageCDN
guard let imageURL = imageURL else {
#if COCOAPODS
Expand Down
26 changes: 26 additions & 0 deletions Sources/StreamChatSwiftUI/Utils/StreamLazyImage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright © 2023 Stream.io Inc. All rights reserved.
//

import SwiftUI

public struct StreamLazyImage: View {

var url: URL?
var size: CGSize

public init(url: URL?, size: CGSize = CGSize(width: 30, height: 30)) {
self.url = url
self.size = size
}

public var body: some View {
LazyImage(url: url)
.onDisappear(.cancel)
.clipShape(Circle())
.frame(
width: size.width,
height: size.height
)
}
}
29 changes: 4 additions & 25 deletions StreamChatSwiftUI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@
84289BEB2807239B00282ABE /* MediaAttachmentsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84289BEA2807239B00282ABE /* MediaAttachmentsViewModel.swift */; };
84289BED2807244E00282ABE /* FileAttachmentsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84289BEC2807244E00282ABE /* FileAttachmentsView.swift */; };
84289BEF2807246E00282ABE /* FileAttachmentsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84289BEE2807246E00282ABE /* FileAttachmentsViewModel.swift */; };
842ADEA428EADC6600F2BE36 /* Nuke in Frameworks */ = {isa = PBXBuildFile; productRef = 842ADEA328EADC6600F2BE36 /* Nuke */; };
842ADEA628EADC6600F2BE36 /* NukeUI in Frameworks */ = {isa = PBXBuildFile; productRef = 842ADEA528EADC6600F2BE36 /* NukeUI */; };
842ADEA928EB018C00F2BE36 /* LazyImageExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842ADEA828EB018C00F2BE36 /* LazyImageExtensions.swift */; };
842F036D288E93BF00496D49 /* ChatMessage_AdjustedText_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842F036C288E93BF00496D49 /* ChatMessage_AdjustedText_Tests.swift */; };
842F0BB8276B3518002C400C /* QuotedMessageView_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842F0BB7276B3518002C400C /* QuotedMessageView_Tests.swift */; };
Expand Down Expand Up @@ -424,6 +422,7 @@
84E95A77284A486600699FD3 /* StreamChat in Frameworks */ = {isa = PBXBuildFile; productRef = 84E95A76284A486600699FD3 /* StreamChat */; };
84E95A7D284A491000699FD3 /* StreamChatTestTools in Frameworks */ = {isa = PBXBuildFile; productRef = 84E95A7C284A491000699FD3 /* StreamChatTestTools */; };
84EDBC37274FE5CD0057218D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 84EDBC36274FE5CD0057218D /* Localizable.strings */; };
84F130C12AEAA957006E7B52 /* StreamLazyImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F130C02AEAA957006E7B52 /* StreamLazyImage.swift */; };
84F2908A276B90610045472D /* GalleryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F29089276B90610045472D /* GalleryView.swift */; };
84F2908C276B91700045472D /* ZoomableScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F2908B276B91700045472D /* ZoomableScrollView.swift */; };
84F2908E276B92A40045472D /* GalleryHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F2908D276B92A40045472D /* GalleryHeaderView.swift */; };
Expand Down Expand Up @@ -931,6 +930,7 @@
84E6EC24279AEE9F0017207B /* StreamChatTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamChatTestCase.swift; sourceTree = "<group>"; };
84E6EC26279B0C930017207B /* ReactionsUsersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactionsUsersView.swift; sourceTree = "<group>"; };
84EDBC36274FE5CD0057218D /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
84F130C02AEAA957006E7B52 /* StreamLazyImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamLazyImage.swift; sourceTree = "<group>"; };
84F29089276B90610045472D /* GalleryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryView.swift; sourceTree = "<group>"; };
84F2908B276B91700045472D /* ZoomableScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZoomableScrollView.swift; sourceTree = "<group>"; };
84F2908D276B92A40045472D /* GalleryHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryHeaderView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -982,9 +982,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
842ADEA628EADC6600F2BE36 /* NukeUI in Frameworks */,
84E95A77284A486600699FD3 /* StreamChat in Frameworks */,
842ADEA428EADC6600F2BE36 /* Nuke in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1654,6 +1652,7 @@
841B64C92775BBC10016FF3B /* Errors.swift */,
847CEFED27C38ABE00606257 /* MessageCachingUtils.swift */,
84733EC527FDBF82006926E0 /* NetworkReachability.swift */,
84F130C02AEAA957006E7B52 /* StreamLazyImage.swift */,
842ADEA828EB018C00F2BE36 /* LazyImageExtensions.swift */,
8465FD382746A95600AF091E /* Common */,
);
Expand Down Expand Up @@ -2064,8 +2063,6 @@
name = StreamChatSwiftUI;
packageProductDependencies = (
84E95A76284A486600699FD3 /* StreamChat */,
842ADEA328EADC6600F2BE36 /* Nuke */,
842ADEA528EADC6600F2BE36 /* NukeUI */,
);
productName = StreamChatSwiftUI;
productReference = 8465FBB52746873A00AF091E /* StreamChatSwiftUI.framework */;
Expand Down Expand Up @@ -2160,7 +2157,6 @@
8400A346282C06F90067D3A0 /* XCRemoteSwiftPackageReference "OHHTTPStubs" */,
A3571601283E9D9F0014E3B0 /* XCRemoteSwiftPackageReference "swifter" */,
84E95A75284A486600699FD3 /* XCRemoteSwiftPackageReference "stream-chat-swift" */,
842ADEA228EADC6600F2BE36 /* XCRemoteSwiftPackageReference "Nuke" */,
82543C7B2AD41B0400D5F6CD /* XCRemoteSwiftPackageReference "stream-chat-swift-test-helpers" */,
);
productRefGroup = 8465FBB62746873A00AF091E /* Products */;
Expand Down Expand Up @@ -2372,6 +2368,7 @@
82D64BE02AD7E5B700C5C79E /* LazyImage.swift in Sources */,
82D64C052AD7E5B700C5C79E /* Deprecated.swift in Sources */,
84DEC8EC27611CAE00172876 /* SendInChannelView.swift in Sources */,
84F130C12AEAA957006E7B52 /* StreamLazyImage.swift in Sources */,
82D64BD12AD7E5B700C5C79E /* Image.swift in Sources */,
82D64BD52AD7E5B700C5C79E /* AnimatedFrame.swift in Sources */,
8465FD9F2746A95700AF091E /* ChatChannelExtensions.swift in Sources */,
Expand Down Expand Up @@ -3240,14 +3237,6 @@
minimumVersion = 9.0.0;
};
};
842ADEA228EADC6600F2BE36 /* XCRemoteSwiftPackageReference "Nuke" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/kean/Nuke.git";
requirement = {
kind = exactVersion;
version = 11.3.1;
};
};
8465FCB227468A8D00AF091E /* XCRemoteSwiftPackageReference "stream-chat-swift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/GetStream/stream-chat-swift.git";
Expand Down Expand Up @@ -3298,16 +3287,6 @@
package = 8400A346282C06F90067D3A0 /* XCRemoteSwiftPackageReference "OHHTTPStubs" */;
productName = OHHTTPStubs;
};
842ADEA328EADC6600F2BE36 /* Nuke */ = {
isa = XCSwiftPackageProductDependency;
package = 842ADEA228EADC6600F2BE36 /* XCRemoteSwiftPackageReference "Nuke" */;
productName = Nuke;
};
842ADEA528EADC6600F2BE36 /* NukeUI */ = {
isa = XCSwiftPackageProductDependency;
package = 842ADEA228EADC6600F2BE36 /* XCRemoteSwiftPackageReference "Nuke" */;
productName = NukeUI;
};
8465FCE32746954F00AF091E /* StreamChat */ = {
isa = XCSwiftPackageProductDependency;
package = 8465FCB227468A8D00AF091E /* XCRemoteSwiftPackageReference "stream-chat-swift" */;
Expand Down
9 changes: 1 addition & 8 deletions StreamChatSwiftUITestsApp/CustomChannelHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright © 2023 Stream.io Inc. All rights reserved.
//

import NukeUI
import StreamChat
import StreamChatSwiftUI
import SwiftUI
Expand All @@ -28,13 +27,7 @@ public struct CustomChannelHeader: ToolbarContent {
Button {
logoutAlertShown = true
} label: {
LazyImage(url: currentUserController.currentUser?.imageURL)
.onDisappear(.cancel)
.clipShape(Circle())
.frame(
width: 30,
height: 30
)
StreamLazyImage(url: currentUserController.currentUser?.imageURL)
}
.accessibilityAddTraits(.isButton)
.accessibilityIdentifier("LogoutButton")
Expand Down

0 comments on commit 6ad6a5c

Please sign in to comment.