Skip to content

Commit

Permalink
edit undo and redo
Browse files Browse the repository at this point in the history
some other update
  • Loading branch information
duzexu committed Aug 29, 2024
1 parent 84ed0aa commit cc6efee
Show file tree
Hide file tree
Showing 59 changed files with 1,314 additions and 431 deletions.
107 changes: 72 additions & 35 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,87 @@ on:
paths:
- .github/workflows/Documentation.yaml
- ADPhotoKit/Classes/**.swift
release:
types: [published]

permissions:
contents: write
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

env:
PACKAGE_NAME: ADPhotoKit
BUILD_DEST: generic/platform=iOS
BUILD_PRODUCT: Debug-iphoneos

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
generate-docc:
name: Build DocC Archives
runs-on: macos-13
steps:
- name: Checkout
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Install Homebrew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -y
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/runner/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
- name: Install swift-doc
- name: Switch Xcode 🔄
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
- name: Generate DocC Archive 🪄
run: xcodebuild -workspace .swiftpm/xcode/package.xcworkspace docbuild -scheme ${{ env.PACKAGE_NAME }} -derivedDataPath /tmp/docbuild -destination ${{ env.BUILD_DEST }}
- name: Zip It Up 🤐
run: |
/home/linuxbrew/.linuxbrew/bin/brew install swiftdocorg/formulae/swift-doc
- name: Generate Documentation
mv /tmp/docbuild/Build/Products/${{ env.BUILD_PRODUCT }}/${{ env.PACKAGE_NAME }}.doccarchive ${{ env.PACKAGE_NAME }}.doccarchive
zip -r ${{ env.PACKAGE_NAME }}.doccarchive.zip ${{ env.PACKAGE_NAME }}.doccarchive
- name: Upload DocC Artifact ⬆️
uses: actions/upload-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}.doccarchive.zip
path: ${{ env.PACKAGE_NAME }}.doccarchive.zip
- name: Upload DocC Archive to GitHub release ⬆️
if: github.event.release
uses: svenstaro/[email protected]
with:
file: ${{ env.PACKAGE_NAME }}.doccarchive.zip
asset_name: ${{ env.PACKAGE_NAME }}.doccarchive.zip
tag: ${{ github.ref_name }}
publish:
name: Publish Documentation Site 🛜
# if: github.event.release.prerelease == false && github.event.release.draft == false && github.event.release.tag_name == github.event.repository.default_branch
runs-on: macos-13
needs: generate-docc
steps:
- name: Download DocC Archive ⬇️
uses: actions/download-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}.doccarchive.zip
- name: Unzip Archive 😮
run: |
swift doc generate ADPhotoKit/Classes --module-name ADPhotoKit --output Wiki
- name: Upload Documentation to Wiki
uses: SwiftDocOrg/github-wiki-publish-action@v1
unzip ${{ env.PACKAGE_NAME }}.doccarchive.zip
ls -li ${{ env.PACKAGE_NAME }}.doccarchive
- name: lowercase Package Name 🔤
id: package-name
uses: vishalmamidi/lowercase-action@v1
with:
path: "Wiki"
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}

- name: Generate Documentation
string: ${{ env.PACKAGE_NAME }}
- name: Build Static Website 🎈
run: |
swift doc generate ADPhotoKit/Classes \
--module-name ADPhotoKit \
--output Documentation \
--format html \
--base-url https://duzexu.github.io/ADPhotoKit/
- name: Permissions
run: sudo chown -R $USER:$USER /home/runner/work/

$(xcrun --find docc) process-archive \
transform-for-static-hosting ${{ env.PACKAGE_NAME }}.doccarchive \
--hosting-base-path ${{ github.event.repository.name }} \
--output-path docs
echo "<script>window.location.href += \"/documentation/${{ steps.package-name.outputs.lowercase }}\"</script>" > docs/index.html
- name: Upload artifact ⬆️
uses: actions/upload-pages-artifact@v1
with:
path: 'docs'
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
publish_dir: Documentation
enable_jekyll: true
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: 'docs'
# - name: Deploy to GitHub Pages 📑
# id: deployment
# uses: actions/deploy-pages@v2
13 changes: 9 additions & 4 deletions ADPhotoKit/ADPhotoKit.docc/ImageEditModule.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Provide image editing capabilities.

### Essentials

- ``ADImageEditConfigurable``
- ``ADImageEditTools``
- ``ADImageEditInfo``
- ``ADImageEditController``

### Edit Tool

Expand All @@ -25,7 +25,6 @@ Provide image editing capabilities.
- ``ADClipInfo``
- ``ADRotation``
- ``ADImageClipConfigurable``
- ``ADImageClipable``

### Interact View

Expand All @@ -36,7 +35,9 @@ Provide image editing capabilities.

### Sticker Interact

- ``ADStickerInfo``
- ``ADStickerInteractView``
- ``ADStickerInteractHandle``
- ``ADStickerContentView``
- ``ADImageStickerContentView``

Expand All @@ -45,12 +46,16 @@ Provide image editing capabilities.
- ``ADTextSticker``
- ``ADTextStickerColor``
- ``ADTextStickerEditConfigurable``
- ``ADTextStickerEditable``

### Image Sticker

- ``ADImageStickerSelectable``
- ``ADImageStickerInfo``
- ``ADImageStickerDataSource``
- ``ADImageStickerSelectConfigurable``

### Undo & Redo

- ``ADEditAction``
- ``ADUndoManageable``
- ``ADEditToolUndoable``
- ``ADStickerActionData``
Binary file modified ADPhotoKit/Assets/CoreUI/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ADPhotoKit/Assets/CoreUI/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/CoreUI/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/CoreUI/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file not shown.
Binary file removed ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file not shown.
Binary file removed ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file not shown.
Binary file removed ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file not shown.
Binary file removed ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file not shown.
Binary file removed ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file not shown.
Binary file modified ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file not shown.
Binary file removed ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file not shown.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
Binary file added ADPhotoKit/Assets/ImageEdit/[email protected]
16 changes: 14 additions & 2 deletions ADPhotoKit/Classes/Base/ADPhotoKitConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,13 @@ public class ADPhotoKitConfiguration {
/// - Parameter image: Original image.
public var customImageEditToolsBlock: ((UIImage) -> [ADImageEditTool])?

/// Custom image edit edit controller.
public var customImageEditVCBlock: ((UIImage,ADImageEditInfo?) -> ADImageEditConfigurable)?

/* =============== draw =============== */

/// System line draw tool selectable colors.
public var lineDrawColors: [UIColor] = [.white, .black, UIColor(hex: 0xF14F4F)!, UIColor(hex: 0xF3AA4E)!, UIColor(hex: 0x10C060)!, UIColor(hex: 0x1EB7F3)!, UIColor(hex: 0x8B69EA)!]
public var lineDrawColors: [UIColor] = [.white, .black, UIColor(hex: 0xF14F4F)!, UIColor(hex: 0xF3AA4E)!, UIColor(hex: 0xFFC300)!, UIColor(hex: 0x90D200)!, UIColor(hex: 0x10C060)!, UIColor(hex: 0x1EB7F3)!, UIColor(hex: 0x1384ED)!, UIColor(hex: 0x8B69EA)!, UIColor(hex: 0x7F7F7F)!]

/// System line draw tool default color index.
public var lineDrawDefaultColorIndex: Int = 2
Expand All @@ -180,6 +183,9 @@ public class ADPhotoKitConfiguration {
/// System mosaic draw tool default line width.
public var mosaicDrawWidth: CGFloat = 25

/// Erase default highlight outline width.
public var eraseOutlineWidth: CGFloat = 8

/* =============== image sticker =============== */

/// System image picker data source.
Expand All @@ -194,11 +200,17 @@ public class ADPhotoKitConfiguration {
public var customTextStickerEditVCBlock: ((ADTextSticker?) -> ADTextStickerEditConfigurable)?

/// System text sticker selectable colors.
public var textStickerColors: [ADTextStickerColor] = [(.white,.black),(.black,.white),(UIColor(hex: 0xF14F4F)!,.white),(UIColor(hex: 0xF3AA4E)!,.white),(UIColor(hex: 0x10C060)!,.white),(UIColor(hex: 0x1EB7F3)!,.white),(UIColor(hex: 0x8B69EA)!,.white)]
public var textStickerColors: [ADTextStickerColor] = [(.white,.black,UIColor(hex: 0x8E8C90)!),(.black,.white,UIColor(hex: 0x8E8C90)!),(UIColor(hex: 0xF14F4F)!,.white,UIColor(hex: 0x8B3031)!),(UIColor(hex: 0xF3AA4E)!,.white,UIColor(hex: 0x7C4F20)!),(UIColor(hex: 0xFFC300)!,.white,UIColor(hex: 0x8C6E02)!),(UIColor(hex: 0x90D200)!,.white,UIColor(hex: 0x567603)!),(UIColor(hex: 0x10C060)!,.white,UIColor(hex: 0x056C39)!),(UIColor(hex: 0x1EB7F3)!,.white,UIColor(hex: 0x06628E)!),(UIColor(hex: 0x1384ED)!,.white,UIColor(hex: 0x0A4C84)!),(UIColor(hex: 0x8B69EA)!,.white,UIColor(hex: 0x3A3A85)!),(UIColor(hex: 0x7F7F7F)!,.white,UIColor(hex: 0x4C494C)!)]

/// System text sticker tool default color index.
public var textStickerDefaultColorIndex: Int = 0

/// System text sticker tool default font size.
public var textStickerDefaultFontSize: CGFloat = 32

/// System text sticker tool default stroke width.
public var textStickerDefaultStrokeWidth: Int = 6

/* =============== clip =============== */

/// Custom image clip controller.
Expand Down
10 changes: 10 additions & 0 deletions ADPhotoKit/Classes/Base/ADWeakProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@ class ADWeakProxy: NSObject {
}

}

class ADWeakRef<T> where T: AnyObject {

private(set) weak var value: T?

init(value: T?) {
self.value = value
}

}
1 change: 1 addition & 0 deletions ADPhotoKit/Classes/Base/Extension/ADEnum+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import AVFoundation
import UIKit

extension ADCapturePreset {
var sessionPreset: AVCaptureSession.Preset {
Expand Down
2 changes: 1 addition & 1 deletion ADPhotoKit/Classes/CoreUI/ADAssetBrowserController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ private extension ADAssetBrowserController {
func editImage(_ img: UIImage?) {
#if Module_ImageEdit
if let image = img, !config.assetOpts.contains(.selectAsLivePhoto) {
let vc = ADImageEditController(image: image, editInfo: dataSource.current!.imageEditInfo)
let vc = ADImageEditConfigure.imageEditVC(image: image, editInfo: dataSource.current!.imageEditInfo)
vc.imageDidEdit = { [weak self] editInfo in
self?.didImageEditInfoUpdate(editInfo)
}
Expand Down
2 changes: 1 addition & 1 deletion ADPhotoKit/Classes/CoreUI/ADCaptureViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ extension ADCaptureViewController: AVCapturePhotoCaptureDelegate {
self.takedImageView.isHidden = false
#if Module_ImageEdit
if let image = image {
let vc = ADImageEditController(image: image, editInfo: nil)
let vc = ADImageEditConfigure.imageEditVC(image: image, editInfo: nil)
vc.cancelEdit = { [weak self] in
self?.retakeBtnAction()
}
Expand Down
2 changes: 1 addition & 1 deletion ADPhotoKit/Classes/CoreUI/View/ADBrowserNavBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ADBrowserNavBarView: ADBaseNavBarView, ADBrowserNavBarConfigurable {

required init(dataSource: ADAssetBrowserDataSource, config: ADPhotoKitConfig) {
self.dataSource = dataSource
super.init(rightItem: (Bundle.image(name: "btn_circle"), Bundle.image(name: "btn_selected"),nil))
super.init(rightItem: (Bundle.image(name: "btn_unselected_with_check"), Bundle.image(name: "btn_selected"),nil))
rightBtnItem.isHidden = config.params.maxCount == 1 && !config.browserOpts.contains(.selectBtnWhenSingleSelect)
setupChildUI()
}
Expand Down
Loading

0 comments on commit cc6efee

Please sign in to comment.