Skip to content

Commit

Permalink
Fix optimisation on copied JPEGs as public.png
Browse files Browse the repository at this point in the history
  • Loading branch information
alin23 committed Aug 23, 2023
1 parent 446b4bc commit ec96260
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Clop.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
CODE_SIGN_ENTITLEMENTS = Clop/Clop.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.1.2;
CURRENT_PROJECT_VERSION = 2.1.3;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Clop/Preview Content\"";
DEVELOPMENT_TEAM = RDDXV84A73;
Expand All @@ -421,7 +421,7 @@
"$(PROJECT_DIR)/Clop/bin",
);
LLVM_LTO = YES_THIN;
MARKETING_VERSION = 2.1.2;
MARKETING_VERSION = 2.1.3;
PRODUCT_BUNDLE_IDENTIFIER = com.lowtechguys.Clop;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -437,7 +437,7 @@
CODE_SIGN_ENTITLEMENTS = Clop/Clop.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.1.2;
CURRENT_PROJECT_VERSION = 2.1.3;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Clop/Preview Content\"";
DEVELOPMENT_TEAM = RDDXV84A73;
Expand All @@ -457,7 +457,7 @@
"$(PROJECT_DIR)/Clop/bin",
);
LLVM_LTO = YES;
MARKETING_VERSION = 2.1.2;
MARKETING_VERSION = 2.1.3;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.lowtechguys.Clop;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
13 changes: 5 additions & 8 deletions Clop/Images.swift
Original file line number Diff line number Diff line change
Expand Up @@ -261,20 +261,17 @@ class Image: CustomStringConvertible {
}

let optimised = item.string(forType: .optimisationStatus) == "true"
let (data, type): (Data?, UTType?) = [NSPasteboard.PasteboardType.png, .jpeg, .gif, .tiff].lazy.compactMap { t in
guard let d = item.data(forType: t) else {
return nil
}
return (d, UTType(t.rawValue))
}.first ?? (nil, nil)
let data: Data? = [NSPasteboard.PasteboardType.png, .jpeg, .gif, .tiff].lazy.compactMap { t in
item.data(forType: t)
}.first

if let originalPath = item.existingFilePath, let path = try? originalPath.copy(to: .images, force: true),
let img = Image(path: path, data: data, nsImage: nsImage, type: type, optimised: optimised, retinaDownscaled: false)
let img = Image(path: path, data: data, nsImage: nsImage, optimised: optimised, retinaDownscaled: false)
{
return img
}

guard let img = Image(nsImage: nsImage, data: data, type: type, optimised: optimised, retinaDownscaled: false) else {
guard let img = Image(nsImage: nsImage, data: data, optimised: optimised, retinaDownscaled: false) else {
throw ClopError.noClipboardImage(item.filePath ?? .init())
}

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ifeq (, $(VERSION))
VERSION=$(shell rg -o --no-filename 'MARKETING_VERSION = ([^;]+).+' -r '$$1' *.xcodeproj/project.pbxproj | head -1)
endif

ifeq (beta, $(BETA))
ifneq (, $(BETA))
FULL_VERSION:=$(VERSION)b$(BETA)
else
FULL_VERSION:=$(VERSION)
Expand Down
3 changes: 3 additions & 0 deletions ReleaseNotes/2.1.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Fixes

- Fix optimisation on copied JPEGs as `public.png`
18 changes: 18 additions & 0 deletions Releases/appcast.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
<?xml version="1.0" standalone="yes"?>
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" version="2.0">
<channel>
<item>
<title>2.1.3</title>
<pubDate>Wed, 23 Aug 2023 23:05:23 +0300</pubDate>
<link>https://lowtechguys.com/clop</link>
<sparkle:fullReleaseNotesLink>https://github.com/FuzzyIdeas/Clop/releases</sparkle:fullReleaseNotesLink>
<sparkle:version>2.1.3</sparkle:version>
<sparkle:shortVersionString>2.1.3</sparkle:shortVersionString>
<sparkle:minimumSystemVersion>13.0</sparkle:minimumSystemVersion>
<sparkle:releaseNotesLink>https://files.lowtechguys.com/ReleaseNotes/Clop-2.1.3.html</sparkle:releaseNotesLink>
<enclosure url="https://files.lowtechguys.com/releases/Clop-2.1.3.dmg" length="52824217" type="application/octet-stream" sparkle:edSignature="x2tPwDTCPNR50RTIQP/4hTzuyqIMqPWP8rJBjdXvgkOAA4UsbOwiMyIJgf1DrIdG7Zc8Whtg/EYB0u+9Mxc7Bg=="/>
<sparkle:deltas>
<enclosure url="https://files.lowtechguys.com/releases/Clop2.1.3-2.1.2.delta" sparkle:deltaFrom="2.1.2" length="256446" type="application/octet-stream" sparkle:deltaFromSparkleExecutableSize="865040" sparkle:deltaFromSparkleLocales="de,he,ar,el,ja,fa,en" sparkle:edSignature="HWAIj9+Aphev11Zi4iTlqEiVqPDlwADn+zgDnacMX8rtAYJTlw44/EAaB/Foa2N1JSAYNOHMrzyRYwwdk+Z0Ag=="/>
<enclosure url="https://files.lowtechguys.com/releases/Clop2.1.3-2.1.1.delta" sparkle:deltaFrom="2.1.1" length="276810" type="application/octet-stream" sparkle:deltaFromSparkleExecutableSize="865040" sparkle:deltaFromSparkleLocales="de,he,ar,el,ja,fa,en" sparkle:edSignature="jteIuPD9m6iKeenNuvsvmHw9tANUp0JjA/qf8p6hHT/EkczglxYv51QJoyPWR5cGuXj9mayNx9zhAN6P2ZrkDA=="/>
<enclosure url="https://files.lowtechguys.com/releases/Clop2.1.3-2.0.3.delta" sparkle:deltaFrom="2.0.3" length="1015878" type="application/octet-stream" sparkle:deltaFromSparkleExecutableSize="865040" sparkle:deltaFromSparkleLocales="de,he,ar,el,ja,fa,en" sparkle:edSignature="0DOEMTxnlCqRBmURXxEAUWM2vQuIBGTWKsX4DZbjII2U1bCSpHmA+ZKSmQuYlU1hTd7XLObPgmNMFN1/CJ7aAw=="/>
<enclosure url="https://files.lowtechguys.com/releases/Clop2.1.3-2.0.2.delta" sparkle:deltaFrom="2.0.2" length="1119458" type="application/octet-stream" sparkle:deltaFromSparkleExecutableSize="865040" sparkle:deltaFromSparkleLocales="de,he,ar,el,ja,fa,en" sparkle:edSignature="kN8Ku5A8UFUVIhCUbqLoHlq8V0h1Uw7eTbgEIk4K5vDMngNMQeaZSAJKAugYcMPscxkSIR+Z6EprPcjNf1dlBQ=="/>
<enclosure url="https://files.lowtechguys.com/releases/Clop2.1.3-2.0.1.delta" sparkle:deltaFrom="2.0.1" length="1120938" type="application/octet-stream" sparkle:deltaFromSparkleExecutableSize="865040" sparkle:deltaFromSparkleLocales="de,he,ar,el,ja,fa,en" sparkle:edSignature="UT8ccwAyvKIGZQ3k/lrA4Ixw2C8++cTYCfQ2anesQ7wvPCaTd/uGht1U3fOnRaXf8xHgVDiTBiHBTuBDCRP3BQ=="/>
</sparkle:deltas>
</item>
<item>
<title>2.1.2</title>
<pubDate>Tue, 22 Aug 2023 17:52:54 +0300</pubDate>
Expand Down

0 comments on commit ec96260

Please sign in to comment.