Commit 2aeebc6ecc4a382c07f826891e95a6a943289990
0 parents
照片修复功能提交
Showing
100 changed files
with
2749 additions
and
0 deletions
Too many changes to show.
To preserve performance only 100 of 149 files are displayed.
.gitignore
0 → 100755
CNLiveCPhotoRepairModule.podspec
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule.podspec | |
| 1 | +# | |
| 2 | +# Be sure to run `pod lib lint CNLiveCPhotoRepairModule.podspec' to ensure this is a | |
| 3 | +# valid spec before submitting. | |
| 4 | +# | |
| 5 | +# Any lines starting with a # are optional, but their use is encouraged | |
| 6 | +# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html | |
| 7 | +# | |
| 8 | + | |
| 9 | +Pod::Spec.new do |s| | |
| 10 | + s.name = 'CNLiveCPhotoRepairModule' | |
| 11 | + s.version = '0.1.0' | |
| 12 | + s.summary = 'A short description of CNLiveCPhotoRepairModule.' | |
| 13 | + | |
| 14 | +# This description is used to generate tags and improve search results. | |
| 15 | +# * Think: What does it do? Why did you write it? What is the focus? | |
| 16 | +# * Try to keep it short, snappy and to the point. | |
| 17 | +# * Write the description between the DESC delimiters below. | |
| 18 | +# * Finally, don't worry about the indent, CocoaPods strips it! | |
| 19 | + | |
| 20 | + s.description = <<-DESC | |
| 21 | +TODO: Add long description of the pod here. | |
| 22 | + DESC | |
| 23 | + | |
| 24 | + s.homepage = 'https://github.com/杨苓玉/CNLiveCPhotoRepairModule' | |
| 25 | + # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' | |
| 26 | + s.license = { :type => 'MIT', :file => 'LICENSE' } | |
| 27 | + s.author = { '杨苓玉' => 'ios_18710032165@163.com' } | |
| 28 | + s.source = { :git => 'https://github.com/杨苓玉/CNLiveCPhotoRepairModule.git', :tag => s.version.to_s } | |
| 29 | + # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' | |
| 30 | + | |
| 31 | + s.ios.deployment_target = '10.0' | |
| 32 | + s.prefix_header_contents = '#import "CNLiveCPhotoRepairModule.h"' | |
| 33 | + s.source_files = 'CNLiveCPhotoRepairModule/Classes/**/*' | |
| 34 | + | |
| 35 | + s.resource_bundles = { | |
| 36 | + 'CNLiveCPhotoRepairModule' => ['CNLiveCPhotoRepairModule/Assets/*'] | |
| 37 | + } | |
| 38 | + | |
| 39 | + # s.public_header_files = 'Pod/Classes/**/*.h' | |
| 40 | + # s.frameworks = 'UIKit', 'MapKit' | |
| 41 | + # s.dependency 'AFNetworking', '~> 2.3' | |
| 42 | + s.dependency 'CNLiveBaseClass' | |
| 43 | + s.dependency 'CNLiveBaseKit' | |
| 44 | + s.dependency 'CNLiveNewTripartiteManagement/YYCategories' | |
| 45 | + s.dependency 'CNLiveNewTripartiteManagement/Masonry' | |
| 46 | + s.dependency 'CNLiveBusinessBaseModule' | |
| 47 | + s.dependency 'DSBaseModule' | |
| 48 | + s.dependency 'CNLiveCommonCategory' | |
| 49 | + s.dependency 'JXCategoryView' | |
| 50 | + s.dependency 'CNLiveUploadManager' | |
| 51 | + s.dependency 'CNLivePhotoBrowser' | |
| 52 | + s.dependency 'CNLiveNewTripartiteManagement/SDWebImage' | |
| 53 | + s.dependency 'CNLiveImagePickerController' | |
| 54 | + s.dependency 'CNLiveEnvironment' | |
| 55 | + s.dependency 'CNLiveNewTripartiteManagement/QMUIKit' | |
| 56 | + s.dependency 'CNLiveBusinessBaseModule' | |
| 57 | + s.dependency 'CNLiveNewTripartiteManagement/MJExtension' | |
| 58 | + s.dependency 'CNLiveCustomControl' | |
| 59 | + s.dependency 'CNLiveBeeHive' | |
| 60 | +end | ... | ... |
CNLiveCPhotoRepairModule/Assets/.gitkeep
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/.gitkeep | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/Contents.json
0 → 100644
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/default _icon_bg.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/default _icon_bg.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "default _icon_bg.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/default _icon_bg.imageset/default _icon_bg.png
0 → 100644
1.13 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_recovNo.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_recovNo.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "advancing_grey@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "advancing_grey@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_recovNo.imageset/advancing_grey@2x.png
0 → 100644
2.3 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_recovNo.imageset/advancing_grey@3x.png
0 → 100644
4.01 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_recovYes.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_recovYes.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "advancing@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "advancing@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_recovYes.imageset/advancing@2x.png
0 → 100644
2.91 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_recovYes.imageset/advancing@3x.png
0 → 100644
5.06 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_removeNo.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_removeNo.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "close@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "close@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_removeNo.imageset/close@2x.png
0 → 100644
1.56 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_removeNo.imageset/close@3x.png
0 → 100644
2.6 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_removeYes.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_removeYes.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "close@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "close@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_removeYes.imageset/close@2x.png
0 → 100644
1.5 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_removeYes.imageset/close@3x.png
0 → 100644
2.66 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_revocNo.imageset/Back_grey@2x.png
0 → 100644
2.36 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_revocNo.imageset/Back_grey@3x.png
0 → 100644
4.03 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_revocNo.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_revocNo.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "Back_grey@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "Back_grey@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_revocYes.imageset/Back@2x.png
0 → 100644
2.98 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_revocYes.imageset/Back@3x.png
0 → 100644
5.22 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_revocYes.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_revocYes.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "Back@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "Back@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_save.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_save.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "Finish@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "Finish@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_save.imageset/Finish@2x.png
0 → 100644
1.33 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/draw_save.imageset/Finish@3x.png
0 → 100644
2.12 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/evaluate_selected.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/evaluate_selected.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "evaluate_selected@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "evaluate_selected@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/evaluate_selected.imageset/evaluate_selected@2x.png
0 → 100644
1.19 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/evaluate_selected.imageset/evaluate_selected@3x.png
0 → 100644
2.39 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/evaluate_unselect.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/evaluate_unselect.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "evaluate_unselect@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "evaluate_unselect@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/evaluate_unselect.imageset/evaluate_unselect@2x.png
0 → 100644
986 Bytes
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/evaluate_unselect.imageset/evaluate_unselect@3x.png
0 → 100644
1.75 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_close.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_close.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "关闭@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "关闭@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_close.imageset/关闭@2x.png
0 → 100644
1.74 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_close.imageset/关闭@3x.png
0 → 100644
3.26 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_failed.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_failed.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "修复失败@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "修复失败@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_failed.imageset/修复失败@2x.png
0 → 100644
26.5 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_failed.imageset/修复失败@3x.png
0 → 100644
44 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_nomalColor.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_nomalColor.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "Photo_coloring@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "Photo_coloring@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_nomalColor.imageset/Photo_coloring@2x.png
0 → 100644
25.2 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_nomalColor.imageset/Photo_coloring@3x.png
0 → 100644
49.9 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_nomalRepair.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_nomalRepair.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "Photo_restoration@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "Photo_restoration@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_nomalRepair.imageset/Photo_restoration@2x.png
0 → 100644
26.5 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_nomalRepair.imageset/Photo_restoration@3x.png
0 → 100644
52.2 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_rapairDrawAndColor.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_rapairDrawAndColor.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "Photo_repair_color@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "Photo_repair_color@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_rapairDrawAndColor.imageset/Photo_repair_color@2x.png
0 → 100644
29.8 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_rapairDrawAndColor.imageset/Photo_repair_color@3x.png
0 → 100644
60.3 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairAfter.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairAfter.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "修复后@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "修复后@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairAfter.imageset/修复后@2x.png
0 → 100644
8.19 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairAfter.imageset/修复后@3x.png
0 → 100644
17.3 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairBefore.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairBefore.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "修复前@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "修复前@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairBefore.imageset/修复前@2x.png
0 → 100644
8.54 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairBefore.imageset/修复前@3x.png
0 → 100644
20 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairDraw.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairDraw.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "Photo_repair@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "Photo_repair@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairDraw.imageset/Photo_repair@2x.png
0 → 100644
27.3 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairDraw.imageset/Photo_repair@3x.png
0 → 100644
54.7 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairing.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairing.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "照片修复中...@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "照片修复中...@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairing.imageset/照片修复中...@2x.png
0 → 100644
59 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_repairing.imageset/照片修复中...@3x.png
0 → 100644
106 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_shareTip.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_shareTip.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "形状@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "形状@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_shareTip.imageset/形状@2x.png
0 → 100644
6.58 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_shareTip.imageset/形状@3x.png
0 → 100644
9.29 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_succeed.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_succeed.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "修复完成@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "修复完成@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_succeed.imageset/修复完成@2x.png
0 → 100644
28 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_succeed.imageset/修复完成@3x.png
0 → 100644
46.3 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_tipClose.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_tipClose.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "关闭@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "关闭@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_tipClose.imageset/关闭@2x.png
0 → 100644
1.08 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldPho_tipClose.imageset/关闭@3x.png
0 → 100644
1.77 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldpho_tip.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldpho_tip.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "选一张照片修复@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "选一张照片修复@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldpho_tip.imageset/选一张照片修复@2x.png
0 → 100644
6.09 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/oldpho_tip.imageset/选一张照片修复@3x.png
0 → 100644
8.39 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/skill_service_back.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/skill_service_back.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "service_back@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "service_back@3x.png", | |
| 14 | + "idiom" : "universal", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "author" : "xcode", | |
| 20 | + "version" : 1 | |
| 21 | + } | |
| 22 | +} | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/skill_service_back.imageset/service_back@2x.png
0 → 100644
628 Bytes
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/skill_service_back.imageset/service_back@3x.png
0 → 100644
1.15 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/wufalianjie.imageset/Contents.json
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/wufalianjie.imageset/Contents.json | |
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "idiom" : "universal", | |
| 9 | + "filename" : "wufalianjie@2x.png", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "filename" : "wufalianjie@3x.png", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "version" : 1, | |
| 20 | + "author" : "xcode" | |
| 21 | + } | |
| 22 | +} | |
| 0 | 23 | \ No newline at end of file | ... | ... |
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/wufalianjie.imageset/wufalianjie@2x.png
0 → 100644
51.4 KB
CNLiveCPhotoRepairModule/Assets/CNLiveCPhotoRepairAsset.xcassets/wufalianjie.imageset/wufalianjie@3x.png
0 → 100644
116 KB
CNLiveCPhotoRepairModule/Classes/.gitkeep
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/.gitkeep | ... | ... |
CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairImage.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairImage.h | |
| 1 | +// | |
| 2 | +// CNLiveCPhotoRepairImage.h | |
| 3 | +// CNLiveCPhotoRepairModule | |
| 4 | +// | |
| 5 | +// Created by iOS on 2023/1/3. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import <Foundation/Foundation.h> | |
| 9 | + | |
| 10 | +NS_ASSUME_NONNULL_BEGIN | |
| 11 | + | |
| 12 | +@interface CNLiveCPhotoRepairImage : NSObject | |
| 13 | +/// 加载图片 | |
| 14 | ++ (UIImage *)getImageWithNamed:(NSString *)name; | |
| 15 | +@end | |
| 16 | + | |
| 17 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairImage.m
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairImage.m | |
| 1 | +// | |
| 2 | +// CNLiveCPhotoRepairImage.m | |
| 3 | +// CNLiveCPhotoRepairModule | |
| 4 | +// | |
| 5 | +// Created by iOS on 2023/1/3. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import "CNLiveCPhotoRepairImage.h" | |
| 9 | + | |
| 10 | +@implementation CNLiveCPhotoRepairImage | |
| 11 | ++ (UIImage *)getImageWithNamed:(NSString *)name{ | |
| 12 | + NSBundle *bundle = [NSBundle bundleForClass:[CNLiveCPhotoRepairImage class]]; | |
| 13 | + NSURL *url = [bundle URLForResource:@"CNLiveCPhotoRepairModule.bundle" withExtension:@""]; | |
| 14 | + if (!url) { | |
| 15 | + return [UIImage new]; | |
| 16 | + } | |
| 17 | + NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | |
| 18 | + return [UIImage imageNamed:name inBundle:targetBundle compatibleWithTraitCollection:NULL]; | |
| 19 | +} | |
| 20 | +@end | ... | ... |
CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairModule.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairModule.h | |
| 1 | +// | |
| 2 | +// CNLiveCPhotoRepairModule.h | |
| 3 | +// Pods | |
| 4 | +// | |
| 5 | +// Created by iOS on 2022/12/29. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#ifndef CNLiveCPhotoRepairModule_h | |
| 9 | +#define CNLiveCPhotoRepairModule_h | |
| 10 | + | |
| 11 | +//////////////////////////////////////////////////////// | |
| 12 | +//////////// frame | |
| 13 | +//////////////////////////////////////////////////////// | |
| 14 | +#define CNScaleW(a) a*KScreenWidth/375 | |
| 15 | +#define CNScaleH(a) a*SCREEN_HEIGHT/667 | |
| 16 | + | |
| 17 | +//协议调取方法 | |
| 18 | +#define CNMessageSend(instance,protocol,message) [(id<protocol>)(instance) message] | |
| 19 | + | |
| 20 | +#import <CNLiveBaseKit/CNLiveBaseKit.h> | |
| 21 | +#import <Masonry/Masonry.h> | |
| 22 | +#import <DSBaseModule/DSBaseModule.h> | |
| 23 | +#import <CNLiveCommonCategory/CNLiveCommonCategory.h> | |
| 24 | +#import <YYCategories/YYCategories.h> | |
| 25 | +#import <CNLivePhotoBrowser/CNLivePhotoBrowser.h> | |
| 26 | +#import <SDWebImage/SDWebImage.h> | |
| 27 | +#import <CNLiveEnvironment/CNLiveEnvironment.h> | |
| 28 | +#import <QMUIKit/QMUIKit.h> | |
| 29 | +#import <CNLiveBusinessBaseModule/CNLiveBusinessBaseModule.h> | |
| 30 | + | |
| 31 | +#import <MJExtension/MJExtension.h> | |
| 32 | +#import <CNLiveCustomControl/CNLiveNavigationBar.h> | |
| 33 | +#import "CNLiveCPhotoRepairService.h" | |
| 34 | +#import "CNLiveCPhotoRepairImage.h" | |
| 35 | + | |
| 36 | +#endif /* CNLiveCPhotoRepairModule_h */ | ... | ... |
CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairProtocol.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairProtocol.h | |
| 1 | +// | |
| 2 | +// CNLiveCPhotoRepairProtocol.h | |
| 3 | +// CNLiveCPhotoRepairModule | |
| 4 | +// | |
| 5 | +// Created by iOS on 2022/12/30. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import <Foundation/Foundation.h> | |
| 9 | +#import <CNLiveBeeHive/CNLiveBeeHive.h> | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | + | |
| 13 | +@protocol CNLiveCPhotoRepairProtocol <NSObject,BHServiceProtocol> | |
| 14 | +/** | |
| 15 | + *跳转照片修复页面 | |
| 16 | + */ | |
| 17 | +- (void)pushPhotoRepair; | |
| 18 | +/** | |
| 19 | + *跳转修复完成页面 | |
| 20 | + *contentId:页面id | |
| 21 | + *oldStr:旧照片地址 | |
| 22 | + *newStr:新照片地址 | |
| 23 | + */ | |
| 24 | +- (void)pushPhotoRepairWithContentId:(NSString *)contentId oldImage:(NSString *)oldStr newImage:(NSString *)newStr; | |
| 25 | +@end | |
| 26 | + | |
| 27 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairService.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairService.h | |
| 1 | +// | |
| 2 | +// CNLiveCPhotoRepairService.h | |
| 3 | +// CNLiveCPhotoRepairModule | |
| 4 | +// | |
| 5 | +// Created by iOS on 2022/12/30. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import <Foundation/Foundation.h> | |
| 9 | +#import "CNLiveCPhotoRepairProtocol.h" | |
| 10 | + | |
| 11 | +typedef NS_ENUM(NSUInteger, CNLivePhotoShareResultType) { | |
| 12 | + CNLivePhotoShareResultTypeStart, | |
| 13 | + CNLivePhotoShareResultTypeSucc, | |
| 14 | + CNLivePhotoShareResultTypeCanc, | |
| 15 | + CNLivePhotoShareResultTypeFail, | |
| 16 | + CNLivePhotoShareResultTypeUnKnow, | |
| 17 | +}; | |
| 18 | +typedef NS_ENUM(NSUInteger, CNLivePhotoSharePlatformType) { | |
| 19 | + CNLivePhotoSharePlatformTypeAll, | |
| 20 | + CNLivePhotoSharePlatformTypeWjjFriend, | |
| 21 | + CNLivePhotoSharePlatformTypeWjjLive, | |
| 22 | + CNLivePhotoSharePlatformTypeWeChat, | |
| 23 | + CNLivePhotoSharePlatformTypeCricle, | |
| 24 | + CNLivePhotoSharePlatformTypeQQFriend, | |
| 25 | + CNLivePhotoSharePlatformTypeSina, | |
| 26 | + CNLivePhotoSharePlatformTypeSafari, | |
| 27 | +}; | |
| 28 | + | |
| 29 | +@interface CNLiveCPhotoRepairService : NSObject<CNLiveCPhotoRepairProtocol> | |
| 30 | +/** | |
| 31 | + 调用分享界面进行分享操作 | |
| 32 | + | |
| 33 | + @param shareTitle 分享标题 | |
| 34 | + @param shareUrl 分享的链接 | |
| 35 | + @param shareDesc 分享的描述 | |
| 36 | + @param shareImage 图片集合,传入参数可以为单张图片信息,也可以为一个NSArray,数组元素可以为UIImage、NSString(图片路径)、NSURL(图片路径) | |
| 37 | + @param isFull 是否横屏显示分享界面 | |
| 38 | + @param isHiddenWjj 是否隐藏网加加 | |
| 39 | + @param platformType 分享平台调用某个单独方法(CNLiveSharePlatformTypeAll 类型为已实现界面,默认为此类型) | |
| 40 | + @param completerBlock 分享结果回调 | |
| 41 | + */ | |
| 42 | ++(void)showShareViewWithParamForShareTitle:(NSString *)shareTitle | |
| 43 | + ShareUrl:(NSString *)shareUrl | |
| 44 | + ShareDesc:(NSString *)shareDesc | |
| 45 | + ShareImage:(id)shareImage | |
| 46 | + ScreenFull:(BOOL)isFull | |
| 47 | + HiddenWjj:(BOOL)isHiddenWjj | |
| 48 | + HiddenQQ:(BOOL)isHiddenQQ | |
| 49 | + HiddenWB:(BOOL)isHiddenWB | |
| 50 | + HiddenLifeCircle:(BOOL)isHiddenLifeCircle | |
| 51 | + HiddenWechatCircle:(BOOL)isHiddenWechatCircle | |
| 52 | + HiddenWechat:(BOOL)isHiddenWechat | |
| 53 | + HiddenSafari:(BOOL)isHiddenSafari | |
| 54 | + FormVC:(UIViewController *)formVC | |
| 55 | + TopImage:(NSArray<NSString *> *)topImage | |
| 56 | + TopTitles:(NSArray<NSString *> *)topTitle | |
| 57 | + PlatformType:(CNLivePhotoSharePlatformType)platformType | |
| 58 | + CompleterBlock:(void(^)(CNLivePhotoShareResultType resultType,CNLivePhotoSharePlatformType platformType,NSString * typtString))completerBlock; | |
| 59 | +@end | |
| 60 | + | ... | ... |
CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairService.m
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/Manager/CNLiveCPhotoRepairService.m | |
| 1 | +// | |
| 2 | +// CNLiveCPhotoRepairService.m | |
| 3 | +// CNLiveCPhotoRepairModule | |
| 4 | +// | |
| 5 | +// Created by iOS on 2022/12/30. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import "CNLiveCPhotoRepairService.h" | |
| 9 | +#import <CNLiveBeeHive/BHRouter.h> | |
| 10 | +#import "CNPhotoRepairManager.h" | |
| 11 | + | |
| 12 | +static NSString *const CNLiveCPhotoRepairRouterWithMineKey = @"com.cnlive.CNLiveNetAdd://call.service.beehive/CNLiveCPhotoRepairModuleService.CNLiveCPhotoRepairModuleProtocol."; | |
| 13 | + | |
| 14 | +static NSString *const CNLiveCPhotoRepairShareKey = @"showShareViewWithParam:fromVC:"; | |
| 15 | + | |
| 16 | +@BeeHiveService(CNLiveCPhotoRepairProtocol,CNLiveCPhotoRepairService); | |
| 17 | +@implementation CNLiveCPhotoRepairService | |
| 18 | +- (void)modSetUp:(BHContext *)context{ | |
| 19 | + //添加主工程交互类 | |
| 20 | + [[BHRouter globalRouter] addPathComponent:@"CNLiveCPhotoRepairModuleService" forClass:NSClassFromString(@"CNLiveCPhotoRepairModuleService")]; | |
| 21 | + //添加组件交互类 | |
| 22 | + [[BHRouter globalRouter] addPathComponent:@"CNLiveCPhotoRepairService" forClass:NSClassFromString(@"CNLiveCPhotoRepairService")]; | |
| 23 | +} | |
| 24 | +#pragma mark - 家园调主工程方法 | |
| 25 | +- (void)pushPhotoRepair{ | |
| 26 | + [CNPhotoRepairManager jumpToRepairPhotoControler]; | |
| 27 | +} | |
| 28 | +- (void)pushPhotoRepairWithContentId:(NSString *)contentId oldImage:(NSString *)oldStr newImage:(NSString *)newStr{ | |
| 29 | + [CNPhotoRepairManager jumpToPhotoRepairedControlerForContentId:contentId oldImage:oldStr newImage:newStr]; | |
| 30 | +} | |
| 31 | +#pragma mark - 主工程调家园模块方法 | |
| 32 | ++ (void)showShareViewWithParamForShareTitle:(NSString *)shareTitle ShareUrl:(NSString *)shareUrl ShareDesc:(NSString *)shareDesc ShareImage:(id)shareImage ScreenFull:(BOOL)isFull HiddenWjj:(BOOL)isHiddenWjj HiddenQQ:(BOOL)isHiddenQQ HiddenWB:(BOOL)isHiddenWB HiddenLifeCircle:(BOOL)isHiddenLifeCircle HiddenWechatCircle:(BOOL)isHiddenWechatCircle HiddenWechat:(BOOL)isHiddenWechat HiddenSafari:(BOOL)isHiddenSafari FormVC:(UIViewController *)formVC TopImage:(NSArray<NSString *> *)topImage TopTitles:(NSArray<NSString *> *)topTitle PlatformType:(CNLivePhotoSharePlatformType)platformType CompleterBlock:(void (^)(CNLivePhotoShareResultType, CNLivePhotoSharePlatformType, NSString *))completerBlock{ | |
| 33 | + NSURL *url = [NSURL URLWithString:[CNLiveCPhotoRepairRouterWithMineKey stringByAppendingString:CNLiveCPhotoRepairShareKey]]; | |
| 34 | + NSDictionary *param = @{ | |
| 35 | + @"shareTitle":shareTitle?shareTitle:@"", | |
| 36 | + @"shareUrl":shareUrl?shareUrl:@"", | |
| 37 | + @"shareDesc":shareDesc?shareDesc:@"", | |
| 38 | + @"shareImage":shareImage?shareImage:@"", | |
| 39 | + @"isFull":@(isFull), | |
| 40 | + @"isHiddenWjj":@(isHiddenWjj), | |
| 41 | + @"isHiddenQQ":@(isHiddenQQ), | |
| 42 | + @"isHiddenWB":@(isHiddenWB), | |
| 43 | + @"isHiddenLifeCircle":@(isHiddenLifeCircle), | |
| 44 | + @"isHiddenWechatCircle":@(isHiddenWechatCircle), | |
| 45 | + @"isHiddenWechat":@(isHiddenWechat), | |
| 46 | + @"isHiddenSafari":@(isHiddenSafari), | |
| 47 | + @"topImage":topImage?topImage:@"", | |
| 48 | + @"topTitle":topTitle?topTitle:@"", | |
| 49 | + @"platformType":@(platformType), | |
| 50 | + }; | |
| 51 | + [BHRouter openURL:url withParams:@{@"CNLiveCPhotoRepairModuleService":@{ | |
| 52 | + @"param":param, | |
| 53 | + @"fromVC":formVC | |
| 54 | + }}]; | |
| 55 | +} | |
| 56 | +@end | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNDrawViewController.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNDrawViewController.h | |
| 1 | +// | |
| 2 | +// CNDrawViewController.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/8/9. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <CNLiveBaseClass/CNLiveBaseViewController.h> | |
| 10 | +#import "CNPhoPresent.h" | |
| 11 | + | |
| 12 | +NS_ASSUME_NONNULL_BEGIN | |
| 13 | + | |
| 14 | +@interface CNDrawViewController : CNLiveBaseViewController | |
| 15 | +-(instancetype)initWithImage:(UIImage *)pcImage withRepairType:(CNLiveRepairType) type; | |
| 16 | +@end | |
| 17 | + | |
| 18 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNDrawViewController.m
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNDrawViewController.m | |
| 1 | +// | |
| 2 | +// CNDrawViewController.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/8/9. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNDrawViewController.h" | |
| 10 | +#import "CNDrawView.h" | |
| 11 | +#import "CNOperatorView.h" | |
| 12 | +#import "CNUploadManager.h" | |
| 13 | +#import "CNRepairPhotosViewController.h" | |
| 14 | + | |
| 15 | +@interface CNDrawViewController () | |
| 16 | +{ | |
| 17 | + UIImage *_pcImage; | |
| 18 | + CGFloat tempWidth,tempHeight,operatorHeight; | |
| 19 | + CNLiveRepairType _type; | |
| 20 | +} | |
| 21 | +@property (nonatomic, strong) CNDrawView *drawView; | |
| 22 | +@property (nonatomic, strong) CNOperatorView *operator; | |
| 23 | +@property (nonatomic, strong) UIImageView *imageView; | |
| 24 | +@property (nonatomic, strong) CNUploadManager *manager; | |
| 25 | +@end | |
| 26 | + | |
| 27 | +@implementation CNDrawViewController | |
| 28 | +-(instancetype)initWithImage:(UIImage *)pcImage withRepairType:(CNLiveRepairType) type | |
| 29 | +{ | |
| 30 | + if (self = [super init]) { | |
| 31 | + _pcImage = pcImage; | |
| 32 | + self.title = @"智能修补"; | |
| 33 | + _type = type; | |
| 34 | + } | |
| 35 | + return self; | |
| 36 | +} | |
| 37 | + | |
| 38 | +- (void)viewDidLoad { | |
| 39 | + [super viewDidLoad]; | |
| 40 | + self.view.backgroundColor = kWhiteColor; | |
| 41 | + operatorHeight = CNScaleH(110); | |
| 42 | + CGFloat imgViewHeight = kScreenHeight - operatorHeight - NavigationContentTop - kVerticalBottomSafeHeight; | |
| 43 | + if (_pcImage.size.width/kScreenWidth <= _pcImage.size.height / imgViewHeight) { | |
| 44 | + tempHeight = imgViewHeight; | |
| 45 | + tempWidth = (_pcImage.size.width/ _pcImage.size.height) *tempHeight; | |
| 46 | + }else | |
| 47 | + { | |
| 48 | + tempWidth = kScreenWidth; | |
| 49 | + tempHeight = (_pcImage.size.height / _pcImage.size.width) *tempWidth; | |
| 50 | + | |
| 51 | + } | |
| 52 | + [self.view addSubview:self.imageView]; | |
| 53 | + [self.view addSubview:self.drawView]; | |
| 54 | + [self.view addSubview:self.operator]; | |
| 55 | + | |
| 56 | + weakself | |
| 57 | + self.operator.actionBlock = ^(NSUInteger tag) { | |
| 58 | + strongself | |
| 59 | + switch (tag) { | |
| 60 | + case 0: | |
| 61 | + { | |
| 62 | + [weakSelf.drawView undo]; | |
| 63 | + } | |
| 64 | + break; | |
| 65 | + case 1: | |
| 66 | + { | |
| 67 | + [weakSelf.drawView redo]; | |
| 68 | + } | |
| 69 | + break; | |
| 70 | + case 2: | |
| 71 | + { | |
| 72 | + [weakSelf.drawView clear]; | |
| 73 | + } | |
| 74 | + break; | |
| 75 | + case 3: | |
| 76 | + { | |
| 77 | + UIImage *drawImage = nil; | |
| 78 | + // 开启位图上下文 | |
| 79 | + UIGraphicsBeginImageContextWithOptions(weakSelf.drawView.size, NO, 1); | |
| 80 | + | |
| 81 | + // 取出画板view的layer | |
| 82 | + CALayer *layer = weakSelf.drawView.layer; | |
| 83 | + | |
| 84 | + // 渲染上下文 | |
| 85 | + [layer renderInContext:UIGraphicsGetCurrentContext()]; | |
| 86 | + | |
| 87 | + // 从上下文中取出图片 | |
| 88 | + drawImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| 89 | + | |
| 90 | + // 关闭上下文 | |
| 91 | + UIGraphicsEndImageContext(); | |
| 92 | + [weakSelf.manager uploadImageManager:self->_pcImage draw:drawImage rect:self->_pcImage.size repairType:self->_type]; | |
| 93 | + weakSelf.manager.popBlock = ^{ | |
| 94 | + [weakSelf.navigationController popToViewController:[weakSelf.navigationController.viewControllers objectAtIndex:weakSelf.navigationController.viewControllers.count -5] animated:YES]; | |
| 95 | + }; | |
| 96 | + weakSelf.manager.pushBlock = ^(NSString * _Nonnull contentId) { | |
| 97 | + strongself | |
| 98 | + CNRepairPhotosViewController *photos = [[CNRepairPhotosViewController alloc] initWithRepairType:self->_type]; | |
| 99 | + photos.contentId = contentId; | |
| 100 | + [weakSelf.navigationController pushViewController:photos animated:YES]; | |
| 101 | + }; | |
| 102 | + } | |
| 103 | + break; | |
| 104 | + | |
| 105 | + default: | |
| 106 | + break; | |
| 107 | + } | |
| 108 | + }; | |
| 109 | + self.operator.sliderBlock = ^(CGFloat width) { | |
| 110 | + weakSelf.drawView.lineWidth = width; | |
| 111 | + }; | |
| 112 | +} | |
| 113 | + | |
| 114 | + | |
| 115 | +#pragma mark - Getting | |
| 116 | +-(CNUploadManager *)manager | |
| 117 | +{ | |
| 118 | + if (!_manager) { | |
| 119 | + _manager = [[CNUploadManager alloc] init]; | |
| 120 | + } | |
| 121 | + return _manager; | |
| 122 | +} | |
| 123 | +- (UIImageView *)imageView | |
| 124 | +{ | |
| 125 | + if (!_imageView) { | |
| 126 | + _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, tempWidth, tempHeight)]; | |
| 127 | + _imageView.center = CGPointMake(kScreenWidth/2, (kScreenHeight - operatorHeight - NavigationContentTop)/2 + NavigationContentTop); | |
| 128 | + _imageView.contentMode = UIViewContentModeScaleAspectFit; | |
| 129 | + [_imageView setImage:_pcImage]; | |
| 130 | + } | |
| 131 | + return _imageView; | |
| 132 | +} | |
| 133 | +- (CNOperatorView *)operator | |
| 134 | +{ | |
| 135 | + if (!_operator) { | |
| 136 | + _operator = [[CNOperatorView alloc] initWithFrame:CGRectMake(0, kScreenHeight - operatorHeight - kVerticalBottomSafeHeight, kScreenWidth, operatorHeight)]; | |
| 137 | + } | |
| 138 | + return _operator; | |
| 139 | +} | |
| 140 | + -(CNDrawView *)drawView | |
| 141 | +{ | |
| 142 | + if (!_drawView) { | |
| 143 | + _drawView = [[CNDrawView alloc] initWithFrame:self.imageView.frame]; | |
| 144 | + _drawView.delegate = self.operator; | |
| 145 | + } | |
| 146 | + return _drawView; | |
| 147 | +} | |
| 148 | +/* | |
| 149 | +#pragma mark - Navigation | |
| 150 | + | |
| 151 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | |
| 152 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
| 153 | + // Get the new view controller using [segue destinationViewController]. | |
| 154 | + // Pass the selected object to the new view controller. | |
| 155 | +} | |
| 156 | +*/ | |
| 157 | + | |
| 158 | +@end | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNOldPhotoVideoViewController.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNOldPhotoVideoViewController.h | |
| 1 | +// | |
| 2 | +// CNOldPhotoVideoViewController.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/8. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <CNLiveBaseClass/CNLiveBaseViewController.h> | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | + | |
| 13 | +@interface CNOldPhotoVideoViewController : CNLiveBaseViewController | |
| 14 | + | |
| 15 | +@end | |
| 16 | + | |
| 17 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNOldPhotoVideoViewController.m
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNOldPhotoVideoViewController.m | |
| 1 | +// | |
| 2 | +// CNOldPhotoVideoViewController.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/8. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNOldPhotoVideoViewController.h" | |
| 10 | +#import "CNPhoRepairViewController.h" | |
| 11 | +#import "CNPhoPresent.h" | |
| 12 | +#import "CNRepairCagegoryCell.h" | |
| 13 | +#import "CNRepairCategoryHeaderView.h" | |
| 14 | + | |
| 15 | +static NSString *cellIdentifer = @"cellIdentifer"; | |
| 16 | +static NSString *headerIdentifer = @"headerIdentifer"; | |
| 17 | + | |
| 18 | +@interface CNOldPhotoVideoViewController ()<UITableViewDelegate,UITableViewDataSource> | |
| 19 | +{ | |
| 20 | + NSArray<CNRepairCategoryModel *> * _dataList; | |
| 21 | +} | |
| 22 | +@property (nonatomic, strong)CNPhoPresent *present; | |
| 23 | +@property (nonatomic, strong)UITableView *tableView; | |
| 24 | +@end | |
| 25 | + | |
| 26 | +@implementation CNOldPhotoVideoViewController | |
| 27 | +-(void)dealloc | |
| 28 | +{ | |
| 29 | + NSLog(@"%@销毁了",[self class]); | |
| 30 | +} | |
| 31 | + | |
| 32 | +- (void)viewDidLoad { | |
| 33 | + [super viewDidLoad]; | |
| 34 | + self.view.backgroundColor = kWhiteColor; | |
| 35 | + self.title = @"照片修复"; | |
| 36 | + [self.view addSubview:self.tableView]; | |
| 37 | + [self.present responseList:^(NSArray<CNRepairCategoryModel *> * _Nonnull dataList) { | |
| 38 | + self->_dataList = dataList; | |
| 39 | + [self.tableView reloadData]; | |
| 40 | + }]; | |
| 41 | + // Do any additional setup after loading the view. | |
| 42 | +} | |
| 43 | +-(void)viewWillAppear:(BOOL)animated | |
| 44 | +{ | |
| 45 | + [super viewWillAppear:animated]; | |
| 46 | + | |
| 47 | +} | |
| 48 | +-(void)viewDidDisappear:(BOOL)animated | |
| 49 | +{ | |
| 50 | + [super viewDidDisappear:animated]; | |
| 51 | +} | |
| 52 | + | |
| 53 | +-(void)viewDidLayoutSubviews | |
| 54 | +{ | |
| 55 | + [super viewDidLayoutSubviews]; | |
| 56 | + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 57 | + make.top.equalTo(self.view).offset(kNavigationBarHeight); | |
| 58 | + make.left.right.equalTo(self.view); | |
| 59 | + make.bottom.equalTo(self.mas_bottomLayoutGuide); | |
| 60 | + }]; | |
| 61 | +} | |
| 62 | +#pragma mark - UITableViewDelegate | |
| 63 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | |
| 64 | + return 92*RATIO; | |
| 65 | +} | |
| 66 | + | |
| 67 | +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ | |
| 68 | + return 39*RATIO; | |
| 69 | +} | |
| 70 | +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section | |
| 71 | +{ | |
| 72 | + return 0; | |
| 73 | +} | |
| 74 | +- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section | |
| 75 | +{ | |
| 76 | + CNRepairCategoryHeaderView *view = [tableView dequeueReusableHeaderFooterViewWithIdentifier:headerIdentifer]; | |
| 77 | + if (!view) { | |
| 78 | + view = [[CNRepairCategoryHeaderView alloc] initWithReuseIdentifier:headerIdentifer]; | |
| 79 | + } | |
| 80 | + CNRepairCategoryModel *model = _dataList[section]; | |
| 81 | + view.titleStr = model.title; | |
| 82 | + return view; | |
| 83 | +} | |
| 84 | + | |
| 85 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | |
| 86 | + CNLiveRepairType type = 0; | |
| 87 | + switch (indexPath.section) { | |
| 88 | + case 0: | |
| 89 | + { | |
| 90 | + if (indexPath.row == 0) { | |
| 91 | + type = 0; | |
| 92 | + }else{ | |
| 93 | + type = 1; | |
| 94 | + } | |
| 95 | + } | |
| 96 | + break; | |
| 97 | + case 1: | |
| 98 | + { | |
| 99 | + if (indexPath.row == 0) { | |
| 100 | + type = 2; | |
| 101 | + }else{ | |
| 102 | + type = 3; | |
| 103 | + } | |
| 104 | + } | |
| 105 | + break; | |
| 106 | + | |
| 107 | + default: | |
| 108 | + break; | |
| 109 | + } | |
| 110 | + | |
| 111 | + CNPhoRepairViewController *repair = [[CNPhoRepairViewController alloc] initWithRepairType:type]; | |
| 112 | + [[BaseAppDelegate sharedAppDelegate] pushViewController:repair]; | |
| 113 | +} | |
| 114 | +#pragma mark - UITableViewDataSource | |
| 115 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ | |
| 116 | + CNRepairCategoryModel *model = _dataList[section]; | |
| 117 | + return model.list.count; | |
| 118 | +} | |
| 119 | + | |
| 120 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | |
| 121 | + CNRepairCagegoryCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; | |
| 122 | + if (!cell) { | |
| 123 | + cell = [[CNRepairCagegoryCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifer]; | |
| 124 | + } | |
| 125 | + CNRepairCategoryModel *model = _dataList[indexPath.section]; | |
| 126 | + CNPhoRepairModel *dataModel = model.list[indexPath.row]; | |
| 127 | + cell.model = dataModel; | |
| 128 | + return cell; | |
| 129 | +} | |
| 130 | + | |
| 131 | +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | |
| 132 | +{ | |
| 133 | + return _dataList.count; | |
| 134 | +} | |
| 135 | + | |
| 136 | +#pragma mark - Getting | |
| 137 | +-(CNPhoPresent *)present | |
| 138 | +{ | |
| 139 | + if (!_present) { | |
| 140 | + _present = [[CNPhoPresent alloc] init]; | |
| 141 | + } | |
| 142 | + return _present; | |
| 143 | +} | |
| 144 | + | |
| 145 | +- (UITableView *)tableView | |
| 146 | +{ | |
| 147 | + if (!_tableView) { | |
| 148 | + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; | |
| 149 | + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | |
| 150 | + _tableView.backgroundColor = RGB(244, 244, 244); | |
| 151 | + _tableView.delegate = self; | |
| 152 | + _tableView.dataSource = self; | |
| 153 | + } | |
| 154 | + return _tableView; | |
| 155 | +} | |
| 156 | + | |
| 157 | +/* | |
| 158 | +#pragma mark - Navigation | |
| 159 | + | |
| 160 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | |
| 161 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
| 162 | + // Get the new view controller using [segue destinationViewController]. | |
| 163 | + // Pass the selected object to the new view controller. | |
| 164 | +} | |
| 165 | +*/ | |
| 166 | + | |
| 167 | +@end | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNPhoRepairViewController.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNPhoRepairViewController.h | |
| 1 | +// | |
| 2 | +// CNPhoRepairViewController.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/9. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <CNLiveBaseClass/CNLiveBaseViewController.h> | |
| 10 | +#import "CNPhoPresent.h" | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | + | |
| 13 | +@interface CNPhoRepairViewController : CNLiveBaseViewController | |
| 14 | +-(instancetype)initWithRepairType:(CNLiveRepairType)type; | |
| 15 | +@end | |
| 16 | + | |
| 17 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNPhoRepairViewController.m
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNPhoRepairViewController.m | |
| 1 | +// | |
| 2 | +// CNPhoRepairViewController.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/9. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNPhoRepairViewController.h" | |
| 10 | +#import <AssetsLibrary/AssetsLibrary.h> | |
| 11 | +#import "CNTailorViewController.h" | |
| 12 | +//#import <TZImagePickerController/TZImagePickerController.h> | |
| 13 | +#import "CNAuthorizeView.h" | |
| 14 | +#import "CNLiveNavigationBar.h" | |
| 15 | +#import <CNLiveImagePickerController/CNImagePickerManager.h> | |
| 16 | + | |
| 17 | +@interface CNPhoRepairViewController ()<UINavigationControllerDelegate,UIImagePickerControllerDelegate,CNTZImagePickerControllerDelegate> | |
| 18 | +{ | |
| 19 | + CNLiveRepairType _type; | |
| 20 | +} | |
| 21 | +@property (nonatomic, strong)UIImagePickerController *pickerVC; | |
| 22 | +@property (nonatomic, strong)UIScrollView *backView; | |
| 23 | +@property (nonatomic, strong)UIImageView *phoImageView; | |
| 24 | +@property (nonatomic, strong)UIImageView *beforeImage; | |
| 25 | +@property (nonatomic, strong)UIImageView *afterImage; | |
| 26 | +@property (nonatomic, strong)UILabel *titleLabel; | |
| 27 | +@property (nonatomic, strong)UILabel *messageLabel; | |
| 28 | +@property (nonatomic, strong)NSArray *chooseTypes; | |
| 29 | +@property (nonatomic, strong)UIButton *tipBtnLabel; | |
| 30 | +@end | |
| 31 | + | |
| 32 | +@implementation CNPhoRepairViewController | |
| 33 | + | |
| 34 | +-(instancetype)initWithRepairType:(CNLiveRepairType)type | |
| 35 | +{ | |
| 36 | + self = [super init]; | |
| 37 | + if (self) { | |
| 38 | + _type = type; | |
| 39 | + switch (type) { | |
| 40 | + case CNLiveRepairTypeNormal: | |
| 41 | + self.title = @"照片修复"; | |
| 42 | + break; | |
| 43 | + case CNLiveRepairTypeAddColor: | |
| 44 | + self.title = @"照片上色"; | |
| 45 | + break; | |
| 46 | + case CNLiveRepairTypeDraw: | |
| 47 | + self.title = @"照片修补"; | |
| 48 | + break; | |
| 49 | + case CNLiveRepairTypeDrawAddColor: | |
| 50 | + self.title = @"照片修补及上色"; | |
| 51 | + break; | |
| 52 | + | |
| 53 | + default: | |
| 54 | + break; | |
| 55 | + } | |
| 56 | + } | |
| 57 | + return self; | |
| 58 | +} | |
| 59 | + | |
| 60 | +- (void)viewDidLoad { | |
| 61 | + [super viewDidLoad]; | |
| 62 | + self.view.backgroundColor = [UIColor whiteColor]; | |
| 63 | + [self.view addSubview:self.navigationBar]; | |
| 64 | + [self.view addSubview:self.backView]; | |
| 65 | + [self.backView addSubview:self.phoImageView]; | |
| 66 | + [self.backView addSubview:self.titleLabel]; | |
| 67 | + [self.backView addSubview:self.messageLabel]; | |
| 68 | + [self.phoImageView addSubview:self.beforeImage]; | |
| 69 | + [self.phoImageView addSubview:self.afterImage]; | |
| 70 | + self.chooseTypes = @[@"拍一张",@"选择照片"]; | |
| 71 | + | |
| 72 | + [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 73 | + make.left.right.equalTo(self.view); | |
| 74 | + make.top.offset(NavigationContentTop); | |
| 75 | + make.bottom.equalTo(self.mas_bottomLayoutGuide); | |
| 76 | + }]; | |
| 77 | + [self.phoImageView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 78 | + make.left.top.equalTo(self.backView).offset(CNScaleW(15)); | |
| 79 | + make.width.height.offset(kScreenWidth - CNScaleW(15)*2); | |
| 80 | + }]; | |
| 81 | + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 82 | + make.left.right.equalTo(self.phoImageView); | |
| 83 | + make.top.equalTo(self.phoImageView.mas_bottom).offset(CNScaleH(15)); | |
| 84 | + make.height.offset(21*RATIO); | |
| 85 | + }]; | |
| 86 | + | |
| 87 | + [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 88 | + make.left.right.equalTo(self.titleLabel); | |
| 89 | + make.top.equalTo(self.titleLabel.mas_bottom).offset(CNScaleH(5)); | |
| 90 | + }]; | |
| 91 | + [self.beforeImage mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 92 | + make.top.left.equalTo(self.phoImageView); | |
| 93 | + make.width.offset(65); | |
| 94 | + make.height.offset(30); | |
| 95 | + }]; | |
| 96 | + [self.afterImage mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 97 | + make.top.right.equalTo(self.phoImageView); | |
| 98 | + make.width.width.equalTo(self.beforeImage); | |
| 99 | + }]; | |
| 100 | + // Do any additional setup after loading the view. | |
| 101 | +} | |
| 102 | + | |
| 103 | +#pragma mark - Action | |
| 104 | +-(void)removeTipBtnLabel{ | |
| 105 | + [self.tipBtnLabel removeFromSuperview]; | |
| 106 | + self.tipBtnLabel = nil; | |
| 107 | +} | |
| 108 | +-(void)chooseBtnClick:(UIButton *)sender | |
| 109 | +{ | |
| 110 | + //流程大致介绍:第一步判断是否授权,否则弹出app授权说明,确定授权之后相机判断是否走过授权流程,是则弹窗,否走系统授权方法 | |
| 111 | + switch (sender.tag-1001) { | |
| 112 | + case 0: | |
| 113 | + { | |
| 114 | + AVAuthorizationStatus videoAuthStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; | |
| 115 | + if (videoAuthStatus == PHAuthorizationStatusAuthorized) { | |
| 116 | + [self ShowphotoTake]; | |
| 117 | + | |
| 118 | + }else{ | |
| 119 | + weakself | |
| 120 | + [CNAuthorizeView setUpAuthorizeViewForTitle:@"网家家需获取以下权限" secondTitle:@"相机、麦克风" mesOne:@"用于拍摄、扫码、语音通话时收集声音和画面。" mesTwo:@"可前往手机自带设置——应用管理——权限管理开启和关闭。" sureTitle:@"开启权限" sureBlock:^{ | |
| 121 | + //判断是否走过授权流程 | |
| 122 | + if ([weakSelf checkAuthStatus]) { | |
| 123 | + [weakSelf ShowphotoTake]; | |
| 124 | + } | |
| 125 | + | |
| 126 | + }]; | |
| 127 | + } | |
| 128 | + } | |
| 129 | + break; | |
| 130 | + case 1: | |
| 131 | + { | |
| 132 | + PHAuthorizationStatus authStatus = [PHPhotoLibrary authorizationStatus]; | |
| 133 | + if (authStatus == PHAuthorizationStatusAuthorized) { | |
| 134 | + [self pushTZImagePickerController]; | |
| 135 | + | |
| 136 | + }else{ | |
| 137 | + weakself | |
| 138 | + [CNAuthorizeView setUpAuthorizeViewForTitle:@"网家家需获取以下权限" secondTitle:@"相册(读写手机存储)" mesOne:@"· 用于照片修复、图片发送时能选择手机相册里的照片。" mesTwo:@"可前往手机自带设置——应用管理——权限管理开启和关闭。" sureTitle:@"开启权限" sureBlock:^{ | |
| 139 | + [weakSelf pushTZImagePickerController]; | |
| 140 | + }]; | |
| 141 | + } | |
| 142 | + } | |
| 143 | + break; | |
| 144 | + | |
| 145 | + default: | |
| 146 | + break; | |
| 147 | + } | |
| 148 | +} | |
| 149 | +-(void)ShowphotoTake | |
| 150 | +{ | |
| 151 | + if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) | |
| 152 | + { | |
| 153 | + UIImagePickerController *pickerVC = [[UIImagePickerController alloc] init]; | |
| 154 | + pickerVC.delegate = self; | |
| 155 | + pickerVC.sourceType = UIImagePickerControllerSourceTypeCamera; | |
| 156 | + //设置拍照后的图片可被编辑 | |
| 157 | + pickerVC.allowsEditing = YES; | |
| 158 | + [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { | |
| 159 | + if(!granted) //如果不允许 | |
| 160 | + { | |
| 161 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 162 | + [[UIApplication sharedApplication].keyWindow.rootViewController.presentedViewController dismissViewControllerAnimated:YES completion:nil]; | |
| 163 | + }); | |
| 164 | + | |
| 165 | + } | |
| 166 | + }]; | |
| 167 | + | |
| 168 | + [self presentViewController:pickerVC animated:YES completion:nil]; | |
| 169 | + | |
| 170 | + } | |
| 171 | +} | |
| 172 | +/// 检测已经询问过是否开通权限部分 | |
| 173 | +- (Boolean)checkAuthStatus { | |
| 174 | + | |
| 175 | + Boolean checkAuth = YES; | |
| 176 | + // 请求相机权限 | |
| 177 | + AVAuthorizationStatus videoAuthStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; | |
| 178 | + if (videoAuthStatus == AVAuthorizationStatusDenied) | |
| 179 | + { | |
| 180 | + checkAuth = NO; | |
| 181 | + [self messageVC]; | |
| 182 | + return checkAuth; | |
| 183 | + | |
| 184 | + } | |
| 185 | + | |
| 186 | + return checkAuth; | |
| 187 | +} | |
| 188 | + | |
| 189 | +/// 询问过后本地提示内容 | |
| 190 | +- (void)messageVC { | |
| 191 | + NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; | |
| 192 | + | |
| 193 | + NSString *appName = [infoDictionary objectForKey:@"CFBundleDisplayName"]; | |
| 194 | + if (appName == nil) | |
| 195 | + { | |
| 196 | + appName = @"APP"; | |
| 197 | + } | |
| 198 | + NSString *message = [NSString stringWithFormat:@"请在iPhone的“设置-隐私“选项中,允许%@访问你的相机和麦克风。", appName];//[NSString stringWithFormat:@"请在iPhone的““设置-隐私””选项中, 允许%@访问你的麦克风?", appName]; | |
| 199 | + | |
| 200 | + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:message preferredStyle:UIAlertControllerStyleAlert]; | |
| 201 | + | |
| 202 | + UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:NULL]; | |
| 203 | + | |
| 204 | + [alertController addAction:okAction]; | |
| 205 | + | |
| 206 | + [self presentViewController:alertController animated:YES completion:nil]; | |
| 207 | +} | |
| 208 | +//调取相册流程方法 | |
| 209 | +- (void)pushTZImagePickerController { | |
| 210 | + CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; | |
| 211 | + imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 212 | + imagePickerVc.allowTakePicture = NO; // 在内部显示拍照按钮 | |
| 213 | + imagePickerVc.allowPickingOriginalPhoto = NO; | |
| 214 | + imagePickerVc.allowPickingVideo = NO; | |
| 215 | + imagePickerVc.showSelectBtn = YES; | |
| 216 | + imagePickerVc.navigationBar.tintColor = kBlackColor; | |
| 217 | + imagePickerVc.photoPickerPageDidLayoutSubviewsBlock = ^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) { | |
| 218 | + doneButton.width = 60; | |
| 219 | + doneButton.titleLabel.textAlignment = NSTextAlignmentRight; | |
| 220 | + doneButton.right =kScreenWidth - previewButton.left; | |
| 221 | + }; | |
| 222 | + imagePickerVc.photoPreviewPageDidLayoutSubviewsBlock = ^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) { | |
| 223 | + naviBar.backgroundColor = kWhiteColor; | |
| 224 | + [backButton setImage:[CNLiveCPhotoRepairImage getImageWithNamed:@"skill_service_back"] forState:UIControlStateNormal]; | |
| 225 | + UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 20)]; | |
| 226 | + titleLabel.text = @"预览"; | |
| 227 | + titleLabel.textColor = kBlackColor; | |
| 228 | + titleLabel.textAlignment = NSTextAlignmentCenter; | |
| 229 | + titleLabel.centerX =KScreenWidth/2; | |
| 230 | + titleLabel.centerY = backButton.centerY; | |
| 231 | + [naviBar addSubview:titleLabel]; | |
| 232 | + doneButton.width = 60; | |
| 233 | + doneButton.right =kScreenWidth - 5; | |
| 234 | + }; | |
| 235 | + weakself | |
| 236 | + [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { | |
| 237 | + UIImage *image = photos.firstObject; | |
| 238 | + NSData *photoData = UIImageJPEGRepresentation(image,1); | |
| 239 | + float length = [photoData length]/1000/1000; | |
| 240 | + if (length>50 ) { | |
| 241 | + [QMUITips showWithText:@"照片容量不能大于50M,请重选" inView:self.view]; | |
| 242 | + return; | |
| 243 | + }else if (image.size.width/image.size.height >10 || image.size.height/image.size.width >10){ | |
| 244 | + [QMUITips showWithText:@"暂不支持长图修复" inView:self.view]; | |
| 245 | + return; | |
| 246 | + } | |
| 247 | + CNTailorViewController *tailor = [[CNTailorViewController alloc] initWithImage:image withRepairType:self->_type]; | |
| 248 | + [weakSelf.navigationController pushViewController:tailor animated:YES]; | |
| 249 | + | |
| 250 | + }]; | |
| 251 | + [self presentViewController:imagePickerVc animated:YES completion:nil]; | |
| 252 | +} | |
| 253 | + | |
| 254 | +#pragma mark - UIImagePickerControllerDelegate | |
| 255 | +- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<UIImagePickerControllerInfoKey, id> *)info{ | |
| 256 | + //获取图片 | |
| 257 | + UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage]; | |
| 258 | + [picker dismissViewControllerAnimated:YES completion:nil]; | |
| 259 | + CNTailorViewController *tailor = [[CNTailorViewController alloc] initWithImage:image withRepairType:_type]; | |
| 260 | + [self.navigationController pushViewController:tailor animated:YES]; | |
| 261 | +} | |
| 262 | + | |
| 263 | +#pragma mark - Getting&&Setting | |
| 264 | +-(UIScrollView *)backView | |
| 265 | +{ | |
| 266 | + if (!_backView) { | |
| 267 | + _backView = [[UIScrollView alloc] init]; | |
| 268 | + } | |
| 269 | + return _backView; | |
| 270 | +} | |
| 271 | +-(UIImageView *)phoImageView | |
| 272 | +{ | |
| 273 | + if (!_phoImageView) { | |
| 274 | + _phoImageView = [[UIImageView alloc] init]; | |
| 275 | + [_phoImageView sd_setImageWithURL:[NSURL URLWithString:@"https://wjj.ys1.cnliveimg.com/download/ac/img/photo_restoration_image.png"] placeholderImage:[CNLiveCPhotoRepairImage getImageWithNamed:@"default _icon_bg"]]; | |
| 276 | + _phoImageView.contentMode = UIViewContentModeScaleAspectFit; | |
| 277 | + } | |
| 278 | + return _phoImageView; | |
| 279 | +} | |
| 280 | + | |
| 281 | +- (UIImageView *)beforeImage | |
| 282 | +{ | |
| 283 | + if (!_beforeImage) { | |
| 284 | + _beforeImage = [[UIImageView alloc] init]; | |
| 285 | + [_beforeImage setImage:[CNLiveCPhotoRepairImage getImageWithNamed:@"oldPho_repairBefore"]]; | |
| 286 | + _beforeImage.contentMode = UIViewContentModeScaleAspectFit; | |
| 287 | + } | |
| 288 | + return _beforeImage; | |
| 289 | +} | |
| 290 | +- (UIImageView *)afterImage | |
| 291 | +{ | |
| 292 | + if (!_afterImage) { | |
| 293 | + _afterImage = [[UIImageView alloc] init]; | |
| 294 | + [_afterImage setImage:[CNLiveCPhotoRepairImage getImageWithNamed:@"oldPho_repairAfter"]]; | |
| 295 | + _afterImage.contentMode = UIViewContentModeScaleAspectFit; | |
| 296 | + } | |
| 297 | + return _afterImage; | |
| 298 | +} | |
| 299 | +-(UILabel *)titleLabel | |
| 300 | +{ | |
| 301 | + if (!_titleLabel) { | |
| 302 | + _titleLabel = [[UILabel alloc] init]; | |
| 303 | + _titleLabel.textColor = RGB(51, 51, 51); | |
| 304 | + _titleLabel.textAlignment = NSTextAlignmentLeft; | |
| 305 | + _titleLabel.font = UIFontCNMake(15); | |
| 306 | + _titleLabel.text = @"修复范围:"; | |
| 307 | + } | |
| 308 | + return _titleLabel; | |
| 309 | +} | |
| 310 | +-(UILabel *)messageLabel | |
| 311 | +{ | |
| 312 | + if (!_messageLabel) { | |
| 313 | + _messageLabel = [[UILabel alloc] init]; | |
| 314 | + _messageLabel.numberOfLines = 0; | |
| 315 | + _messageLabel.textColor = RGB(153, 153, 153); | |
| 316 | + _messageLabel.textAlignment = NSTextAlignmentLeft; | |
| 317 | + _messageLabel.font = UIFontCNMake(15); | |
| 318 | + _messageLabel.text = @"支持修复照片中的残缺、污点;能增加照片清晰度,增强纹理;减少照片中的噪点,提升画质"; | |
| 319 | + } | |
| 320 | + return _messageLabel; | |
| 321 | +} | |
| 322 | +-(UIButton *)tipBtnLabel | |
| 323 | +{ | |
| 324 | + if (!_tipBtnLabel) { | |
| 325 | + _tipBtnLabel = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 326 | + _tipBtnLabel.frame = CGRectMake(0, 0, 151, 64.5); | |
| 327 | + [_tipBtnLabel setTitle:@"选一张照片修复" forState:UIControlStateNormal]; | |
| 328 | + [_tipBtnLabel setTitleColor:RGB(51, 51, 51) forState:UIControlStateNormal]; | |
| 329 | + _tipBtnLabel.titleLabel.font = UIFontMake(15); | |
| 330 | + [_tipBtnLabel setBackgroundImage:[CNLiveCPhotoRepairImage getImageWithNamed:@"oldpho_tip"] forState:UIControlStateNormal]; | |
| 331 | + _tipBtnLabel.centerX = kScreenWidth *3/4; | |
| 332 | + [self performSelector:@selector(removeTipBtnLabel) afterDelay:3]; | |
| 333 | + } | |
| 334 | + return _tipBtnLabel; | |
| 335 | +} | |
| 336 | +-(void)setChooseTypes:(NSArray *)chooseTypes | |
| 337 | +{ | |
| 338 | + CGFloat btnTop = CNScaleH(560.5); | |
| 339 | + CGFloat btnHeight = 35; | |
| 340 | + if (btnTop + btnHeight < kScreenHeight - NavigationContentTop) { | |
| 341 | + btnTop = kScreenHeight - NavigationContentTop - btnHeight -10 - kVerticalBottomSafeHeight; | |
| 342 | + } | |
| 343 | + for (int i = 0 ;i<chooseTypes.count;i++) { | |
| 344 | + UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 345 | + btn.frame = CGRectMake(0, btnTop, CNScaleW(165), btnHeight); | |
| 346 | + [btn setTitle:chooseTypes[i] forState:UIControlStateNormal]; | |
| 347 | + [btn setTitleColor:kWhiteColor forState:UIControlStateNormal]; | |
| 348 | + btn.titleLabel.font = UIFontCNMake(16); | |
| 349 | + if (i == 0) { | |
| 350 | + btn.backgroundColor = RGB(254, 160, 25); | |
| 351 | + }else{ | |
| 352 | + btn.backgroundColor = RGB(252, 128, 90); | |
| 353 | + } | |
| 354 | + btn.tag = 1001 + i; | |
| 355 | + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, CNScaleW(165), btnHeight) cornerRadius:25]; | |
| 356 | + CAShapeLayer *maskLayer = [CAShapeLayer layer]; | |
| 357 | + maskLayer.path = path.CGPath; | |
| 358 | + btn.layer.mask = maskLayer; | |
| 359 | + [btn addTarget:self action:@selector(chooseBtnClick:) forControlEvents:UIControlEventTouchUpInside]; | |
| 360 | + btn.centerX = SCREEN_WIDTH * (2 * i + 1)/4; | |
| 361 | + [_backView addSubview:btn]; | |
| 362 | + } | |
| 363 | + [_backView addSubview:self.tipBtnLabel]; | |
| 364 | + _tipBtnLabel.bottom = btnTop; | |
| 365 | + _backView.contentSize = CGSizeMake(SCREEN_WIDTH, btnTop + btnHeight+5); | |
| 366 | +} | |
| 367 | + | |
| 368 | + | |
| 369 | +@end | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNRepairPhotosViewController.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNRepairPhotosViewController.h | |
| 1 | +// | |
| 2 | +// CNRepairPhotosViewController.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/14. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNCommonViewController.h" | |
| 10 | +#import "CNPhoPresent.h" | |
| 11 | + | |
| 12 | +NS_ASSUME_NONNULL_BEGIN | |
| 13 | + | |
| 14 | +@interface CNRepairPhotosViewController : CNCommonViewController | |
| 15 | +@property (nonatomic, strong) NSString *contentId;//页面id | |
| 16 | +@property (nonatomic) BOOL isNotFromTailor; //不是从修图流程进入的 | |
| 17 | + | |
| 18 | +-(instancetype)initWithRepairType:(CNLiveRepairType)type; | |
| 19 | +@end | |
| 20 | + | |
| 21 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNRepairPhotosViewController.m
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNRepairPhotosViewController.m | |
| 1 | +// | |
| 2 | +// CNRepairPhotosViewController.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/14. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNRepairPhotosViewController.h" | |
| 10 | +#import "JXCategoryTitleView.h" | |
| 11 | +#import "JXCategoryIndicatorLineView.h" | |
| 12 | +#import "CNLiveNavigationBar.h" | |
| 13 | +#import "CNOldPhotoVideoViewController.h" | |
| 14 | +#import "CNPhoRepairModel.h" | |
| 15 | + | |
| 16 | +@interface CNRepairPhotosViewController ()<UIScrollViewDelegate,JXCategoryViewDelegate,CNPhotoResponseDelegate> | |
| 17 | +{ | |
| 18 | + BOOL _isSavePhoto; | |
| 19 | + UIImage *_saveimage; | |
| 20 | + BOOL done; | |
| 21 | + CNPhoRepairsListModel *dataModel; | |
| 22 | + CNLiveRepairType _type; | |
| 23 | +} | |
| 24 | +@property (nonatomic, strong)CNLiveNavigationBar *navigationBar; | |
| 25 | +@property (nonatomic, strong) JXCategoryTitleView *titleCategoryView; | |
| 26 | +@property (nonatomic, strong) UIScrollView *scrollView; | |
| 27 | +@property (nonatomic, strong) NSArray *titles; | |
| 28 | +@property (nonatomic, strong) UIButton *saveBtn; | |
| 29 | +@property (nonatomic, strong) UIButton *sharebtn; | |
| 30 | +@property (nonatomic, strong)UIButton *tipBtnLabel; | |
| 31 | +@property (nonatomic, strong)CNPhoPresent *present; | |
| 32 | +@end | |
| 33 | + | |
| 34 | +@implementation CNRepairPhotosViewController | |
| 35 | +static const CGFloat height = 44; | |
| 36 | +-(instancetype)initWithRepairType:(CNLiveRepairType)type | |
| 37 | +{ | |
| 38 | + self = [super init]; | |
| 39 | + if (self) { | |
| 40 | + _type = type; | |
| 41 | + } | |
| 42 | + return self; | |
| 43 | +} | |
| 44 | +- (void)viewDidLoad { | |
| 45 | + [super viewDidLoad]; | |
| 46 | + [self.present requestRepairedPhotos:_contentId]; | |
| 47 | + self.view.backgroundColor = kWhiteColor; | |
| 48 | + [self.view addSubview:self.navigationBar]; | |
| 49 | + [self.view addSubview:self.titleCategoryView]; | |
| 50 | + [self.view addSubview:self.scrollView]; | |
| 51 | + [self.view addSubview:self.saveBtn]; | |
| 52 | + [self.view addSubview:self.sharebtn]; | |
| 53 | + [self.view addSubview:self.tipBtnLabel]; | |
| 54 | +} | |
| 55 | + | |
| 56 | +-(void)viewWillAppear:(BOOL)animated | |
| 57 | +{ | |
| 58 | + [super viewWillAppear:animated]; | |
| 59 | + self.navigationController.navigationBarHidden = YES; | |
| 60 | +} | |
| 61 | +- (BOOL)prefersStatusBarHidden { | |
| 62 | + return self.statusHidenPhotoBrowser; | |
| 63 | +} | |
| 64 | +#pragma mark - CNPhotoResponseDelegate | |
| 65 | +-(void)requestSucceed:(CNPhoRepairsListModel *)model | |
| 66 | +{ | |
| 67 | + [self hideEmptyView]; | |
| 68 | + dataModel = model; | |
| 69 | + if (!dataModel.slimPicture || [dataModel.slimPicture isEqualToString:@""]) { | |
| 70 | + dataModel.slimPicture = model.repairedPicture; | |
| 71 | + } | |
| 72 | + for (UIImageView *view in self.scrollView.subviews) { | |
| 73 | + if (view.tag-1001==0) { | |
| 74 | + [self addImageView:view image:dataModel.oldPicture]; | |
| 75 | + } | |
| 76 | + if (view.tag-1001==1) { | |
| 77 | + [self addImageView:view image:dataModel.slimPicture]; | |
| 78 | + } | |
| 79 | + } | |
| 80 | + if (dataModel.repairedPicture&&[[NSUserDefaults standardUserDefaults] objectForKey:dataModel.repairedPicture]) { | |
| 81 | + NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:dataModel.repairedPicture]; | |
| 82 | + self -> _saveimage = [UIImage imageWithData:data]; | |
| 83 | + }else if (dataModel.repairedPicture){ | |
| 84 | + weakself | |
| 85 | + [self.present downLoadImage:dataModel.repairedPicture response:^(NSData * _Nonnull data) { | |
| 86 | + strongself | |
| 87 | + if (self) { | |
| 88 | + self -> _saveimage = [UIImage imageWithData:data]; | |
| 89 | + self-> done = YES; | |
| 90 | + } | |
| 91 | + | |
| 92 | + }]; | |
| 93 | + }else | |
| 94 | + { | |
| 95 | + done = YES; | |
| 96 | + } | |
| 97 | +} | |
| 98 | +-(void)addImageView:(UIImageView *)view image:(NSString *)imageUrl | |
| 99 | +{ | |
| 100 | + weakself | |
| 101 | + [view sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[CNLiveCPhotoRepairImage getImageWithNamed:@"default _icon_bg"] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { | |
| 102 | + if (error) { | |
| 103 | + if (view.emptyView) { | |
| 104 | + return; | |
| 105 | + } | |
| 106 | + [view displayEmptyView:[CNLiveCPhotoRepairImage getImageWithNamed:@"wufalianjie"] remind:@"照片加载失败,刷新试试" hint:nil disposeBtnTitle:@" 重试 " inset:UIEdgeInsetsMake(0, 0, 0, 0) tapDisposeBtnCallBack:^{ | |
| 107 | + [weakSelf addImageView:view image:imageUrl]; | |
| 108 | + }]; | |
| 109 | + }else{ | |
| 110 | + [view removeEmptyView]; | |
| 111 | + } | |
| 112 | + }]; | |
| 113 | +} | |
| 114 | + | |
| 115 | +-(void)requstFailed | |
| 116 | +{ | |
| 117 | + [self showEmptyViewWithImage:[CNLiveCPhotoRepairImage getImageWithNamed:@"wufalianjie"] text:@"数据加载失败" detailText:@"别紧张,试试看刷新页面~" buttonTitle:@" 重试 " buttonAction:@selector(loadData)]; | |
| 118 | + [self setCNNoNetworkingEmptyView]; | |
| 119 | + self.emptyView.frame = CGRectMake(0, NavigationContentTop, kScreenWidth, kScreenHeight -NavigationContentTop ); | |
| 120 | +} | |
| 121 | +-(void)loadData{ | |
| 122 | + [self.present requestRepairedPhotos:_contentId]; | |
| 123 | +} | |
| 124 | +#pragma mark - Action | |
| 125 | +-(void)removeTipBtnLabel{ | |
| 126 | + [self.tipBtnLabel removeFromSuperview]; | |
| 127 | + self.tipBtnLabel = nil; | |
| 128 | +} | |
| 129 | +-(void)saveBtnClick | |
| 130 | +{ | |
| 131 | + [QMUITips showLoading:@"保存中" inView:self.view]; | |
| 132 | + do{ | |
| 133 | + [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; | |
| 134 | + | |
| 135 | + }while (!done&&!_saveimage); | |
| 136 | + weakself | |
| 137 | + [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ | |
| 138 | + strongself | |
| 139 | + [PHAssetChangeRequest creationRequestForAssetFromImage:self->_saveimage]; | |
| 140 | + } completionHandler:^(BOOL success, NSError * _Nullable error) { | |
| 141 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 142 | + strongself | |
| 143 | + [QMUITips hideAllTips]; | |
| 144 | + if (success) { | |
| 145 | + self->_isSavePhoto = YES; | |
| 146 | + [QMUITips showSucceed:@"保存成功" inView:self.view]; | |
| 147 | + }else | |
| 148 | + { | |
| 149 | + if (error.code == 2047) { | |
| 150 | + NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; | |
| 151 | + | |
| 152 | + NSString *appName = [infoDictionary objectForKey:@"CFBundleDisplayName"]; | |
| 153 | + if (appName == nil) | |
| 154 | + { | |
| 155 | + appName = @"APP"; | |
| 156 | + } | |
| 157 | + NSString *message = [NSString stringWithFormat:@"请在iPhone的“设置-隐私“选项中,允许%@访问相册。", appName]; | |
| 158 | + | |
| 159 | + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:message preferredStyle:UIAlertControllerStyleAlert]; | |
| 160 | + | |
| 161 | + UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:NULL]; | |
| 162 | + | |
| 163 | + [alertController addAction:okAction]; | |
| 164 | + | |
| 165 | + [self presentViewController:alertController animated:YES completion:nil]; | |
| 166 | + }else{ | |
| 167 | + [QMUITips showError:@"保存失败" inView:self.view]; | |
| 168 | + } | |
| 169 | + } | |
| 170 | + }); | |
| 171 | + | |
| 172 | + }]; | |
| 173 | +} | |
| 174 | + | |
| 175 | +-(void)shareBtnClick | |
| 176 | +{ | |
| 177 | + NSString *urlStr = [NSString stringWithFormat:@"%@%@?contentId=%@",WjjH5_Host,@"/cnPhotoRestoration.html",_contentId]; | |
| 178 | + [CNLiveCPhotoRepairService showShareViewWithParamForShareTitle:@"我修复了一张照片" ShareUrl:urlStr ShareDesc:@"我在网家家修复了一张照片,快来看看我修的怎么样?" ShareImage:dataModel.slimPicture ScreenFull:NO HiddenWjj:NO HiddenQQ:NO HiddenWB:NO HiddenLifeCircle:NO HiddenWechatCircle:NO HiddenWechat:NO HiddenSafari:NO FormVC:self TopImage:NULL TopTitles:NULL PlatformType:CNLivePhotoSharePlatformTypeAll CompleterBlock:^(CNLivePhotoShareResultType resultType, CNLivePhotoSharePlatformType platformType, NSString *typtString) { | |
| 179 | + if (resultType == CNLivePhotoShareResultTypeSucc) { | |
| 180 | + [QMUITips showSucceed:@"分享成功" inView:self.view]; | |
| 181 | + } | |
| 182 | + }]; | |
| 183 | +} | |
| 184 | +#pragma mark - Getting | |
| 185 | +- (JXCategoryTitleView *)titleCategoryView{ | |
| 186 | + if (!_titleCategoryView) { | |
| 187 | + _titleCategoryView = [[JXCategoryTitleView alloc]initWithFrame:CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, height *RATIO)]; | |
| 188 | + _titleCategoryView.backgroundColor = [UIColor whiteColor]; | |
| 189 | + _titleCategoryView.titles = self.titles; | |
| 190 | + _titleCategoryView.titleFont = UIFontCNMake(16); | |
| 191 | + _titleCategoryView.collectionView.frame = CGRectMake(12, 0, SCREEN_WIDTH , 44); | |
| 192 | + _titleCategoryView.collectionView.scrollEnabled = NO; | |
| 193 | + _titleCategoryView.delegate = self; | |
| 194 | + _titleCategoryView.defaultSelectedIndex = 1; | |
| 195 | + _titleCategoryView.titleColor = RGB(153, 153, 153); | |
| 196 | + _titleCategoryView.titleSelectedColor = RGB(74, 74, 74); | |
| 197 | + _titleCategoryView.titleFont = [UIFont systemFontOfSize:16]; | |
| 198 | + _titleCategoryView.titleLabelZoomScale = 1.0; | |
| 199 | + _titleCategoryView.titleLabelZoomEnabled = YES; | |
| 200 | + _titleCategoryView.titleColorGradientEnabled = YES; | |
| 201 | + | |
| 202 | + JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init]; | |
| 203 | + lineView.indicatorColor = RGB(252, 21, 65); | |
| 204 | + lineView.indicatorWidth = 20; | |
| 205 | + _titleCategoryView.indicators = @[lineView]; | |
| 206 | + _titleCategoryView.contentScrollView = self.scrollView; | |
| 207 | + | |
| 208 | + UIView *line = [[UIView alloc] initWithFrame:CGRectMake(KScreenWidth/2-0.2, 14.5*RATIO, 0.5, 13*RATIO)]; | |
| 209 | + line.backgroundColor = RGB(230, 230, 230); | |
| 210 | + [_titleCategoryView addSubview:line]; | |
| 211 | + | |
| 212 | + } | |
| 213 | + return _titleCategoryView; | |
| 214 | +} | |
| 215 | + | |
| 216 | +- (UIScrollView *)scrollView { | |
| 217 | + if (!_scrollView) { | |
| 218 | + CGFloat scrollW = SCREEN_WIDTH; | |
| 219 | + CGFloat scrollH = SCREEN_HEIGHT - NavigationContentTop - height - CNScaleH(114) - kVerticalBottomSafeHeight; | |
| 220 | + _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, NavigationContentTop + height, scrollW, scrollH)]; | |
| 221 | + _scrollView.contentSize = CGSizeMake(scrollW * self.titles.count, scrollH); | |
| 222 | + _scrollView.pagingEnabled = YES; | |
| 223 | + _scrollView.bounces = NO; | |
| 224 | + _scrollView.delegate = self; | |
| 225 | + _scrollView.showsHorizontalScrollIndicator = NO; | |
| 226 | + _scrollView.scrollEnabled = YES; | |
| 227 | + _scrollView.backgroundColor = [UIColor whiteColor]; | |
| 228 | + | |
| 229 | + for(int i = 0; i < self.titles.count; i++){ | |
| 230 | + UIImageView *imageView = [[UIImageView alloc]init]; | |
| 231 | + imageView.contentMode = UIViewContentModeScaleAspectFit; | |
| 232 | + imageView.frame = CGRectMake(i*scrollW +CNScaleW(15), CNScaleH(15), scrollW-CNScaleW(30), scrollH-CNScaleH(15)); | |
| 233 | + imageView.tag = 1001+ i; | |
| 234 | + imageView.userInteractionEnabled = YES; | |
| 235 | + [_scrollView addSubview:imageView]; | |
| 236 | + } | |
| 237 | + | |
| 238 | + } | |
| 239 | + return _scrollView; | |
| 240 | +} | |
| 241 | + | |
| 242 | +- (NSArray *)titles{ | |
| 243 | + if (!_titles) { | |
| 244 | + _titles = [NSArray arrayWithObjects:@"修复前", @"修复后", nil]; | |
| 245 | + } | |
| 246 | + return _titles; | |
| 247 | +} | |
| 248 | + | |
| 249 | +-(UIButton *)saveBtn | |
| 250 | +{ | |
| 251 | + if (!_saveBtn) { | |
| 252 | + _saveBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 253 | + _saveBtn.frame = CGRectMake(CNScaleW(15), 0, CNScaleW(100), 35); | |
| 254 | + _saveBtn.bottom = kScreenHeight -CNScaleH(10) - kVerticalBottomSafeHeight; | |
| 255 | + _saveBtn.backgroundColor = RGB(254, 166, 24); | |
| 256 | + _saveBtn.titleLabel.font = UIFontCNMake(16); | |
| 257 | + [_saveBtn setTitle:@"保存" forState:UIControlStateNormal]; | |
| 258 | + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, CNScaleW(100), 35) cornerRadius:19]; | |
| 259 | + CAShapeLayer *maskLayer = [CAShapeLayer layer]; | |
| 260 | + maskLayer.path = path.CGPath; | |
| 261 | + _saveBtn.layer.mask = maskLayer; | |
| 262 | + [_saveBtn addTarget:self action:@selector(saveBtnClick) forControlEvents:UIControlEventTouchUpInside]; | |
| 263 | + } | |
| 264 | + return _saveBtn; | |
| 265 | +} | |
| 266 | +-(UIButton *)sharebtn | |
| 267 | +{ | |
| 268 | + if (!_sharebtn) { | |
| 269 | + _sharebtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 270 | + _sharebtn.frame = CGRectMake(0, 0, CNScaleW(230), 35); | |
| 271 | + _sharebtn.bottom = kScreenHeight -CNScaleH(10) - kVerticalBottomSafeHeight; | |
| 272 | + _sharebtn.right = kScreenWidth - CNScaleW(15); | |
| 273 | + _sharebtn.titleLabel.font = UIFontCNMake(16); | |
| 274 | + _sharebtn.backgroundColor = RGB(252, 128, 89); | |
| 275 | + [_sharebtn setTitle:@"分享给好友 " forState:UIControlStateNormal]; | |
| 276 | + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, CNScaleW(230), 35) cornerRadius:19]; | |
| 277 | + CAShapeLayer *maskLayer = [CAShapeLayer layer]; | |
| 278 | + maskLayer.path = path.CGPath; | |
| 279 | + _sharebtn.layer.mask = maskLayer; | |
| 280 | + [_sharebtn addTarget:self action:@selector(shareBtnClick) forControlEvents:UIControlEventTouchUpInside]; | |
| 281 | + } | |
| 282 | + return _sharebtn; | |
| 283 | +} | |
| 284 | + | |
| 285 | +-(UIButton *)tipBtnLabel | |
| 286 | +{ | |
| 287 | + if (!_tipBtnLabel) { | |
| 288 | + _tipBtnLabel = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 289 | + _tipBtnLabel.frame = CGRectMake(0, 0, 210, 49); | |
| 290 | + [_tipBtnLabel setTitle:@"和好友分享你的美好时光吧" forState:UIControlStateNormal]; | |
| 291 | + [_tipBtnLabel setTitleColor:RGB(102, 102, 102) forState:UIControlStateNormal]; | |
| 292 | + _tipBtnLabel.titleLabel.font = UIFontMake(15); | |
| 293 | + [_tipBtnLabel setBackgroundImage:[CNLiveCPhotoRepairImage getImageWithNamed:@"oldPho_shareTip"] forState:UIControlStateNormal]; | |
| 294 | + _tipBtnLabel.centerX = _sharebtn.centerX; | |
| 295 | + _tipBtnLabel.bottom = _sharebtn.top; | |
| 296 | + [self performSelector:@selector(removeTipBtnLabel) afterDelay:3]; | |
| 297 | + } | |
| 298 | + return _tipBtnLabel; | |
| 299 | +} | |
| 300 | +#pragma mark - Navigation | |
| 301 | + | |
| 302 | +- (CNLiveNavigationBar *)navigationBar | |
| 303 | +{ | |
| 304 | + if (!_navigationBar) { | |
| 305 | + _navigationBar = [CNLiveNavigationBar navigationBar]; | |
| 306 | + _navigationBar.title.text = @"修复完成"; | |
| 307 | + _navigationBar.backgroundColor = kWhiteColor; | |
| 308 | + _navigationBar.lineHidden = NO; | |
| 309 | + _navigationBar.right.hidden = NO; | |
| 310 | + _navigationBar.rightTitle = @"再修一张"; | |
| 311 | + _navigationBar.right.width = 80; | |
| 312 | + _navigationBar.right.right = kScreenWidth -12; | |
| 313 | + [_navigationBar.right setTitleColor:RGB(0, 145, 255) forState:UIControlStateNormal]; | |
| 314 | + | |
| 315 | + weakself | |
| 316 | + _navigationBar.onClickLeftButton = ^{ | |
| 317 | + if (weakSelf.isNotFromTailor) { | |
| 318 | + [weakSelf.navigationController popViewControllerAnimated:YES]; | |
| 319 | + }else{ | |
| 320 | + if (self->_type == 0||self->_type == 1) { | |
| 321 | + [weakSelf.navigationController popToViewController:[weakSelf.navigationController.viewControllers objectAtIndex:weakSelf.navigationController.viewControllers.count - 5] animated:YES]; | |
| 322 | + return; | |
| 323 | + } | |
| 324 | + [weakSelf.navigationController popToViewController:[weakSelf.navigationController.viewControllers objectAtIndex:weakSelf.navigationController.viewControllers.count - 6] animated:YES]; | |
| 325 | + } | |
| 326 | + | |
| 327 | + }; | |
| 328 | + _navigationBar.onClickRightButton = ^{ | |
| 329 | + strongself | |
| 330 | + if (weakSelf.isNotFromTailor) { | |
| 331 | + CNOldPhotoVideoViewController *phoRepair = [[CNOldPhotoVideoViewController alloc] init]; | |
| 332 | + NSMutableArray *controlerArray = [NSMutableArray arrayWithArray:self.navigationController.viewControllers]; | |
| 333 | + [controlerArray replaceObjectAtIndex:self.navigationController.viewControllers.count-1 withObject:phoRepair]; | |
| 334 | + [self.navigationController setViewControllers:controlerArray animated:YES]; | |
| 335 | + return; | |
| 336 | + } | |
| 337 | + if (!self->_isSavePhoto) { | |
| 338 | + //选择再修一张则自动保存照片 | |
| 339 | + [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ | |
| 340 | + [PHAssetChangeRequest creationRequestForAssetFromImage:self->_saveimage]; | |
| 341 | + } completionHandler:^(BOOL success, NSError * _Nullable error) { | |
| 342 | + }]; | |
| 343 | + } | |
| 344 | + if (self->_type == 0||self->_type == 1) { | |
| 345 | + [weakSelf.navigationController popToViewController:[weakSelf.navigationController.viewControllers objectAtIndex:(weakSelf.navigationController.viewControllers.count-4)] animated:YES]; | |
| 346 | + return; | |
| 347 | + } | |
| 348 | + [weakSelf.navigationController popToViewController:[weakSelf.navigationController.viewControllers objectAtIndex:(weakSelf.navigationController.viewControllers.count-5)] animated:YES]; | |
| 349 | + }; | |
| 350 | + } | |
| 351 | + return _navigationBar; | |
| 352 | +} | |
| 353 | +- (CNPhoPresent *)present | |
| 354 | +{ | |
| 355 | + if (!_present) { | |
| 356 | + _present = [[CNPhoPresent alloc] init]; | |
| 357 | + _present.delegate = self; | |
| 358 | + } | |
| 359 | + return _present; | |
| 360 | +} | |
| 361 | + | |
| 362 | +@end | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNTailorViewController.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNTailorViewController.h | |
| 1 | +// | |
| 2 | +// CNTailorViewController.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/13. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <CNLiveBaseClass/CNLiveBaseViewController.h> | |
| 10 | +#import "CNPhoPresent.h" | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | + | |
| 13 | +@interface CNTailorViewController : CNLiveBaseViewController | |
| 14 | +//被选中的图片在init里传值 | |
| 15 | +-(instancetype)initWithImage:(UIImage *)pcImage withRepairType:(CNLiveRepairType) type; | |
| 16 | +@end | |
| 17 | + | |
| 18 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNTailorViewController.m
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Controller/CNTailorViewController.m | |
| 1 | +// | |
| 2 | +// CNTailorViewController.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/13. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNTailorViewController.h" | |
| 10 | +#import "CNLiveNavigationBar.h" | |
| 11 | +#import "CNImageTailorView.h" | |
| 12 | +#import "CNHintView.h" | |
| 13 | +#import "CNRepairPhotosViewController.h" | |
| 14 | +#import "CNDrawViewController.h" | |
| 15 | +#import "CNUploadManager.h" | |
| 16 | + | |
| 17 | +@interface CNTailorViewController () | |
| 18 | +{ | |
| 19 | + UIImage *_pcImage; | |
| 20 | + CNLiveRepairType _type; | |
| 21 | +} | |
| 22 | +@property (nonatomic, strong)CNImageTailorView *tailorView; | |
| 23 | +@property (nonatomic, strong)NSArray *chooseTypes; | |
| 24 | +@property (nonatomic, strong)CNHintView *tipView; | |
| 25 | +@property (nonatomic, strong) CNUploadManager *manager; | |
| 26 | +@end | |
| 27 | + | |
| 28 | +@implementation CNTailorViewController | |
| 29 | +-(void)dealloc | |
| 30 | +{ | |
| 31 | + | |
| 32 | +} | |
| 33 | +-(instancetype)initWithImage:(UIImage *)pcImage withRepairType:(CNLiveRepairType)type{ | |
| 34 | + if (self = [super init]) { | |
| 35 | + _pcImage = pcImage; | |
| 36 | + _type = type; | |
| 37 | + } | |
| 38 | + return self; | |
| 39 | +} | |
| 40 | +- (void)viewDidLoad { | |
| 41 | + [super viewDidLoad]; | |
| 42 | + self.title = @"照片裁剪"; | |
| 43 | + self.view.backgroundColor = kBlackColor; | |
| 44 | + [self.view addSubview:self.navigationBar]; | |
| 45 | + [self.view addSubview:self.tailorView]; | |
| 46 | + [self.view addSubview:self.tipView]; | |
| 47 | + self.chooseTypes = @[@"换一张",@"确定"]; | |
| 48 | +} | |
| 49 | +-(void)viewWillAppear:(BOOL)animated | |
| 50 | +{ | |
| 51 | + [super viewWillAppear:animated]; | |
| 52 | + self.navigationController.navigationBarHidden = YES; | |
| 53 | + | |
| 54 | +} | |
| 55 | +-(void)viewDidDisappear:(BOOL)animated | |
| 56 | +{ | |
| 57 | + [super viewDidDisappear:animated]; | |
| 58 | +} | |
| 59 | + | |
| 60 | +#pragma mark - Action | |
| 61 | + | |
| 62 | +-(void)chooseBtnClick:(UIButton *)sender | |
| 63 | +{ | |
| 64 | + switch (sender.tag - 1001) { | |
| 65 | + case 0: | |
| 66 | + { | |
| 67 | + [self.navigationController popViewControllerAnimated:YES]; | |
| 68 | + } | |
| 69 | + break; | |
| 70 | + case 1: | |
| 71 | + { | |
| 72 | + UIImage *newImage = [_pcImage cropImageToRect:self.tailorView.imageCropFrame]; | |
| 73 | + if (_type == CNLiveRepairTypeNormal || _type == CNLiveRepairTypeAddColor) | |
| 74 | + { | |
| 75 | + [self.manager uploadImageManager:newImage draw:NULL rect:self.tailorView.imageCropFrame.size repairType:_type]; | |
| 76 | + weakself | |
| 77 | + self.manager.popBlock = ^{ | |
| 78 | + [weakSelf.navigationController popToViewController:[weakSelf.navigationController.viewControllers objectAtIndex:weakSelf.navigationController.viewControllers.count -4] animated:YES]; | |
| 79 | + }; | |
| 80 | + self.manager.pushBlock = ^(NSString * _Nonnull contentId) { | |
| 81 | + strongself | |
| 82 | + CNRepairPhotosViewController *photos = [[CNRepairPhotosViewController alloc] initWithRepairType:self->_type]; | |
| 83 | + photos.contentId = contentId; | |
| 84 | + [weakSelf.navigationController pushViewController:photos animated:YES]; | |
| 85 | + }; | |
| 86 | + | |
| 87 | + }else{ | |
| 88 | + | |
| 89 | + CNDrawViewController *drawVC = [[CNDrawViewController alloc] initWithImage:newImage withRepairType:_type]; | |
| 90 | + [self.navigationController pushViewController:drawVC animated:YES]; | |
| 91 | + } | |
| 92 | + } | |
| 93 | + break; | |
| 94 | + | |
| 95 | + default: | |
| 96 | + break; | |
| 97 | + } | |
| 98 | +} | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | +#pragma mark - Getting&&Setting | |
| 103 | +-(CNUploadManager *)manager | |
| 104 | +{ | |
| 105 | + if (!_manager) { | |
| 106 | + _manager = [[CNUploadManager alloc] init]; | |
| 107 | + } | |
| 108 | + return _manager; | |
| 109 | +} | |
| 110 | +-(void)setChooseTypes:(NSArray *)chooseTypes | |
| 111 | +{ | |
| 112 | + CGFloat btnHeight = 35; | |
| 113 | + for (int i = 0 ;i<chooseTypes.count;i++) { | |
| 114 | + UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 115 | + btn.frame = CGRectMake(0, kScreenHeight - 45 -kVerticalBottomSafeHeight, CNScaleW(165), btnHeight); | |
| 116 | + [btn setTitle:chooseTypes[i] forState:UIControlStateNormal]; | |
| 117 | + [btn setTitleColor:kWhiteColor forState:UIControlStateNormal]; | |
| 118 | + btn.titleLabel.font = UIFontCNMake(16); | |
| 119 | + if (i == 0) { | |
| 120 | + btn.backgroundColor = RGB(254, 160, 25); | |
| 121 | + }else{ | |
| 122 | + btn.backgroundColor = RGB(252, 128, 90); | |
| 123 | + } | |
| 124 | + btn.tag = 1001 + i; | |
| 125 | + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, CNScaleW(165), btnHeight) cornerRadius:25]; | |
| 126 | + CAShapeLayer *maskLayer = [CAShapeLayer layer]; | |
| 127 | + maskLayer.path = path.CGPath; | |
| 128 | + btn.layer.mask = maskLayer; | |
| 129 | + [btn addTarget:self action:@selector(chooseBtnClick:) forControlEvents:UIControlEventTouchUpInside]; | |
| 130 | + btn.centerX = SCREEN_WIDTH * (2 * i + 1)/4; | |
| 131 | + [self.view addSubview:btn]; | |
| 132 | + } | |
| 133 | + | |
| 134 | +} | |
| 135 | +- (CNImageTailorView *)tailorView | |
| 136 | +{ | |
| 137 | + if (!_tailorView) { | |
| 138 | + _tailorView = [[CNImageTailorView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, KScreenWidth, kScreenHeight -NavigationContentTop- 45- kVerticalBottomSafeHeight -15) withImage:_pcImage]; | |
| 139 | + } | |
| 140 | + return _tailorView; | |
| 141 | +} | |
| 142 | +-(CNHintView *)tipView | |
| 143 | +{ | |
| 144 | + if (!_tipView) { | |
| 145 | + _tipView = [[CNHintView alloc] initWithFrame:CGRectMake(CNScaleW(15), 0, kScreenWidth - CNScaleW(15) *2, 61*RATIO + CNScaleH(38))]; | |
| 146 | + _tipView.bottom = kScreenHeight - 60 - kVerticalBottomSafeHeight; | |
| 147 | + } | |
| 148 | + return _tipView; | |
| 149 | +} | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | +/* | |
| 154 | +#pragma mark - Navigation | |
| 155 | + | |
| 156 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | |
| 157 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
| 158 | + // Get the new view controller using [segue destinationViewController]. | |
| 159 | + // Pass the selected object to the new view controller. | |
| 160 | +} | |
| 161 | +*/ | |
| 162 | + | |
| 163 | +@end | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Present/CNPhoPresent.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Present/CNPhoPresent.h | |
| 1 | +// | |
| 2 | +// CNPhoPresent.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/14. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | +#import "CNPhoRepairModel.h" | |
| 11 | + | |
| 12 | +typedef enum : NSUInteger { | |
| 13 | + CNLiveRepairTypeNormal = 0, //照片修复 | |
| 14 | + CNLiveRepairTypeAddColor, //照片上色 | |
| 15 | + CNLiveRepairTypeDraw, //照片修补 | |
| 16 | + CNLiveRepairTypeDrawAddColor,//修补+上色 | |
| 17 | +} CNLiveRepairType; | |
| 18 | + | |
| 19 | +@protocol CNPhotoResponseDelegate <NSObject> | |
| 20 | +/** | |
| 21 | + *修复后图片返回 | |
| 22 | + */ | |
| 23 | +-(void)requestSucceed:(CNPhoRepairsListModel *_Nullable)model; | |
| 24 | +/** | |
| 25 | + *请求失败返回 | |
| 26 | + */ | |
| 27 | +-(void)requstFailed; | |
| 28 | +@end | |
| 29 | + | |
| 30 | +NS_ASSUME_NONNULL_BEGIN | |
| 31 | +typedef void(^CancelBlock)(void); | |
| 32 | + | |
| 33 | +static NSString *const haveMovieVC = @"haveMovieVC"; | |
| 34 | +@interface CNPhoPresent : NSObject | |
| 35 | + | |
| 36 | +@property (nonatomic, weak) id<CNPhotoResponseDelegate> delegate; | |
| 37 | +@property (nonatomic, copy) CancelBlock cancel; //取消网络请求调用 | |
| 38 | + | |
| 39 | +/** | |
| 40 | + *上传就图片请求 | |
| 41 | + */ | |
| 42 | +-(void)repairPhoRequest:(UIImage *)image | |
| 43 | + drawImage:(UIImage *_Nullable)drawImage | |
| 44 | + height:(CGFloat)height | |
| 45 | + width:(CGFloat)width | |
| 46 | + repairType:(CNLiveRepairType)type | |
| 47 | + succeed:(void(^)(NSString *contentId)) succeedCode | |
| 48 | + error:(void(^)(NSError *error))errorCode; | |
| 49 | + | |
| 50 | +-(void)downLoadImage:(NSString *)urlStr response:(void(^)(NSData *data))block; | |
| 51 | +/** | |
| 52 | + *请求修复后的图片 | |
| 53 | + *contentId就是页面标记Id | |
| 54 | + */ | |
| 55 | +-(void)requestRepairedPhotos:(NSString *)contentId; | |
| 56 | +/** | |
| 57 | + *照片类型修复列表 | |
| 58 | + */ | |
| 59 | +-(void)responseList:(void(^)(NSArray<CNRepairCategoryModel *> * dataList))block; | |
| 60 | +@end | |
| 61 | + | |
| 62 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/Present/CNPhoPresent.m
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/Present/CNPhoPresent.m | |
| 1 | +// | |
| 2 | +// CNPhoPresent.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/14. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNPhoPresent.h" | |
| 10 | +#import <CNLiveCommonCategory/UIImage+zipData.h> | |
| 11 | +#import <CNLiveUploadManager/CNLiveUploadManager.h> | |
| 12 | + | |
| 13 | +@implementation CNPhoPresent | |
| 14 | + | |
| 15 | +-(void)repairPhoRequest:(UIImage *)image | |
| 16 | + drawImage:(UIImage *_Nullable)drawImage | |
| 17 | + height:(CGFloat)height | |
| 18 | + width:(CGFloat)width | |
| 19 | + repairType:(CNLiveRepairType)type | |
| 20 | + succeed:(void(^)(NSString *contentId))succeedCode | |
| 21 | + error:(void (^)(NSError *error))errorCode | |
| 22 | +{ | |
| 23 | + NSDictionary *param = @{ | |
| 24 | + @"appId":AppId, | |
| 25 | + @"verb":@"POST", | |
| 26 | + @"storageType":@"2", | |
| 27 | + @"bucket":API_BucketName | |
| 28 | + | |
| 29 | + }; | |
| 30 | + NSMutableArray *imageArr = [NSMutableArray array]; | |
| 31 | + [imageArr addObject:image]; | |
| 32 | + if (drawImage) { | |
| 33 | + [imageArr addObject:drawImage]; | |
| 34 | + } | |
| 35 | + [CNLiveUploadManager uploadRequestType:CNLiveUploadTypeQN url:CNUploadAuthForApp dic:param imageArray:imageArr assetArray:NULL isOriginal:YES limitType:0 progress:NULL success:^(NSMutableArray *fileArray) { | |
| 36 | + CNLiveUploadModel *model1 = fileArray[0]; | |
| 37 | + CNLiveUploadModel *model2; | |
| 38 | + if (drawImage) { | |
| 39 | + model2 = fileArray[1]; | |
| 40 | + }else | |
| 41 | + { | |
| 42 | + model2 = [CNLiveUploadModel new]; | |
| 43 | + model2.imageUrl = @""; | |
| 44 | + } | |
| 45 | + [CNLiveUploadManager shareInsance].qnUploadOption = nil; | |
| 46 | + if ([CNLiveUploadManager shareInsance].calcelOption) { | |
| 47 | + [CNLiveUploadManager shareInsance].calcelOption = NO; | |
| 48 | + return; | |
| 49 | + } | |
| 50 | + if (!model1.imageUrl||!model2.imageUrl) { | |
| 51 | + errorCode(nil); | |
| 52 | + NSLog(@"预防七牛上传错误崩溃!!!!!"); | |
| 53 | + return; | |
| 54 | + } | |
| 55 | + [self repairPhotoImage:model1.imageUrl restoreImage:model2.imageUrl type:type height:height width:width succeed:^(NSString *contentId) { | |
| 56 | + succeedCode(contentId); | |
| 57 | + } error:^(NSError *error) { | |
| 58 | + errorCode(error); | |
| 59 | + }]; | |
| 60 | + } failure:^(NSMutableArray *errorArray, NSError *error) { | |
| 61 | + [CNLiveUploadManager shareInsance].qnUploadOption = nil; | |
| 62 | + if ([CNLiveUploadManager shareInsance].calcelOption) { | |
| 63 | + [CNLiveUploadManager shareInsance].calcelOption = NO; | |
| 64 | + return; | |
| 65 | + } | |
| 66 | + errorCode(error); | |
| 67 | + }]; | |
| 68 | + self.cancel = ^{ | |
| 69 | + [CNLiveUploadManager shareInsance].calcelOption = YES; | |
| 70 | + if ([CNLiveUploadManager shareInsance].qnUploadOption) { | |
| 71 | + [CNLiveUploadManager shareInsance].qnUploadOption.cancellationSignal(); | |
| 72 | + } | |
| 73 | + | |
| 74 | + }; | |
| 75 | +} | |
| 76 | + | |
| 77 | +-(void)repairPhotoImage:(NSString *)image | |
| 78 | + restoreImage:(NSString *)restoreImage | |
| 79 | + type:(CNLiveRepairType)type | |
| 80 | + height:(CGFloat)height | |
| 81 | + width:(CGFloat)width | |
| 82 | + succeed:(void(^)(NSString *contentId))succeedCode | |
| 83 | + error:(void (^)(NSError *error))errorCode | |
| 84 | +{ | |
| 85 | + NSString *isColorize = @"0"; | |
| 86 | + NSString *isRestore = @"0"; | |
| 87 | + if (type == 2 ||type == 3) { | |
| 88 | + //修复串 | |
| 89 | + isRestore = @"1"; | |
| 90 | + } | |
| 91 | + if (type == 1 || type == 3) { | |
| 92 | + //上色串赋值 | |
| 93 | + isColorize = @"1"; | |
| 94 | + } | |
| 95 | + [CNLiveNetworking setAllowRequestDefaultArgument:NO]; | |
| 96 | + NSDictionary *param = @{ | |
| 97 | + @"sid":CNUserShareModelUid, | |
| 98 | + @"image":image, | |
| 99 | + @"restoreImage":restoreImage, | |
| 100 | + @"isColorize":isColorize, | |
| 101 | + @"isRestore":isRestore, | |
| 102 | + @"high":[NSString stringWithFormat:@"%.f",height], | |
| 103 | + @"width":[NSString stringWithFormat:@"%.f",width] | |
| 104 | + }; | |
| 105 | + NSURLSessionTask *task = [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:cn_API_Classify(@"/contentApi/repairPictureNew") Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 106 | + if ([error.localizedDescription isEqualToString:@"已取消"]) { | |
| 107 | + return; | |
| 108 | + } | |
| 109 | + NSLog(@"%@",responseObject); | |
| 110 | + NSString *code = [NSString stringWithFormat:@"%@",responseObject[@"errorCode"]]; | |
| 111 | + if ([code isEqualToString:@"0"]) { | |
| 112 | + succeedCode(responseObject[@"data"]); | |
| 113 | + }else{ | |
| 114 | + errorCode(error); | |
| 115 | + } | |
| 116 | + | |
| 117 | + | |
| 118 | + }]; | |
| 119 | + | |
| 120 | + self.cancel = ^{ | |
| 121 | + [task cancel]; | |
| 122 | + }; | |
| 123 | +} | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | +-(void)downLoadImage:(NSString *)urlStr response:(nonnull void (^)(NSData * _Nonnull))block | |
| 128 | +{ | |
| 129 | + weakself | |
| 130 | + NSURLSessionConfiguration *configuration = [ NSURLSessionConfiguration defaultSessionConfiguration ]; | |
| 131 | + AFURLSessionManager *manager = [[ AFURLSessionManager alloc ] initWithSessionConfiguration :configuration]; | |
| 132 | + NSURLRequest *request = [ NSURLRequest requestWithURL :[NSURL URLWithString:urlStr]]; | |
| 133 | + NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest :request progress : nil destination :^ NSURL *( NSURL *targetPath, NSURLResponse *response) { | |
| 134 | + | |
| 135 | + NSURL *documentsDirectoryURL = [[ NSFileManager defaultManager ] URLForDirectory : NSDocumentDirectory inDomain : NSUserDomainMask appropriateForURL : nil create : NO error : nil ]; | |
| 136 | + return [documentsDirectoryURL URLByAppendingPathComponent :[response suggestedFilename ]]; | |
| 137 | + } completionHandler :^( NSURLResponse *response, NSURL *filePath, NSError *error) { | |
| 138 | + NSLog ( @"File downloaded to: %@" , filePath); | |
| 139 | + if (error) { | |
| 140 | + [weakSelf downLoadImage:urlStr response:^(NSData * _Nonnull data) { | |
| 141 | + block(data); | |
| 142 | + }]; | |
| 143 | + } | |
| 144 | + if (!filePath) { | |
| 145 | + return; | |
| 146 | + } | |
| 147 | + NSData * image = [NSData dataWithContentsOfURL :filePath]; | |
| 148 | + [[NSUserDefaults standardUserDefaults] setObject:image forKey:urlStr]; | |
| 149 | + block(image); | |
| 150 | + | |
| 151 | + }]; | |
| 152 | + [downloadTask resume ]; | |
| 153 | + | |
| 154 | +} | |
| 155 | + | |
| 156 | +-(void)requestRepairedPhotos:(NSString *)contentId | |
| 157 | +{ | |
| 158 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 159 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Classify(@"/contentApi/getRepairPicture") Param:@{@"id":contentId} CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 160 | + NSDictionary *dic = [NSDictionary dictionaryWithDictionary:responseObject]; | |
| 161 | + NSString *code = [NSString stringWithFormat:@"%@",dic[@"errorCode"]]; | |
| 162 | + if (error) { | |
| 163 | + [QMUITips showError:error.localizedDescription inView:AppKeyWindow hideAfterDelay:1.5f]; | |
| 164 | + CNMessageSend(self.delegate, CNPhotoResponseDelegate, requstFailed); | |
| 165 | + return; | |
| 166 | + } | |
| 167 | + CNPhoRepairsListModel *model = [CNPhoRepairsListModel mj_objectWithKeyValues:dic[@"data"]]; | |
| 168 | + if ([code isEqualToString:@"0"]) { | |
| 169 | + CNMessageSend(self.delegate, CNPhotoResponseDelegate, requestSucceed:model); | |
| 170 | + }else{ | |
| 171 | + if (dic) { | |
| 172 | + [QMUITips showError:dic[@"errorMessage"] inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 173 | + } | |
| 174 | + | |
| 175 | + CNMessageSend(self.delegate, CNPhotoResponseDelegate, requstFailed); | |
| 176 | + } | |
| 177 | + }]; | |
| 178 | +} | |
| 179 | + | |
| 180 | +-(void)responseList:(void (^)(NSArray<CNRepairCategoryModel *> * _Nonnull))block | |
| 181 | +{ | |
| 182 | + NSArray *list1 = @[ | |
| 183 | + @{ | |
| 184 | + @"image":@"oldPho_nomalRepair", | |
| 185 | + @"title":@"照片修复", | |
| 186 | + @"message":@"智能修复模糊照片" | |
| 187 | + }, | |
| 188 | + | |
| 189 | + @{ | |
| 190 | + @"image":@"oldPho_nomalColor", | |
| 191 | + @"title":@"照片上色", | |
| 192 | + @"message":@"黑白照片智能上色" | |
| 193 | + } | |
| 194 | + | |
| 195 | +]; | |
| 196 | + NSArray *list2 = @[ | |
| 197 | + @{ | |
| 198 | + @"image":@"oldPho_repairDraw", | |
| 199 | + @"title":@"照片修补", | |
| 200 | + @"message":@"智能修补手绘区域中图像" | |
| 201 | + }, | |
| 202 | + | |
| 203 | + @{ | |
| 204 | + @"image":@"oldPho_rapairDrawAndColor", | |
| 205 | + @"title":@"照片修补及上色", | |
| 206 | + @"message":@"智能修补手绘区域中图像并对照片上色" | |
| 207 | + } | |
| 208 | + | |
| 209 | +]; | |
| 210 | + NSMutableArray *dataArr1 = [[NSMutableArray alloc] init]; | |
| 211 | + for (NSDictionary *dic in list1) { | |
| 212 | + CNPhoRepairModel *model = [CNPhoRepairModel mj_objectWithKeyValues:dic]; | |
| 213 | + [dataArr1 addObject:model]; | |
| 214 | + } | |
| 215 | + NSMutableArray *dataArr2 = [[NSMutableArray alloc] init]; | |
| 216 | + for (NSDictionary *dic in list2) { | |
| 217 | + CNPhoRepairModel *model = [CNPhoRepairModel mj_objectWithKeyValues:dic]; | |
| 218 | + [dataArr2 addObject:model]; | |
| 219 | + } | |
| 220 | + NSArray *list3 = @[ | |
| 221 | + @{ | |
| 222 | + @"title":@"照片修复", | |
| 223 | + @"list":dataArr1 | |
| 224 | + }, | |
| 225 | + @{ | |
| 226 | + @"title":@"照片修补", | |
| 227 | + @"list":dataArr2 | |
| 228 | + } | |
| 229 | + ]; | |
| 230 | + NSMutableArray *responsData = [[NSMutableArray alloc] init]; | |
| 231 | + for (NSDictionary *dic in list3) { | |
| 232 | + CNRepairCategoryModel *model = [CNRepairCategoryModel mj_objectWithKeyValues:dic]; | |
| 233 | + [responsData addObject:model]; | |
| 234 | + } | |
| 235 | + | |
| 236 | + block(responsData.copy); | |
| 237 | +} | |
| 238 | +@end | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/View/AuthreAlertView/CNAuthorizeView.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/View/AuthreAlertView/CNAuthorizeView.h | |
| 1 | +// | |
| 2 | +// CNAuthorizeView.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/9. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | + | |
| 13 | +typedef void(^AuthorizeBlock)(void); | |
| 14 | + | |
| 15 | +@interface CNAuthorizeView : UIView | |
| 16 | +//关闭按钮不在空白区域的类工厂方法 | |
| 17 | ++(CNAuthorizeView *)setUpAuthorizeViewForTitle:(NSString *)title | |
| 18 | + secondTitle:(NSString *)secondTitle | |
| 19 | + mesOne:(NSString *)mesOne | |
| 20 | + mesTwo:(NSString *)mesTwo | |
| 21 | + sureTitle:(NSString *)sureName | |
| 22 | + sureBlock:(AuthorizeBlock)sureBlock; | |
| 23 | +@end | |
| 24 | + | |
| 25 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/View/AuthreAlertView/CNAuthorizeView.m
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/View/AuthreAlertView/CNAuthorizeView.m | |
| 1 | +// | |
| 2 | +// CNAuthorizeView.m | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/9. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNAuthorizeView.h" | |
| 10 | + | |
| 11 | +@interface CNAuthorizeView() | |
| 12 | +{ | |
| 13 | + CGFloat _width,_height; | |
| 14 | + NSString *_imageStr; | |
| 15 | +} | |
| 16 | + | |
| 17 | +@property (nonatomic, strong)UIView *backView; | |
| 18 | +@property (nonatomic, strong)UIView *secondBackView; | |
| 19 | +@property (nonatomic, strong)UILabel *titleLabel; | |
| 20 | +@property (nonatomic, strong)UILabel *secondTitleLabel; | |
| 21 | +@property (nonatomic, strong)UILabel *mesLineOne; | |
| 22 | +@property (nonatomic, strong)UILabel *mesLineTwo; | |
| 23 | +@property (nonatomic, strong)UIButton *sureBtn; | |
| 24 | +@property (nonatomic, strong)UIButton *closeBtn; | |
| 25 | +@end | |
| 26 | + | |
| 27 | +@implementation CNAuthorizeView | |
| 28 | ++(CNAuthorizeView *)setUpAuthorizeViewForTitle:(NSString *)title | |
| 29 | + secondTitle:(NSString *)secondTitle | |
| 30 | + mesOne:(NSString *)mesOne | |
| 31 | + mesTwo:(NSString *)mesTwo | |
| 32 | + sureTitle:(NSString *)sureName | |
| 33 | + sureBlock:(AuthorizeBlock)sureBlock | |
| 34 | +{ | |
| 35 | + CNAuthorizeView *contentView = [[CNAuthorizeView alloc] initWithFrame:CGRectMake(0, 0, 285, 380)]; | |
| 36 | + contentView.backgroundColor = kClearColor; | |
| 37 | + | |
| 38 | + [contentView addSubview:contentView.backView]; | |
| 39 | + [contentView.backView addSubview:contentView.titleLabel]; | |
| 40 | + [contentView.backView addSubview:contentView.secondBackView]; | |
| 41 | + [contentView.secondBackView addSubview:contentView.secondTitleLabel]; | |
| 42 | + [contentView.secondBackView addSubview:contentView.mesLineOne]; | |
| 43 | + [contentView.secondBackView addSubview:contentView.mesLineTwo]; | |
| 44 | + [contentView.backView addSubview:contentView.sureBtn]; | |
| 45 | + [contentView addSubview:contentView.closeBtn]; | |
| 46 | + | |
| 47 | + contentView.backView.layer.cornerRadius = 10; | |
| 48 | + [contentView.backView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 49 | + make.top.left.right.equalTo(contentView); | |
| 50 | + make.height.offset(295); | |
| 51 | + }]; | |
| 52 | + | |
| 53 | + contentView.titleLabel.text = title; | |
| 54 | + [contentView.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 55 | + make.top.equalTo(contentView).offset(25); | |
| 56 | + make.width.offset(190); | |
| 57 | + make.height.offset(25); | |
| 58 | + make.centerX.equalTo(contentView); | |
| 59 | + }]; | |
| 60 | + | |
| 61 | + [contentView.secondBackView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 62 | + make.top.equalTo(contentView.titleLabel.mas_bottom).offset(15); | |
| 63 | + make.left.equalTo(contentView).offset(15); | |
| 64 | + make.right.equalTo(contentView).offset(-15); | |
| 65 | + make.height.offset(145); | |
| 66 | + }]; | |
| 67 | + | |
| 68 | + contentView.secondTitleLabel.text = secondTitle; | |
| 69 | + [contentView.secondTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 70 | + make.top.equalTo(contentView.secondBackView).offset(15); | |
| 71 | + make.left.equalTo(contentView.secondBackView).offset(16); | |
| 72 | + make.width.offset(160); | |
| 73 | + make.height.offset(21); | |
| 74 | + }]; | |
| 75 | + contentView.mesLineOne.text = mesOne; | |
| 76 | + contentView.mesLineOne.numberOfLines = 2; | |
| 77 | + [contentView.mesLineOne mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 78 | + make.top.equalTo(contentView.secondTitleLabel.mas_bottom).offset(5); | |
| 79 | + make.left.equalTo(contentView.secondTitleLabel); | |
| 80 | + make.width.offset(225); | |
| 81 | + make.height.offset(42); | |
| 82 | + }]; | |
| 83 | + | |
| 84 | + contentView.mesLineTwo.text = mesTwo; | |
| 85 | + contentView.mesLineTwo.numberOfLines = 2; | |
| 86 | + [contentView.mesLineTwo mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 87 | + make.top.equalTo(contentView.mesLineOne.mas_bottom).offset(5); | |
| 88 | + make.left.equalTo(contentView.secondTitleLabel); | |
| 89 | + make.width.offset(225); | |
| 90 | + make.height.offset(42); | |
| 91 | + }]; | |
| 92 | + | |
| 93 | + [contentView.sureBtn setTitle:sureName forState:UIControlStateNormal]; | |
| 94 | + contentView.sureBtn.layer.cornerRadius = 22.5; | |
| 95 | + [contentView.sureBtn mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 96 | + make.top.equalTo(contentView.secondBackView.mas_bottom).offset(20); | |
| 97 | + make.width.offset(225); | |
| 98 | + make.height.offset(45); | |
| 99 | + make.centerX.equalTo(contentView); | |
| 100 | + }]; | |
| 101 | + | |
| 102 | + [contentView.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 103 | + make.top.equalTo(contentView.backView.mas_bottom).offset(49.5); | |
| 104 | + make.width.height.offset(31); | |
| 105 | + make.centerX.equalTo(contentView); | |
| 106 | + }]; | |
| 107 | + | |
| 108 | + QMUIModalPresentationViewController *modalViewController = [[QMUIModalPresentationViewController alloc] init]; | |
| 109 | + modalViewController.contentView = contentView; | |
| 110 | + modalViewController.modal = YES; | |
| 111 | + [modalViewController showWithAnimated:YES completion:nil]; | |
| 112 | + | |
| 113 | + __weak typeof(modalViewController) weakModalViewController = modalViewController; | |
| 114 | + [contentView.closeBtn addBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) { | |
| 115 | + [weakModalViewController hideWithAnimated:YES completion:nil]; | |
| 116 | + }]; | |
| 117 | + | |
| 118 | + [contentView.sureBtn addBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) { | |
| 119 | + [weakModalViewController hideWithAnimated:YES completion:^(BOOL finished) { | |
| 120 | + if (finished&&sureBlock) { | |
| 121 | + sureBlock(); | |
| 122 | + } | |
| 123 | + }]; | |
| 124 | + }]; | |
| 125 | + return contentView; | |
| 126 | +} | |
| 127 | + | |
| 128 | +#pragma mark - Getting | |
| 129 | +-(UIView *)backView | |
| 130 | +{ | |
| 131 | + if (!_backView) { | |
| 132 | + _backView = [[UIView alloc] init]; | |
| 133 | + _backView.backgroundColor = kWhiteColor; | |
| 134 | + } | |
| 135 | + return _backView; | |
| 136 | +} | |
| 137 | + | |
| 138 | +-(UIView *)secondBackView | |
| 139 | +{ | |
| 140 | + if (!_secondBackView) { | |
| 141 | + _secondBackView = [[UIView alloc] init]; | |
| 142 | + _secondBackView.backgroundColor = RGB(250, 251, 253); | |
| 143 | + } | |
| 144 | + return _secondBackView; | |
| 145 | +} | |
| 146 | + | |
| 147 | +-(UILabel *)titleLabel | |
| 148 | +{ | |
| 149 | + if (!_titleLabel) { | |
| 150 | + _titleLabel = [[UILabel alloc] init]; | |
| 151 | + _titleLabel.textColor = RGB(51, 51, 51); | |
| 152 | + _titleLabel.textAlignment = NSTextAlignmentCenter; | |
| 153 | + _titleLabel.font = UIFontMake(18); | |
| 154 | + } | |
| 155 | + return _titleLabel; | |
| 156 | +} | |
| 157 | +-(UILabel *)secondTitleLabel | |
| 158 | +{ | |
| 159 | + if (!_secondTitleLabel) { | |
| 160 | + _secondTitleLabel = [[UILabel alloc] init]; | |
| 161 | + _secondTitleLabel.textAlignment = NSTextAlignmentLeft; | |
| 162 | + _secondTitleLabel.textColor = RGB(102, 102, 102); | |
| 163 | + _secondTitleLabel.font = UIFontMake(15); | |
| 164 | + } | |
| 165 | + return _secondTitleLabel; | |
| 166 | +} | |
| 167 | + | |
| 168 | +-(UILabel *)mesLineOne | |
| 169 | +{ | |
| 170 | + if (!_mesLineOne) { | |
| 171 | + _mesLineOne = [[UILabel alloc] init]; | |
| 172 | + _mesLineOne.textAlignment = NSTextAlignmentLeft; | |
| 173 | + _mesLineOne.textColor = RGB(102, 102, 102); | |
| 174 | + _mesLineOne.font = UIFontMake(15); | |
| 175 | + } | |
| 176 | + return _mesLineOne; | |
| 177 | +} | |
| 178 | +-(UILabel *)mesLineTwo | |
| 179 | +{ | |
| 180 | + if (!_mesLineTwo) { | |
| 181 | + _mesLineTwo = [[UILabel alloc] init]; | |
| 182 | + _mesLineTwo.textAlignment = NSTextAlignmentLeft; | |
| 183 | + _mesLineTwo.textColor = RGB(102, 102, 102); | |
| 184 | + _mesLineTwo.font = UIFontMake(15); | |
| 185 | + } | |
| 186 | + return _mesLineTwo; | |
| 187 | +} | |
| 188 | +-(UIButton *)sureBtn | |
| 189 | +{ | |
| 190 | + if (!_sureBtn) { | |
| 191 | + _sureBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 192 | + [_sureBtn setTitleColor:kWhiteColor forState:UIControlStateNormal]; | |
| 193 | + _sureBtn.titleLabel.font = UIFontMake(17); | |
| 194 | + _sureBtn.backgroundColor = RGB(252, 118, 85); | |
| 195 | + } | |
| 196 | + return _sureBtn; | |
| 197 | +} | |
| 198 | +-(UIButton *)closeBtn | |
| 199 | +{ | |
| 200 | + if (!_closeBtn) { | |
| 201 | + _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 202 | + [_closeBtn setImage:[CNLiveCPhotoRepairImage getImageWithNamed:@"oldPho_close"] forState:UIControlStateNormal]; | |
| 203 | + } | |
| 204 | + return _closeBtn; | |
| 205 | +} | |
| 206 | +@end | ... | ... |
CNLiveCPhotoRepairModule/Classes/PhotoRepair/View/CNHintView.h
0 → 100644
| 1 | +++ a/CNLiveCPhotoRepairModule/Classes/PhotoRepair/View/CNHintView.h | |
| 1 | +// | |
| 2 | +// CNHintView.h | |
| 3 | +// CNLiveNetAdd | |
| 4 | +// | |
| 5 | +// Created by CNLive on 2021/7/13. | |
| 6 | +// Copyright © 2021 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | + | |
| 13 | +@interface CNHintView : UIView | |
| 14 | + | |
| 15 | +@end | |
| 16 | + | |
| 17 | +NS_ASSUME_NONNULL_END | ... | ... |