Commit e550d783 authored by shenyong's avatar shenyong

取消删除照片动画立即小时处理

parent ca08bfa1
...@@ -307,9 +307,9 @@ class CompressCompletedViewController : BaseViewController{ ...@@ -307,9 +307,9 @@ class CompressCompletedViewController : BaseViewController{
PHPhotoLibrary.shared().performChanges ({ PHPhotoLibrary.shared().performChanges ({
PHAssetChangeRequest.deleteAssets([assetToDelete] as NSFastEnumeration) PHAssetChangeRequest.deleteAssets([assetToDelete] as NSFastEnumeration)
}){ success, error in }){ success, error in
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { if(success){
PMLoadingHUD.share.disMiss() DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
if(success){ PMLoadingHUD.share.disMiss()
var models :[AssetModel] = [] var models :[AssetModel] = []
var count = 0 var count = 0
for ele in self.model! { for ele in self.model! {
...@@ -322,10 +322,11 @@ class CompressCompletedViewController : BaseViewController{ ...@@ -322,10 +322,11 @@ class CompressCompletedViewController : BaseViewController{
print("删除文件成功") print("删除文件成功")
self.showDeleteSuccess(fileCount:count, fileSize: fileSize) self.showDeleteSuccess(fileCount:count, fileSize: fileSize)
self.jumpToCompressVC() self.jumpToCompressVC()
}else { }
if let error = error { }else {
print("删除文件时出错: \(error.localizedDescription)") PMLoadingHUD.share.disMiss()
} if let error = error {
print("删除文件时出错: \(error.localizedDescription)")
} }
} }
} }
......
...@@ -64,39 +64,47 @@ class HomeInfoViewController:BaseViewController { ...@@ -64,39 +64,47 @@ class HomeInfoViewController:BaseViewController {
} }
let fetchs = PHAsset.fetchAssets(withLocalIdentifiers: tempStringArray, options: nil) let fetchs = PHAsset.fetchAssets(withLocalIdentifiers: tempStringArray, options: nil)
let fileSize = FileTool().calculateTotalAssetSize(fetchResult: fetchs) let fileSize = FileTool().calculateTotalAssetSize(fetchResult: fetchs)
//
PhotoAndVideoMananger.deleteAssets(localIdentifiers: tempStringArray) {[weak self] in PhotoAndVideoMananger.deleteAssets(localIdentifiers: tempStringArray) {[weak self] in
guard let self else {return} guard let self else {return}
// 更新免费次数 DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
if isAfterAdv == false { PMLoadingHUD.share.disMiss()
updateFreeTimes()
// 更新免费次数
if isAfterAdv == false {
updateFreeTimes()
}
} self.showDeleteSuccess(fileCount: tempStringArray.count, fileSize: fileSize)
self.showDeleteSuccess(fileCount: tempStringArray.count, fileSize: fileSize)
// 删除缓存数据 // 删除缓存数据
PhotoDataManager.manager.removeDataWhenDeleteInPage(data: imgs) PhotoDataManager.manager.removeDataWhenDeleteInPage(data: imgs)
// 更新下ids // 更新下ids
PhotoDataManager.manager.loadFromFileSystem(resultModel: {[weak self] model in PhotoDataManager.manager.loadFromFileSystem(resultModel: {[weak self] model in
DispatchQueue.main.async { DispatchQueue.main.async {
if self?.type == .duplicates { if self?.type == .duplicates {
self?.ids = model.titleModelArray[0].assets self?.ids = model.titleModelArray[0].assets
} }
if self?.type == .similar { if self?.type == .similar {
self?.ids = model.titleModelArray[1].assets self?.ids = model.titleModelArray[1].assets
} }
if self?.type == .SimilarVideos { if self?.type == .SimilarVideos {
self?.ids = model.otherModelArray[3].assets self?.ids = model.otherModelArray[3].assets
} }
if self?.type == .similarScreenshots { if self?.type == .similarScreenshots {
self?.ids = model.otherModelArray[1].assets self?.ids = model.otherModelArray[1].assets
}
self?.tablewView.ids = self?.ids
self?.tablewView.deleteModel(array: imgs)
} }
self?.tablewView.ids = self?.ids })
self?.tablewView.deleteModel(array: imgs) }
}
})
// 更新下首页数据以及缓存数据 // 更新下首页数据以及缓存数据
let dataUpdated = Notification.Name("DataUpdatedNotification") let dataUpdated = Notification.Name("DataUpdatedNotification")
NotificationCenter.default.post(name: dataUpdated, object: nil, userInfo: nil) NotificationCenter.default.post(name: dataUpdated, object: nil, userInfo: nil)
......
...@@ -562,21 +562,25 @@ extension HomePhotosDetailViewController:WaterfallMutiSectionDelegate,UICollecti ...@@ -562,21 +562,25 @@ extension HomePhotosDetailViewController:WaterfallMutiSectionDelegate,UICollecti
PHAssetChangeRequest.deleteAssets(fetchResult as NSFastEnumeration) PHAssetChangeRequest.deleteAssets(fetchResult as NSFastEnumeration)
}){ success, error in }){ success, error in
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { if(success){
PMLoadingHUD.share.disMiss() print("删除文件成功")
if(success){ DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
print("删除文件成功") PMLoadingHUD.share.disMiss()
if isAfterAdv == false { if isAfterAdv == false {
self.updateFreeTimes() self.updateFreeTimes()
} }
self.showDeleteSuccess(fileCount: allIdent.count, fileSize: fileSize) self.showDeleteSuccess(fileCount: allIdent.count, fileSize: fileSize)
self.updateCurrentPageWhenDeleteAny() self.updateCurrentPageWhenDeleteAny()
}else { }
if let error = error {
print("删除文件时出错: \(error.localizedDescription)") }else {
} PMLoadingHUD.share.disMiss()
if let error = error {
print("删除文件时出错: \(error.localizedDescription)")
} }
} }
} }
} }
......
...@@ -477,10 +477,9 @@ extension HomeVideoDetailController:WaterfallMutiSectionDelegate,UICollectionVie ...@@ -477,10 +477,9 @@ extension HomeVideoDetailController:WaterfallMutiSectionDelegate,UICollectionVie
PHPhotoLibrary.shared().performChanges ({ PHPhotoLibrary.shared().performChanges ({
PHAssetChangeRequest.deleteAssets(fetchResult as NSFastEnumeration) PHAssetChangeRequest.deleteAssets(fetchResult as NSFastEnumeration)
}){ success, error in }){ success, error in
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { if(success){
PMLoadingHUD.share.disMiss() DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
PMLoadingHUD.share.disMiss()
if(success){
print("删除文件成功") print("删除文件成功")
// 如果是看广告删除的,且还有免费次数 // 如果是看广告删除的,且还有免费次数
if isAfterAdv == false { if isAfterAdv == false {
...@@ -490,10 +489,11 @@ extension HomeVideoDetailController:WaterfallMutiSectionDelegate,UICollectionVie ...@@ -490,10 +489,11 @@ extension HomeVideoDetailController:WaterfallMutiSectionDelegate,UICollectionVie
self.showDeleteSuccess(fileCount: self.selectedModel.count, fileSize: fileSize) self.showDeleteSuccess(fileCount: self.selectedModel.count, fileSize: fileSize)
// 移除当前总数据源的数据 // 移除当前总数据源的数据
self.updateCurrentPageWhenDeleteAny() self.updateCurrentPageWhenDeleteAny()
}else { }
if let error = error { }else {
print("删除文件时出错: \(error.localizedDescription)") PMLoadingHUD.share.disMiss()
} if let error = error {
print("删除文件时出错: \(error.localizedDescription)")
} }
} }
} }
......
...@@ -107,7 +107,7 @@ class NewGuideViewController: UIViewController { ...@@ -107,7 +107,7 @@ class NewGuideViewController: UIViewController {
func startTimer() { func startTimer() {
// 创建定时器,每隔 3 秒调用一次 // 创建定时器,每隔 3 秒调用一次
timer = Timer.scheduledTimer(timeInterval: 3.5, target: self, selector: #selector(advanceToNextItem), userInfo: nil, repeats: true) // timer = Timer.scheduledTimer(timeInterval: 3.5, target: self, selector: #selector(advanceToNextItem), userInfo: nil, repeats: true)
} }
@objc func advanceToNextItem() { @objc func advanceToNextItem() {
......
...@@ -82,6 +82,10 @@ ...@@ -82,6 +82,10 @@
</label> </label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_guide_huadong" translatesAutoresizingMaskIntoConstraints="NO" id="dtg-ck-CGz"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_guide_huadong" translatesAutoresizingMaskIntoConstraints="NO" id="dtg-ck-CGz">
<rect key="frame" x="8" y="392.66666666666669" width="375" height="144.00000000000006"/> <rect key="frame" x="8" y="392.66666666666669" width="375" height="144.00000000000006"/>
<constraints>
<constraint firstAttribute="height" constant="144" id="7cs-70-ugl" customClass="ScreenWidthRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstAttribute="width" constant="375" id="WrQ-JG-AK0" customClass="ScreenWidthRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
</constraints>
</imageView> </imageView>
</subviews> </subviews>
</view> </view>
......
...@@ -18,7 +18,11 @@ ...@@ -18,7 +18,11 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_guide_tongjitu" translatesAutoresizingMaskIntoConstraints="NO" id="vPU-c0-KKP"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_guide_tongjitu" translatesAutoresizingMaskIntoConstraints="NO" id="vPU-c0-KKP">
<rect key="frame" x="85" y="265" width="244" height="239"/> <rect key="frame" x="85" y="316" width="244" height="239"/>
<constraints>
<constraint firstAttribute="height" constant="239" id="4zt-cu-Hqj" customClass="ScreenWidthRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstAttribute="width" constant="244" id="gAB-82-r6I" customClass="ScreenWidthRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
</constraints>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Experience higher accuracy and professionalism" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZvL-Z4-1T4"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Experience higher accuracy and professionalism" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZvL-Z4-1T4">
<rect key="frame" x="41.666666666666657" y="47" width="331" height="60"/> <rect key="frame" x="41.666666666666657" y="47" width="331" height="60"/>
...@@ -30,20 +34,34 @@ ...@@ -30,20 +34,34 @@
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1.56X" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="N0R-LM-a3O"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1.56X" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="N0R-LM-a3O">
<rect key="frame" x="142.66666666666666" y="157" width="128.99999999999997" height="58"/> <rect key="frame" x="142.66666666666666" y="157" width="128.99999999999997" height="59"/>
<constraints>
<constraint firstAttribute="height" constant="59" id="A7Z-VL-TvL"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="48"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="48"/>
<color key="textColor" red="0.0" green="0.50980392159999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="0.0" green="0.50980392159999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Industry average" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HR3-Fr-izE">
<rect key="frame" x="96" y="216" width="222" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="pQw-Xg-8E2"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="31"/>
<color key="textColor" red="0.08235294118" green="0.08235294118" blue="0.08235294118" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews> </subviews>
</view> </view>
<viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/> <viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints> <constraints>
<constraint firstItem="HR3-Fr-izE" firstAttribute="top" secondItem="N0R-LM-a3O" secondAttribute="bottom" id="6eV-Ep-auM"/>
<constraint firstItem="ZvL-Z4-1T4" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="8X2-pX-F3n"/> <constraint firstItem="ZvL-Z4-1T4" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="8X2-pX-F3n"/>
<constraint firstItem="vPU-c0-KKP" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="HLK-ZG-TjB"/> <constraint firstItem="vPU-c0-KKP" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="HLK-ZG-TjB"/>
<constraint firstItem="vPU-c0-KKP" firstAttribute="top" secondItem="HR3-Fr-izE" secondAttribute="bottom" constant="57" id="HPy-W3-HcW"/>
<constraint firstItem="N0R-LM-a3O" firstAttribute="top" secondItem="ZvL-Z4-1T4" secondAttribute="bottom" constant="50" id="IRN-zP-UZ0"/> <constraint firstItem="N0R-LM-a3O" firstAttribute="top" secondItem="ZvL-Z4-1T4" secondAttribute="bottom" constant="50" id="IRN-zP-UZ0"/>
<constraint firstItem="vPU-c0-KKP" firstAttribute="top" secondItem="N0R-LM-a3O" secondAttribute="bottom" constant="50" id="atv-wd-Rfc"/> <constraint firstItem="HR3-Fr-izE" firstAttribute="centerX" secondItem="N0R-LM-a3O" secondAttribute="centerX" id="O9d-fI-MXB"/>
<constraint firstItem="N0R-LM-a3O" firstAttribute="centerX" secondItem="ZvL-Z4-1T4" secondAttribute="centerX" id="qXa-FX-3CI"/> <constraint firstItem="N0R-LM-a3O" firstAttribute="centerX" secondItem="ZvL-Z4-1T4" secondAttribute="centerX" id="qXa-FX-3CI"/>
<constraint firstItem="ZvL-Z4-1T4" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="47" id="zT2-fE-W1k"/> <constraint firstItem="ZvL-Z4-1T4" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="47" id="zT2-fE-W1k"/>
</constraints> </constraints>
......
...@@ -45,7 +45,7 @@ class PMLoadingView: UIView { ...@@ -45,7 +45,7 @@ class PMLoadingView: UIView {
addSubview(animationView) addSubview(animationView)
animationView.snp.makeConstraints { make in animationView.snp.makeConstraints { make in
make.centerX.equalToSuperview() make.centerX.equalToSuperview()
make.top.equalTo(200) make.centerY.equalToSuperview()
make.width.equalTo(300) make.width.equalTo(300)
make.height.equalTo(200) make.height.equalTo(200)
} }
......
...@@ -16,6 +16,7 @@ class DelSuccessViewController: UIViewController { ...@@ -16,6 +16,7 @@ class DelSuccessViewController: UIViewController {
@IBOutlet weak var points: UILabel! @IBOutlet weak var points: UILabel!
@IBOutlet weak var delText: UILabel! @IBOutlet weak var delText: UILabel!
@IBOutlet weak var conTitle: UILabel!
var delType:String = "photo" var delType:String = "photo"
var fileCount:Int = 0 var fileCount:Int = 0
...@@ -25,8 +26,15 @@ class DelSuccessViewController: UIViewController { ...@@ -25,8 +26,15 @@ class DelSuccessViewController: UIViewController {
super.viewDidLoad() super.viewDidLoad()
bottomBtn.layer.cornerRadius = 15 bottomBtn.layer.cornerRadius = 15
animationView.frame = CGRect(x: (ScreenW-CGFloat(250.RH()))/2+20, y: 80.RH(), width: 250.RH(), height: 250.RH()) // 设置 frame // animationView.frame = CGRect(x: (ScreenW-CGFloat(250.RH()))/2 + 20.RW(), y: 70.RH(), width: 250.RH(), height: 250.RH()) // 设置 frame
view.addSubview(animationView) view.addSubview(animationView)
animationView.snp.makeConstraints { make in
make.centerX.equalToSuperview().offset(20.RW())
make.bottom.equalTo(conTitle.snp.top).offset(15)
make.size.equalTo(250)
}
startAnimation() startAnimation()
reloadUI() reloadUI()
} }
...@@ -90,11 +98,6 @@ class DelSuccessViewController: UIViewController { ...@@ -90,11 +98,6 @@ class DelSuccessViewController: UIViewController {
let otherRange = (delTextString as NSString).range(of: "(\(formattedSize))") // 获取其他文本的范围 let otherRange = (delTextString as NSString).range(of: "(\(formattedSize))") // 获取其他文本的范围
delTextAttributedString.addAttribute(.foregroundColor, value: UIColor.colorWithHex(hexStr: "#1A1A1A"), range: otherRange) delTextAttributedString.addAttribute(.foregroundColor, value: UIColor.colorWithHex(hexStr: "#1A1A1A"), range: otherRange)
delText.attributedText = delTextAttributedString delText.attributedText = delTextAttributedString
} }
} }
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<connections> <connections>
<outlet property="bottomBtn" destination="LCj-Gz-gce" id="BOZ-jZ-MLX"/> <outlet property="bottomBtn" destination="LCj-Gz-gce" id="BOZ-jZ-MLX"/>
<outlet property="bottomText" destination="nIS-b5-Znx" id="ASM-VW-Ehs"/> <outlet property="bottomText" destination="nIS-b5-Znx" id="ASM-VW-Ehs"/>
<outlet property="conTitle" destination="Wuv-Jo-ClG" id="8fE-sb-OjD"/>
<outlet property="delText" destination="zkh-yv-aYk" id="ech-5X-5e2"/> <outlet property="delText" destination="zkh-yv-aYk" id="ech-5X-5e2"/>
<outlet property="points" destination="mhe-iG-xpQ" id="Txp-U4-fpy"/> <outlet property="points" destination="mhe-iG-xpQ" id="Txp-U4-fpy"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
...@@ -85,13 +86,13 @@ ...@@ -85,13 +86,13 @@
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="LCj-Gz-gce" secondAttribute="trailing" constant="15" id="0CP-MC-Lr5"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="LCj-Gz-gce" secondAttribute="trailing" constant="15" id="0CP-MC-Lr5"/>
<constraint firstItem="LCj-Gz-gce" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="15" id="2Xv-th-L23"/> <constraint firstItem="LCj-Gz-gce" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="15" id="2Xv-th-L23"/>
<constraint firstItem="V9c-pl-MwJ" firstAttribute="top" secondItem="Npn-Yc-tdh" secondAttribute="top" id="5QM-aj-IeW"/> <constraint firstItem="V9c-pl-MwJ" firstAttribute="top" secondItem="Npn-Yc-tdh" secondAttribute="top" id="5QM-aj-IeW"/>
<constraint firstItem="Wuv-Jo-ClG" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="246" id="D2b-Te-XzC"/> <constraint firstItem="Wuv-Jo-ClG" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="246" id="D2b-Te-XzC" customClass="ScreenHeightRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstItem="gYc-Ja-g1G" firstAttribute="leading" secondItem="WJ0-hg-B3V" secondAttribute="trailing" constant="14" id="EhM-Yr-SAL"/> <constraint firstItem="gYc-Ja-g1G" firstAttribute="leading" secondItem="WJ0-hg-B3V" secondAttribute="trailing" constant="14" id="EhM-Yr-SAL"/>
<constraint firstItem="zkh-yv-aYk" firstAttribute="top" secondItem="Npn-Yc-tdh" secondAttribute="bottom" constant="9" id="EjO-a7-oYm"/> <constraint firstItem="zkh-yv-aYk" firstAttribute="top" secondItem="Npn-Yc-tdh" secondAttribute="bottom" constant="9" id="EjO-a7-oYm"/>
<constraint firstItem="zkh-yv-aYk" firstAttribute="leading" secondItem="V9c-pl-MwJ" secondAttribute="trailing" constant="14" id="H7C-tK-dfK"/> <constraint firstItem="zkh-yv-aYk" firstAttribute="leading" secondItem="V9c-pl-MwJ" secondAttribute="trailing" constant="14" id="H7C-tK-dfK"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="LCj-Gz-gce" secondAttribute="bottom" constant="30" id="Tfh-Lq-LH9"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="LCj-Gz-gce" secondAttribute="bottom" constant="30" id="Tfh-Lq-LH9"/>
<constraint firstItem="WJ0-hg-B3V" firstAttribute="trailing" secondItem="V9c-pl-MwJ" secondAttribute="trailing" id="Ua4-M7-B4Z"/> <constraint firstItem="WJ0-hg-B3V" firstAttribute="trailing" secondItem="V9c-pl-MwJ" secondAttribute="trailing" id="Ua4-M7-B4Z"/>
<constraint firstItem="V9c-pl-MwJ" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="43" id="Yy5-S5-Cya"/> <constraint firstItem="V9c-pl-MwJ" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="43" id="Yy5-S5-Cya" customClass="ScreenWidthRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstItem="V9c-pl-MwJ" firstAttribute="top" secondItem="Wuv-Jo-ClG" secondAttribute="bottom" constant="43" id="Zve-oH-e3d"/> <constraint firstItem="V9c-pl-MwJ" firstAttribute="top" secondItem="Wuv-Jo-ClG" secondAttribute="bottom" constant="43" id="Zve-oH-e3d"/>
<constraint firstItem="nIS-b5-Znx" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="32" id="eXY-M7-Pr3"/> <constraint firstItem="nIS-b5-Znx" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="32" id="eXY-M7-Pr3"/>
<constraint firstItem="Npn-Yc-tdh" firstAttribute="leading" secondItem="V9c-pl-MwJ" secondAttribute="trailing" constant="14" id="fsX-Yg-e6H"/> <constraint firstItem="Npn-Yc-tdh" firstAttribute="leading" secondItem="V9c-pl-MwJ" secondAttribute="trailing" constant="14" id="fsX-Yg-e6H"/>
......
...@@ -651,19 +651,18 @@ class PhotoAndVideoMananger { ...@@ -651,19 +651,18 @@ class PhotoAndVideoMananger {
static func deleteAssets(localIdentifiers: [String],suc:@escaping () -> ()) { static func deleteAssets(localIdentifiers: [String],suc:@escaping () -> ()) {
// 获取要删除的 PHAsset // 获取要删除的 PHAsset
let fetchResult = PHAsset.fetchAssets(withLocalIdentifiers: localIdentifiers, options: nil) let fetchResult = PHAsset.fetchAssets(withLocalIdentifiers: localIdentifiers, options: nil)
PMLoadingHUD.share.show()
// 开始删除操作 // 开始删除操作
PMLoadingHUD.share.show()
PHPhotoLibrary.shared().performChanges({ PHPhotoLibrary.shared().performChanges({
// 创建删除请求 // 创建删除请求
PHAssetChangeRequest.deleteAssets(fetchResult) PHAssetChangeRequest.deleteAssets(fetchResult)
}) { success, error in }) { success, error in
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { if success {
suc()
} else if let error = error {
PMLoadingHUD.share.disMiss() PMLoadingHUD.share.disMiss()
if success { print("删除失败: \(error.localizedDescription)")
suc()
} else if let error = error {
print("删除失败: \(error.localizedDescription)")
}
} }
} }
} }
...@@ -1138,13 +1137,14 @@ class SecretPhotoManager: NSObject, PhotoPickerControllerDelegate , CameraContro ...@@ -1138,13 +1137,14 @@ class SecretPhotoManager: NSObject, PhotoPickerControllerDelegate , CameraContro
PHPhotoLibrary.shared().performChanges({ PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.deleteAssets(assets as NSFastEnumeration) PHAssetChangeRequest.deleteAssets(assets as NSFastEnumeration)
}) { success, error in }) { success, error in
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
PMLoadingHUD.share.disMiss() if success {
if success { print("删除成功")
print("删除成功") DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
} else if let error = error { PMLoadingHUD.share.disMiss()
print("删除失败: \(error.localizedDescription)")
} }
} else if let error = error {
print("删除失败: \(error.localizedDescription)")
} }
} }
......
...@@ -61,11 +61,13 @@ class ScreenWidthRatioConstraint: NSLayoutConstraint { ...@@ -61,11 +61,13 @@ class ScreenWidthRatioConstraint: NSLayoutConstraint {
return return
} }
// 计算新的约束常量 // 计算新的约束常量(直接使用屏幕高度与标准高度的比率)
self.constant = screenWidth / screenWidth * self.multiplier let calculatedConstant = (screenWidth / 375.0) * self.constant
// 再次确保常量是有效的 // 检查 calculatedConstant 是否为有限值
if !self.constant.isFinite { if calculatedConstant.isFinite {
self.constant = calculatedConstant
} else {
self.constant = 0 // 设置为默认值以避免崩溃 self.constant = 0 // 设置为默认值以避免崩溃
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment