Commit 49b751ca authored by shenyong's avatar shenyong

优化ui,内购处理

parent 46bd273a
......@@ -270,7 +270,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
private func setupDefault() {
HomePayModel.share.loadLocalData()
// HomePayModel.share.loadLocalData()
HomePayModel.share.checkSubscriptionState { isSubscribed, expiresDate in
}
NetStatusManager.manager.startNet { status in
switch status {
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "queshengtu@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -128,7 +128,7 @@ class HomeInfoViewController:BaseViewController {
func updateFreeTimes(){
// 删除成功后更新次数
var times = UserDefaults.standard.object(forKey: "saveAdvTimes") as! Int
if var times = UserDefaults.standard.object(forKey: "saveAdvTimes") as? Int{
if times > 0 {
// 如果免费次数大于0
times = times - 1
......@@ -136,6 +136,8 @@ class HomeInfoViewController:BaseViewController {
}
}
}
setDefaultPage()
}
}
......
......@@ -292,8 +292,6 @@ class HomeViewController:BaseViewController {
}
}
}
}
// 重复图片
......
......@@ -7,6 +7,7 @@
import UIKit
import StoreKit
import SVProgressHUD
class HomePayModel: NSObject ,SKProductsRequestDelegate ,SKPaymentTransactionObserver {
......@@ -23,8 +24,10 @@ class HomePayModel: NSObject ,SKProductsRequestDelegate ,SKPaymentTransactionObs
var state:PayState = .Subscribe
private let productIdentifiers:[String] = ["com.app.phonemanager.year.member" , "com.app.phonemanager.lifetime.member"]
private let productIdentifiers:[String] = ["com.app.phonemanager.week.member" , "com.app.phonemanager.lifetime.member"]
var isSubscribed:Bool = false
var isNoAd:Bool {
get {
guard let noabd = UserDefaults.standard.object(forKey: "noabd") as? Bool else { return false }
......@@ -61,7 +64,7 @@ class HomePayModel: NSObject ,SKProductsRequestDelegate ,SKPaymentTransactionObs
private func checkTrialStatus() -> Void {
if state == .Subscribe { // 订阅型
verifyReceiptWithApple { receipt in
self.alert.dismiss()
self.alert.disMiss()
guard let json = receipt else {
self.refreshReceipt()
return
......@@ -78,10 +81,12 @@ class HomePayModel: NSObject ,SKProductsRequestDelegate ,SKPaymentTransactionObs
}else{
self.isNoAd = false
}
DismissPresen()
}
}else{
self.alert.dismiss()
self.alert.disMiss()
self.isNoAd = true
DismissPresen()
}
}
......@@ -168,31 +173,55 @@ class HomePayModel: NSObject ,SKProductsRequestDelegate ,SKPaymentTransactionObs
/** 获取商品列表 */
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
let products = response.products
var ps:[SKProduct?] = [nil,nil]
var ps:[SKProduct] = []
if products.count >= 2 {
if products.first?.productIdentifier == productIdentifiers.first {
ps[0] = products.first
ps[1] = products.last
if let first = products.first,let last = products.last{
if first.productIdentifier == productIdentifiers.first{
ps = [first,last]
}else{
ps[1] = products.first
ps[0] = products.last
ps = [last,first]
}
}else{
ps = products
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2, execute: {
Print("获取商品信息成功")
if self.getCachedProduct(forIdentifier: self.productIdentifiers)?.count == 0 {
Print("获取商品信息成功--缓存没有数据由请求提供")
self.product = ps
DispatchQueue.main.async{
self.storeCall(ps)
}
Print("开始缓存商品信息")
self.cacheProducts(products)
Print("缓存商品信息成功")
self.cacheProducts(ps)
BackgroundTaskManager.share.endTask()
}
}else{
self.product = products
}
})
// if products.count >= 2 {
// if products.first?.productIdentifier == productIdentifiers.first {
//
// ps = [products.first,products.last]
// }else{
// ps = [products.last,products.first]
// }
// }else{
// ps = products
// }
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.2, execute: {
// Print("获取商品信息成功")
// if self.getCachedProduct(forIdentifier: self.productIdentifiers)?.count == 0 {
// Print("获取商品信息成功--缓存没有数据由请求提供")
// self.product = ps
// self.storeCall(ps)
// }
// Print("开始缓存商品信息")
// self.cacheProducts(products)
// Print("缓存商品信息成功")
// BackgroundTaskManager.share.endTask()
//
// })
}
func request(_ request: SKRequest, didFailWithError error: Error) {
......@@ -208,14 +237,14 @@ class HomePayModel: NSObject ,SKProductsRequestDelegate ,SKPaymentTransactionObs
self.state = states
let payment = SKPayment(product: states == .Subscribe ? p1! : p2!)
SKPaymentQueue.default().add(payment)
alert.show()
alert.show("Loading... Please wait.","")
}
/** 恢复 */
func restore(_ states:PayState = .Subscribe) -> Void {
self.state = states
SKPaymentQueue.default().restoreCompletedTransactions()
alert.show()
alert.show("Loading... Please wait.","")
}
override init() {
......@@ -223,7 +252,7 @@ class HomePayModel: NSObject ,SKProductsRequestDelegate ,SKPaymentTransactionObs
SKPaymentQueue.default().add(self)
}
let alert = PMAlertView()
let alert = PMLoadingHUD.share
}
......@@ -242,7 +271,7 @@ extension HomePayModel {
break
case .failed:
Print("购买失败")
alert.dismiss()
alert.disMiss()
SKPaymentQueue.default().finishTransaction(transaction)
break
case .restored:
......@@ -379,7 +408,7 @@ extension HomePayModel {
/** 恢复失败 */
func paymentQueue(_ queue: SKPaymentQueue, restoreCompletedTransactionsFailedWithError error: any Error) {
alert.dismiss()
alert.disMiss()
}
/** 刷新收据 */
......@@ -390,6 +419,38 @@ extension HomePayModel {
}
}
extension HomePayModel {
/// 检查订阅状态
/// - Parameter completion: 回调闭包,返回订阅状态和到期时间
func checkSubscriptionState(completion: @escaping (_ isSubscribed: Bool, _ expiresDate: Date?) -> Void) {
verifyReceiptWithApple { receipt in
guard let json = receipt else {
self.refreshReceipt()
completion(false, nil)
return
}
let status = self.checkSubscriptionStatus(receiptInfo: json)
DispatchQueue.main.async {
completion(status.isActive, status.expiresDate)
// 更新本地订阅状态
self.isNoAd = status.isActive
self.isSubscribed = status.isActive
#if DEBUG
if let expDate = status.expiresDate {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
Print("订阅状态:\(status.isActive ? "已订阅" : "未订阅"),到期时间:\(formatter.string(from: expDate))")
}
#endif
}
}
}
}
extension Notification.Name {
static let HelperPurchaseNotification = Notification.Name("PhoneManagerisStore")
}
......@@ -132,7 +132,7 @@ class HomePayView:UIView {
closeBtn?.snp.makeConstraints { make in
make.top.equalToSuperview().offset(statusBarHeight + 10)
make.left.equalToSuperview().offset(15)
make.right.equalToSuperview().offset(-15)
make.width.height.equalTo(28)
}
......
......@@ -18,9 +18,10 @@ class PMLoadingHUD{
return loadingView
}()
func show(){
func show(_ title:String = "Deleting...",_ subTitle:String = "Please wait on the screen. This might take several minutes."){
DispatchQueue.main.async {
KEYWINDOW()?.addSubview(self.loadingView)
self.loadingView.setTitleaAndSubTitle(title: title, subTitle: subTitle)
self.loadingView.animationView.play()
}
}
......@@ -31,10 +32,19 @@ class PMLoadingHUD{
self.loadingView.removeFromSuperview()
}
}
func setTimerDismiss(){
}
}
class PMLoadingView: UIView {
var title:UILabel!
var subtitle:UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
......@@ -48,13 +58,13 @@ class PMLoadingView: UIView {
make.height.equalTo(200)
}
let title = UILabel()
title = UILabel()
title.text = "Deleting..."
title.textColor = .white
title.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
addSubview(title)
let subtitle = UILabel()
subtitle = UILabel()
subtitle.text = "Please wait on the screen. This might take several minutes."
subtitle.textColor = .white
subtitle.numberOfLines = 0
......@@ -89,4 +99,10 @@ class PMLoadingView: UIView {
}()
func setTitleaAndSubTitle(title:String,subTitle:String){
self.title.text = title
self.subtitle.text = subTitle
}
}
//
// PMPermissionView.swift
// PhoneManager
//
// Created by edy on 2025/4/29.
//
import UIKit
class PMPermissionView: UIView {
override func awakeFromNib() {
super.awakeFromNib()
}
@IBAction func goSetting(_ sender: Any) {
// 跳转到系统设置的相册权限设置页面
if let settingsUrl = URL(string: UIApplication.openSettingsURLString) {
if UIApplication.shared.canOpenURL(settingsUrl) {
UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
print("跳转设置页面: \(success)")
})
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="EwM-B0-fXo" customClass="PMPermissionView" customModule="PhoneManager" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="529" height="489"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_queshengtu" translatesAutoresizingMaskIntoConstraints="NO" id="qhV-IF-vsx">
<rect key="frame" x="170" y="100" width="189" height="189"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Access permission is required to start scan" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ci8-h6-fiE">
<rect key="frame" x="22" y="297" width="485" height="20"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="e8v-Xy-wvP">
<rect key="frame" x="24" y="320" width="480" height="38.333333333333314"/>
<string key="text">Phone Manager We need access to all the photos
in your photo library</string>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fRi-wi-J8I">
<rect key="frame" x="170" y="371.33333333333331" width="189" height="46"/>
<color key="backgroundColor" red="0.0" green="0.50980392159999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="46" id="2ml-bk-VZ7"/>
<constraint firstAttribute="width" constant="189" id="5L8-3e-E4p"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Go to Settings"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="Radius">
<real key="value" value="23"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="goSetting:" destination="EwM-B0-fXo" eventType="touchUpInside" id="1Q0-Re-BL9"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="Z86-W8-437"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="fRi-wi-J8I" firstAttribute="centerX" secondItem="qhV-IF-vsx" secondAttribute="centerX" id="06a-VZ-yHW"/>
<constraint firstItem="ci8-h6-fiE" firstAttribute="leading" secondItem="Z86-W8-437" secondAttribute="leading" constant="22" id="2pS-Hl-sgb"/>
<constraint firstItem="ci8-h6-fiE" firstAttribute="centerX" secondItem="qhV-IF-vsx" secondAttribute="centerX" id="Fv3-iO-5BI"/>
<constraint firstItem="e8v-Xy-wvP" firstAttribute="leading" secondItem="Z86-W8-437" secondAttribute="leading" constant="24" id="Ygj-Ix-aYR"/>
<constraint firstItem="qhV-IF-vsx" firstAttribute="top" secondItem="EwM-B0-fXo" secondAttribute="top" constant="100" id="fx5-wC-f0q"/>
<constraint firstItem="fRi-wi-J8I" firstAttribute="top" secondItem="e8v-Xy-wvP" secondAttribute="bottom" constant="13" id="jys-rP-uUI"/>
<constraint firstItem="Z86-W8-437" firstAttribute="trailing" secondItem="e8v-Xy-wvP" secondAttribute="trailing" constant="25" id="p6c-uL-oEh"/>
<constraint firstItem="e8v-Xy-wvP" firstAttribute="top" secondItem="ci8-h6-fiE" secondAttribute="bottom" constant="3" id="tgi-kq-3Ap"/>
<constraint firstItem="ci8-h6-fiE" firstAttribute="top" secondItem="qhV-IF-vsx" secondAttribute="bottom" constant="8" id="uKW-kw-KCJ"/>
<constraint firstItem="Z86-W8-437" firstAttribute="trailing" secondItem="ci8-h6-fiE" secondAttribute="trailing" constant="22" id="wMs-cZ-eGL"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="284.73282442748092" y="-315.14084507042253"/>
</view>
</objects>
<resources>
<image name="icon_queshengtu" width="189" height="189"/>
</resources>
</document>
......@@ -18,12 +18,13 @@ class TipsDuplicatesSimilarController: UIViewController {
@IBOutlet weak var mainTitle: UILabel!
@IBOutlet weak var subTitle: UILabel!
@IBOutlet weak var bottomC: ScreenHeightRatioConstraint!
var type:GuideTipsType = .duplicates
override func viewDidLoad() {
super.viewDidLoad()
startBtn.layer.cornerRadius = 23.RH()
startBtn.layer.cornerRadius = 23
lineText.text = type.lineText
iconOne.image = UIImage.init(named: type.tipOneIcon)
......@@ -31,6 +32,8 @@ class TipsDuplicatesSimilarController: UIViewController {
mainTitle.text = type.title
subTitle.text = type.text
bottomC.constant = kSafeAreaInsets.bottom == 0 ? 30 : 0
}
......
......@@ -11,6 +11,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TipsDuplicatesSimilarController" customModule="PhoneManager" customModuleProvider="target">
<connections>
<outlet property="bottomC" destination="dX6-cv-Gto" id="3Ws-Iq-33S"/>
<outlet property="iconOne" destination="5sP-3G-R5V" id="ypq-LB-87o"/>
<outlet property="iconTwo" destination="LIQ-mA-CKi" id="Uzy-Sr-7tG"/>
<outlet property="lineText" destination="XMa-dY-JFG" id="WBd-Yf-wR9"/>
......@@ -57,10 +58,10 @@
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XPg-Ph-1k0">
<rect key="frame" x="15" y="846" width="410" height="46"/>
<rect key="frame" x="15" y="876" width="410" height="46"/>
<color key="backgroundColor" red="0.0" green="0.50980392156862742" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="46" id="DDB-jE-Azu" customClass="ScreenHeightRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstAttribute="height" constant="46" id="DDB-jE-Azu"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
......@@ -81,7 +82,7 @@
<constraint firstAttribute="trailing" secondItem="OOD-68-wMD" secondAttribute="trailing" constant="25" id="Vcx-gz-lAI"/>
<constraint firstItem="XMa-dY-JFG" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="40" id="a0g-kE-ugQ"/>
<constraint firstItem="LIQ-mA-CKi" firstAttribute="leading" secondItem="5sP-3G-R5V" secondAttribute="leading" id="cqt-w5-eff"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="XPg-Ph-1k0" secondAttribute="bottom" constant="30" id="dX6-cv-Gto" customClass="ScreenHeightRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="XPg-Ph-1k0" secondAttribute="bottom" id="dX6-cv-Gto" customClass="ScreenHeightRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstItem="dRr-c6-YoB" firstAttribute="top" secondItem="5sP-3G-R5V" secondAttribute="bottom" constant="20" id="eD3-DG-qkC" customClass="ScreenHeightRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="5sP-3G-R5V" secondAttribute="trailing" constant="53" id="h2C-hf-maH"/>
<constraint firstItem="OOD-68-wMD" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="25" id="jJ3-Yj-u0w"/>
......
......@@ -9,11 +9,12 @@ import UIKit
class TipsScreenShotController: UIViewController {
@IBOutlet weak var bottomC: NSLayoutConstraint!
@IBOutlet weak var startBtn: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
startBtn.layer.cornerRadius = 23.RH()
bottomC.constant = kSafeAreaInsets.bottom == 0 ? 30 : 0
startBtn.layer.cornerRadius = 23
}
......
......@@ -11,6 +11,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TipsScreenShotController" customModule="PhoneManager" customModuleProvider="target">
<connections>
<outlet property="bottomC" destination="NWj-ld-9UY" id="vpf-nx-pUQ"/>
<outlet property="startBtn" destination="ybT-3z-Wb2" id="Gl8-Ue-VUX"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
......@@ -28,10 +29,10 @@
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ybT-3z-Wb2">
<rect key="frame" x="15" y="822" width="400" height="46"/>
<rect key="frame" x="15" y="852" width="400" height="46"/>
<color key="backgroundColor" red="0.0" green="0.50980392159999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="46" id="4Qc-vw-6p8" customClass="ScreenHeightRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstAttribute="height" constant="46" id="4Qc-vw-6p8"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
......@@ -61,7 +62,7 @@
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="VkR-UI-FBK" secondAttribute="trailing" constant="25" id="4JU-rc-hns"/>
<constraint firstItem="ybT-3z-Wb2" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="15" id="IIW-NA-SQU"/>
<constraint firstItem="QGK-yy-jOF" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="Kee-LL-a9m"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="ybT-3z-Wb2" secondAttribute="bottom" constant="30" id="NWj-ld-9UY"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="ybT-3z-Wb2" secondAttribute="bottom" id="NWj-ld-9UY"/>
<constraint firstItem="VkR-UI-FBK" firstAttribute="top" secondItem="h8I-lL-ELV" secondAttribute="bottom" constant="18" id="aYz-ey-Yc7"/>
<constraint firstItem="QGK-yy-jOF" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="46" id="cHD-Cc-XiT"/>
<constraint firstItem="h8I-lL-ELV" firstAttribute="top" secondItem="QGK-yy-jOF" secondAttribute="bottom" constant="55" id="dDM-Pu-5g1"/>
......
......@@ -14,18 +14,20 @@ class TipsVideoPhotoController: UIViewController {
@IBOutlet weak var icon: UIImageView!
@IBOutlet weak var subtitle: UILabel!
@IBOutlet weak var bottomC: NSLayoutConstraint!
var type:GuideTipsType = .duplicates
override func viewDidLoad() {
super.viewDidLoad()
startBtn.layer.cornerRadius = 23.RH()
startBtn.layer.cornerRadius = 23
icon.image = UIImage.init(named: type.tipOneIcon)
mainTitle.text = type.title
subtitle.text = type.text
bottomC.constant = kSafeAreaInsets.bottom == 0 ? 30 : 0
}
......
......@@ -11,6 +11,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TipsVideoPhotoController" customModule="PhoneManager" customModuleProvider="target">
<connections>
<outlet property="bottomC" destination="SCz-tZ-pgH" id="Y5K-9r-aX4"/>
<outlet property="icon" destination="OpM-5k-AoO" id="Y63-tI-7xy"/>
<outlet property="mainTitle" destination="dcU-ld-SUp" id="ngg-L4-U4l"/>
<outlet property="startBtn" destination="KHL-A7-P8d" id="qKH-gd-iBZ"/>
......@@ -39,10 +40,10 @@
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KHL-A7-P8d">
<rect key="frame" x="15" y="742" width="363" height="46"/>
<rect key="frame" x="15" y="772" width="363" height="46"/>
<color key="backgroundColor" red="0.0" green="0.50980392159999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="46" id="bCa-jh-IT1" customClass="ScreenHeightRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstAttribute="height" constant="46" id="bCa-jh-IT1"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
......@@ -60,7 +61,7 @@
<constraint firstAttribute="trailing" secondItem="KHL-A7-P8d" secondAttribute="trailing" constant="15" id="MaN-MT-FnY"/>
<constraint firstItem="dcU-ld-SUp" firstAttribute="top" secondItem="OpM-5k-AoO" secondAttribute="bottom" constant="80" id="Okf-QC-Jrn" customClass="ScreenHeightRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstItem="KHL-A7-P8d" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="15" id="Rl4-Mh-CiF"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="KHL-A7-P8d" secondAttribute="bottom" constant="30" id="SCz-tZ-pgH"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="KHL-A7-P8d" secondAttribute="bottom" id="SCz-tZ-pgH"/>
<constraint firstItem="dcU-ld-SUp" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="USR-RC-nO5"/>
<constraint firstItem="LeZ-aM-wDE" firstAttribute="top" secondItem="dcU-ld-SUp" secondAttribute="bottom" constant="18" id="Zga-Sv-DYE" customClass="ScreenHeightRatioConstraint" customModule="PhoneManager" customModuleProvider="target"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="LeZ-aM-wDE" secondAttribute="trailing" constant="25" id="lAh-or-e83"/>
......
......@@ -1046,7 +1046,6 @@ class PhotoAndVideoMananger {
print("开始处理相似图片")
DispatchQueue.global().async {
print("进入异步任务处理相似图片")
var assetModels: [AssetModel] = []
var hashes: [String: AssetModel] = [:]
var groupedImages: [[AssetModel]] = []
......@@ -1070,11 +1069,9 @@ class PhotoAndVideoMananger {
dispatchGroup.leave()
}
}
// 等待所有请求完成后进行比较
dispatchGroup.notify(queue: .global()) {
print("获取到全部hash值")
var usedHashes: Set<String> = []
for (hash1, model1) in hashes {
if usedHashes.contains(hash1) { continue }
......
......@@ -382,7 +382,6 @@ class PhotoSimilarityFinder {
filteredGroups.append(currentGroup)
groupsLock.unlock()
}
group.leave()
}
}
......
......@@ -6,7 +6,7 @@
//
import Foundation
import UIKit
struct APPConfig{
static let APPID = "1530333201"
......@@ -16,3 +16,12 @@ func KEYWINDOW() ->UIWindow?{
return UIApplication.shared.windows.first{$0.isKeyWindow}
}
func DismissPresen(){
DispatchQueue.main.async{
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let topController = windowScene.windows.first?.rootViewController?.presentedViewController {
topController.dismiss(animated: true, completion: nil)
}
}
}
......@@ -224,5 +224,9 @@
<string>3qcr597p9d.skadnetwork</string>
</dict>
</array>
<key>UIBackgroundModes</key>
<array>
<string>processing</string>
</array>
</dict>
</plist>
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