Skip to content

Commit

Permalink
Merge branch 'master' into v8
Browse files Browse the repository at this point in the history
# Conflicts:
#	Kingfisher.xcodeproj/project.pbxproj
#	Sources/SwiftUI/ImageContext.swift
#	Sources/Utility/String+MD5.swift
#	fastlane/Fastfile
  • Loading branch information
onevcat committed Jun 10, 2024
2 parents ba97d52 + 7e1d2c0 commit b701edd
Show file tree
Hide file tree
Showing 17 changed files with 308 additions and 29 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on: [push, pull_request]
jobs:
run-test:
runs-on: self-hosted
continue-on-error: true
strategy:
matrix:
destination: [
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

-----

## [7.12.0 - Lucky Seven](https://github.com/onevcat/Kingfisher/releases/tag/7.12.0) (2024-06-10)

#### Add
* Mark the `removeSizeExceededValues` method in `DiskStorage` as `public`. Now it is possible to call this method to trigger a cleanup of the disk cache manually. [#2214](https://github.com/onevcat/Kingfisher/pull/2214) @nickruddeni
* A new `PHPickerResultImageDataProvider` for loading and caching images from `PHPickerResult`. [#2233](https://github.com/onevcat/Kingfisher/pull/2233) @nuomi1
* An option of `reducePriorityOnDisappear` for SwiftUI. It sets a lower priority for the image download task when the view disappears, and restore it when re-appears. [#2211](https://github.com/onevcat/Kingfisher/pull/2211) @Aelx-Vaiman

#### Fix
* Some improvements for documentation grammar and typos. [#2236](https://github.com/onevcat/Kingfisher/pull/2236) @FlyingCaiChong
* Use `.process` for the `PrivacyInfo.xcprivacy` in SPM to follow the practice suggested by Apple. [#2243](https://github.com/onevcat/Kingfisher/pull/2243) @BorysKhl @onevcat
* An issue that the file extension was not correctly retrieved for calculating hash file name when `autoExtAfterHashedFileName` is set to `true`. [#2250](https://github.com/onevcat/Kingfisher/pull/2250) @freezy7

---

## [7.11.0 - visionOS for CocoaPods](https://github.com/onevcat/Kingfisher/releases/tag/7.11.0) (2024-02-12)

#### Add
Expand Down
73 changes: 70 additions & 3 deletions Demo/Demo/Kingfisher-Demo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22113.3" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="peg-r0-mlo">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="peg-r0-mlo">
<device id="retina5_5" orientation="portrait" appearance="dark"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22089.1"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand Down Expand Up @@ -467,9 +467,33 @@
<segue destination="m5P-35-yHH" kind="show" id="iY4-PO-rZO"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="TIF-8x-GLM">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="5xh-yt-GCq">
<rect key="frame" x="0.0" y="666" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="5xh-yt-GCq" id="RYS-B1-kkb">
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Picker Result" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wm0-0Z-bjC">
<rect key="frame" x="20.000000000000007" y="11.666666666666664" width="98.666666666666686" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="wm0-0Z-bjC" secondAttribute="trailing" constant="20" symbolic="YES" id="B3I-gk-g0y"/>
<constraint firstItem="wm0-0Z-bjC" firstAttribute="leading" secondItem="RYS-B1-kkb" secondAttribute="leading" constant="20" symbolic="YES" id="drj-Dz-zub"/>
<constraint firstItem="wm0-0Z-bjC" firstAttribute="centerY" secondItem="RYS-B1-kkb" secondAttribute="centerY" id="wFd-yU-MrL"/>
</constraints>
</tableViewCellContentView>
<connections>
<segue destination="wco-eY-gNu" kind="show" id="KCP-ab-diO"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="TIF-8x-GLM">
<rect key="frame" x="0.0" y="710" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="TIF-8x-GLM" id="ykx-Ds-PkP">
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down Expand Up @@ -1127,6 +1151,49 @@
</objects>
<point key="canvasLocation" x="1851" y="-1114"/>
</scene>
<!--Picker Result View Controller-->
<scene sceneID="JMu-F0-c9u">
<objects>
<viewController id="wco-eY-gNu" customClass="PHPickerResultViewController" customModule="Kingfisher_Demo" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="22H-rk-RMJ">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="1LX-Oj-TiN">
<rect key="frame" x="87" y="114" width="240" height="240"/>
<constraints>
<constraint firstAttribute="height" constant="240" id="bGC-o1-bQV"/>
<constraint firstAttribute="width" constant="240" id="bya-2p-YYh"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ySI-TE-gHl">
<rect key="frame" x="167.33333333333334" y="404" width="79.666666666666657" height="34.333333333333314"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Tap Me"/>
<buttonConfiguration key="configuration" style="plain" title="Tap Me"/>
<connections>
<action selector="onTapButton" destination="wco-eY-gNu" eventType="touchUpInside" id="QyB-8Y-1Oc"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="BKk-eJ-kIo"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="ySI-TE-gHl" firstAttribute="centerX" secondItem="1LX-Oj-TiN" secondAttribute="centerX" id="Sm9-p7-uMP"/>
<constraint firstItem="ySI-TE-gHl" firstAttribute="top" secondItem="1LX-Oj-TiN" secondAttribute="bottom" constant="50" id="gbM-rb-Ok8"/>
<constraint firstItem="1LX-Oj-TiN" firstAttribute="centerX" secondItem="BKk-eJ-kIo" secondAttribute="centerX" id="qyZ-NL-vmv"/>
<constraint firstItem="1LX-Oj-TiN" firstAttribute="top" secondItem="BKk-eJ-kIo" secondAttribute="top" constant="50" id="x3D-dH-ynU"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="r2f-l4-Rbs"/>
<connections>
<outlet property="imageView" destination="1LX-Oj-TiN" id="ni0-hA-iSX"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="hjI-mE-I0S" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1850.7246376811595" y="1735.5978260869567"/>
</scene>
</scenes>
<resources>
<systemColor name="secondaryLabelColor">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//
// PHPickerResultViewController.swift
// Kingfisher
//
// Created by nuomi1 on 2024-04-17.
//
// Copyright (c) 2024 Wei Wang <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import Foundation
import Kingfisher
import PhotosUI
import UIKit

class PHPickerResultViewController: UIViewController {
@IBOutlet var imageView: UIImageView!

@IBAction func onTapButton() {
if #available(iOS 14.0, *) {
presentPickerViewController()
} else {
presentAlertController()
}
}

private func presentAlertController() {
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
let alertController = UIAlertController(title: "Warning!", message: "Only supports iOS 14+", preferredStyle: .alert)
alertController.addAction(cancelAction)
present(alertController, animated: true)
}

@available(iOS 14.0, *)
private func presentPickerViewController() {
var configuration = PHPickerConfiguration(photoLibrary: .shared())
configuration.filter = .images
configuration.selectionLimit = 1
let viewController = PHPickerViewController(configuration: configuration)
viewController.delegate = self
present(viewController, animated: true)
}
}

@available(iOS 14, *)
extension PHPickerResultViewController: PHPickerViewControllerDelegate {
public func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
picker.dismiss(animated: true)
guard let result = results.first else { return }
let provider = PHPickerResultImageDataProvider(pickerResult: result)
imageView.kf.setImage(with: .provider(provider))
}
}
4 changes: 4 additions & 0 deletions Demo/Kingfisher-Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
072922432638639D0089E810 /* AnimatedImageDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 072922422638639D0089E810 /* AnimatedImageDemo.swift */; };
078DCB512BCFEFB40008114E /* PHPickerResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 078DCB502BCFEFB40008114E /* PHPickerResultViewController.swift */; };
277EAE8D2045B39C00547CD3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 277EAE892045B39C00547CD3 /* Assets.xcassets */; };
277EAE8E2045B39C00547CD3 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 277EAE8A2045B39C00547CD3 /* Interface.storyboard */; };
277EAE9D2045B4D500547CD3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 277EAE962045B4D500547CD3 /* Assets.xcassets */; };
Expand Down Expand Up @@ -156,6 +157,7 @@

/* Begin PBXFileReference section */
072922422638639D0089E810 /* AnimatedImageDemo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimatedImageDemo.swift; sourceTree = "<group>"; };
078DCB502BCFEFB40008114E /* PHPickerResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PHPickerResultViewController.swift; sourceTree = "<group>"; };
277EAE892045B39C00547CD3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
277EAE8B2045B39C00547CD3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = "<group>"; };
277EAE8C2045B39C00547CD3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -398,6 +400,7 @@
C959EEE522874DC600467A10 /* ProgressiveJPEGViewController.swift */,
D12EB83D24DD902300329EE1 /* TextAttachmentViewController.swift */,
D16CC3D724E03FEA00F1A515 /* AVAssetImageGeneratorViewController.swift */,
078DCB502BCFEFB40008114E /* PHPickerResultViewController.swift */,
D1F78A5E2589F0AA00930759 /* SwiftUIViewController.swift */,
);
path = ViewControllers;
Expand Down Expand Up @@ -722,6 +725,7 @@
D1F06F3321AA4292000B1C38 /* DetailImageViewController.swift in Sources */,
D198F42225EDC4B900C53E0D /* GridDemo.swift in Sources */,
4B1C7A3D21A256E300CE9D31 /* InfinityCollectionViewController.swift in Sources */,
078DCB512BCFEFB40008114E /* PHPickerResultViewController.swift in Sources */,
D1A1CCA321A1879600263AD8 /* MainViewController.swift in Sources */,
4BC0ED4A29A6EE78003E9CD1 /* Issue2035View.swift in Sources */,
D1F06F3721AAEACF000B1C38 /* GIFViewController.swift in Sources */,
Expand Down
32 changes: 17 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GEM
base64
nkf
rexml
activesupport (7.1.3.2)
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand All @@ -23,24 +23,24 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.917.0)
aws-sdk-core (3.192.1)
aws-partitions (1.941.0)
aws-sdk-core (3.197.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.79.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-kms (1.83.0)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.147.0)
aws-sdk-core (~> 3, >= 3.192.0)
aws-sdk-s3 (1.152.0)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
bigdecimal (3.1.7)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.15.2)
addressable (~> 2.8)
Expand Down Expand Up @@ -83,7 +83,7 @@ GEM
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
declarative (0.0.20)
digest-crc (0.6.5)
Expand Down Expand Up @@ -166,7 +166,7 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
ffi (1.16.3)
ffi (1.17.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
Expand Down Expand Up @@ -207,21 +207,21 @@ GEM
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-cookie (1.0.5)
http-cookie (1.0.6)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.14.4)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.7.2)
jwt (2.8.1)
base64
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.22.3)
minitest (5.23.1)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.4.0)
multipart-post (2.4.1)
mutex_m (0.2.0)
nanaimo (0.3.0)
nap (1.1.0)
Expand All @@ -238,7 +238,8 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.6)
rexml (3.2.9)
strscan
rouge (2.0.7)
ruby-macho (2.5.1)
ruby2_keywords (0.0.5)
Expand All @@ -252,6 +253,7 @@ GEM
simctl (1.6.10)
CFPropertyList
naturally
strscan (3.1.0)
terminal-notifier (2.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
Expand Down
2 changes: 1 addition & 1 deletion Kingfisher.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "Kingfisher"
s.version = "7.11.0"
s.version = "7.12.0"
s.summary = "A lightweight and pure Swift implemented library for downloading and cacheing image from the web."

s.description = <<-DESC
Expand Down
Loading

0 comments on commit b701edd

Please sign in to comment.