Commit a26c9905 authored by CZ1004's avatar CZ1004

Merge branch 'develop_0409' into launch

* develop_0409:
  修改首页问题

# Conflicts:
#	PhoneManager/Class/Session/Home/View/VideoDetaiNavView.swift
parents 7680fbc1 de98cae7
...@@ -55,7 +55,7 @@ class ChargeInfoSettingView:UIView { ...@@ -55,7 +55,7 @@ class ChargeInfoSettingView:UIView {
// 存储到userDefaults // 存储到userDefaults
UserDefaults.standard.set(String(flag!), forKey: "chargePicInfo") UserDefaults.standard.set(String(flag!), forKey: "chargePicInfo")
let alert = UIAlertController(title: nil, message: "完成!", preferredStyle: .alert) let alert = UIAlertController(title: nil, message: "Done!", preferredStyle: .alert)
self.responderViewController()?.present(alert, animated: true, completion: nil) self.responderViewController()?.present(alert, animated: true, completion: nil)
// 2 秒后关闭弹窗 // 2 秒后关闭弹窗
......
...@@ -60,6 +60,11 @@ class HomeViewController:BaseViewController { ...@@ -60,6 +60,11 @@ class HomeViewController:BaseViewController {
if otherItemRow == 2 || otherItemRow == 4{ if otherItemRow == 2 || otherItemRow == 4{
DispatchQueue.main.async { DispatchQueue.main.async {
let vc:HomePhotosDetailViewController = HomePhotosDetailViewController(model: model) let vc:HomePhotosDetailViewController = HomePhotosDetailViewController(model: model)
if otherItemRow == 2 {
vc.mediaType = .screenshots
}else{
vc.mediaType = .Other
}
vc.dealData() vc.dealData()
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} }
......
...@@ -52,8 +52,14 @@ class VideoDetaiNavView : UIView { ...@@ -52,8 +52,14 @@ class VideoDetaiNavView : UIView {
self.addSubview(backButton) self.addSubview(backButton)
self.addSubview(self.seletedAllBtn) self.addSubview(self.seletedAllBtn)
seletedAllBtn.x = self.width - marginLR - seletedAllBtn.width seletedAllBtn.x = self.width - marginLR - seletedAllBtn.width
seletedAllBtn.centerY = navCenterY seletedAllBtn.centerY = navCenterY
// self.seletedAllBtn.snp.makeConstraints { make in
// make.right.equalToSuperview().offset(-23)
// make.centerY.equalTo(self.backButton.snp.centerY)
// }
backButton.snp.makeConstraints { make in backButton.snp.makeConstraints { make in
......
...@@ -231,19 +231,6 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa ...@@ -231,19 +231,6 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
completion(nil, NSError(domain: "com.example.error", code: 1, userInfo: [NSLocalizedDescriptionKey: "未找到对应视频资源"])) completion(nil, NSError(domain: "com.example.error", code: 1, userInfo: [NSLocalizedDescriptionKey: "未找到对应视频资源"]))
return return
} }
PHPhotoLibrary.requestAuthorization { status in
switch status {
case .authorized:
print("Access granted")
case .denied, .restricted:
print("Access denied")
case .notDetermined:
print("Access not determined")
@unknown default:
print("Unhandled authorization status")
}
}
let options = PHVideoRequestOptions() let options = PHVideoRequestOptions()
options.isNetworkAccessAllowed = true // 允许从网络下载 options.isNetworkAccessAllowed = true // 允许从网络下载
......
...@@ -799,6 +799,37 @@ class PhotoAndVideoMananger { ...@@ -799,6 +799,37 @@ class PhotoAndVideoMananger {
// MARK: - 处理截图数据------------------------------------------------------- // MARK: - 处理截图数据-------------------------------------------------------
/// 获取视频第一帧
/// - Parameters:
/// - ident: 视频的标识
/// - finished: 完成回调
func getVideoImageByIdent(ident: String,finished:@escaping (UIImage)->Void,errorHandler:@escaping ()->Void){
// 定义请求选项来获取视频的第一帧
let options = PHImageRequestOptions()
// 获取当前版本的照片或视频
options.version = .current
// 尽可能快地提供结果
options.deliveryMode = .opportunistic
// 允许从iCloud请求
options.isNetworkAccessAllowed = true
// 异步请求
options.isSynchronous = true
// 从 PHAsset 获取 AVAsset
if let videoAsset = PhotoAndVideoMananger.mananger.getPHAsssetwithID(ids: [ident]){
// 使用requestImageForAsset方法请求视频的第一帧图片
PHImageManager.default().requestImage(for: videoAsset, targetSize: CGSize(width: 400, height: 400), contentMode: PHImageContentMode.aspectFit, options: options) { image, _ in
// 处理获取到的图片
if let thumbnailImage = image {
// 使用获取到的图片,例如显示在UIImageView上
finished(thumbnailImage)
} else {
errorHandler()
}
}
}
}
} }
......
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