Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PhoneManager
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yang
PhoneManager
Commits
17db8452
Commit
17db8452
authored
Apr 16, 2025
by
CZ1004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
96dd0303
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
424 additions
and
228 deletions
+424
-228
AppDelegate.swift
PhoneManager/AppDelegate.swift
+45
-102
ChargeViewController.swift
...lass/Session/Charge/Controller/ChargeViewController.swift
+2
-2
CompressCompletedViewController.swift
...Compress/Controller/CompressCompletedViewController.swift
+1
-1
CompressNavView.swift
...Manager/Class/Session/Compress/View/CompressNavView.swift
+7
-2
HomeViewController.swift
...er/Class/Session/Home/Controller/HomeViewController.swift
+4
-0
HomeNavView.swift
PhoneManager/Class/Session/Home/View/HomeNavView.swift
+6
-2
HomePhotosModel .swift
...ager/Class/Session/Home/View/Model/HomePhotosModel .swift
+35
-103
PayCompletedViewController.swift
...ssion/Pay/ViewController/PayCompletedViewController.swift
+102
-0
SettingViewHeaderCell.swift
...r/Class/Session/Settings/View/SettingViewHeaderCell.swift
+24
-5
SettingViewController.swift
...ssion/Settings/ViewController/SettingViewController.swift
+5
-1
PhotoAndVideoMananger.swift
...l/Class/PhotoAndVideoMananger/PhotoAndVideoMananger.swift
+193
-10
No files found.
PhoneManager/AppDelegate.swift
View file @
17db8452
...
@@ -65,16 +65,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -65,16 +65,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
}
func
getHomeCacheData
(){
// 首页有7个数据源
PhotoAndVideoMananger
.
mananger
.
setAssets
()
}
var
dataArrayDu
:
[[
AssetModel
]]
=
[]
var
dataArrayDu
:
[[
AssetModel
]]
=
[]
...
@@ -175,6 +165,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -175,6 +165,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
Print
(
"更新截图数据结束"
)
Print
(
"更新截图数据结束"
)
})
})
}
}
Print
(
"更新相似截图数据"
)
PhotoAndVideoMananger
.
mananger
.
groupSimilarImages
(
assets
:
PhotoAndVideoMananger
.
mananger
.
screenShotAssets
)
{
similarGroups
in
model
.
otherModelArray
[
1
]
.
assets
=
similarGroups
model
.
otherModelArray
[
1
]
.
allFileSize
=
0
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
model
)
let
dataUpdated
=
Notification
.
Name
(
"HomeSimilarScreenshotResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
}
completion
:
{
similarGroups
in
Print
(
"更新相似截图数据结束"
)
}
}
}
...
@@ -200,109 +203,49 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -200,109 +203,49 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
}
}
}
// 更新重复图片和截图
// 查看更新到了哪一个时间点了【这里以时间为基准】
var
allImageUpdateLocation
=
UserDefaults
.
standard
.
object
(
forKey
:
"allImageUpdateLocationDate"
)
if
allImageUpdateLocation
==
nil
{
allImageUpdateLocation
=
[]
}
// 找到位置
if
screeshotCount
!=
PhotoAndVideoMananger
.
mananger
.
screenShotAssets
.
count
||
imageCount
!=
PhotoAndVideoMananger
.
mananger
.
otherAssets
.
count
{
var
newArray
:
[
PHAsset
]
=
[]
Print
(
"更新重复图片数据"
)
for
item
in
PhotoAndVideoMananger
.
mananger
.
allAssets
{
PhotoAndVideoMananger
.
mananger
.
groupDuplicateImages
(
assets
:
PhotoAndVideoMananger
.
mananger
.
allAssets
)
{
similarGroups
in
if
!
(
allImageUpdateLocation
as!
[
String
])
.
contains
(
item
.
localIdentifier
)
{
newArray
.
append
(
item
)
}
}
if
newArray
.
count
>
0
{
// 继续比较
PhotoAndVideoMananger
.
mananger
.
dealSimilarPhotos
(
assets
:
newArray
,
type
:
0
,
threshold
:
0.99
)
{
data1
,
data2
in
var
dataArray1
:
[
AssetModel
]
=
[]
var
dataArray
:
[
AssetModel
]
=
[]
for
item
in
data1
{
for
item
in
similarGroups
{
dataArray1
=
dataArray1
+
item
dataArray
=
dataArray
+
item
}
var
dataArray2
:
[
AssetModel
]
=
[]
for
item
in
data2
{
dataArray2
=
dataArray2
+
item
}
}
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray
)
!
,
progress
:
{
fileSiez
,
index
in
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray1
)
!
,
progress
:
{
fileSiez
,
index
in
// 不做处理
},
completion
:
{[
dataArray1
=
dataArray1
]
fileSize
,
index
in
if
dataArray1
.
count
>
0
{
self
.
dataArrayDu
.
append
(
dataArray1
)
model
.
titleModelArray
[
0
]
.
assets
=
self
.
dataArrayDu
self
.
dataArrayDu
.
remove
(
at
:
self
.
dataArrayDu
.
count
-
1
)
model
.
titleModelArray
[
0
]
.
allFileSize
=
self
.
dataDuFileSize
+
Double
(
fileSize
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
model
)
let
dataUpdated
=
Notification
.
Name
(
"HomeDupImageResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
}
})
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray2
)
!
,
progress
:
{
fileSize
,
index
in
// 不做处理
// 不做处理
},
completion
:
{[
dataArray2
=
dataArray2
]
fileSize
,
index
in
},
completion
:
{
fileSize
,
index
in
if
dataArray2
.
count
>
0
{
model
.
titleModelArray
[
0
]
.
allFileSize
=
Double
(
fileSize
)
self
.
dataArraySi
.
append
(
dataArray2
)
model
.
titleModelArray
[
0
]
.
assets
=
similarGroups
model
.
titleModelArray
[
1
]
.
assets
=
self
.
dataArraySi
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
model
)
self
.
dataArraySi
.
remove
(
at
:
self
.
dataArraySi
.
count
-
1
)
let
dataUpdated
=
Notification
.
Name
(
"HomeDupImageResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
model
.
titleModelArray
[
1
]
.
allFileSize
=
self
.
dataSiFileSize
+
Double
(
fileSize
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
model
)
let
dataUpdated
=
Notification
.
Name
(
"HomeSimilarImageResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
}
})
})
}
completionHandler
:
{
data1
,
data2
in
}
completion
:
{
similarGroups
in
Print
(
"更新重复图片数据结束"
)
}
}
// 处理相似截图
var
screenshotUpdateLocation
=
UserDefaults
.
standard
.
object
(
forKey
:
"screenshotUpdateLocationDate"
)
if
screenshotUpdateLocation
==
nil
{
screenshotUpdateLocation
=
[]
}
// 找到位置
var
screenshotNewArray
:
[
PHAsset
]
=
[]
for
item
in
PhotoAndVideoMananger
.
mananger
.
screenShotAssets
{
if
!
(
screenshotUpdateLocation
as!
[
String
])
.
contains
(
item
.
localIdentifier
)
{
screenshotNewArray
.
append
(
item
)
}
}
}
if
screenshotNewArray
.
count
>
0
{
Print
(
"更新相似图片数据"
)
PhotoAndVideoMananger
.
mananger
.
dealSimilarPhotos
(
assets
:
screenshotNewArray
,
type
:
1
,
threshold
:
0.99
)
{
data1
,
data2
in
PhotoAndVideoMananger
.
mananger
.
groupSimilarImages
(
assets
:
PhotoAndVideoMananger
.
mananger
.
allAssets
)
{
similarGroups
in
var
dataArray2
:
[
AssetModel
]
=
[]
for
item
in
data2
{
dataArray2
=
dataArray2
+
item
}
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray2
)
!
,
progress
:
{
fileSiez
,
index
in
var
dataArray
:
[
AssetModel
]
=
[]
for
item
in
similarGroups
{
dataArray
=
dataArray
+
item
}
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray
)
!
,
progress
:
{
fileSiez
,
index
in
// 不做处理
// 不做处理
},
completion
:
{[
dataArray2
=
dataArray2
]
fileSize
,
index
in
},
completion
:
{
fileSize
,
index
in
if
dataArray2
.
count
>
0
{
model
.
titleModelArray
[
1
]
.
assets
=
similarGroups
self
.
dataArraySc
.
append
(
dataArray2
)
model
.
titleModelArray
[
1
]
.
allFileSize
=
Double
(
fileSize
)
model
.
titleModelArray
[
0
]
.
assets
=
self
.
dataArraySc
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
model
)
self
.
dataArraySc
.
remove
(
at
:
self
.
dataArraySc
.
count
-
1
)
let
dataUpdated
=
Notification
.
Name
(
"HomeSimilarScreenshotResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
model
.
otherModelArray
[
1
]
.
allFileSize
=
self
.
dataScFileSize
+
Double
(
fileSize
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
model
)
let
dataUpdated
=
Notification
.
Name
(
"HomeSimilarScreenshotResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
}
})
})
}
completion
Handler
:
{
data1
,
data2
in
}
completion
:
{
similarGroups
in
Print
(
"更新相似图片数据结束"
)
}
}
}
}
}
catch
{
}
catch
{
Print
(
"获取首页数据失败"
)
Print
(
"获取首页数据失败"
)
PhotoDataManager
.
manager
.
loadDataFromPhotos
{
model
in
}
PhotoDataManager
.
manager
.
loadDataFromPhotos
{
model
in
}
...
...
PhoneManager/Class/Session/Charge/Controller/ChargeViewController.swift
View file @
17db8452
...
@@ -14,8 +14,8 @@ class ChargeViewController:BaseViewController {
...
@@ -14,8 +14,8 @@ class ChargeViewController:BaseViewController {
let
sview
:
UIButton
=
UIButton
()
let
sview
:
UIButton
=
UIButton
()
sview
.
setImage
(
UIImage
(
named
:
"ic_details_charging"
),
for
:
.
normal
)
sview
.
setImage
(
UIImage
(
named
:
"ic_details_charging"
),
for
:
.
normal
)
sview
.
width
=
2
0
sview
.
width
=
2
8
sview
.
height
=
2
0
sview
.
height
=
2
8
sview
.
x
=
view
.
width
-
sview
.
width
-
15
sview
.
x
=
view
.
width
-
sview
.
width
-
15
sview
.
centerY
=
navCenterY
sview
.
centerY
=
navCenterY
sview
.
addTarget
(
self
,
action
:
#selector(
guideClick
)
,
for
:
.
touchUpInside
)
sview
.
addTarget
(
self
,
action
:
#selector(
guideClick
)
,
for
:
.
touchUpInside
)
...
...
PhoneManager/Class/Session/Compress/Controller/CompressCompletedViewController.swift
View file @
17db8452
...
@@ -305,7 +305,7 @@ class CompressCompletedViewController : BaseViewController{
...
@@ -305,7 +305,7 @@ class CompressCompletedViewController : BaseViewController{
}){
success
,
error
in
}){
success
,
error
in
if
(
success
){
if
(
success
){
self
.
updateCompressData
(
flag
:
data
.
ident
)
self
.
updateCompressData
(
flag
:
data
.
ident
)
var
deleteModel
=
AssetModel
(
localIdentifier
:
data
.
ident
,
assetSize
:
data
.
orgSize
,
createDate
:
data
.
createDate
)
let
deleteModel
=
AssetModel
(
localIdentifier
:
data
.
ident
,
assetSize
:
data
.
orgSize
,
createDate
:
data
.
createDate
)
PhotoDataManager
.
manager
.
removeDataWhenDeleteInPage
(
data
:
[
deleteModel
])
PhotoDataManager
.
manager
.
removeDataWhenDeleteInPage
(
data
:
[
deleteModel
])
print
(
"删除文件成功"
)
print
(
"删除文件成功"
)
}
else
{
}
else
{
...
...
PhoneManager/Class/Session/Compress/View/CompressNavView.swift
View file @
17db8452
...
@@ -58,9 +58,14 @@ class CompressNavView : UIView {
...
@@ -58,9 +58,14 @@ class CompressNavView : UIView {
}
}
@objc
private
func
proBtnClick
()
{
@objc
private
func
proBtnClick
()
{
HomePayViewController
.
show
{
if
HomePayModel
.
share
.
isNoAd
==
false
{
HomePayViewController
.
show
{}
}
else
{
let
vc
:
PayCompletedViewController
=
PayCompletedViewController
()
vc
.
modalPresentationStyle
=
.
fullScreen
self
.
responderViewController
()?
.
present
(
vc
,
animated
:
true
)
}
}
}
}
...
...
PhoneManager/Class/Session/Home/Controller/HomeViewController.swift
View file @
17db8452
...
@@ -225,6 +225,10 @@ class HomeViewController:BaseViewController {
...
@@ -225,6 +225,10 @@ class HomeViewController:BaseViewController {
}
else
{
}
else
{
if
HomePayModel
.
share
.
isNoAd
==
false
{
if
HomePayModel
.
share
.
isNoAd
==
false
{
HomePayViewController
.
show
{}
HomePayViewController
.
show
{}
}
else
{
let
vc
:
PayCompletedViewController
=
PayCompletedViewController
()
vc
.
modalPresentationStyle
=
.
fullScreen
self
.
present
(
vc
,
animated
:
true
)
}
}
}
}
}
}
...
...
PhoneManager/Class/Session/Home/View/HomeNavView.swift
View file @
17db8452
...
@@ -88,8 +88,12 @@ class HomeNavView:UIView {
...
@@ -88,8 +88,12 @@ class HomeNavView:UIView {
}
}
@objc
private
func
proBtnClick
()
{
@objc
private
func
proBtnClick
()
{
HomePayViewController
.
show
{
if
HomePayModel
.
share
.
isNoAd
==
false
{
HomePayViewController
.
show
{}
}
else
{
let
vc
:
PayCompletedViewController
=
PayCompletedViewController
()
vc
.
modalPresentationStyle
=
.
fullScreen
self
.
responderViewController
()?
.
present
(
vc
,
animated
:
true
)
}
}
}
}
...
...
PhoneManager/Class/Session/Home/View/Model/HomePhotosModel .swift
View file @
17db8452
...
@@ -111,26 +111,6 @@ class PhotoDataManager {
...
@@ -111,26 +111,6 @@ class PhotoDataManager {
self
.
saveToFileSystem
(
model
:
model
)
self
.
saveToFileSystem
(
model
:
model
)
}
}
})
})
// 将磁盘中存的内容也删除
let
allImageUpdateLocation
:
[
String
]
=
UserDefaults
.
standard
.
object
(
forKey
:
"allImageUpdateLocationDate"
)
as!
[
String
]
var
tempArray
=
allImageUpdateLocation
for
item
in
data
{
tempArray
.
removeAll
{
$0
==
item
.
localIdentifier
}
}
UserDefaults
.
standard
.
set
(
tempArray
,
forKey
:
"allImageUpdateLocationDate"
)
var
screenshotUpdateLocation
:
[
String
]
=
UserDefaults
.
standard
.
object
(
forKey
:
"screenshotUpdateLocationDate"
)
as!
[
String
]
var
tempArraySC
=
screenshotUpdateLocation
for
item
in
data
{
tempArraySC
.
removeAll
{
$0
==
item
.
localIdentifier
}
}
UserDefaults
.
standard
.
set
(
tempArraySC
,
forKey
:
"screenshotUpdateLocationDate"
)
// 删除更新中的数据
for
item
in
data
{
screenshotUpdateLocation
.
removeAll
{
$0
==
item
.
localIdentifier
}
}
// 将单利中的数据也删除
// 将单利中的数据也删除
for
item
in
data
{
for
item
in
data
{
Singleton
.
shared
.
resourceModel
.
removeAll
{
$0
.
ident
==
item
.
localIdentifier
}
Singleton
.
shared
.
resourceModel
.
removeAll
{
$0
.
ident
==
item
.
localIdentifier
}
...
@@ -176,71 +156,48 @@ class PhotoDataManager {
...
@@ -176,71 +156,48 @@ class PhotoDataManager {
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
Print
(
"正在处理重复图片"
)
PhotoAndVideoMananger
.
mananger
.
groupDuplicateImages
(
assets
:
PhotoAndVideoMananger
.
mananger
.
allAssets
)
{
similarGroups
in
let
group
=
DispatchGroup
()
var
dataArray
:
[
AssetModel
]
=
[]
for
item
in
similarGroups
{
Print
(
"正在处理重复和相似图片"
)
dataArray
=
dataArray
+
item
group
.
enter
()
PhotoAndVideoMananger
.
mananger
.
dealSimilarPhotos
(
assets
:
PhotoAndVideoMananger
.
mananger
.
allAssets
,
type
:
0
,
threshold
:
0.99
)
{
data1
,
data2
in
var
dataArray1
:
[
AssetModel
]
=
[]
var
dataArray2
:
[
AssetModel
]
=
[]
for
item
in
data1
{
dataArray1
=
dataArray1
+
item
}
for
item
in
data2
{
dataArray2
=
dataArray2
+
item
}
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray1
)
!
,
progress
:
{
fileSiez
,
index
in
// 不做处理
},
completion
:
{
fileSize
,
index
in
// model1.assets = data1
// model1.allFileSize = Double(fileSize)
// PhotoDataManager.manager.saveToFileSystem(model: allModel)
let
dataUpdated
=
Notification
.
Name
(
"HomeDupImageResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
})
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray2
)
!
,
progress
:
{
fileSize
,
index
in
// 不做处理
},
completion
:
{
fileSize
,
index
in
model2
.
assets
=
data2
model2
.
allFileSize
=
Double
(
fileSize
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
let
dataUpdated
=
Notification
.
Name
(
"HomeSimilarImageResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
})
}
completionHandler
:
{
data1
,
data2
in
var
dataArray1
:
[
AssetModel
]
=
[]
var
dataArray2
:
[
AssetModel
]
=
[]
for
item
in
data1
{
dataArray1
=
dataArray1
+
item
}
for
item
in
data2
{
dataArray2
=
dataArray2
+
item
}
}
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray
1
)
!
,
progress
:
{
fileSiez
,
index
in
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray
)
!
,
progress
:
{
fileSiez
,
index
in
// 不做处理
// 不做处理
},
completion
:
{
fileSize
,
index
in
},
completion
:
{
fileSize
,
index
in
model1
.
assets
=
data1
model1
.
assets
=
similarGroups
model1
.
allFileSize
=
Double
(
fileSize
)
model1
.
allFileSize
=
Double
(
fileSize
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
let
dataUpdated
=
Notification
.
Name
(
"HomeDupImageResourceUpdate"
)
let
dataUpdated
=
Notification
.
Name
(
"HomeDupImageResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
})
})
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray1
)
!
,
progress
:
{
fileSize
,
index
in
}
completion
:
{
model
in
Print
(
"处理重复图片结束"
)
}
Print
(
"正在处理相似图片"
)
PhotoAndVideoMananger
.
mananger
.
groupSimilarImages
(
assets
:
PhotoAndVideoMananger
.
mananger
.
allAssets
)
{
(
similarGroups
)
in
var
dataArray
:
[
AssetModel
]
=
[]
for
item
in
similarGroups
{
dataArray
=
dataArray
+
item
}
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray
)
!
,
progress
:
{
fileSiez
,
index
in
// 不做处理
// 不做处理
},
completion
:
{
fileSize
,
index
in
},
completion
:
{
fileSize
,
index
in
model2
.
assets
=
data2
model2
.
assets
=
similarGroups
model2
.
allFileSize
=
Double
(
fileSize
)
model2
.
allFileSize
=
Double
(
fileSize
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
let
dataUpdated
=
Notification
.
Name
(
"HomeSimilarImageResourceUpdate"
)
let
dataUpdated
=
Notification
.
Name
(
"HomeSimilarImageResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
})
})
group
.
leave
()
Print
(
"处理重复和相似图片结束"
)
}
completion
:
{
similarGroups
in
Print
(
"处理相似图片结束"
)
}
}
// 视频数据
// 视频数据
...
@@ -262,43 +219,19 @@ class PhotoDataManager {
...
@@ -262,43 +219,19 @@ class PhotoDataManager {
})
})
}
}
// 相似截图
Print
(
"正在处理相似截图"
)
Print
(
"正在处理相似截图"
)
PhotoAndVideoMananger
.
mananger
.
dealSimilarPhotos
(
assets
:
PhotoAndVideoMananger
.
mananger
.
screenShotAssets
,
type
:
1
,
threshold
:
0.99
)
{
data1
,
data2
in
PhotoAndVideoMananger
.
mananger
.
groupSimilarImages
(
assets
:
PhotoAndVideoMananger
.
mananger
.
screenShotAssets
)
{
(
similarGroups
)
in
var
dataArray1
:
[
AssetModel
]
=
[]
model4
.
assets
=
similarGroups
for
item
in
data1
{
model4
.
allFileSize
=
0
dataArray1
=
dataArray1
+
item
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
}
let
dataUpdated
=
Notification
.
Name
(
"HomeSimilarScreenshotResourceUpdate"
)
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray1
)
!
,
progress
:
{
fileSiez
,
index
in
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
// 不做处理
}
completion
:
{
similarGroups
in
},
completion
:
{
fileSize
,
index
in
Print
(
"处理相似截图结束"
)
model4
.
assets
=
data2
model4
.
allFileSize
=
Double
(
fileSize
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
let
dataUpdated
=
Notification
.
Name
(
"HomeSimilarScreenshotResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
})
}
completionHandler
:
{
data1
,
data2
in
var
dataArray1
:
[
AssetModel
]
=
[]
for
item
in
data1
{
dataArray1
=
dataArray1
+
item
}
PhotoAndVideoMananger
.
mananger
.
calculateTotalSize
(
of
:
PhotoAndVideoMananger
.
mananger
.
getPHAsssetwithIDs
(
ids
:
dataArray1
)
!
,
progress
:
{
fileSiez
,
index
in
// 不做处理
},
completion
:
{
fileSize
,
index
in
model4
.
assets
=
data2
model4
.
allFileSize
=
Double
(
fileSize
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
let
dataUpdated
=
Notification
.
Name
(
"HomeSimilarScreenshotResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
})
}
}
// 截图数据
// 截图数据
Print
(
"正在处理截图"
)
Print
(
"正在处理截图"
)
group
.
enter
()
PhotoAndVideoMananger
.
mananger
.
dealScreenShotData
{
data
in
PhotoAndVideoMananger
.
mananger
.
dealScreenShotData
{
data
in
var
dataArray
:
[
AssetModel
]
=
[]
var
dataArray
:
[
AssetModel
]
=
[]
for
item
in
data
{
for
item
in
data
{
...
@@ -312,7 +245,6 @@ class PhotoDataManager {
...
@@ -312,7 +245,6 @@ class PhotoDataManager {
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
PhotoDataManager
.
manager
.
saveToFileSystem
(
model
:
allModel
)
let
dataUpdated
=
Notification
.
Name
(
"HomeScreenShotResourceUpdate"
)
let
dataUpdated
=
Notification
.
Name
(
"HomeScreenShotResourceUpdate"
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
NotificationCenter
.
default
.
post
(
name
:
dataUpdated
,
object
:
nil
)
group
.
leave
()
Print
(
"处理截图结束"
)
Print
(
"处理截图结束"
)
})
})
}
}
...
...
PhoneManager/Class/Session/Pay/ViewController/PayCompletedViewController.swift
0 → 100644
View file @
17db8452
//
// PayCompletedViewController.swift
// PhoneManager
//
// Created by edy on 2025/4/16.
//
import
Foundation
class
PayCompletedViewController
:
BaseViewController
{
lazy
var
logoImageView
:
UIImageView
=
{
let
view
=
UIImageView
()
view
.
layer
.
cornerRadius
=
22.5
view
.
clipsToBounds
=
true
view
.
image
=
UIImage
(
named
:
"logo_phone_manager"
)
return
view
}()
lazy
var
titleLabel
:
UILabel
=
{
let
view
=
UILabel
()
view
.
text
=
"Phone Manager Pro Edition"
view
.
textColor
=
UIColor
(
red
:
0.2
,
green
:
0.2
,
blue
:
0.2
,
alpha
:
1
)
view
.
font
=
UIFont
.
systemFont
(
ofSize
:
18
,
weight
:
.
bold
)
view
.
textAlignment
=
.
center
return
view
}()
lazy
var
detailTitleLabel
:
UILabel
=
{
let
view
=
UILabel
()
view
.
text
=
"You can now access all Phone Manager features without restrictions"
view
.
textColor
=
UIColor
(
red
:
0.4
,
green
:
0.4
,
blue
:
0.4
,
alpha
:
1
)
view
.
font
=
UIFont
.
systemFont
(
ofSize
:
14
,
weight
:
.
regular
)
view
.
textAlignment
=
.
center
view
.
numberOfLines
=
0
return
view
}()
lazy
var
closeButton
:
UIButton
=
{
let
view
=
UIButton
()
view
.
backgroundColor
=
.
clear
view
.
setImage
(
UIImage
(
named
:
"ic_close_charging"
),
for
:
.
normal
)
view
.
addTarget
(
self
,
action
:
#selector(
closeCurrentPage
)
,
for
:
.
touchUpInside
)
return
view
}()
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
setUI
()
}
func
setUI
(){
self
.
view
.
addSubview
(
self
.
closeButton
)
self
.
view
.
addSubview
(
self
.
logoImageView
)
self
.
view
.
addSubview
(
self
.
titleLabel
)
self
.
view
.
addSubview
(
self
.
detailTitleLabel
)
self
.
closeButton
.
snp
.
makeConstraints
{
make
in
make
.
right
.
equalToSuperview
()
.
offset
(
-
15
)
make
.
top
.
equalToSuperview
()
.
offset
(
statusBarHeight
+
15
)
make
.
width
.
height
.
equalTo
(
28
)
}
self
.
logoImageView
.
snp
.
makeConstraints
{
make
in
make
.
width
.
height
.
equalTo
(
150
)
make
.
top
.
equalToSuperview
()
.
offset
(
210
)
make
.
centerX
.
equalToSuperview
()
}
self
.
titleLabel
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
self
.
logoImageView
.
snp
.
bottom
)
.
offset
(
40
)
make
.
left
.
equalToSuperview
()
.
offset
(
30
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
30
)
make
.
height
.
equalTo
(
25
)
}
self
.
detailTitleLabel
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
self
.
titleLabel
.
snp
.
bottom
)
.
offset
(
4
)
make
.
left
.
equalToSuperview
()
.
offset
(
30
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
30
)
make
.
height
.
equalTo
(
40
)
}
}
}
extension
PayCompletedViewController
{
@objc
func
closeCurrentPage
(){
self
.
dismiss
(
animated
:
true
)
}
}
PhoneManager/Class/Session/Settings/View/SettingViewHeaderCell.swift
View file @
17db8452
...
@@ -21,7 +21,12 @@ class SettingViewHeaderCell : UITableViewCell {
...
@@ -21,7 +21,12 @@ class SettingViewHeaderCell : UITableViewCell {
lazy
var
fLabel
:
UILabel
=
{
lazy
var
fLabel
:
UILabel
=
{
let
label
=
UILabel
();
let
label
=
UILabel
();
label
.
text
=
"Unlock Unlimited Access"
if
HomePayModel
.
share
.
isNoAd
==
false
{
label
.
text
=
"Unlock Unlimited Access"
}
else
{
label
.
text
=
"Phone Manager Pro Edition"
}
label
.
font
=
UIFont
(
name
:
"PingFang SC-Bold"
,
size
:
18
)
label
.
font
=
UIFont
(
name
:
"PingFang SC-Bold"
,
size
:
18
)
label
.
textColor
=
UIColor
(
red
:
0.2
,
green
:
0.2
,
blue
:
0.2
,
alpha
:
1
)
label
.
textColor
=
UIColor
(
red
:
0.2
,
green
:
0.2
,
blue
:
0.2
,
alpha
:
1
)
label
.
textAlignment
=
.
center
label
.
textAlignment
=
.
center
...
@@ -29,11 +34,17 @@ class SettingViewHeaderCell : UITableViewCell {
...
@@ -29,11 +34,17 @@ class SettingViewHeaderCell : UITableViewCell {
}()
}()
lazy
var
sLabel
:
UILabel
=
{
lazy
var
sLabel
:
UILabel
=
{
let
label
=
UILabel
();
let
label
=
UILabel
()
label
.
text
=
"Enjoy unlimited access with all Cleanup features"
label
.
numberOfLines
=
0
if
HomePayModel
.
share
.
isNoAd
==
false
{
label
.
text
=
"Enjoy unlimited access with all Cleanup features"
}
else
{
label
.
text
=
"You can now access all Phone Manager features without restrictions"
}
label
.
font
=
UIFont
(
name
:
"PingFang SC-Regular"
,
size
:
14
)
label
.
font
=
UIFont
(
name
:
"PingFang SC-Regular"
,
size
:
14
)
label
.
textColor
=
UIColor
(
red
:
0.4
,
green
:
0.4
,
blue
:
0.4
,
alpha
:
1
)
label
.
textColor
=
UIColor
(
red
:
0.4
,
green
:
0.4
,
blue
:
0.4
,
alpha
:
1
)
label
.
textAlignment
=
.
center
label
.
textAlignment
=
.
center
return
label
return
label
}()
}()
...
@@ -90,7 +101,11 @@ class SettingViewHeaderCell : UITableViewCell {
...
@@ -90,7 +101,11 @@ class SettingViewHeaderCell : UITableViewCell {
make
.
left
.
equalToSuperview
()
.
offset
(
15
)
make
.
left
.
equalToSuperview
()
.
offset
(
15
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
15
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
15
)
make
.
top
.
equalTo
(
fLabel
.
snp
.
bottom
)
.
offset
(
4
)
make
.
top
.
equalTo
(
fLabel
.
snp
.
bottom
)
.
offset
(
4
)
make
.
height
.
equalTo
(
20
)
if
HomePayModel
.
share
.
isNoAd
==
false
{
make
.
height
.
equalTo
(
20
)
}
else
{
make
.
height
.
equalTo
(
42
)
}
}
}
self
.
preButtonImageView
.
snp
.
makeConstraints
{
make
in
self
.
preButtonImageView
.
snp
.
makeConstraints
{
make
in
...
@@ -101,7 +116,11 @@ class SettingViewHeaderCell : UITableViewCell {
...
@@ -101,7 +116,11 @@ class SettingViewHeaderCell : UITableViewCell {
self
.
moreButton
.
snp
.
makeConstraints
{
make
in
self
.
moreButton
.
snp
.
makeConstraints
{
make
in
make
.
width
.
equalTo
(
245
)
make
.
width
.
equalTo
(
245
)
make
.
height
.
equalTo
(
46
)
if
HomePayModel
.
share
.
isNoAd
==
false
{
make
.
height
.
equalTo
(
46
)
}
else
{
make
.
height
.
equalTo
(
0
)
}
make
.
centerX
.
equalToSuperview
()
make
.
centerX
.
equalToSuperview
()
make
.
top
.
equalTo
(
self
.
sLabel
.
snp
.
bottom
)
.
offset
(
20
)
make
.
top
.
equalTo
(
self
.
sLabel
.
snp
.
bottom
)
.
offset
(
20
)
}
}
...
...
PhoneManager/Class/Session/Settings/ViewController/SettingViewController.swift
View file @
17db8452
...
@@ -138,7 +138,11 @@ class SettingViewController : BaseViewController , UITableViewDelegate, UITableV
...
@@ -138,7 +138,11 @@ class SettingViewController : BaseViewController , UITableViewDelegate, UITableV
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
if
indexPath
.
section
==
0
{
if
indexPath
.
section
==
0
{
return
385
if
HomePayModel
.
share
.
isNoAd
==
false
{
return
385
}
else
{
return
339
}
}
}
return
60
return
60
}
}
...
...
PhoneManager/Class/Tool/Class/PhotoAndVideoMananger/PhotoAndVideoMananger.swift
View file @
17db8452
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment