Skip to content

Commit

Permalink
Migrate from SDWebImage to Nuke
Browse files Browse the repository at this point in the history
  • Loading branch information
danpashin committed Jun 15, 2024
1 parent 0fecea0 commit b7ffd6f
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 62 deletions.
2 changes: 0 additions & 2 deletions twackup-gui/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ target "Twackup" do
platform :ios, "14.0"
use_frameworks! :linkage => :static

pod "SDWebImage"
pod "Sentry"
pod "DZNEmptyDataSet"
pod "StyledTextKit"

Expand Down
14 changes: 1 addition & 13 deletions twackup-gui/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
PODS:
- DZNEmptyDataSet (1.8.1)
- SDWebImage (5.19.2):
- SDWebImage/Core (= 5.19.2)
- SDWebImage/Core (5.19.2)
- Sentry (8.28.0):
- Sentry/Core (= 8.28.0)
- Sentry/Core (8.28.0)
- StyledTextKit (0.2.0)

DEPENDENCIES:
- DZNEmptyDataSet
- SDWebImage
- Sentry
- StyledTextKit

SPEC REPOS:
trunk:
- DZNEmptyDataSet
- SDWebImage
- Sentry
- StyledTextKit

SPEC CHECKSUMS:
DZNEmptyDataSet: 9525833b9e68ac21c30253e1d3d7076cc828eaa7
SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a
Sentry: 1482a20b132098929714143f436a4fe574ad0517
StyledTextKit: dbfb29a59922c6f18897a0266acd139b7c9e712b

PODFILE CHECKSUM: a9ff5b807d1ae60c2e0cea81cc3e17c39440f4ef
PODFILE CHECKSUM: 0333d228da71984d961f27bce3f4f90e02f0018b

COCOAPODS: 1.15.2
120 changes: 84 additions & 36 deletions twackup-gui/Twackup.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
0BBD2FDF2C1C67D500438457 /* DpkgProgressNotifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BBD2FDE2C1C67D500438457 /* DpkgProgressNotifier.swift */; };
0BE2E0B22C1B346B00CADFE3 /* SwiftConversions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BE2E0B12C1B346B00CADFE3 /* SwiftConversions.swift */; };
0BE78040294DC60C00AE77CE /* DpkgListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BE7803F294DC60C00AE77CE /* DpkgListModel.swift */; };
0BE87E862C1E0166009C95A7 /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = 0BE87E852C1E0166009C95A7 /* Sentry */; };
0BE87E902C1E0565009C95A7 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BE87E8F2C1E0565009C95A7 /* Result.swift */; };
0BE87E932C1E05CE009C95A7 /* NukeUI in Frameworks */ = {isa = PBXBuildFile; productRef = 0BE87E922C1E05CE009C95A7 /* NukeUI */; };
0BF07A502941027800EEC8FC /* SplitController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BF07A4F2941027800EEC8FC /* SplitController.swift */; };
0BF07A5C2941D8D100EEC8FC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0BF07A592941D8D100EEC8FC /* Localizable.strings */; };
0BF07A62294335F700EEC8FC /* FFILogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BF07A61294335F700EEC8FC /* FFILogger.swift */; };
Expand Down Expand Up @@ -144,6 +147,7 @@
0BBD2FDE2C1C67D500438457 /* DpkgProgressNotifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DpkgProgressNotifier.swift; sourceTree = "<group>"; };
0BE2E0B12C1B346B00CADFE3 /* SwiftConversions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftConversions.swift; sourceTree = "<group>"; };
0BE7803F294DC60C00AE77CE /* DpkgListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DpkgListModel.swift; sourceTree = "<group>"; };
0BE87E8F2C1E0565009C95A7 /* Result.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = "<group>"; };
0BF07A4F2941027800EEC8FC /* SplitController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplitController.swift; sourceTree = "<group>"; };
0BF07A5A2941D8D100EEC8FC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
0BF07A5B2941D8D100EEC8FC /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand All @@ -164,7 +168,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0BE87E932C1E05CE009C95A7 /* NukeUI in Frameworks */,
C1FF8C5621CC9FEC564B8CCE /* Pods_Twackup.framework in Frameworks */,
0BE87E862C1E0166009C95A7 /* Sentry in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -186,6 +192,7 @@
children = (
0B0DBB6E2934FA58002F3BB2 /* String.swift */,
0B86CDCC2C199FA500F3B4A0 /* Jailbreaks.swift */,
0BE87E8F2C1E0565009C95A7 /* Result.swift */,
);
path = Helpers;
sourceTree = "<group>";
Expand Down Expand Up @@ -486,13 +493,16 @@
0B8661622930ADA300EA4301 /* Frameworks */,
0B8661632930ADA300EA4301 /* Resources */,
0B0DBB702934FAB5002F3BB2 /* Lint swift sources */,
F1259801DF613223D64EE4AB /* [CP] Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
);
name = Twackup;
packageProductDependencies = (
0BE87E852C1E0166009C95A7 /* Sentry */,
0BE87E922C1E05CE009C95A7 /* NukeUI */,
);
productName = Twackup;
productReference = 0B8661652930ADA300EA4301 /* Twackup.app */;
productType = "com.apple.product-type.application";
Expand Down Expand Up @@ -522,6 +532,10 @@
ru,
);
mainGroup = 0B86615C2930ADA300EA4301;
packageReferences = (
0BE87E842C1E0166009C95A7 /* XCRemoteSwiftPackageReference "sentry-cocoa" */,
0BE87E912C1E05CE009C95A7 /* XCRemoteSwiftPackageReference "Nuke" */,
);
productRefGroup = 0B8661662930ADA300EA4301 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -587,23 +601,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
F1259801DF613223D64EE4AB /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Twackup/Pods-Twackup-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Twackup/Pods-Twackup-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Twackup/Pods-Twackup-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand All @@ -629,6 +626,7 @@
0B50FF742949EAB900CF4BCF /* DiskSpaceUsageView.swift in Sources */,
0B5B332B294DA9F00097398F /* MainModel.swift in Sources */,
0BF07A6429433BE100EEC8FC /* LogViewController.swift in Sources */,
0BE87E902C1E0565009C95A7 /* Result.swift in Sources */,
0BB369E52952EF6B004AAFFF /* ScrollableViewController.swift in Sources */,
0B5B332F294DB7770097398F /* InstalledPackagesModel.swift in Sources */,
0B463A9B29389EBB00021EF7 /* DebsListModel.swift in Sources */,
Expand Down Expand Up @@ -849,11 +847,14 @@
MARKETING_VERSION = 2.0.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-framework",
"\"ImageIO\"",
"\"DZNEmptyDataSet\"",
"-framework",
"\"SDWebImage\"",
"$(PROJECT_DIR)/../target/libtwackup.a",
"\"StyledTextKit\"",
"-framework",
"\"UIKit\"",
"\"$(PROJECT_DIR)/../target/libtwackup.a\"",
);
PRODUCT_BUNDLE_IDENTIFIER = ru.danpashin.Twackup;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -905,11 +906,14 @@
MARKETING_VERSION = 2.0.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-framework",
"\"DZNEmptyDataSet\"",
"-framework",
"\"ImageIO\"",
"\"StyledTextKit\"",
"-framework",
"\"SDWebImage\"",
"$(PROJECT_DIR)/../target/libtwackup.a",
"\"UIKit\"",
"\"$(PROJECT_DIR)/../target/libtwackup.a\"",
);
PRODUCT_BUNDLE_IDENTIFIER = ru.danpashin.Twackup;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1022,11 +1026,14 @@
MARKETING_VERSION = 2.0.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-framework",
"\"ImageIO\"",
"\"DZNEmptyDataSet\"",
"-framework",
"\"SDWebImage\"",
"$(PROJECT_DIR)/../target/libtwackup.a",
"\"StyledTextKit\"",
"-framework",
"\"UIKit\"",
"\"$(PROJECT_DIR)/../target/libtwackup.a\"",
);
PRODUCT_BUNDLE_IDENTIFIER = ru.danpashin.Twackup;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1134,11 +1141,14 @@
MARKETING_VERSION = 2.0.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-framework",
"\"DZNEmptyDataSet\"",
"-framework",
"\"ImageIO\"",
"\"StyledTextKit\"",
"-framework",
"\"SDWebImage\"",
"$(PROJECT_DIR)/../target/libtwackup.a",
"\"UIKit\"",
"\"$(PROJECT_DIR)/../target/libtwackup.a\"",
);
PRODUCT_BUNDLE_IDENTIFIER = ru.danpashin.Twackup;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1251,11 +1261,14 @@
MARKETING_VERSION = 2.0.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-framework",
"\"ImageIO\"",
"\"DZNEmptyDataSet\"",
"-framework",
"\"SDWebImage\"",
"$(PROJECT_DIR)/../target/libtwackup.a",
"\"StyledTextKit\"",
"-framework",
"\"UIKit\"",
"\"$(PROJECT_DIR)/../target/libtwackup.a\"",
);
PRODUCT_BUNDLE_IDENTIFIER = ru.danpashin.Twackup;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1363,11 +1376,14 @@
MARKETING_VERSION = 2.0.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-framework",
"\"DZNEmptyDataSet\"",
"-framework",
"\"ImageIO\"",
"\"StyledTextKit\"",
"-framework",
"\"SDWebImage\"",
"$(PROJECT_DIR)/../target/libtwackup.a",
"\"UIKit\"",
"\"$(PROJECT_DIR)/../target/libtwackup.a\"",
);
PRODUCT_BUNDLE_IDENTIFIER = ru.danpashin.Twackup;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1423,6 +1439,38 @@
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
0BE87E842C1E0166009C95A7 /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/getsentry/sentry-cocoa";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 8.29.0;
};
};
0BE87E912C1E05CE009C95A7 /* XCRemoteSwiftPackageReference "Nuke" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/kean/Nuke";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 12.7.2;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
0BE87E852C1E0166009C95A7 /* Sentry */ = {
isa = XCSwiftPackageProductDependency;
package = 0BE87E842C1E0166009C95A7 /* XCRemoteSwiftPackageReference "sentry-cocoa" */;
productName = Sentry;
};
0BE87E922C1E05CE009C95A7 /* NukeUI */ = {
isa = XCSwiftPackageProductDependency;
package = 0BE87E912C1E05CE009C95A7 /* XCRemoteSwiftPackageReference "Nuke" */;
productName = NukeUI;
};
/* End XCSwiftPackageProductDependency section */

/* Begin XCVersionGroup section */
0B5D3F982934D0C300AE50F2 /* Twackup.xcdatamodeld */ = {
isa = XCVersionGroup;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"originHash" : "d1aeda81a7bf270897b56c013ea456af992a1f3b963407fcd269c45746c97503",
"pins" : [
{
"identity" : "nuke",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kean/Nuke",
"state" : {
"revision" : "084076db4f9b9ee4db51177ef5a4879689c1aa09",
"version" : "12.7.2"
}
},
{
"identity" : "sentry-cocoa",
"kind" : "remoteSourceControl",
"location" : "https://github.com/getsentry/sentry-cocoa",
"state" : {
"revision" : "c9a692ba837f4832ec7ce6378c071cb91cb55f92",
"version" : "8.29.0"
}
}
],
"version" : 3
}
22 changes: 22 additions & 0 deletions twackup-gui/Twackup/Sources/Helpers/Result.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// Result.swift
// Twackup
//
// Created by Daniil on 15.06.2024.
//

extension Result {
var isSuccess: Bool {
return value != nil
}

var value: Success? {
switch self {
case let .success(value):
return value

case .failure:
return nil
}
}
}
20 changes: 9 additions & 11 deletions twackup-gui/Twackup/Sources/Views/Package/PackageDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Daniil on 25.11.2022.
//

import SDWebImage
import NukeUI
import UIKit

@MainActor
Expand Down Expand Up @@ -49,14 +49,18 @@ class PackageDetailedView: UIView {
}()

private(set) lazy var logoHeightConstraint = logoView.heightAnchor.constraint(equalToConstant: 0.0)
private(set) lazy var logoView: UIImageView = {
let view = UIImageView()
private(set) lazy var logoView: LazyImageView = {
let view = LazyImageView()
view.translatesAutoresizingMaskIntoConstraints = false
view.contentMode = .scaleAspectFit
view.layer.cornerCurve = .continuous
view.layer.cornerRadius = 14
view.layer.masksToBounds = true

view.onCompletion = { [self] result in
logoHeightConstraint.constant = result.isSuccess ? 60 : 0
}

return view
}()

Expand Down Expand Up @@ -112,6 +116,7 @@ class PackageDetailedView: UIView {
let constraints = [
logoView.topAnchor.constraint(equalTo: scrollView.topAnchor),
logoHeightConstraint,
logoView.widthAnchor.constraint(equalTo: logoView.heightAnchor),
logoView.centerXAnchor.constraint(equalTo: scrollView.centerXAnchor),

labelsStack.topAnchor.constraint(equalTo: logoView.bottomAnchor),
Expand Down Expand Up @@ -146,14 +151,7 @@ class PackageDetailedView: UIView {
}

if let icon = package.icon {
if icon.isFileURL {
logoView.image = UIImage(contentsOfFile: icon.relativePath)
logoHeightConstraint.constant = logoView.image != nil ? 60.0 : 0.0
} else {
logoView.sd_setImage(with: icon, placeholderImage: nil) { img, _, _, _ in
self.logoHeightConstraint.constant = img != nil ? 60.0 : 0.0
}
}
logoView.url = icon
} else {
logoHeightConstraint.constant = 0.0
}
Expand Down

0 comments on commit b7ffd6f

Please sign in to comment.