Commit 56ff6516 authored by yqz's avatar yqz

Merge branch 'dev_main' of http://gitlab.zhangxindiet.com/ShuMing/phonemanager into dev_main

* 'dev_main' of http://gitlab.zhangxindiet.com/ShuMing/phonemanager:
  1
  fix bugs
parents 9c116077 eb771ea4
......@@ -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)
}
}
......@@ -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"
}
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "phone_manager@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "phone_manager@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -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,
......
......@@ -364,7 +364,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{
......
......@@ -7,6 +7,7 @@
import UIKit
import AppTrackingTransparency
import SVProgressHUD
class HomeViewController:BaseViewController {
......@@ -225,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()
}
}
}
}
......
......@@ -393,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()
......
......@@ -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()
}
......
......@@ -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)
}
}
......
......@@ -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
// }()
}
......@@ -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())
......
......@@ -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
}
......
......@@ -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