Commit 718b47c9 authored by CZ1004's avatar CZ1004

Merge branch 'dev_main' into dev_zhaoqian

* dev_main:
  ui优化
  1
  fix bugs
  优化
parents 6155b6ac 56ff6516
......@@ -13,6 +13,7 @@ import UserMessagingPlatform
import GoogleSignIn
import AdjustSdk
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
......@@ -78,17 +79,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
Adjust.attribution { attribution in
Print("获取归因数据11",attribution?.jsonResponse)
// let trackerToken = attribution?.trackerToken
// let trackerName = attribution?.trackerName
// let network = attribution?.network
// let campaign = attribution?.campaign
// let adgroup = attribution?.adgroup
// let creative = attribution?.creative
// let clickLabel = attribution?.clickLabel
// let costType = attribution?.costType
// let costAmount = attribution?.costAmount
// let costCurrency = attribution?.costCurrency
// Print("获取归因数据11",attribution?.jsonResponse)
// let pram = [
// "trackerToken":attribution?.trackerToken ?? "",
// "trackerName":attribution?.trackerName ?? "",
// "network":attribution?.network ?? "",
// "campaign":attribution?.campaign ?? "",
// "adgroup":attribution?.adgroup ?? "",
// "creative":attribution?.creative ?? "",
// "clickLabel":attribution?.clickLabel ?? "",
// "costType":attribution?.costType ?? "",
// "costAmount":attribution?.costAmount ?? "",
// "costCurrency":attribution?.costCurrency ?? "",
// ]
// let dic = attribution.jso
Print("获取当前归因信息",attribution?.jsonResponse as Any)
// APIReportManager.shared.startReport(type: .source_atrribute,ext: pram)
}
......
......@@ -29,6 +29,7 @@ extension AppDelegate{
switch shortcutItem.type {
case "com.app.phonemanager.iap.distance":
// 执行相应操作
IAPManager.share.config()
IAPManager.share.showYearPage = true
if IAPManager.share.isHotLaunch{
// 热启动走这里
......@@ -57,13 +58,12 @@ extension AppDelegate{
extension AppDelegate:AdjustDelegate{
// 因变化时触发函数
func adjustAttributionChanged(_ attribution: ADJAttribution?) {
guard let attribution = attribution else { return }
// 可以将这些数据上报给自己的服务器或者做其他处理
print("归因数据:", attribution)
print("归因变化数据:", attribution.jsonResponse)
}
}
{
"images" : [
{
"filename" : "img_phone_battery_02.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "img_phone_battery_02@2x.png",
"filename" : "Group_1171275124@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "img_phone_battery_02@3x.png",
"filename" : "Group_1171275124@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "phone_manager@2x.png",
"filename" : "ic-select-new-All-n@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "phone_manager@3x.png",
"filename" : "ic-select-new-All-n@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic-select-new-All-s@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic-select-new-All-s@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "Frame_1171276341@2x.png",
"filename" : "Frame_1171276354@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame_1171276341@3x.png",
"filename" : "Frame_1171276354@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
{
"images" : [
{
"filename" : "ic_check_similar.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_check_similar@2x.png",
"filename" : "Frame@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_check_similar@3x.png",
"filename" : "Frame@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "Frame_1171276341@2x.png",
"filename" : "Frame_1171276354@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame_1171276341@3x.png",
"filename" : "Frame_1171276354@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "logo_phone_manager@2x.png",
"filename" : "Group_1171275248@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "logo_phone_manager@3x.png",
"filename" : "Group_1171275248@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
......@@ -120,6 +120,8 @@ class IAPManager: NSObject {
}
}
func config(){}
// MARK: - Initialization
private override init() {
......
......@@ -224,7 +224,7 @@ extension PhotoDuplicateManager {
return fetchResult.firstObject == nil
}
return SimilarGroupModel(groupId: group.groupId, assets: validAssets)
}.filter { !$0.assets.isEmpty }
}.filter { $0.assets.count > 1}
}
// 移除本地文件资源
......
......@@ -348,7 +348,7 @@ extension PhotoSimilarManager{
return fetchResult.firstObject == nil
}
return SimilarGroupModel(groupId: group.groupId, assets: validAssets)
}.filter { !$0.assets.isEmpty }
}.filter { $0.assets.count > 1}
}
// 移除本地文件资源
......
......@@ -380,7 +380,7 @@ extension ScreenshotSimilarJSONManager{
return fetchResult.firstObject == nil
}
return SimilarGroupModel(groupId: group.groupId, assets: validAssets)
}.filter { !$0.assets.isEmpty }
}.filter { $0.assets.count > 1}
}
......
......@@ -687,7 +687,7 @@ extension VideoSimilarJSONManager {
return fetchResult.firstObject == nil
}
return SimilarGroupModel(groupId: group.groupId, assets: validAssets)
}.filter { !$0.assets.isEmpty }
}.filter { $0.assets.count > 1}
}
}
......
......@@ -30,6 +30,8 @@ class AdvManager : NSObject, FullScreenContentDelegate {
static let shared : AdvManager = AdvManager()
var currentVCName:String = ""
// 看完广告的回调
var finisedCallBack:()->Void = {}
......@@ -105,7 +107,7 @@ class AdvManager : NSObject, FullScreenContentDelegate {
/// 获取激励插页广告
///
func loadRewardedInterstitialAd() async {
APIReportManager.shared.startReport(type: .ad_pull_start, ext: ["ad_type":"rewardAd","from":""])
APIReportManager.shared.startReport(type: .ad_pull_start, ext: ["ad_type":"rewardAd"])
do {
rewardedInterstitialAd = try await RewardedInterstitialAd.load(
with: AdvManager.REWARDED_INTERSTITIALAD_KEY, request: Request())
......@@ -133,7 +135,7 @@ class AdvManager : NSObject, FullScreenContentDelegate {
/// 获取单纯的插页广告
fileprivate func loadInterstitial() async {
APIReportManager.shared.startReport(type: .ad_pull_start, ext: ["ad_type":"interAd","from":""])
APIReportManager.shared.startReport(type: .ad_pull_start, ext: ["ad_type":"interAd"])
do {
interstitial = try await InterstitialAd.load(
with: AdvManager.INTERSTITIALAD_KEY, request: Request())
......@@ -176,9 +178,10 @@ class AdvManager : NSObject, FullScreenContentDelegate {
}
return
}
self.currentVCName = NSStringFromClass(type(of: vc))
APIReportManager.shared.startReport(
type: .ad_prepare_show,
ext: ["ad_type": "rewardAd","from":""])
ext: ["ad_type": "rewardAd","from":self.currentVCName])
ad.present(from: vc) {}
}
......@@ -191,9 +194,10 @@ class AdvManager : NSObject, FullScreenContentDelegate {
return
}
self.currentAdvType = .interstitialType
self.currentVCName = NSStringFromClass(type(of: vc))
APIReportManager.shared.startReport(
type: .ad_prepare_show,
ext: ["ad_type": "interAd","from":""])
ext: ["ad_type": "interAd","from":currentVCName])
ad.present(from: vc)
}
......@@ -202,12 +206,12 @@ class AdvManager : NSObject, FullScreenContentDelegate {
func adWillPresentFullScreenContent(_ ad: FullScreenPresentingAd) {
print("Ad did present full screen content.")
var ad_type = "interAd"
if let ad = ad as? RewardedInterstitialAd{
if let _ = ad as? RewardedInterstitialAd{
ad_type = "rewardAd"
}
APIReportManager.shared.startReport(
type: .ad_show,
ext: ["ad_type": ad_type,"from":""])
ext: ["ad_type": ad_type,"from":currentVCName])
}
......@@ -220,7 +224,7 @@ class AdvManager : NSObject, FullScreenContentDelegate {
}
APIReportManager.shared.startReport(
type: .ad_show_error,
ext: ["ad_type": ad_type,"from":"","reason":error.localizedDescription])
ext: ["ad_type": ad_type,"from":currentVCName,"reason":error.localizedDescription])
self.rewardedInterstitialAd = nil
......@@ -326,7 +330,7 @@ extension AdvManager{
let pram = [
"ad_type": ad_type,
"from":"",
"from":currentVCName,
"networkname":adNetworkName,
"source":adSourceName,
"adSourceInstanceName":adSourceInstanceName,
......
......@@ -88,20 +88,23 @@ class ChargeGuideController : BaseViewController,UIScrollViewDelegate,UINavigati
if i==0 {
view.detailTipTitleLabel.isHidden = false
// 在滑动的第一个添加一个button
let jumpButton = UIButton(type: .custom)
jumpButton.setTitle("Open shortcut command", for: .normal)
jumpButton.setTitleColor(.white, for: .normal)
jumpButton.backgroundColor = UIColor(red: 0, green: 0.51, blue: 1, alpha: 1)
jumpButton.layer.cornerRadius = 25
jumpButton.clipsToBounds = true
view.addSubview(jumpButton)
jumpButton.snp.makeConstraints { make in
make.left.equalToSuperview().offset(32)
make.right.equalToSuperview().offset(-32)
make.height.equalTo(50)
make.bottom.equalToSuperview().offset(-122 * RScreenH())
}
jumpButton.addTarget(self, action: #selector(jumpButtonAction), for: .touchUpInside)
// let jumpButton = UIButton(type: .custom)
// jumpButton.setTitle("Open shortcut command", for: .normal)
// jumpButton.setTitleColor(.white, for: .normal)
// jumpButton.backgroundColor = UIColor(red: 0, green: 0.51, blue: 1, alpha: 1)
// jumpButton.layer.cornerRadius = 25
// jumpButton.clipsToBounds = true
// view.addSubview(jumpButton)
// jumpButton.snp.makeConstraints { make in
// make.left.equalToSuperview().offset(32)
// make.right.equalToSuperview().offset(-32)
// make.height.equalTo(50)
// make.bottom.equalToSuperview().offset(-122 * RScreenH())
// }
// jumpButton.addTarget(self, action: #selector(jumpButtonAction), for: .touchUpInside)
let tap = UITapGestureRecognizer(target: self, action: #selector(jumpButtonAction(_:)))
view.guideView.isUserInteractionEnabled = true
view.guideView.addGestureRecognizer(tap)
}else {
view.detailTipTitleLabel.isHidden = true
}
......@@ -132,10 +135,17 @@ class ChargeGuideController : BaseViewController,UIScrollViewDelegate,UINavigati
self.navigationController?.popViewController(animated: true)
}
@objc func jumpButtonAction(){
if let url = URL(string: "shortcuts://") {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
@objc func jumpButtonAction(_ ges:UIGestureRecognizer){
let point = ges.location(in: ges.view)
var frame = ges.view?.frame ?? CGRect()
frame.origin.y = (frame.height) - 205
frame.size.height = 100
if CGRectContainsPoint(frame, point) {
if let url = URL(string: "shortcuts://") {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
}
}
......
......@@ -80,7 +80,6 @@ class ChargeGuideNormalView : UIView{
make.centerX.equalToSuperview()
make.width.equalTo(316)
make.height.equalTo(534)
}
}
......
......@@ -12,7 +12,7 @@ import UIKit
class ContactIncompleteViewController : BaseViewController {
private var widthConstraint: Constraint?
// private var widthConstraint: Constraint?
var dataSourceModel : [ContactModel]?
......@@ -78,7 +78,7 @@ class ContactIncompleteViewController : BaseViewController {
self.selectAllButton.snp.makeConstraints { make in
make.right.equalTo(-15 * RScreenW())
make.centerY.equalTo(self.navView.backButton.snp.centerY)
widthConstraint = make.width.equalTo(115).constraint
// widthConstraint = make.width.equalTo(115).constraint
make.height.equalTo(32)
}
......@@ -86,17 +86,17 @@ class ContactIncompleteViewController : BaseViewController {
// 选择之后,更新宽度约束的常量值
if isSelected {
self.normalView.selectedContacts = self.normalView.dataSourceModel
self.widthConstraint?.update(offset: 131)
// self.widthConstraint?.update(offset: 131)
}else {
self.normalView.selectedContacts.removeAll()
self.widthConstraint?.update(offset: 115)
// self.widthConstraint?.update(offset: 115)
}
self.normalView.updateDeleteButtonStatus()
// 强制重新布局
UIView.animate(withDuration: 0.3) {
self.selectAllButton.setNeedsLayout()
self.selectAllButton.layoutIfNeeded()
}
// UIView.animate(withDuration: 0.3) {
// self.selectAllButton.setNeedsLayout()
// self.selectAllButton.layoutIfNeeded()
// }
self.normalView.tableView.reloadData()
}
self.normalView.dataClearCallBack = {
......
......@@ -74,9 +74,9 @@ class ContactsDupViewController : BaseViewController {
self.navView.addSubview(self.selectAllButton)
self.selectAllButton.snp.makeConstraints { make in
make.right.equalTo(-15 * RScreenW())
make.right.equalToSuperview().offset(-15)
make.centerY.equalTo(self.navView.backButton.snp.centerY)
widthConstraint = make.width.equalTo(115).constraint
// widthConstraint = make.width.equalTo(115).constraint
make.height.equalTo(32)
}
......@@ -88,21 +88,21 @@ class ContactsDupViewController : BaseViewController {
DispatchQueue.main.async {
// 选择之后,更新宽度约束的常量值
if isSelected {
self.widthConstraint?.update(offset: 131)
// self.widthConstraint?.update(offset: 131)
if let data = self.dataSourceModel {
for(index,item) in data.enumerated(){
self.normalView.selectData[String(index)] = item
}
}
}else {
self.widthConstraint?.update(offset: 115)
// self.widthConstraint?.update(offset: 115)
self.normalView.selectData = [:]
}
// 强制重新布局
UIView.animate(withDuration: 0.3) {
self.selectAllButton.setNeedsLayout()
self.selectAllButton.layoutIfNeeded()
}
// UIView.animate(withDuration: 0.3) {
// self.selectAllButton.setNeedsLayout()
// self.selectAllButton.layoutIfNeeded()
// }
self.normalView.tableView.reloadData()
}
}
......@@ -111,11 +111,11 @@ class ContactsDupViewController : BaseViewController {
DispatchQueue.main.async {
// 选择之后,更新宽度约束的常量值
if changed {
self.widthConstraint?.update(offset: 131)
// self.widthConstraint?.update(offset: 131)
self.selectAllButton.isSelected = true
}else {
self.widthConstraint?.update(offset: 115)
self.selectAllButton.isSelected = false
// self.selectAllButton.isSelected = false
}
}
}
......
......@@ -88,16 +88,21 @@ class SelectAllButton : UIView {
label.textColor = isSelected ? UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1) : UIColor(red: 0, green: 0.51, blue: 1, alpha: 1)
label.text = isSelected ? "Unselect all" : "Select All"
// 强制布局更新以适应新文本
setNeedsLayout()
layoutIfNeeded()
// // 强制布局更新以适应新文本
// UIView.animate(withDuration: 0.1) {
// self.setNeedsLayout()
// self.layoutIfNeeded()
// }
}
@objc func selectClick(){
self.isUserInteractionEnabled = false
self.isSelected = !self.isSelected
tapCallback(self.isSelected)
DispatchQueue.main.asyncAfter(deadline: .now()+0.01) {
self.isUserInteractionEnabled = true
}
}
}
......@@ -12,25 +12,31 @@ class HomeInfoViewController:BaseViewController {
private var type:PhotsFileType?
lazy var seletedAllBtn:UIButton = {
let btn:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 115, height: 32))
btn.addTarget(self, action: #selector(seletedAllBtnClick), for: .touchUpInside)
btn.backgroundColor = UIColor.colorWithHex(hexStr: "#F2F6FC")
btn.setImage(UIImage.init(named: "ic_check_similar"), for: .normal)
btn.setTitle("Select All", for: .normal)
btn.setImage(UIImage.init(named: "ic_close_similar"), for: .selected)
btn.setTitle("Unselect all", for: .selected)
btn.setTitleColor(UIColor.colorWithHex(hexStr: mColor), for: .normal)
btn.setTitleColor(UIColor.colorWithHex(hexStr: black3Color), for: .selected)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .bold)
btn.layer.cornerRadius = btn.height / 2
btn.layer.masksToBounds = true
btn.changBtnWithStytl(btnStyle: .defalut, margin: 8)
return btn
lazy var seletedAllBtn:SelectAllButton = {
let view = SelectAllButton()
view.clipsToBounds = true
view.layer.cornerRadius = 16
view.tapCallback = {[weak self] isselect in
self?.seletedAllBtnClick()
}
return view
// let btn:UIButton = UIButton(type: .custom)//(frame: CGRect(x: 0, y: 0, width: 115, height: 32))
//
// btn.addTarget(self, action: #selector(seletedAllBtnClick), for: .touchUpInside)
// btn.backgroundColor = UIColor.colorWithHex(hexStr: "#F2F6FC")
// btn.setImage(UIImage.init(named: "ic_check_similar"), for: .normal)
// btn.setTitle("Select All", for: .normal)
// btn.setImage(UIImage.init(named: "ic_close_similar"), for: .selected)
// btn.setTitle("Unselect all", for: .selected)
// btn.setTitleColor(UIColor.colorWithHex(hexStr: mColor), for: .normal)
// btn.setTitleColor(UIColor.colorWithHex(hexStr: black3Color), for: .selected)
// btn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .bold)
//
// btn.layer.cornerRadius = btn.height / 2
// btn.layer.masksToBounds = true
// btn.changBtnWithStytl(btnStyle: .defalut, margin: 8)
//
// return btn
}()
lazy var tablewView:HomeInfoView = {
......@@ -63,8 +69,8 @@ class HomeInfoViewController:BaseViewController {
guard let self else {return}
self.seletedAllBtn.isSelected = cS
self.seletedAllBtn.width = cS ? 131 : 115
seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
// self.seletedAllBtn.width = cS ? 131 : 115
// seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
}
}
}
......@@ -325,6 +331,10 @@ class HomeInfoViewController:BaseViewController {
configSelectAll()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
seletedAllBtn.isHidden = (self.ids?.count ?? 0 <= 0)
}
// 删除成功页面
func showDeleteSuccess(fileCount:Int,fileSize:Int64){
......@@ -392,10 +402,14 @@ class HomeInfoViewController:BaseViewController {
super.addViews()
seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
seletedAllBtn.centerY = navCenterY
// seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
// seletedAllBtn.centerY = navCenterY
titleView.addSubview(seletedAllBtn)
seletedAllBtn.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-marginLR)
make.centerY.equalTo(titleView.backBtn.snp.centerY)
make.height.equalTo(32)
}
titleLabel.x = titleView.backBtn.width + titleView.backBtn.x + 10
titleLabel.centerY = navCenterY
......@@ -445,8 +459,8 @@ class HomeInfoViewController:BaseViewController {
func configSelectAll(){
seletedAllBtn.isSelected = true
self.seletedAllBtn.width = seletedAllBtn.isSelected ? 131 : 115
seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
// self.seletedAllBtn.width = seletedAllBtn.isSelected ? 131 : 115
// seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
tablewView.changeALlValue(isSeleted: seletedAllBtn.isSelected)
}
......@@ -457,9 +471,9 @@ class HomeInfoViewController:BaseViewController {
guard let self else {return}
seletedAllBtn.isSelected = !seletedAllBtn.isSelected
self.seletedAllBtn.width = seletedAllBtn.isSelected ? 131 : 115
seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
// seletedAllBtn.isSelected = !seletedAllBtn.isSelected
// self.seletedAllBtn.width = seletedAllBtn.isSelected ? 131 : 115
// seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
tablewView.changeALlValue(isSeleted: seletedAllBtn.isSelected)
}
......
......@@ -240,6 +240,8 @@ class HomePhotosDetailViewController : BaseViewController {
}else{
self.collectionView.frame = CGRect(x: marginLR, y: self.videoDetailNavView!.height, width: self.view.width - 2 * marginLR, height: self.view.height - self.videoDetailNavView!.height)
}
self.videoDetailNavView?.startSelectButton.isHidden = (self.resourceData.count <= 0)
}
}
......@@ -451,6 +453,8 @@ extension HomePhotosDetailViewController:WaterfallMutiSectionDelegate,UICollecti
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "HomePhotosDetailCollectionCell", for: indexPath) as! HomePhotosDetailCollectionCell
cell.resourceIdent = self.resourceData[indexPath.row]
cell.saveSizeView.isHidden = mediaType != .Other
// 这里做缓存
cell.backImageView.image = UIImage()
self.getImageFromCache(model: self.resourceData[indexPath.row]) {[weak self] image in
......@@ -574,7 +578,8 @@ extension HomePhotosDetailViewController:WaterfallMutiSectionDelegate,UICollecti
header.countLabel.attributedText = header.getAttrText(fullText: "\(self.resourceData.count) Photos")
header.modelTitlelabel.text = self.mediaType?.rawValue
currentHeaderView = header
header.filterButton.isHidden = (self.resourceData.count <= 0)
header.countLabel.isHidden = (self.resourceData.count <= 0)
header.sortViewSubmitCallBack = {[weak self] filterModel in
guard let self else {return}
PhotoManager.shared.reloadTrashAndKeep()
......
......@@ -317,6 +317,7 @@ class HomeVideoDetailController :BaseViewController {
}else{
self.collectionView.frame = CGRect(x: marginLR, y: self.videoDetailNavView!.height, width: self.view.width - 2 * marginLR, height: self.view.height - self.videoDetailNavView!.height)
}
self.videoDetailNavView?.startSelectButton.isHidden = (self.resourceData.count <= 0)
}
}
......@@ -364,7 +365,7 @@ extension HomeVideoDetailController:WaterfallMutiSectionDelegate,UICollectionVie
cell.resourceIdent = self.resourceData[indexPath.row]
cell.currentOrder = indexPath.row
cell.backImageView.image = nil
// cell.backImageView.image = nil
if self.selectedModel.contains(where: { $0.localIdentifier == cell.resourceIdent!.localIdentifier }) {
cell.choose = true
}else{
......@@ -497,6 +498,9 @@ extension HomeVideoDetailController:WaterfallMutiSectionDelegate,UICollectionVie
currentHeaderView = header
header.compressionTipView.reloadData()
header.sizeLabel.attributedText = header.getAttrText(fullText: "\(self.resourceData.count) Videos")
header.sizeLabel.isHidden = (self.resourceData.count <= 0)
header.filterButton.isHidden = (self.resourceData.count <= 0)
header.compressionTipView.isHidden = (PhotoManager.shared.permissionStatus != .authorized)
header.sortViewSubmitCallBack = {[weak self] filterModel in
guard let self else {return}
PhotoManager.shared.reloadTrashAndKeep()
......@@ -739,6 +743,7 @@ extension HomeVideoDetailController:WaterfallMutiSectionDelegate,UICollectionVie
}
}
self.addTrashView()
}
}
......
......@@ -7,6 +7,7 @@
import UIKit
import AppTrackingTransparency
import SVProgressHUD
class HomeViewController:BaseViewController {
......@@ -20,10 +21,9 @@ class HomeViewController:BaseViewController {
fileprivate func junmToModule(_ cIndex: Int, _ self: HomeViewController) {
fileprivate func junmToModule(_ cIndex: String, _ self: HomeViewController) {
switch cIndex {
case 0 :
case HomeTabbarItemState.Charging.rawValue:
DispatchQueue.main.async {[weak self] in
......@@ -34,7 +34,7 @@ class HomeViewController:BaseViewController {
self.navigationController?.pushViewController(vc, animated: true)
}
break
case 1:
case HomeTabbarItemState.SecretSpace.rawValue:
DispatchQueue.main.async { [weak self] in
guard let self else {return}
......@@ -56,14 +56,14 @@ class HomeViewController:BaseViewController {
self.navigationController?.pushViewController(vc, animated: true)
}
}
case 2 :
case HomeTabbarItemState.Contacts.rawValue :
DispatchQueue.main.async {[weak self] in
guard let self else {return}
let vc:ContactViewController = ContactViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
break
case 3 :
case HomeTabbarItemState.EmailCleaner.rawValue :
DispatchQueue.main.async {[weak self] in
guard let self else {return}
if PMEmailManager.shareManager.loginUser != nil {
......@@ -75,7 +75,7 @@ class HomeViewController:BaseViewController {
}
}
break
case 4 :
case HomeTabbarItemState.Compress.rawValue :
DispatchQueue.main.async {[weak self] in
guard let self else {return}
let vc:CompressController = CompressController()
......@@ -178,8 +178,7 @@ class HomeViewController:BaseViewController {
guard let self else {return}
if let cIndex = index as? Int {
if let cIndex = index as? String {
// 先走广告策略
if AdvManager.shared.advTimeAfterInAPP <= 0{
if IAPManager.share.isSubscribed == false {
......@@ -227,29 +226,33 @@ class HomeViewController:BaseViewController {
func showIAPVC(){
IAPManager.share.isHotLaunch = true
IAPManager.share.checkSubscriptionState { isSubscribed,type,expiresDate in
IAPManager.share.checkSubscriptionState {[weak self] isSubscribed,type,expiresDate in
guard let self = self else { return }
Print("是否内购---",isSubscribed)
if IAPManager.share.showYearPage{
//按钮启动
switch type {
case .none,.week:
let vc:PayDistanceViewController = PayDistanceViewController()
let nav:BaseNavViewController = BaseNavViewController(rootViewController: vc)
nav.modalPresentationStyle = .fullScreen
self.present(nav, animated: true)
break
case .lifetime,.year:
let vc : PayCompletedViewController = PayCompletedViewController()
vc.modalPresentationStyle = .fullScreen
self.present(vc, animated: true)
}
}else{
// 正常启动
if !isSubscribed{
DispatchQueue.main.async {
if !IAPManager.share.showYearPage{
HomePayViewController.show {
NotificationManager().configNotifications()
DispatchQueue.main.async {
if IAPManager.share.showYearPage{
//按钮启动
switch type {
case .none,.week:
let vc = PayDistanceViewController()
let nav:BaseNavViewController = BaseNavViewController(rootViewController: vc)
nav.modalPresentationStyle = .fullScreen
self.present(nav, animated: true)
break
case .lifetime,.year:
let vc : PayCompletedViewController = PayCompletedViewController()
vc.modalPresentationStyle = .fullScreen
self.present(vc, animated: true)
}
}else{
// 正常启动
if !isSubscribed{
DispatchQueue.main.async {
if !IAPManager.share.showYearPage{
HomePayViewController.show {
NotificationManager().configNotifications()
}
}
}
}
......
......@@ -28,6 +28,14 @@ func loadTabbarImtesSONFromBundle() -> [HomeTabbarItem]? {
}
}
enum HomeTabbarItemState : String {
case Charging = "Charging"
case SecretSpace = "Secret Space"
case Contacts = "Contacts"
case EmailCleaner = "Email Cleaner"
case Compress = "Compress"
}
struct HomeTabbarItem:Codable {
var normalImage:String
......
[
{
"normalImage": "ic_charging_home_pre",
"heightImage": "tabbar_Charging_high",
"text":"Charging",
},
{
"normalImage": "ic_secret_home_pre",
"heightImage": "tabbar_secret_hight",
"text":"Secret Space",
},
{
"normalImage": "ic_contacts_home_pre",
"heightImage": "tabbar_contacts_hight",
"text":"Contacts",
"normalImage": "ic_charging_home_pre",
"heightImage": "tabbar_Charging_high",
"text":"Charging",
},
{
"normalImage": "ic_cmpress_home_pre",
"heightImage": "tabbar_cmpress_high",
"text":"Compress",
},
{
"normalImage": "ic_email_home_pre",
......@@ -20,8 +20,8 @@
"text":"Email Cleaner",
},
{
"normalImage": "ic_cmpress_home_pre",
"heightImage": "tabbar_cmpress_high",
"text":"Compress",
}
"normalImage": "ic_contacts_home_pre",
"heightImage": "tabbar_contacts_hight",
"text":"Contacts",
},
]
......@@ -47,7 +47,8 @@ class HomeInfoView :UIView {
let sview:HomeInfoTitleView = HomeInfoTitleView(frame: CGRect(x: 0, y: 0, width: width, height: 84))
sview.titleLabel.text = self.titleText
sview.type = self.type
sview.filterButton.isHidden = self.type != .similar && self.type != .SimilarVideos
sview.filterButton.isHidden = (self.type != .similar && self.type != .SimilarVideos || (ids?.count ?? 0 <= 0))
sview.numberLabel.isHidden = (ids?.count ?? 0 <= 0)
return sview
}()
......@@ -314,7 +315,8 @@ class HomeInfoView :UIView {
tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: deleteView.isHidden ? 12 : deleteView.height + 12 , right: 0)
self.nextRowButton.isHidden = !self.isShowNextRowButton()
headerView.filterButton.isHidden = (self.type != .similar && self.type != .SimilarVideos || (ids?.count ?? 0 <= 0))
headerView.numberLabel.isHidden = (ids?.count ?? 0 <= 0)
}
}
......@@ -391,17 +393,19 @@ extension HomeInfoView:UITableViewDataSource,UITableViewDelegate {
let cell = tableView.dequeueReusableCell(withIdentifier: HomeInfoTableViewCell.identifier, for: indexPath) as! HomeInfoTableViewCell
cell.saveKeepListFinishedCallback = {[weak self] index in
guard let self else {return}
self.ids?.remove(at: index.section)
self.models.remove(at: index.section)
self.ids?.remove(at:indexPath.row)
self.models.remove(at:indexPath.row)
DispatchQueue.main.async {
self.setTitleView()
}
// 禁用动画
UIView.performWithoutAnimation {
tableView.beginUpdates()
tableView.deleteRows(at: [index], with: .fade)
tableView.endUpdates()
// tableView.beginUpdates()
// tableView.deleteRows(at: [indexPath], with: .fade)
// tableView.endUpdates()
tableView.reloadData()
}
// tableView.reloadData()
if let data = self.ids {
if data.count <= 0 {
self.keepAllNoDataCallBack()
......
......@@ -36,7 +36,7 @@ class HomeTabbarView:UIView {
private func addButton() {
let cW:CGFloat = (self.width - 16) / Double(tabbarItems.count)
let cW:CGFloat = (self.width - 32) / Double(tabbarItems.count)
let cH:CGFloat = 54
for (index,item) in tabbarItems.enumerated() {
......@@ -49,11 +49,11 @@ class HomeTabbarView:UIView {
btn.setTitle(item.text, for: .normal)
btn.addTarget(self, action: #selector(tabbarClick(_:)), for: .touchUpInside)
btn.width = cW
btn.tag = 10 + index
btn.height = cH
btn.y = safeHeight == 0 ? 6 : 12
btn.x = 8 + Double(index) * cW
btn.x = 16 + Double(index) * cW
btn.changBtnWithStytl(btnStyle: .imageTop, margin: 5)
self.addSubview(btn)
}
}
......@@ -65,14 +65,15 @@ class HomeTabbarView:UIView {
}
@objc func tabbarClick(_ btn:UIButton) {
let btnText = btn.titleLabel?.text
for (index, item) in tabbarItems.enumerated() {
if item.text == btnText {
indexCallBack(index)
}
}
let tm = tabbarItems[btn.tag % 10]
indexCallBack(tm.text)
// let btnText = btn.titleLabel?.text
//
// for (index, item) in tabbarItems.enumerated() {
// if item.text == btnText {
// indexCallBack(index)
// }
// }
}
......
......@@ -82,17 +82,17 @@ class HomeView:UIView {
viewModel.homeDataChanged = {[weak self] section,row in
guard let weakSelf = self else { return }
DispatchQueue.main.async {
// if let cell = weakSelf.collectionView.cellForItem(at: IndexPath(row: row, section: section)) as? HomeTitleCollectionCell {
// // 只更新需要改变的内容
// let model = weakSelf.viewModel.headerGroup[row]
// cell.reloadUIWithModel(model: model)
// }
// if let cell = weakSelf.collectionView.cellForItem(at: IndexPath(row: row, section: section)) as? HomeOtherCollectionCell {
// // 只更新需要改变的内容
// let model = weakSelf.viewModel.cardGroup[row]
// cell.reloadUIWithModel(model: model)
// }
weakSelf.collectionView.reloadData()
if let cell = weakSelf.collectionView.cellForItem(at: IndexPath(row: row, section: section)) as? HomeTitleCollectionCell {
// 只更新需要改变的内容
let model = weakSelf.viewModel.headerGroup[row]
cell.reloadUIWithModel(model: model)
}
if let cell = weakSelf.collectionView.cellForItem(at: IndexPath(row: row, section: section)) as? HomeOtherCollectionCell {
// 只更新需要改变的内容
let model = weakSelf.viewModel.cardGroup[row]
cell.reloadUIWithModel(model: model)
}
// weakSelf.collectionView.reloadData()
weakSelf.homeHeader?.progressBar.chaoticProgress = CGFloat(weakSelf.viewModel.totalSize)
weakSelf.reloadHeadSize()
}
......@@ -130,14 +130,14 @@ class HomeView:UIView {
backgroundColor = .clear
clipsToBounds = true
homeTabbarView = HomeTabbarView(frame: CGRect(x: 0, y: 0, width: self.width, height: safeHeight + 66))
homeTabbarView = HomeTabbarView(frame: CGRect(x: 0, y: 0, width: self.width, height: safeHeight + 80))
self.addSubview(homeTabbarView!)
homeTabbarView?.snp.makeConstraints({ make in
make.bottom.centerX.width.equalToSuperview()
make.height.equalTo(safeHeight + 66)
make.height.equalTo(safeHeight + 80)
})
homeTabbarView?.indexCallBack = {[weak self] index in
......
......@@ -131,7 +131,7 @@ class PhotosRemoveBaseView: UIView {
self.rightButton.alpha = 0
self.maskTempleteView.backgroundColor = UIColor(red: 0.95, green: 0.21, blue: 0.21, alpha: 0.4000)
self.addSubview(self.maskTempleteView)
self.bringSubviewToFront(self.leftButton)
}
func showRightButton() {
......@@ -140,6 +140,7 @@ class PhotosRemoveBaseView: UIView {
}else {
self.rightButton.center = imageView.center
}
self.bringSubviewToFront(self.rightButton)
UIView.animate(withDuration: 0.2) {
self.rightButton.alpha = 1
self.maskTempleteView.backgroundColor = UIColor(red: 0.26, green: 0.78, blue: 0.41, alpha: 0.4000)
......
......@@ -29,22 +29,30 @@ class VideoDetaiNavView : UIView {
return button
}()
lazy var seletedAllBtn:UIButton = {
lazy var seletedAllBtn:SelectAllButton = {
let btn:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 115, height: 32))
btn.isSelected = false
btn.backgroundColor = UIColor.colorWithHex(hexStr: "#F2F6FC")
btn.setImage(UIImage.init(named: "ic_check_similar"), for: .normal)
btn.setTitle("Select All", for: .normal)
btn.setImage(UIImage.init(named: "ic_close_similar"), for: .selected)
btn.setTitle("Unselect all", for: .selected)
btn.setTitleColor(UIColor.colorWithHex(hexStr: mColor), for: .normal)
btn.setTitleColor(UIColor.colorWithHex(hexStr: black3Color), for: .selected)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .bold)
btn.changBtnWithStytl(btnStyle: .defalut, margin: 8)
btn.addTarget(self, action: #selector(seletedAllBtnClick), for: .touchUpInside)
btn.layer.cornerRadius = btn.height / 2
return btn
let view = SelectAllButton()
view.clipsToBounds = true
view.layer.cornerRadius = 16
view.tapCallback = {[weak self] isselect in
self?.seletedAllBtnClick()
}
return view
// let btn:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 115, height: 32))
// btn.isSelected = false
// btn.backgroundColor = UIColor.colorWithHex(hexStr: "#F2F6FC")
// btn.setImage(UIImage.init(named: "ic_check_similar"), for: .normal)
// btn.setTitle("Select All", for: .normal)
// btn.setImage(UIImage.init(named: "ic_close_similar"), for: .selected)
// btn.setTitle("Unselect all", for: .selected)
// btn.setTitleColor(UIColor.colorWithHex(hexStr: mColor), for: .normal)
// btn.setTitleColor(UIColor.colorWithHex(hexStr: black3Color), for: .selected)
// btn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .bold)
// btn.changBtnWithStytl(btnStyle: .defalut, margin: 8)
// btn.addTarget(self, action: #selector(seletedAllBtnClick), for: .touchUpInside)
// btn.layer.cornerRadius = btn.height / 2
// return btn
}()
override init(frame: CGRect) {
......@@ -69,8 +77,15 @@ class VideoDetaiNavView : UIView {
self.addSubview(self.seletedAllBtn)
seletedAllBtn.x = marginLR
seletedAllBtn.centerY = navCenterY
// seletedAllBtn.x = marginLR
// seletedAllBtn.centerY = navCenterY
seletedAllBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(marginLR)
make.height.equalTo(32)
make.centerY.equalTo(navCenterY)
}
backButton.snp.makeConstraints { make in
make.centerY.equalTo(navCenterY)
......@@ -97,9 +112,9 @@ class VideoDetaiNavView : UIView {
DispatchQueue.main.async {[weak self] in
guard let self else {return}
seletedAllBtn.isSelected = !seletedAllBtn.isSelected
self.seletedAllBtn.width = seletedAllBtn.isSelected ? 131 : 115
seletedAllBtn.x = marginLR
// seletedAllBtn.isSelected = !seletedAllBtn.isSelected
// self.seletedAllBtn.width = seletedAllBtn.isSelected ? 131 : 115
// seletedAllBtn.x = marginLR
self.selectAllCallBack(seletedAllBtn.isSelected)
}
......@@ -112,6 +127,7 @@ class VideoDetaiNavView : UIView {
seletedAllBtn.isSelected = true
seletedAllBtnClick()
}
backButton.isHidden = self.startSelectButton.isSelected
self.startSelectCallBack(self.startSelectButton.isSelected)
}
}
......@@ -116,10 +116,11 @@ class HomeInfoTableViewCell:UITableViewCell {
collectionView?.x = (backView?.x ?? 0) + marginLR
collectionView?.y = (backView?.y ?? 0) + (backView?.height ?? 0) - (collectionView?.height ?? 0) - 16
self.collectionView?.reloadData()
UIView.transition(with: collectionView!, duration: 0.3, options: .transitionCrossDissolve, animations: {
self.collectionView?.reloadData()
}, completion: nil)
// UIView.transition(with: collectionView!, duration: 0.3, options: .transitionCrossDissolve, animations: {
// self.collectionView?.reloadData()
// }, completion: nil)
}
}
......
......@@ -27,13 +27,46 @@ class HomePhotosDetailCollectionCell : UICollectionViewCell {
}
}
var resourceIdent : AssetModel?
var resourceIdent : AssetModel? {
didSet {
let sizeKB : Double = Double((resourceIdent?.assetSize ?? 0) / 1000)
if sizeKB < 1000{
self.saveSizeLabel.text = String(format: "%.2f KB" ,sizeKB)
}else if sizeKB < (1000 * 1000) && sizeKB > 1000{
self.saveSizeLabel.text = String(format: "%.2f MB" ,sizeKB/1000)
}else{
self.saveSizeLabel.text = String(format: "%.2f GB" ,sizeKB/(1000 * 1000))
}
}
}
var currentOrder : Int = 0
lazy var saveSizeView: UIView = {
let view = UIView()
view.layer.masksToBounds = true
view.layer.cornerRadius = 12
view.backgroundColor = UIColor(red: 0, green: 0.51, blue: 1, alpha: 1)
return view
}()
lazy var saveSizeLabel: UILabel = {
let view = UILabel()
view.textAlignment = .left
view.textColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1)
view.font = UIFont.systemFont(ofSize: 12, weight: .semibold)
view.text = "0.0MB"
return view
}()
lazy var moreImageView: UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "Frame 9")
view.backgroundColor = .clear
return view
}()
lazy var backImageView: UIImageView = {
let view = UIImageView()
view.clipsToBounds = true
......@@ -91,6 +124,11 @@ class HomePhotosDetailCollectionCell : UICollectionViewCell {
self.addSubview(self.selectImageView)
self.addSubview(self.extensionView)
self.addSubview(self.saveSizeView)
self.saveSizeView.addSubview(self.saveSizeLabel)
self.saveSizeView.addSubview(self.moreImageView)
self.backImageView.snp.makeConstraints { make in
make.left.right.height.width.equalToSuperview()
}
......@@ -104,6 +142,23 @@ class HomePhotosDetailCollectionCell : UICollectionViewCell {
make.bottom.right.equalToSuperview().offset(-6)
make.height.width.equalTo(18)
}
self.saveSizeView.snp.makeConstraints { make in
make.left.top.equalToSuperview().offset(6)
make.height.equalTo(24)
make.width.equalTo(100)
}
self.saveSizeLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(11)
make.centerY.equalToSuperview()
make.height.equalTo(17)
}
self.moreImageView.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-10)
make.centerY.equalToSuperview()
make.height.width.equalTo(16)
}
}
required init?(coder: NSCoder) {
......
......@@ -48,7 +48,7 @@ class HomeTitleCollectionCell:UICollectionViewCell {
titleLabel = UILabel()
titleLabel.font = UIFont.systemFont(ofSize: 16, weight: .bold)
titleLabel.font = UIFont.systemFont(ofSize: 18, weight: .bold)
titleLabel.textColor = UIColor.colorWithHex(hexStr: black3Color)
fileLabel = UILabel()
......
......@@ -216,14 +216,13 @@ extension HomeVideoCoverCell{
if videoURL == videoUrl{
// Print("地址相同,无需刷新")
if videoPlayer.rate == 0{
videoPlayer.play()
}
return
}
videoUrl = videoURL
// if videoPlayer
// Print("地址不同,需刷新")
let item = AVPlayerItem.init(url: videoURL)
videoPlayer.replaceCurrentItem(with: item)
......
......@@ -18,48 +18,65 @@ class HomeVideoDetailCell : UICollectionViewCell {
var resourceIdent : AssetModel? {
didSet{
// 定义请求选项来获取视频的第一帧
let options = PHImageRequestOptions()
// 获取当前版本的照片或视频
options.version = .current
// 尽可能快地提供结果
options.deliveryMode = .opportunistic
// 允许从iCloud请求
options.isNetworkAccessAllowed = true
// 异步请求
options.isSynchronous = false
// 从 PHAsset 获取 AVAsset
if let videoAsset = PhotoAndVideoMananger.mananger.getPHAsssetwithID(ids: [resourceIdent!.localIdentifier]){
// 使用requestImageForAsset方法请求视频的第一帧图片
PHImageManager.default().requestImage(for: videoAsset, targetSize: CGSize(width: 400, height: 400), contentMode: PHImageContentMode.aspectFit, options: options) { image, _ in
// 处理获取到的图片
if let thumbnailImage = image {
// 图片大小
let resources = PHAssetResource.assetResources(for: videoAsset)
var assetSize : Int = 0
for resource in resources {
if let fileSize = resource.value(forKey: "fileSize") as? Int64 {
assetSize += Int(fileSize)
}
}
DispatchQueue.main.async {
// 确保在主线程更新UI
self.backImageView.image = thumbnailImage
let sizeKB : Double = Double(assetSize / 1000)
if sizeKB < 1000{
self.saveSizeLabel.text = String(format: "%.2f KB" ,sizeKB)
}else if sizeKB < (1000 * 1000) && sizeKB > 1000{
self.saveSizeLabel.text = String(format: "%.2f MB" ,sizeKB/1000)
}else{
self.saveSizeLabel.text = String(format: "%.2f GB" ,sizeKB/(1000 * 1000))
}
}
} else {
print("无法获取图片")
}
}
guard let model = resourceIdent else{
return
}
self.backImageView.asset.load(withLocalIdentifier: model.localIdentifier,placeholder: UIImage.init(named: "videosmoren"))
let sizeKB : Double = Double(model.assetSize / 1000)
if sizeKB < 1000{
self.saveSizeLabel.text = String(format: "%.2f KB" ,sizeKB)
}else if sizeKB < (1000 * 1000) && sizeKB > 1000{
self.saveSizeLabel.text = String(format: "%.2f MB" ,sizeKB/1000)
}else{
self.saveSizeLabel.text = String(format: "%.2f GB" ,sizeKB/(1000 * 1000))
}
// // 定义请求选项来获取视频的第一帧
// let options = PHImageRequestOptions()
// // 获取当前版本的照片或视频
// options.version = .current
// // 尽可能快地提供结果
// options.deliveryMode = .opportunistic
// // 允许从iCloud请求
// options.isNetworkAccessAllowed = true
// // 异步请求
// options.isSynchronous = false
// 从 PHAsset 获取 AVAsset
// if let videoAsset = PhotoAndVideoMananger.mananger.getPHAsssetwithID(ids: [resourceIdent!.localIdentifier]){
// // 使用requestImageForAsset方法请求视频的第一帧图片
// PHImageManager.default().requestImage(for: videoAsset, targetSize: CGSize(width: 400, height: 400), contentMode: PHImageContentMode.aspectFit, options: options) { image, _ in
// // 处理获取到的图片
// if let thumbnailImage = image {
//
// // 图片大小
// let resources = PHAssetResource.assetResources(for: videoAsset)
// var assetSize : Int = 0
// for resource in resources {
// if let fileSize = resource.value(forKey: "fileSize") as? Int64 {
// assetSize += Int(fileSize)
// }
// }
// DispatchQueue.main.async {
// // 确保在主线程更新UI
// self.backImageView.image = thumbnailImage
// let sizeKB : Double = Double(assetSize / 1000)
// if sizeKB < 1000{
// self.saveSizeLabel.text = String(format: "%.2f KB" ,sizeKB)
// }else if sizeKB < (1000 * 1000) && sizeKB > 1000{
// self.saveSizeLabel.text = String(format: "%.2f MB" ,sizeKB/1000)
// }else{
// self.saveSizeLabel.text = String(format: "%.2f GB" ,sizeKB/(1000 * 1000))
// }
// }
// } else {
// print("无法获取图片")
// }
// }
// }
}
}
......
......@@ -72,69 +72,74 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
seletedBtn?.isSelected = model.isSeleted ?? false
}
if let image = model.image {
DispatchQueue.main.async {[weak self] in
guard let self else {return}
backImageView?.image = image
}
}else {
DispatchQueue.global().async {[weak self] in
guard let self else {return}
// 如果是图片
if self.photsFileType == .SimilarVideos {
// 定义请求选项来获取视频的第一帧
let options = PHImageRequestOptions()
// 获取当前版本的照片或视频
options.version = .current
// 尽可能快地提供结果
options.deliveryMode = .highQualityFormat
// 允许从iCloud请求
options.isNetworkAccessAllowed = true
// 异步请求
options.isSynchronous = false
// 从 PHAsset 获取 AVAsset
if let videoAsset = PhotoAndVideoMananger.mananger.getPHAsssetwithID(ids: [model.id!.localIdentifier]){
// 使用requestImageForAsset方法请求视频的第一帧图片
PHImageManager.default().requestImage(for: videoAsset, targetSize: CGSize(width: 400, height: 400), contentMode: PHImageContentMode.aspectFit, options: options) { image, _ in
// 处理获取到的图片
if let thumbnailImage = image {
// 使用获取到的图片,例如显示在UIImageView上
DispatchQueue.main.async { [weak self] in
guard let self else {return}
// 确保在主线程更新UI
self.model.image = thumbnailImage
self.backImageView?.image = thumbnailImage
}
} else {
print("无法获取图片")
}
}
}
}else{
if let asset = PhotoAndVideoMananger.mananger.getPHAsssetwithID(ids: [model.id!.localIdentifier]){
let image = PhotoAndVideoMananger.mananger.getImageFromAsset(asset: asset)
model.image = image
DispatchQueue.main.async {[weak self] in
guard let self else {return}
backImageView?.image = image
}
}
}
}
let placeImage = model.id?.mediaType == 1 ? "othermoren" : "videosmoren"
if let id = model.id?.localIdentifier{
backImageView?.asset.load(withLocalIdentifier: id,placeholder: UIImage.init(named: placeImage))
}else{
backImageView?.image = UIImage.init(named: placeImage)
}
// if let image = model.image {
//
// DispatchQueue.main.async {[weak self] in
//
// guard let self else {return}
//
// backImageView?.image = image
//
// }
//
// }else {
//
// DispatchQueue.global().async {[weak self] in
// guard let self else {return}
// // 如果是图片
// if self.photsFileType == .SimilarVideos {
// // 定义请求选项来获取视频的第一帧
// let options = PHImageRequestOptions()
// // 获取当前版本的照片或视频
// options.version = .current
// // 尽可能快地提供结果
// options.deliveryMode = .highQualityFormat
// // 允许从iCloud请求
// options.isNetworkAccessAllowed = true
// // 异步请求
// options.isSynchronous = false
// // 从 PHAsset 获取 AVAsset
// if let videoAsset = PhotoAndVideoMananger.mananger.getPHAsssetwithID(ids: [model.id!.localIdentifier]){
// // 使用requestImageForAsset方法请求视频的第一帧图片
// PHImageManager.default().requestImage(for: videoAsset, targetSize: CGSize(width: 400, height: 400), contentMode: PHImageContentMode.aspectFit, options: options) { image, _ in
// // 处理获取到的图片
// if let thumbnailImage = image {
// // 使用获取到的图片,例如显示在UIImageView上
// DispatchQueue.main.async { [weak self] in
// guard let self else {return}
// // 确保在主线程更新UI
// self.model.image = thumbnailImage
// self.backImageView?.image = thumbnailImage
// }
// } else {
// print("无法获取图片")
// }
// }
// }
// }else{
// if let asset = PhotoAndVideoMananger.mananger.getPHAsssetwithID(ids: [model.id!.localIdentifier]){
// let image = PhotoAndVideoMananger.mananger.getImageFromAsset(asset: asset)
//
// model.image = image
//
// DispatchQueue.main.async {[weak self] in
//
// guard let self else {return}
//
// backImageView?.image = image
//
// }
// }
// }
// }
// }
}
}
......
......@@ -24,33 +24,39 @@ class HomeLaunchView:UIView {
func configUI(){
backgroundColor = UIColor.colorWithHex(hexStr: "#0082FF")
// backgroundColor = UIColor.colorWithHex(hexStr: "#0082FF")
self.az_setGradientBackground(with: [UIColor.colorWithHex(hexStr: "#2AB4FF"),UIColor.colorWithHex(hexStr: "#0082FF")], locations: nil, start: CGPoint(x: 0, y: 0), end: CGPoint(x: 0, y: 1))
let logoImage = UIImageView()
logoImage.image = UIImage.init(named: "icon_phone_manager")
addSubview(logoImage)
let nameImage = UIImageView()
nameImage.image = UIImage.init(named: "icon_phone_manager_name")
addSubview(nameImage)
// let nameImage = UIImageView()
// nameImage.image = UIImage.init(named: "icon_phone_manager_name")
// addSubview(nameImage)
addSubview(LaunchingLoop)
// addSubview(LaunchingLoop)
logoImage.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(kSafeAreaInsets.top+150)
make.centerY.equalToSuperview()
// make.top.equalTo(kSafeAreaInsets.top+150)
}
nameImage.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(logoImage.snp.bottom).offset(12)
}
// nameImage.snp.makeConstraints { make in
// make.centerX.equalToSuperview()
// make.top.equalTo(logoImage.snp.bottom).offset(12)
// }
LaunchingLoop.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.width.height.equalTo(150)
make.bottom.equalToSuperview().offset(-60 * RScreenH())
}
// LaunchingLoop.snp.makeConstraints { make in
// make.centerX.equalToSuperview()
// make.width.height.equalTo(150)
// make.bottom.equalToSuperview().offset(-60 * RScreenH())
// }
}
......@@ -68,11 +74,11 @@ class HomeLaunchView:UIView {
})
}
private lazy var LaunchingLoop: LottieAnimationView = {
let animationView = LottieAnimationView(name: "launch_loaing")
animationView.loopMode = .loop
animationView.play()
return animationView
}()
// private lazy var LaunchingLoop: LottieAnimationView = {
// let animationView = LottieAnimationView(name: "launch_loaing")
// animationView.loopMode = .loop
// animationView.play()
// return animationView
// }()
}
......@@ -20,10 +20,10 @@ class HomePayDueView: UIView {
override func awakeFromNib() {
super.awakeFromNib()
freeTime.layer.cornerRadius = 8
freeTime.layer.cornerRadius = 10.5
freeTime.layer.masksToBounds = true
saveL.layer.cornerRadius = 8
saveL.layer.cornerRadius = 10.5
saveL.layer.masksToBounds = true
dueDay.font = UIFont.scaledSystemFont(ofSize: 14, weight: .bold)
......@@ -32,9 +32,9 @@ class HomePayDueView: UIView {
priceL.font = UIFont.scaledSystemFont(ofSize: 12, weight: .regular)
freeTime.font = UIFont.scaledSystemFont(ofSize: 12, weight: .regular)
freeTime.font = UIFont.scaledSystemFont(ofSize: 12, weight: .bold)
saveL.font = UIFont.scaledSystemFont(ofSize: 14, weight: .bold)
saveL.font = UIFont.scaledSystemFont(ofSize: 12, weight: .bold)
freePrice.font = UIFont.scaledSystemFont(ofSize: 12, weight: .regular)
......@@ -73,7 +73,7 @@ class HomePayDueView: UIView {
saveL.isHidden = false
priceL.text = "\(pord1.localizedPrice)"
priceL.font = UIFont.scaledSystemFont(ofSize: 14, weight: .regular)
priceL.font = UIFont.scaledSystemFont(ofSize: 12, weight: .regular)
}
}
......
......@@ -66,7 +66,7 @@
<constraint firstAttribute="height" constant="21" id="HGB-v2-yhW" customClass="ScreenWidthRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstAttribute="width" constant="85" id="eSe-ik-cPa" customClass="ScreenWidthRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="12"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
......
......@@ -9,6 +9,7 @@ import UIKit
import SnapKit
import Lottie
import StoreKit
import Kingfisher
class HomePayView:UIView {
......@@ -99,7 +100,6 @@ class HomePayView:UIView {
lazy var animationView:LottieAnimationView = {
let animationView = LottieAnimationView(name: "iapAnimation")
animationView.loopMode = .loop
return animationView
......@@ -159,10 +159,17 @@ class HomePayView:UIView {
titleLabel2?.sizeToFit()
self.addSubview(animationView)
// self.addSubview(animationView)
let webpImage = UIImageView()
if let webpPath = Bundle.main.path(forResource: "pay_animation", ofType: "gif"),
let webpURL = URL(string: "file://" + webpPath) {
webpImage.kf.setImage(with: webpURL)
}
self.addSubview(webpImage)
playAnimationWithDelay()
animationView.snp.makeConstraints { make in
// playAnimationWithDelay()
webpImage.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(titleLabel2!.snp.bottom).offset(40)
make.width.equalTo(285.RW())
......@@ -245,8 +252,8 @@ class HomePayView:UIView {
contentView2Switch?.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-16)
make.centerY.equalToSuperview()
make.width.equalTo(46)
make.height.equalTo(28)
// make.width.equalTo(46)
// make.height.equalTo(28)
}
contentView2Switch?.addTarget(self, action: #selector(switchValueChanged(_:)), for: .valueChanged)
......@@ -430,12 +437,13 @@ class HomePayView:UIView {
make.left.equalTo(16)
make.right.equalTo(-16)
make.top.equalTo(subTitle.snp.bottom).offset(8.RH())
make.bottom.equalToSuperview().offset(-16)
}
tipsView.snp.makeConstraints { make in
make.top.equalTo(titleLabel2!.snp.bottom).offset(230.RH())
make.left.right.equalToSuperview().inset(12)
make.height.equalTo(110.RH())
make.left.right.equalToSuperview().inset(marginLR)
// make.height.equalTo(110.RH())
}
payDueView.snp.makeConstraints { make in
......
......@@ -29,6 +29,21 @@ class PMShowImgCell: UICollectionViewCell {
}
}
var model:ImageSeletedCollectionItem?{
didSet{
guard let model = model else{
return
}
scaleImg.localIdentifier = model.id?.localIdentifier
// if let id = model.id.localIdentifier{
// scaleImg.showImg
// }
}
}
lazy var bestResultButton:UIButton = {
let button = UIButton(type: .custom)
......
......@@ -24,6 +24,19 @@ class PMShowItemCell: UICollectionViewCell {
}
}
var model:ImageSeletedCollectionItem?{
didSet{
guard let model = model else{
return
}
if let id = model.id?.localIdentifier{
iconV.asset.load(withLocalIdentifier: id)
}
}
}
private lazy var iconV: UIImageView = {
let ic = UIImageView()
ic.contentMode = .scaleAspectFill
......
......@@ -407,7 +407,8 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
if collectionView == MaxCollection {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: PMShowImgCellID, for: indexPath) as! PMShowImgCell
cell.icon = self.homeDataSource![indexPath.row].image ?? UIImage()
// cell.icon = self.homeDataSource![indexPath.row].image ?? UIImage()
cell.model = homeDataSource?[indexPath.row]
cell.isCurrent = selectSet.contains(indexPath.row)
if let data = self.homeDataSource {
cell.bestResultButton.isHidden = indexPath.row != 0 || data.count <= 1 || state == .duplicates
......@@ -429,7 +430,8 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
}else {
if indexPath.row < self.homeDataSource?.count ?? 0 {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: PMShowItemCellID, for: indexPath) as! PMShowItemCell
cell.icon = self.homeDataSource![indexPath.row].image ?? UIImage()
// cell.icon = self.homeDataSource![indexPath.row].image ?? UIImage()
cell.model = homeDataSource?[indexPath.row]
cell.isCurrent = selectSet.contains(indexPath.row) //(self.currentIdx == indexPath.row)
return cell
}
......@@ -475,7 +477,8 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
}else{
if indexPath.row < self.homeDataSource?.count ?? 0 {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: PMShowItemCellID, for: indexPath) as! PMShowItemCell
cell.icon = self.homeDataSource![indexPath.row].image ?? UIImage()
//cell.icon = self.homeDataSource![indexPath.row].image ?? UIImage()
cell.model = homeDataSource?[indexPath.row]
cell.isCurrent = selectSet.contains(indexPath.row)
return cell
}
......
......@@ -162,9 +162,15 @@ class SecretViewController: BaseViewController {
secretDesc.text = "0 Photos, 0 Videos"
secretCollect.register(SecretFirstCell.self, forCellWithReuseIdentifier: SecretFirstCellID)
seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
seletedAllBtn.centerY = navCenterY
// seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
// seletedAllBtn.centerY = navCenterY
titleView.addSubview(seletedAllBtn)
seletedAllBtn.snp.makeConstraints { make in
make.right.equalToSuperview().inset(marginLR)
make.height.equalTo(32)
make.centerY.equalTo(titleView.backBtn.snp.centerY)
}
secretTL.snp.makeConstraints { make in
make.left.equalToSuperview().inset(UIEdgeInsets(top: 72.RW(), left: 15.RW(), bottom: 0, right: 0))
......@@ -281,10 +287,19 @@ class SecretViewController: BaseViewController {
let all = self.selectArray.allObjects.sorted { a, b in
guard let ia = a as? Int,
let ib = b as? Int else { return false }
return ia > ib
return ia < ib
}
if let name = self.dataSource.first {
if let idx = all.first as? Int,
let name = self.dataSource[idx] as? String {
let url = "SecretIm".document().appendingPathComponent(name)
if name.hasSuffix(".png") {
let urls = "".af() + "/SecretIm/" + name
if let icon = UIImage(contentsOfFile: urls) {
PhoneShare([icon], parent: self)
}
}else{
PhoneShare([url], parent: self)
}
}
}else{
// 删除图片的时候不弹广告和内购
......@@ -298,24 +313,31 @@ class SecretViewController: BaseViewController {
return b
}()
private lazy var seletedAllBtn:UIButton = {
let btn:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 115, height: 32))
btn.addTarget(self, action: #selector(seletedAllBtnClick), for: .touchUpInside)
btn.backgroundColor = UIColor.colorWithHex(hexStr: "#F2F6FC")
btn.setImage(UIImage.init(named: "ic_check_similar"), for: .normal)
btn.setTitle("Select All", for: .normal)
btn.setImage(UIImage.init(named: "ic_close_similar"), for: .selected)
btn.setTitle("Unselect all", for: .selected)
btn.setTitleColor(UIColor.colorWithHex(hexStr: mColor), for: .normal)
btn.setTitleColor(UIColor.colorWithHex(hexStr: black3Color), for: .selected)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .bold)
btn.addTarget(self, action: #selector(seletedAllBtnClick), for: .touchUpInside)
btn.layer.cornerRadius = btn.height / 2
btn.layer.masksToBounds = true
btn.changBtnWithStytl(btnStyle: .defalut, margin: 8)
return btn
private lazy var seletedAllBtn:SelectAllButton = {
let view = SelectAllButton()
view.clipsToBounds = true
view.layer.cornerRadius = 16
view.tapCallback = {[weak self] isselect in
self?.seletedAllBtnClick()
}
return view
// let btn:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 115, height: 32))
// btn.addTarget(self, action: #selector(seletedAllBtnClick), for: .touchUpInside)
// btn.backgroundColor = UIColor.colorWithHex(hexStr: "#F2F6FC")
// btn.setImage(UIImage.init(named: "ic_check_similar"), for: .normal)
// btn.setTitle("Select All", for: .normal)
// btn.setImage(UIImage.init(named: "ic_close_similar"), for: .selected)
// btn.setTitle("Unselect all", for: .selected)
// btn.setTitleColor(UIColor.colorWithHex(hexStr: mColor), for: .normal)
// btn.setTitleColor(UIColor.colorWithHex(hexStr: black3Color), for: .selected)
// btn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .bold)
// btn.addTarget(self, action: #selector(seletedAllBtnClick), for: .touchUpInside)
//
// btn.layer.cornerRadius = btn.height / 2
// btn.layer.masksToBounds = true
// btn.changBtnWithStytl(btnStyle: .defalut, margin: 8)
//
// return btn
}()
deinit {
......@@ -369,9 +391,9 @@ extension SecretViewController : UICollectionViewDelegate,UICollectionViewDataSo
@objc private func seletedAllBtnClick() {
DispatchQueue.main.async {[weak self] in
guard let self else {return}
seletedAllBtn.isSelected = !seletedAllBtn.isSelected
self.seletedAllBtn.width = seletedAllBtn.isSelected ? 131 : 115
seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
// seletedAllBtn.isSelected = !seletedAllBtn.isSelected
// self.seletedAllBtn.width = seletedAllBtn.isSelected ? 131 : 115
// seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
let sets = NSMutableSet()
if seletedAllBtn.isSelected {
for i in 0..<dataSource.count {
......
......@@ -110,7 +110,7 @@ class SettingViewHeaderCell : UITableViewCell {
self.preButtonImageView.snp.makeConstraints { make in
make.width.height.equalTo(46)
make.left.equalToSuperview().offset(6)
make.left.equalToSuperview().offset(-56)
make.top.equalToSuperview()
}
......@@ -124,8 +124,23 @@ class SettingViewHeaderCell : UITableViewCell {
make.centerX.equalToSuperview()
make.top.equalTo(self.sLabel.snp.bottom).offset(20)
}
self.layoutIfNeeded()
if IAPManager.share.isSubscribed == false {
}
}
// lazy var basic: CABasicAnimation = {
// let basic = CABasicAnimation(keyPath: "position.x")
// basic.fromValue = -50
// basic.toValue = self.moreButton.width + 10
// basic.repeatCount = .infinity
// preButtonImageView.layer.add(basic, forKey: "position")
// return basic
// }()
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
......
......@@ -52,6 +52,10 @@ class SettingViewController : BaseViewController , UITableViewDelegate, UITableV
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell : SettingViewHeaderCell = tableView.dequeueReusableCell(withIdentifier: "SettingViewHeaderCell",for: indexPath) as! SettingViewHeaderCell
if IAPManager.share.isSubscribed == false {
// cell.basic.duration = 1.5
// cell.preButtonImageView.startAnimating()
}
return cell
}else{
let model : SettingModel = modelData![indexPath.section]
......
......@@ -21,7 +21,7 @@
<rect key="frame" x="15" y="0.0" width="326" height="89"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XwR-Ch-R1t">
<rect key="frame" x="6" y="15" width="44" height="44"/>
<rect key="frame" x="6" y="15.000000000000004" width="44" height="44.333333333333343"/>
<constraints>
<constraint firstAttribute="width" constant="44" id="waN-0f-ZFP"/>
</constraints>
......@@ -34,7 +34,7 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="G" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lkh-fE-u5M">
<rect key="frame" x="50" y="17" width="40" height="40"/>
<rect key="frame" x="50" y="17.333333333333329" width="40" height="40"/>
<color key="backgroundColor" red="0.0" green="0.50980392156862742" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="WQp-b1-7L9"/>
......@@ -50,7 +50,7 @@
</userDefinedRuntimeAttributes>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="tF1-pU-1Ak">
<rect key="frame" x="100" y="15.333333333333332" width="216" height="53.333333333333343"/>
<rect key="frame" x="100" y="15.666666666666668" width="216" height="53.333333333333329"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="aXC-da-48n">
<rect key="frame" x="0.0" y="0.0" width="216" height="19.333333333333332"/>
......@@ -73,14 +73,14 @@
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Social Media" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="49v-3u-EtJ">
<rect key="frame" x="8" y="0.0" width="93" height="19.333333333333332"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="5Cl-XH-rD8">
<rect key="frame" x="101" y="3.3333333333333339" width="115" height="13.000000000000002"/>
<rect key="frame" x="101" y="3.0000000000000018" width="115" height="12.999999999999998"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="11 Nov" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2zo-ld-bPP">
<rect key="frame" x="0.0" y="0.0" width="85" height="13"/>
......@@ -110,15 +110,15 @@
</subviews>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Google Payments:您的付款处于暂停状..." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Mr-iL-2qm">
<rect key="frame" x="0.0" y="21.333333333333329" width="216" height="15.666666666666664"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<rect key="frame" x="0.0" y="21.333333333333336" width="216" height="15.666666666666664"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="13"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Google Payments:您的付款处于暂停状..." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S8d-tj-cjO">
<rect key="frame" x="0.0" y="39" width="216" height="14.333333333333336"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.70196078431372544" green="0.70196078431372544" blue="0.70196078431372544" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
......@@ -166,7 +166,7 @@
</objects>
<resources>
<image name="ic_emial_start" width="13" height="13.333333015441895"/>
<image name="ic_sel_com" width="24" height="24"/>
<image name="ic_sel_com" width="24" height="24.333333969116211"/>
<image name="ic_unsel_com_red" width="24" height="24"/>
<image name="icon_left_setting_grey" width="20" height="20"/>
</resources>
......
......@@ -22,7 +22,7 @@
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="60" id="q5h-W4-mcE"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
<color key="textColor" red="0.20000001789999999" green="0.20000001789999999" blue="0.20000001789999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
......
......@@ -25,8 +25,8 @@
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="72" id="g5j-o3-20E"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="u6a-TR-UVD">
......@@ -56,12 +56,12 @@
</userDefinedRuntimeAttributes>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AcA-F1-B4u">
<rect key="frame" x="0.0" y="99" width="136" height="45"/>
<rect key="frame" x="0.0" y="99" width="151" height="45"/>
<color key="backgroundColor" red="0.94901960784313721" green="0.96470588235294119" blue="0.9882352941176471" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="Xtx-DS-XGd"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
<inset key="contentEdgeInsets" minX="10" minY="10" maxX="20" maxY="10"/>
<inset key="titleEdgeInsets" minX="5" minY="0.0" maxX="-5" maxY="0.0"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
......
......@@ -22,7 +22,7 @@
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="BJb-Xh-MSY"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
<color key="textColor" red="0.20000001789999999" green="0.20000001789999999" blue="0.20000001789999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
......@@ -76,7 +76,7 @@
</tableViewCell>
</objects>
<resources>
<image name="ic_sel_com" width="24" height="24"/>
<image name="ic_sel_com" width="24" height="24.333333969116211"/>
<image name="ic_unsel_com_red" width="24" height="24"/>
</resources>
</document>
......@@ -35,16 +35,15 @@ class EmailCleanListController: BaseViewController {
@objc func seletedAllBtnClick() {
DispatchQueue.main.async {[weak self] in
guard let self else {return}
seletedAllBtn.isUserInteractionEnabled = false
seletedAllBtn.isSelected = !seletedAllBtn.isSelected
UIView.animate(withDuration: 0.2) {
self.seletedAllBtn.width = self.seletedAllBtn.isSelected ? 131 : 115
self.seletedAllBtn.x = self.titleView.width - marginLR - self.seletedAllBtn.width
} completion: { su in
if su {
self.seletedAllBtn.isUserInteractionEnabled = true
}
}
// seletedAllBtn.isSelected = !seletedAllBtn.isSelected
// UIView.animate(withDuration: 0.2) {
// self.seletedAllBtn.width = self.seletedAllBtn.isSelected ? 131 : 115
// self.seletedAllBtn.x = self.titleView.width - marginLR - self.seletedAllBtn.width
// } completion: { su in
// if su {
// self.seletedAllBtn.isUserInteractionEnabled = true
// }
// }
tableView.changeSelectAll(seletedAllBtn.isSelected)
}
}
......@@ -60,15 +59,20 @@ class EmailCleanListController: BaseViewController {
make.bottom.equalToSuperview()
}
titleView.addSubview(seletedAllBtn)
seletedAllBtn.centerY = navCenterY
seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
seletedAllBtn.snp.makeConstraints { make in
make.right.equalToSuperview().inset(marginLR)
make.height.equalTo(32)
make.centerY.equalTo(titleView.backBtn.snp.centerY)
}
// seletedAllBtn.centerY = navCenterY
// seletedAllBtn.x = titleView.width - marginLR - seletedAllBtn.width
}
lazy var titleLabel: UILabel = {
let label = UILabel()
label.text = ""
label.font = UIFont.systemFont(ofSize: 20, weight: .bold)
label.textColor = .black
label.textColor = UIColor.colorWithHex(hexStr: "#333333")
label.textAlignment = .left
view.addSubview(label)
return label
......@@ -92,20 +96,27 @@ class EmailCleanListController: BaseViewController {
return tab
}()
private lazy var seletedAllBtn:UIButton = {
let btn:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 115, height: 32))
btn.addTarget(self, action: #selector(seletedAllBtnClick), for: .touchUpInside)
btn.backgroundColor = UIColor.colorWithHex(hexStr: "#F2F6FC")
btn.setImage(UIImage.init(named: "ic_check_similar"), for: .normal)
btn.setTitle("Select All", for: .normal)
btn.setImage(UIImage.init(named: "ic_close_similar"), for: .selected)
btn.setTitle("Unselect all", for: .selected)
btn.setTitleColor(UIColor.colorWithHex(hexStr: mColor), for: .normal)
btn.setTitleColor(UIColor.colorWithHex(hexStr: black3Color), for: .selected)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .bold)
btn.layer.cornerRadius = btn.height / 2
btn.layer.masksToBounds = true
btn.changBtnWithStytl(btnStyle: .defalut, margin: 8)
return btn
private lazy var seletedAllBtn:SelectAllButton = {
let view = SelectAllButton()
view.clipsToBounds = true
view.layer.cornerRadius = 16
view.tapCallback = {[weak self] isselect in
self?.seletedAllBtnClick()
}
return view
// let btn:UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 115, height: 32))
// btn.addTarget(self, action: #selector(seletedAllBtnClick), for: .touchUpInside)
// btn.backgroundColor = UIColor.colorWithHex(hexStr: "#F2F6FC")
// btn.setImage(UIImage.init(named: "ic_check_similar"), for: .normal)
// btn.setTitle("Select All", for: .normal)
// btn.setImage(UIImage.init(named: "ic_close_similar"), for: .selected)
// btn.setTitle("Unselect all", for: .selected)
// btn.setTitleColor(UIColor.colorWithHex(hexStr: mColor), for: .normal)
// btn.setTitleColor(UIColor.colorWithHex(hexStr: black3Color), for: .selected)
// btn.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .bold)
// btn.layer.cornerRadius = btn.height / 2
// btn.layer.masksToBounds = true
// btn.changBtnWithStytl(btnStyle: .defalut, margin: 8)
// return btn
}()
}
......@@ -5,3 +5,4 @@
#import "NSString+Ex.h"
#import <UIKit/UIKit.h>
#import "UIView+AZGradient.h"
//
// UIView+AZGradient.h
// AZCategory
//
// Created by Alfred Zhang on 2017/6/29.
// Copyright © 2017年 Alfred Zhang. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (AZGradient)
/* The array of CGColorRef objects defining the color of each gradient
* stop. Defaults to nil. Animatable. */
@property(nullable, copy) NSArray *az_colors;
/* An optional array of NSNumber objects defining the location of each
* gradient stop as a value in the range [0,1]. The values must be
* monotonically increasing. If a nil array is given, the stops are
* assumed to spread uniformly across the [0,1] range. When rendered,
* the colors are mapped to the output colorspace before being
* interpolated. Defaults to nil. Animatable. */
@property(nullable, copy) NSArray<NSNumber *> *az_locations;
/* The start and end points of the gradient when drawn into the layer's
* coordinate space. The start point corresponds to the first gradient
* stop, the end point to the last gradient stop. Both points are
* defined in a unit coordinate space that is then mapped to the
* layer's bounds rectangle when drawn. (I.e. [0,0] is the bottom-left
* corner of the layer, [1,1] is the top-right corner.) The default values
* are [.5,0] and [.5,1] respectively. Both are animatable. */
@property CGPoint az_startPoint;
@property CGPoint az_endPoint;
+ (UIView *_Nullable)az_gradientViewWithColors:(NSArray<UIColor *> *_Nullable)colors locations:(NSArray<NSNumber *> *_Nullable)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;
- (void)az_setGradientBackgroundWithColors:(NSArray<UIColor *> *_Nullable)colors locations:(NSArray<NSNumber *> *_Nullable)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;
@end
//
// UIView+AZGradient.m
// AZCategory
//
// Created by Alfred Zhang on 2017/6/29.
// Copyright © 2017年 Alfred Zhang. All rights reserved.
//
#import "UIView+AZGradient.h"
#import <objc/runtime.h>
@implementation UIView (AZGradient)
+ (Class)layerClass {
return [CAGradientLayer class];
}
+ (UIView *)az_gradientViewWithColors:(NSArray<UIColor *> *)colors locations:(NSArray<NSNumber *> *)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint {
UIView *view = [[self alloc] init];
[view az_setGradientBackgroundWithColors:colors locations:locations startPoint:startPoint endPoint:endPoint];
return view;
}
- (void)az_setGradientBackgroundWithColors:(NSArray<UIColor *> *)colors locations:(NSArray<NSNumber *> *)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint {
NSMutableArray *colorsM = [NSMutableArray array];
for (UIColor *color in colors) {
[colorsM addObject:(__bridge id)color.CGColor];
}
self.az_colors = [colorsM copy];
self.az_locations = locations;
self.az_startPoint = startPoint;
self.az_endPoint = endPoint;
}
#pragma mark- Getter&Setter
- (NSArray *)az_colors {
return objc_getAssociatedObject(self, _cmd);
}
- (void)setAz_colors:(NSArray *)colors {
objc_setAssociatedObject(self, @selector(az_colors), colors, OBJC_ASSOCIATION_COPY_NONATOMIC);
if ([self.layer isKindOfClass:[CAGradientLayer class]]) {
[((CAGradientLayer *)self.layer) setColors:self.az_colors];
}
}
- (NSArray<NSNumber *> *)az_locations {
return objc_getAssociatedObject(self, _cmd);
}
- (void)setAz_locations:(NSArray<NSNumber *> *)locations {
objc_setAssociatedObject(self, @selector(az_locations), locations, OBJC_ASSOCIATION_COPY_NONATOMIC);
if ([self.layer isKindOfClass:[CAGradientLayer class]]) {
[((CAGradientLayer *)self.layer) setLocations:self.az_locations];
}
}
- (CGPoint)az_startPoint {
return [objc_getAssociatedObject(self, _cmd) CGPointValue];
}
- (void)setAz_startPoint:(CGPoint)startPoint {
objc_setAssociatedObject(self, @selector(az_startPoint), [NSValue valueWithCGPoint:startPoint], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
if ([self.layer isKindOfClass:[CAGradientLayer class]]) {
[((CAGradientLayer *)self.layer) setStartPoint:self.az_startPoint];
}
}
- (CGPoint)az_endPoint {
return [objc_getAssociatedObject(self, _cmd) CGPointValue];
}
- (void)setAz_endPoint:(CGPoint)endPoint {
objc_setAssociatedObject(self, @selector(az_endPoint), [NSValue valueWithCGPoint:endPoint], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
if ([self.layer isKindOfClass:[CAGradientLayer class]]) {
[((CAGradientLayer *)self.layer) setEndPoint:self.az_endPoint];
}
}
@end
@implementation UILabel (AZGradient)
+ (Class)layerClass {
return [CAGradientLayer class];
}
@end
......@@ -19,6 +19,20 @@ class PMScaleImageView: UIView , UIScrollViewDelegate {
setup()
}
var localIdentifier:String?{
didSet {
guard let localIdentifier = localIdentifier else{
return
}
showImg.asset.load(withLocalIdentifier: localIdentifier) {[weak self] image in
guard let weakSelf = self else { return }
weakSelf.icon = image
}
}
}
var icon:UIImage? {
didSet {
showImg.image = icon
......@@ -54,7 +68,7 @@ class PMScaleImageView: UIView , UIScrollViewDelegate {
}
}
private lazy var showImg: UIImageView = {
lazy var showImg: UIImageView = {
let iv = UIImageView()
iv.contentMode = .scaleAspectFill
scroll.addSubview(iv)
......
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